Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
usd_animation_io.h
Go to the documentation of this file.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
14#include <momentum/math/types.h>
15
16#include <pxr/usd/usd/prim.h>
17#include <pxr/usd/usd/stage.h>
18#include <pxr/usd/usdSkel/skeleton.h>
19
20#include <span>
21#include <string>
22#include <tuple>
23#include <vector>
24
25PXR_NAMESPACE_USING_DIRECTIVE
26
27namespace momentum {
28
40 const UsdStageRefPtr& stage,
41 UsdSkelSkeleton& skelPrim,
42 const Skeleton& skeleton,
43 std::span<const SkeletonState> skeletonStates,
44 float fps);
45
54std::tuple<std::vector<SkeletonState>, std::vector<float>> loadSkeletonStatesFromUsd(
55 const UsdStageRefPtr& stage,
56 const Skeleton& skeleton);
57
60 const UsdPrim& prim,
61 float fps,
62 const MotionParameters& motion,
63 const IdentityParameters& offsets);
64
66std::tuple<MotionParameters, IdentityParameters, float> loadMotionFromUsd(const UsdPrim& prim);
67
78 const UsdStageRefPtr& stage,
79 const SdfPath& skelRootPath,
80 float fps,
81 std::span<const std::vector<Marker>> markerSequence);
82
90MarkerSequence loadMarkerSequenceFromUsd(const UsdStageRefPtr& stage);
91
92} // namespace momentum
SkeletonT< float > Skeleton
Definition fwd.h:263
std::tuple< std::vector< std::string >, JointParameters > IdentityParameters
A tuple of skeleton joint names and identity parameters.
Definition types.h:179
std::tuple< std::vector< std::string >, Eigen::MatrixXf > MotionParameters
A tuple of model parameter names and a matrix of poses across a sequence of frames.
Definition types.h:173
void saveSkeletonStatesToUsd(const UsdStageRefPtr &stage, UsdSkelSkeleton &skelPrim, const Skeleton &skeleton, std::span< const SkeletonState > skeletonStates, float fps)
Save skeleton states as a UsdSkelAnimation on the stage.
void saveMotionToUsd(const UsdPrim &prim, float fps, const MotionParameters &motion, const IdentityParameters &offsets)
Save model-parameter motion as custom attributes on a USD prim.
void saveMarkerSequenceToUsd(const UsdStageRefPtr &stage, const SdfPath &skelRootPath, float fps, std::span< const std::vector< Marker > > markerSequence)
Save marker sequence as animated Xform prims under a Markers scope.
std::tuple< MotionParameters, IdentityParameters, float > loadMotionFromUsd(const UsdPrim &prim)
Load model-parameter motion from custom attributes on a USD prim.
MarkerSequence loadMarkerSequenceFromUsd(const UsdStageRefPtr &stage)
Load marker sequence from animated Xform prims.
std::tuple< std::vector< SkeletonState >, std::vector< float > > loadSkeletonStatesFromUsd(const UsdStageRefPtr &stage, const Skeleton &skeleton)
Load skeleton states from a USD stage.
All frames from a single motion capture sequence for one subject (actor).
Definition marker.h:37