Baked motion-matching feature database from one or more AnimClips. Feature layout per frame: [0..1] root velocity xz [2..7] trajectory pos xz at +0.33/+0.66/+1.0s (character space) [8..9] trajectory facing dir xz at +1.0s [10..] selected joint world positions (xyz each) The optional locomotion layout has 19 trajectory and 11 pose dimensions; see setLocomotionFeatures(). Existing databases retain the basic layout. Script type: MotionDatabase.
更多...
#include <MotionDatabase.h>
类 | |
| struct | Frame |
| Frame public API. 更多... | |
| struct | SchemaSampler |
Public 成员函数 | |
| MotionDatabase (AnimSkeleton *skeleton) | |
| Motion database. | |
| ~MotionDatabase () | |
| Motion database. | |
| MotionDatabase (const MotionDatabase &)=delete | |
| MotionDatabase & | operator= (const MotionDatabase &)=delete |
| AnimSkeleton * | getSkeleton () const |
| Returns the skeleton. | |
| void | addFeatureBone (int boneIndex) |
| Include bone world position in pose features (by index). | |
| void | addFeatureBoneByName (const std::string &name) |
| Adds feature bone by name. | |
| eve::Result< void > | setLocomotionFeatures (int leftFoot, int rightFoot, int pelvis) |
| Configure the locomotion layout before baking or creating matchers. | |
| bool | hasLocomotionFeatures () const |
| Whether this database uses the 30-dimensional locomotion layout. | |
| eve::Result< void > | setFeatureLayout (const MotionFeatureLayout &layout) |
| Atomically configure an owning variable feature layout before bake. | |
| bool | hasFeatureLayout () const |
| Whether this database uses an explicitly configured variable layout. | |
| eve::Result< void > | setFeatureCurves (std::span< const std::byte > bytes, std::span< const std::string > sources) |
| Atomically copy scalar source curves for the configured layout. | |
| eve::Result< int > | setFeatureNormalizationRanges (std::span< const MotionNormalizationRange > ranges) |
| Atomically select weighted source ranges used to normalize a variable feature layout. | |
| void | setRootBone (int boneIndex) |
Bone used for trajectory / velocity features (default 0). Mixamo clips typically want hips (mixamorig:Hips). | |
| int | getRootBone () const |
| Returns the root bone. | |
| void | setRootBoneByName (const std::string &name) |
| Sets the root bone by name. | |
| void | addClip (AnimClip *clip) |
| Adds clip. | |
| int | getClipCount () const |
| Returns the clip count. | |
| void | bake () |
| Bake all clips into searchable frames. Call after addClip / feature bones. | |
| bool | isBaked () const |
| True when baked. | |
| int | getFrameCount () const |
| Returns the frame count. | |
| int | getFeatureSize () const |
| Returns the feature size. | |
| float | getFrameTime (int frameIndex) const |
| Returns the frame time. | |
| int | getFrameClipIndex (int frameIndex) const |
| Returns the frame clip index. | |
| AnimClip * | getClip (int clipIndex) const |
| Returns the clip. | |
| int | getFeatureBoneCount () const |
| Returns the feature bone count. | |
| int | getFeatureBone (int index) const |
| Returns the feature bone. | |
| void | getFeature (int frameIndex, float *out, int outCount) const |
| Copy feature vector into out[0..featureSize). | |
| void | normalizeFeature (std::vector< float > &feature) const |
| Normalize a query with statistics computed by bake(). | |
| const Frame & | frameAt (int index) const |
友元 | |
| class | MotionMatcher |
详细描述
Baked motion-matching feature database from one or more AnimClips. Feature layout per frame: [0..1] root velocity xz [2..7] trajectory pos xz at +0.33/+0.66/+1.0s (character space) [8..9] trajectory facing dir xz at +1.0s [10..] selected joint world positions (xyz each) The optional locomotion layout has 19 trajectory and 11 pose dimensions; see setLocomotionFeatures(). Existing databases retain the basic layout. Script type: MotionDatabase.
在文件 MotionDatabase.h 第 39 行定义.
构造及析构函数说明
◆ MotionDatabase() [1/2]
|
explicit |
Motion database.
在文件 MotionDatabase.cpp 第 14 行定义.
引用了 eve::animation::AnimSkeleton::getBoneCount() , 以及 eve::animation::AnimPose::resize().
◆ ~MotionDatabase()
|
default |
Motion database.
◆ MotionDatabase() [2/2]
|
delete |
成员函数说明
◆ addClip()
| void eve::animation::MotionDatabase::addClip | ( | AnimClip * | clip | ) |
◆ addFeatureBone()
| void eve::animation::MotionDatabase::addFeatureBone | ( | int | boneIndex | ) |
Include bone world position in pose features (by index).
在文件 MotionDatabase.cpp 第 20 行定义.
引用了 b , 以及 eve::animation::AnimSkeleton::getBoneCount().
被这些函数引用 addFeatureBoneByName(), bake() , 以及 eve::animation::exposeMotionMatcherBindings().
◆ addFeatureBoneByName()
| void eve::animation::MotionDatabase::addFeatureBoneByName | ( | const std::string & | name | ) |
Adds feature bone by name.
在文件 MotionDatabase.cpp 第 32 行定义.
引用了 addFeatureBone(), eve::animation::AnimSkeleton::findBone() , 以及 name.
◆ bake()
| void eve::animation::MotionDatabase::bake | ( | ) |
Bake all clips into searchable frames. Call after addClip / feature bones.
Uses up to eight native threads for 16 or more clips; frame and normalization order match serial baking exactly. Borrowed skeleton and clips must remain immutable until this synchronous owner-thread call returns. No callbacks or retained jobs.
在文件 MotionDatabase.cpp 第 179 行定义.
引用了 addFeatureBone(), clip, eve::animation::MotionDatabase::Frame::clipIndex, eve::animation::Curve, d, f, eve::animation::AnimSkeleton::getBoneCount(), index, normalizeFeature(), output, eve::animation::detail::parallelAnimationItems(), rate , 以及 t.
◆ frameAt()
| const MotionDatabase::Frame & eve::animation::MotionDatabase::frameAt | ( | int | index | ) | const |
在文件 MotionDatabase.cpp 第 275 行定义.
引用了 getFrameCount() , 以及 index.
被这些函数引用 getFeature(), getFrameClipIndex(), getFrameTime(), eve::animation::MotionMatcher::search() , 以及 eve::animation::MotionMatcher::setCandidateRanges().
◆ getClip()
| AnimClip * eve::animation::MotionDatabase::getClip | ( | int | clipIndex | ) | const |
Returns the clip.
在文件 MotionDatabase.cpp 第 60 行定义.
引用了 getClipCount().
被这些函数引用 eve::animation::MotionMatcher::search() , 以及 eve::animation::MotionMatcher::setCandidateRanges().
◆ getClipCount()
|
inline |
Returns the clip count.
在文件 MotionDatabase.h 第 123 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings(), getClip() , 以及 eve::animation::MotionMatcher::setCandidateRanges().
◆ getFeature()
| void eve::animation::MotionDatabase::getFeature | ( | int | frameIndex, |
| float * | out, | ||
| int | outCount | ||
| ) | const |
Copy feature vector into out[0..featureSize).
在文件 MotionDatabase.cpp 第 287 行定义.
◆ getFeatureBone()
| int eve::animation::MotionDatabase::getFeatureBone | ( | int | index | ) | const |
◆ getFeatureBoneCount()
|
inline |
Returns the feature bone count.
在文件 MotionDatabase.h 第 150 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings() , 以及 getFeatureBone().
◆ getFeatureSize()
|
inline |
Returns the feature size.
在文件 MotionDatabase.h 第 140 行定义.
◆ getFrameClipIndex()
| int eve::animation::MotionDatabase::getFrameClipIndex | ( | int | frameIndex | ) | const |
Returns the frame clip index.
在文件 MotionDatabase.cpp 第 285 行定义.
引用了 eve::animation::MotionDatabase::Frame::clipIndex , 以及 frameAt().
被这些函数引用 eve::animation::exposeMotionMatcherBindings(), eve::animation::MotionMatcher::getMatchedClipIndex() , 以及 eve::animation::MotionMatcher::search().
◆ getFrameCount()
|
inline |
Returns the frame count.
在文件 MotionDatabase.h 第 138 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings(), frameAt(), eve::animation::MotionMatcher::search() , 以及 eve::animation::MotionMatcher::setCandidateRanges().
◆ getFrameTime()
| float eve::animation::MotionDatabase::getFrameTime | ( | int | frameIndex | ) | const |
Returns the frame time.
在文件 MotionDatabase.cpp 第 283 行定义.
引用了 frameAt() , 以及 eve::animation::MotionDatabase::Frame::time.
被这些函数引用 eve::animation::exposeMotionMatcherBindings() , 以及 eve::animation::MotionMatcher::search().
◆ getRootBone()
|
inline |
Returns the root bone.
在文件 MotionDatabase.h 第 116 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings() , 以及 eve::animation::MotionMatcher::setFeatureQuery().
◆ getSkeleton()
|
inline |
Returns the skeleton.
在文件 MotionDatabase.h 第 50 行定义.
◆ hasFeatureLayout()
| bool eve::animation::MotionDatabase::hasFeatureLayout | ( | ) | const |
Whether this database uses an explicitly configured variable layout.
在文件 MotionDatabaseSchema.cpp 第 14 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings(), eve::animation::MotionMatcher::setQueryPose() , 以及 eve::animation::MotionMatcher::setTrajectory().
◆ hasLocomotionFeatures()
|
inline |
Whether this database uses the 30-dimensional locomotion layout.
在文件 MotionDatabase.h 第 71 行定义.
被这些函数引用 eve::animation::exposeMotionMatcherBindings(), eve::animation::MotionMatcher::search(), eve::animation::MotionMatcher::setLocomotionQuery(), eve::animation::MotionMatcher::setQueryPose() , 以及 eve::animation::MotionMatcher::setTrajectory().
◆ isBaked()
|
inline |
◆ normalizeFeature()
| void eve::animation::MotionDatabase::normalizeFeature | ( | std::vector< float > & | feature | ) | const |
Normalize a query with statistics computed by bake().
在文件 MotionDatabase.cpp 第 263 行定义.
被这些函数引用 bake() , 以及 eve::animation::MotionMatcher::setFeatureQuery().
◆ operator=()
|
delete |
◆ setFeatureCurves()
| eve::Result< void > eve::animation::MotionDatabase::setFeatureCurves | ( | std::span< const std::byte > | bytes, |
| std::span< const std::string > | sources | ||
| ) |
Atomically copy scalar source curves for the configured layout.
- 参数
-
bytes Borrowed EVFC/1 bytes for this synchronous call only; decoded data is owned. sources Borrowed source names in exact database clip order; names are copied.
- 返回
- Applied, or InvalidArgument preserving the previous curve data.
Call after adding all clips and configuring the layout, before bake. Every clip must resolve to a source record; absent channels evaluate to zero. Clips and skeleton remain caller-owned. No callbacks or retained input pointers. @thread Owner thread, outside bake/search; not reentrant.
在文件 MotionDatabaseSchema.cpp 第 86 行定义.
引用了 eve::Applied, bytes, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, message, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setFeatureLayout()
| eve::Result< void > eve::animation::MotionDatabase::setFeatureLayout | ( | const MotionFeatureLayout & | layout | ) |
Atomically configure an owning variable feature layout before bake.
- 参数
-
layout Borrowed only for this call; all channels and strings are copied.
- 返回
- Applied, or InvalidArgument preserving the previous configuration.
Rejects invalid bones, axes, weights, times and unsupported pose offsets. Skeleton and clips remain borrowed, immutable and caller-owned throughout bake and matching. Configure before constructing any matcher. Reconfiguration after bake is rejected. No callbacks or retained input pointers. @thread Owner thread, outside bake/search; not reentrant.
在文件 MotionDatabaseSchema.cpp 第 35 行定义.
引用了 eve::Applied, c, eve::animation::Character, eve::animation::Continuing, count, eve::animation::Curve, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::animation::AnimSkeleton::getBoneCount(), group, eve::InvalidArgument, layout, message, eve::animation::Pose, eve::Status::success(), eve::Result< T >::success(), eve::animation::Trajectory , 以及 eve::animation::Velocity.
◆ setFeatureNormalizationRanges()
| eve::Result< int > eve::animation::MotionDatabase::setFeatureNormalizationRanges | ( | std::span< const MotionNormalizationRange > | ranges | ) |
Atomically select weighted source ranges used to normalize a variable feature layout.
- 参数
-
ranges Borrowed only for this call and copied in order. Duplicate and overlapping ranges deliberately contribute again, matching multiple source database entries.
- 返回
- Number of sampled feature rows that will contribute, or InvalidArgument while preserving the previous configuration.
Requires a configured unbaked variable layout and existing clips. Each finite nonnegative inclusive interval must address a clip and contain at least one layout-rate sample. Empty input, more than 100000 ranges or more than 100 million contributing rows reject. Omit this call to normalize over every baked frame once. Inputs are owned after copy; the borrowed clips and skeleton remain caller-owned and immutable through bake/matching. @thread Owner thread before bake; synchronous, no callbacks or reentrancy.
在文件 MotionDatabaseSchema.cpp 第 108 行定义.
引用了 eve::Applied, clip, end, eve::Diagnostic::error(), eve::Result< T >::failure(), first, eve::InvalidArgument, message, range, rate, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setLocomotionFeatures()
| eve::Result< void > eve::animation::MotionDatabase::setLocomotionFeatures | ( | int | leftFoot, |
| int | rightFoot, | ||
| int | pelvis | ||
| ) |
Configure the locomotion layout before baking or creating matchers.
- 参数
-
leftFoot Left foot bone index. rightFoot Right foot bone index. pelvis Pelvis bone index; local +Z is its heading axis (Y-up assets).
- 返回
- Applied, or InvalidArgument without changing the database.
Uses relative feet position, character-space feet velocities, pelvis heading, and trajectory at -0.05, 0, 0.35, 0.7, 1 seconds. Selects channel-wise mean-deviation normalization with a shared feet-velocity group. Bone IDs must be distinct and valid. Reconfiguration after bake is rejected. Borrowed skeleton/clips remain caller-owned and immutable during bake and playback. @thread Owner thread; no callbacks, reentrancy or retained input pointers.
在文件 MotionDatabaseLocomotion.cpp 第 11 行定义.
引用了 eve::Applied, bones, count, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::animation::AnimSkeleton::getBoneCount(), eve::InvalidArgument, eve::Status::success() , 以及 eve::Result< T >::success().
◆ setRootBone()
| void eve::animation::MotionDatabase::setRootBone | ( | int | boneIndex | ) |
Bone used for trajectory / velocity features (default 0). Mixamo clips typically want hips (mixamorig:Hips).
在文件 MotionDatabase.cpp 第 38 行定义.
引用了 eve::animation::AnimSkeleton::getBoneCount().
被这些函数引用 eve::animation::exposeMotionMatcherBindings() , 以及 setRootBoneByName().
◆ setRootBoneByName()
| void eve::animation::MotionDatabase::setRootBoneByName | ( | const std::string & | name | ) |
Sets the root bone by name.
在文件 MotionDatabase.cpp 第 47 行定义.
引用了 eve::animation::AnimSkeleton::findBone(), name , 以及 setRootBone().
友元及相关函数文档
◆ MotionMatcher
|
friend |
在文件 MotionDatabase.h 第 176 行定义.
该类的文档由以下文件生成:
- src/modules/animation/MotionDatabase.h
- src/modules/animation/MotionDatabase.cpp
- src/modules/animation/MotionDatabaseLocomotion.cpp
- src/modules/animation/MotionDatabaseSchema.cpp