Momentum
A library for solving nonlinear optimization problems related to human body kinematics
Loading...
Searching...
No Matches
usd_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
16#include <momentum/math/types.h>
17
18#include <cstddef>
19#include <span>
20#include <string>
21#include <tuple>
22#include <vector>
23
24namespace momentum {
25
30Character loadUsdCharacter(const filesystem::path& inputPath);
31
36Character loadUsdCharacter(std::span<const std::byte> inputSpan);
37
42std::tuple<Character, std::vector<SkeletonState>, std::vector<float>>
43loadUsdCharacterWithSkeletonStates(const filesystem::path& inputPath);
44
49std::tuple<Character, std::vector<SkeletonState>, std::vector<float>>
50loadUsdCharacterWithSkeletonStates(std::span<const std::byte> inputSpan);
51
57void saveUsd(
58 const filesystem::path& filename,
59 const Character& character,
60 const FileSaveOptions& options = FileSaveOptions());
61
71 const filesystem::path& filename,
72 const Character& character,
73 float fps,
74 std::span<const SkeletonState> skeletonStates,
75 std::span<const std::vector<Marker>> markerSequence = {},
76 const FileSaveOptions& options = FileSaveOptions());
77
82std::tuple<Character, MotionParameters, IdentityParameters, float> loadUsdCharacterWithMotion(
83 const filesystem::path& inputPath);
84
89std::tuple<Character, MotionParameters, IdentityParameters, float> loadUsdCharacterWithMotion(
90 std::span<const std::byte> inputSpan);
91
102 const filesystem::path& filename,
103 const Character& character,
104 float fps = 120.0f,
105 const MotionParameters& motion = {},
106 const IdentityParameters& offsets = {},
107 std::span<const std::vector<Marker>> markerSequence = {},
108 const FileSaveOptions& options = FileSaveOptions());
109
121std::tuple<Character, MatrixXf, ModelParameters, float>
122loadUsdCharacterWithMotionModelParameterScales(const filesystem::path& inputPath);
123
129std::tuple<Character, MatrixXf, ModelParameters, float>
130loadUsdCharacterWithMotionModelParameterScales(std::span<const std::byte> inputSpan);
131
136MarkerSequence loadUsdMarkerSequence(const filesystem::path& inputPath);
137
138} // namespace momentum
std::tuple< std::vector< std::string >, JointParameters > IdentityParameters
A tuple of skeleton joint names and identity parameters.
Definition types.h:179
std::tuple< Character, MatrixXf, ModelParameters, float > loadUsdCharacterWithMotionModelParameterScales(const filesystem::path &inputPath)
Load a USD character with motion and apply scale parameters to the motion.
Definition usd_io.cpp:754
void saveUsdCharacter(const filesystem::path &filename, const Character &character, float fps, std::span< const SkeletonState > skeletonStates, std::span< const std::vector< Marker > > markerSequence, const FileSaveOptions &options)
Save a character with skeleton state animation to a USD file.
Definition usd_io.cpp:651
std::tuple< Character, std::vector< SkeletonState >, std::vector< float > > loadUsdCharacterWithSkeletonStates(const filesystem::path &inputPath)
Load a USD character with skeleton states from a local file path.
Definition usd_io.cpp:625
void saveUsd(const filesystem::path &filename, const Character &character, const FileSaveOptions &options)
Save a character to a USD file.
Definition usd_io.cpp:613
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
std::tuple< Character, MotionParameters, IdentityParameters, float > loadUsdCharacterWithMotion(const filesystem::path &inputPath)
Load a USD character with model-parameter motion from a local file path.
Definition usd_io.cpp:711
void saveUsdCharacterWithMotion(const filesystem::path &filename, const Character &character, float fps, const MotionParameters &motion, const IdentityParameters &offsets, std::span< const std::vector< Marker > > markerSequence, const FileSaveOptions &options)
Save a character with model-parameter motion to a USD file.
Definition usd_io.cpp:674
Character loadUsdCharacter(const filesystem::path &inputPath)
Load a USD character from a local file path.
Definition usd_io.cpp:595
MarkerSequence loadUsdMarkerSequence(const filesystem::path &inputPath)
Load a marker sequence from a USD file.
Definition usd_io.cpp:763
A character model with skeletal structure, mesh, and optional components.
Definition character.h:32
Unified options for saving files in both FBX and GLTF formats.
All frames from a single motion capture sequence for one subject (actor).
Definition marker.h:37