|
Momentum
A library for solving nonlinear optimization problems related to human body kinematics
|
Builder class for creating FBX files with multiple characters and animations. More...
#include <fbx_builder.h>
Classes | |
| struct | Impl |
Public Member Functions | |
| FbxBuilder () | |
| ~FbxBuilder () | |
| FbxBuilder (FbxBuilder const &)=delete | |
| void | operator= (FbxBuilder const &)=delete |
| FbxBuilder (FbxBuilder &&) noexcept | |
| FbxBuilder & | operator= (FbxBuilder &&) noexcept |
| void | addCharacter (const Character &character, const FileSaveOptions &options=FileSaveOptions()) |
| Add a skinned character (skeleton + mesh with skin weights) to the scene. | |
| void | addRigidBody (const Character &character, const std::string &name="", size_t parentJoint=0, const FileSaveOptions &options=FileSaveOptions()) |
| Add a rigid body (skeleton + mesh parented to a joint, no skinning). | |
| void | addMotion (const Character &character, float fps, const MatrixXf &motion={}, const VectorXf &offsets={}) |
| Add model-parameter animation for a previously added character. | |
| void | addMotionWithJointParams (const Character &character, float fps, const MatrixXf &jointParams) |
| Add joint-parameter animation for a previously added character. | |
| void | addAnimatedMesh (const Character &character, const std::string &name, float fps, const MatrixXf &jointParams, const FbxUserProperties &userProperties={}) |
| Add an animated mesh (mesh node with per-frame transform, no skeleton). | |
| void | addAnimatedMesh (const Mesh &mesh, const std::string &name, float fps, const MatrixXf &jointParams, const Vector3f &translationOffset=Vector3f::Zero(), const FbxUserProperties &userProperties={}) |
| Add an animated mesh from a Mesh object (no Character needed). | |
| void | addMarkerSequence (float fps, std::span< const std::vector< Marker > > markerSequence) |
| Add a marker sequence to the scene. | |
| void | save (const filesystem::path &filename) |
| Save the FBX scene to a file. | |
Builder class for creating FBX files with multiple characters and animations.
FbxBuilder allows you to incrementally construct an FBX scene by adding skinned characters, rigid bodies, motions, and marker data. This is useful for creating scenes with multiple characters/objects in a single FBX file.
Example usage:
Definition at line 49 of file fbx_builder.h.
| momentum::FbxBuilder::FbxBuilder | ( | ) |
Definition at line 489 of file fbx_builder.cpp.
References MT_THROW.
Referenced by addCharacter(), FbxBuilder(), FbxBuilder(), operator=(), and operator=().
|
default |
|
delete |
References FbxBuilder().
|
defaultnoexcept |
References FbxBuilder().
| void momentum::FbxBuilder::addAnimatedMesh | ( | const Character & | character, |
| const std::string & | name, | ||
| float | fps, | ||
| const MatrixXf & | jointParams, | ||
| const FbxUserProperties & | userProperties = {} ) |
Add an animated mesh (mesh node with per-frame transform, no skeleton).
Creates a standalone mesh node and animates its transform directly from the root joint parameters. This is for props/objects that should appear as a simple animated mesh without any skeleton hierarchy.
| character | The character providing the mesh geometry. |
| name | Name for the mesh node. |
| fps | Animation frame rate in frames per second. |
| jointParams | Joint parameters matrix with shape (nFrames x nJointParams). |
| userProperties | User-defined properties to write onto the mesh node, surfaced by DCC tools as the object's custom attributes. |
Definition at line 520 of file fbx_builder.cpp.
References MT_THROW.
| void momentum::FbxBuilder::addAnimatedMesh | ( | const Mesh & | mesh, |
| const std::string & | name, | ||
| float | fps, | ||
| const MatrixXf & | jointParams, | ||
| const Vector3f & | translationOffset = Vector3f::Zero(), | ||
| const FbxUserProperties & | userProperties = {} ) |
Add an animated mesh from a Mesh object (no Character needed).
Creates a standalone mesh node and animates its transform from joint parameters. The joint params follow momentum convention: 7 values per joint (tx, ty, tz, rx, ry, rz, sc). Only the first joint's parameters are used (root transform).
| mesh | The mesh geometry. |
| name | Name for the mesh node. |
| fps | Animation frame rate in frames per second. |
| jointParams | Joint parameters matrix with shape (nFrames x nJointParams). |
| translationOffset | Rest-pose translation offset added to the translation channels (defaults to zero). |
| userProperties | User-defined properties to write onto the mesh node, surfaced by DCC tools as the object's custom attributes. |
Definition at line 529 of file fbx_builder.cpp.
References MT_THROW.
| void momentum::FbxBuilder::addCharacter | ( | const Character & | character, |
| const FileSaveOptions & | options = FileSaveOptions() ) |
Add a skinned character (skeleton + mesh with skin weights) to the scene.
Creates the skeleton hierarchy, mesh with skin deformer, locators, collision geometry, and metadata.
| character | The character to add. |
| options | File save options controlling mesh, locators, collisions. |
Definition at line 500 of file fbx_builder.cpp.
References addCharacter(), FbxBuilder(), and MT_THROW.
Referenced by addCharacter(), and operator=().
| void momentum::FbxBuilder::addMarkerSequence | ( | float | fps, |
| std::span< const std::vector< Marker > > | markerSequence ) |
Add a marker sequence to the scene.
| fps | Frame rate for the marker animation. |
| markerSequence | Marker data per frame: markerSequence[frame][marker]. |
Definition at line 539 of file fbx_builder.cpp.
References MT_THROW.
| void momentum::FbxBuilder::addMotion | ( | const Character & | character, |
| float | fps, | ||
| const MatrixXf & | motion = {}, | ||
| const VectorXf & | offsets = {} ) |
Add model-parameter animation for a previously added character.
Converts model parameters to joint parameters via CharacterState, then creates animation curves. Also extracts and animates blend shape weights when the character has blend shapes.
| character | The character to animate (must match a previously added character). |
| fps | Animation frame rate in frames per second. |
| motion | Model parameters matrix with shape (nFrames x nModelParams). |
| offsets | Identity/offset parameters for the bind pose. |
Definition at line 512 of file fbx_builder.cpp.
References MT_THROW.
Referenced by operator=().
| void momentum::FbxBuilder::addMotionWithJointParams | ( | const Character & | character, |
| float | fps, | ||
| const MatrixXf & | jointParams ) |
Add joint-parameter animation for a previously added character.
Uses joint parameters directly, bypassing the activeJointParams check. This is useful for rigid bodies or characters with simple parameterization.
| character | The character to animate (must match a previously added character). |
| fps | Animation frame rate in frames per second. |
| jointParams | Joint parameters matrix with shape (nFrames x nJointParams). |
Definition at line 516 of file fbx_builder.cpp.
References MT_THROW.
| void momentum::FbxBuilder::addRigidBody | ( | const Character & | character, |
| const std::string & | name = "", | ||
| size_t | parentJoint = 0, | ||
| const FileSaveOptions & | options = FileSaveOptions() ) |
Add a rigid body (skeleton + mesh parented to a joint, no skinning).
For props/objects where the entire mesh moves rigidly with a joint. The mesh is parented under the specified joint node instead of the scene root, so it inherits the skeleton's animation without needing skin weights.
| character | The character to add as a rigid body. |
| name | Optional name override. Uses character.name if empty. |
| parentJoint | Index of the joint to parent the mesh under. |
| options | File save options (mesh option is respected). |
Definition at line 504 of file fbx_builder.cpp.
References MT_THROW.
Referenced by operator=().
|
defaultnoexcept |
References addCharacter(), addMotion(), addRigidBody(), and FbxBuilder().
|
delete |
References FbxBuilder().
| void momentum::FbxBuilder::save | ( | const filesystem::path & | filename | ) |
Save the FBX scene to a file.
After saving, the builder is in a moved-from state and should not be used.
| filename | Output file path. |
Definition at line 543 of file fbx_builder.cpp.
References MT_THROW.