载入中...
搜索中...
未找到
AnimationClipBindings.cpp
浏览该文件的文档.
33 "loadAnimationTrackBatch", [bind](ssq::Array clips, ssq::Array paths, AnimSkeleton* skeleton, int workers) {
51 inputs.push_back({*destination, {static_cast<const std::byte*>(data->getData()), data->getSize()}});
61 "AnimRetargetProfile", std::function<AnimRetargetProfile*()>([]() { return new AnimRetargetProfile(); }), true);
72 retarget.addFunc("setUseSkeletonSpaceRotation", &AnimRetargetProfile::setUseSkeletonSpaceRotation);
73 retarget.addFunc("getUseSkeletonSpaceRotation", &AnimRetargetProfile::getUseSkeletonSpaceRotation);
74 retarget.addFunc("setSkinnedInteractionPreserve", &AnimRetargetProfile::setSkinnedInteractionPreserve);
75 retarget.addFunc("getSkinnedInteractionPreserve", &AnimRetargetProfile::getSkinnedInteractionPreserve);
76 retarget.addFunc("setInteractionContactThreshold", &AnimRetargetProfile::setInteractionContactThreshold);
77 retarget.addFunc("getInteractionContactThreshold", &AnimRetargetProfile::getInteractionContactThreshold);
78 retarget.addFunc("setInteractionCorrectionWeight", &AnimRetargetProfile::setInteractionCorrectionWeight);
79 retarget.addFunc("getInteractionCorrectionWeight", &AnimRetargetProfile::getInteractionCorrectionWeight);
82 retarget.addFunc("getInteractionCorrectionCount", &AnimRetargetProfile::getInteractionCorrectionCount);
94 auto clip = table.addClass<AnimClip>("AnimClip", std::function<AnimClip*()>([]() { return new AnimClip(); }), true);
104 bind.vm(), loadAnimationTracks(*self, {static_cast<const std::byte*>(data->getData()), data->getSize()},
Per-translation-unit VM + diagnostic-source helper for Squirrel bindings.
The single Squirrel projection for common Result, Status and Value.
Explicit Value/Owned/Borrowed semantics at the Squirrel boundary.
Keyframed skeletal animation clip (local TRS tracks per bone). Script type: AnimClip.
Definition AnimClip.h:145
void sample(float time, AnimPose *out, const AnimSkeleton *skeleton=nullptr) const
Sample local pose at time (seconds). If skeleton non-null, missing tracks fall back to bind pose; oth...
Definition AnimClip.cpp:575
AnimClip * retargetWithProfile(const AnimSkeleton *sourceSkeleton, const AnimSkeleton *targetSkeleton, AnimRetargetProfile *profile) const
Retarget using an Avatar-like mapping/profile and update its diagnostics. Skeleton-space rotation pre...
Definition AnimClip.cpp:811
void addSyncMarker(float time, const std::string &name)
Add a named locomotion sync marker at clip-local time.
Definition AnimClip.cpp:216
float getPositionKeyZ(int boneIndex, int keyIndex) const
Returns the position key z.
Definition AnimClip.cpp:400
bool hasCompatibleSyncMarkers(const AnimClip *target) const
Whether this clip and target share a usable ordered marker interval.
Definition AnimClip.cpp:252
bool setScaleKey(int boneIndex, int keyIndex, float time, float x, float y, float z)
Replace and re-sort one scale key.
Definition AnimClip.cpp:114
float getRotationKeyW(int boneIndex, int keyIndex) const
Returns the rotation key w.
Definition AnimClip.cpp:421
bool setPositionKey(int boneIndex, int keyIndex, float time, float x, float y, float z)
Replace and re-sort one position key.
Definition AnimClip.cpp:86
float getSyncMarkerTime(int index) const
Return a sync marker's time, or 0 for an invalid index.
Definition AnimClip.cpp:242
void addScaleKey(int boneIndex, float time, float x, float y, float z)
Adds scale key.
Definition AnimClip.cpp:76
float getEventTime(int index) const
Return an event marker's time, or 0 for an invalid index.
Definition AnimClip.cpp:181
void sampleLod(float time, AnimPose *out, const AnimSkeleton *skeleton, int lodLevel) const
Sample only bones enabled for lodLevel; culled tracks use target bind pose.
Definition AnimClip.cpp:579
float getScaleKeyY(int boneIndex, int keyIndex) const
Returns the scale key y.
Definition AnimClip.cpp:434
float getPositionKeyTime(int boneIndex, int keyIndex) const
Returns the position key time.
Definition AnimClip.cpp:388
bool setRotationKey(int boneIndex, int keyIndex, float time, float x, float y, float z, float w)
Replace and re-sort one rotation key.
Definition AnimClip.cpp:97
void addPositionKey(int boneIndex, float time, float x, float y, float z)
Adds position key.
Definition AnimClip.cpp:45
bool setEvent(int index, float time, const std::string &name, const std::string &payload="")
Replace and re-sort one event marker.
Definition AnimClip.cpp:164
bool removePositionKey(int boneIndex, int keyIndex)
Delete one position key.
Definition AnimClip.cpp:125
float getRotationKeyTime(int boneIndex, int keyIndex) const
Returns the rotation key time.
Definition AnimClip.cpp:405
std::string getEventName(int index) const
Return an event marker's name, or empty for an invalid index.
Definition AnimClip.cpp:186
int getRotationKeyCount(int boneIndex) const
Returns the rotation key count.
Definition AnimClip.cpp:370
float getScaleKeyTime(int boneIndex, int keyIndex) const
Returns the scale key time.
Definition AnimClip.cpp:426
void addEvent(float time, const std::string &name, const std::string &payload="")
Add a named event marker at clip-local time. Events are kept time-sorted.
Definition AnimClip.cpp:155
void applyPlanarRootMotion(int boneIndex, float speedX, float speedZ)
Bake planar root motion onto an existing position track (or create one). For each position key at tim...
Definition AnimClip.cpp:443
float mapSyncTimeTo(float time, const AnimClip *target) const
Map local time into target marker space, falling back to normalized duration.
Definition AnimClip.cpp:280
bool clearTrack(int boneIndex)
Clear every transform channel for one bone.
Definition AnimClip.cpp:149
float getRotationKeyZ(int boneIndex, int keyIndex) const
Returns the rotation key z.
Definition AnimClip.cpp:417
bool setSyncMarker(int index, float time, const std::string &name)
Replace and re-sort one sync marker.
Definition AnimClip.cpp:225
void setSampleRate(float hz)
Sample rate hint used by MotionDatabase baking (Hz).
Definition AnimClip.cpp:33
float getPositionKeyX(int boneIndex, int keyIndex) const
Returns the position key x.
Definition AnimClip.cpp:392
int getPositionKeyCount(int boneIndex) const
Returns the position key count.
Definition AnimClip.cpp:365
void addRotationKey(int boneIndex, float time, float x, float y, float z, float w)
Adds rotation key.
Definition AnimClip.cpp:55
float getRotationKeyX(int boneIndex, int keyIndex) const
Returns the rotation key x.
Definition AnimClip.cpp:409
AnimClip * retarget(const AnimSkeleton *sourceSkeleton, const AnimSkeleton *targetSkeleton) const
Bake this clip onto a target skeleton by matching bone names and preserving bind-pose deltas....
Definition AnimClip.cpp:806
int getSyncMarkerCount() const
Return the number of locomotion sync markers.
Definition AnimClip.h:232
float getRotationKeyY(int boneIndex, int keyIndex) const
Returns the rotation key y.
Definition AnimClip.cpp:413
bool removeRotationKey(int boneIndex, int keyIndex)
Delete one rotation key.
Definition AnimClip.cpp:133
float getPositionKeyY(int boneIndex, int keyIndex) const
Returns the position key y.
Definition AnimClip.cpp:396
int compress(float positionError=0.001f, float rotationErrorDegrees=0.1f, float scaleError=0.001f)
Remove interpolation-redundant keys while keeping sampled error below the supplied tolerances.
Definition AnimClip.cpp:602
int getTrackCount() const
Return the number of allocated bone tracks, including empty tracks.
Definition AnimClip.h:196
std::string getSyncMarkerName(int index) const
Return a sync marker's name, or empty for an invalid index.
Definition AnimClip.cpp:247
float wrapTime(float time) const
Wrap or clamp time according to loop flag.
Definition AnimClip.cpp:471
float getScaleKeyX(int boneIndex, int keyIndex) const
Returns the scale key x.
Definition AnimClip.cpp:430
float getScaleKeyZ(int boneIndex, int keyIndex) const
Returns the scale key z.
Definition AnimClip.cpp:438
std::string getEventPayload(int index) const
Return an event marker's optional payload.
Definition AnimClip.cpp:191
Settings and diagnostics for offline skeletal animation retargeting.
Definition AnimClip.h:27
const std::string & getNeuralBackend() const
Return the neural backend hint.
Definition AnimClip.h:102
float getInteractionContactThreshold() const
Return the configured interaction contact threshold (0 = auto).
Definition AnimClip.h:70
void setRootTranslationScale(float horizontal, float vertical)
Set additional horizontal and vertical multipliers for root translation.
Definition AnimClip.cpp:703
void setInteractionCorrectionWeight(float weight)
Blend weight [0,1] applied to interaction IK corrections.
Definition AnimClip.cpp:720
int getNeuralInferenceCount() const
Non-zero when the last retarget used the neural MeshRet path.
Definition AnimClip.h:104
void setNeuralRetargetEnabled(bool enabled)
Prefer neural MeshRet inference when animation_tensor provides ISmrNeuralRetarget....
Definition AnimClip.h:93
void setUseSkeletonSpaceRotation(bool enabled)
Choose skeleton-space Bind correction instead of legacy local-space correction.
Definition AnimClip.h:51
const std::string & getNeuralModelPath() const
Return the configured neural model path (may be empty).
Definition AnimClip.h:88
int getInteractionCorrectionCount() const
Number of frames that received at least one interaction IK correction last retarget.
Definition AnimClip.h:80
float getRootVerticalScale() const
Return the additional vertical root translation multiplier.
Definition AnimClip.h:49
int getUnmatchedBoneCount() const
Number of target bones left at bind pose by the most recent operation.
Definition AnimClip.h:109
std::string getUnmatchedTargetBone(int index) const
Name of an unmatched target bone, or empty for an invalid index.
Definition AnimClip.cpp:710
void addInteractionIkChain(const std::string &rootBone, const std::string &midBone, const std::string &tipBone)
Register a two-bone IK chain used to realize tip-sensor corrections.
Definition AnimClip.cpp:726
void setSkinnedInteractionPreserve(bool enabled)
Enable MeshRet-inspired skinned interaction preservation after FK retarget.
Definition AnimClip.h:61
bool getUseSkeletonSpaceRotation() const
Return whether skeleton-space rotation correction is enabled.
Definition AnimClip.h:53
bool getAutoRootScale() const
Return whether automatic root scaling is enabled.
Definition AnimClip.h:43
void clearInteractionIkChains()
Remove all explicitly registered interaction IK chains (auto-detect remains).
Definition AnimClip.cpp:733
void addBoneMapping(const std::string &sourceBone, const std::string &targetBone)
Map one source bone to one target bone; replaces an existing mapping for that target.
Definition AnimClip.cpp:684
float getRootHorizontalScale() const
Return the additional horizontal root translation multiplier.
Definition AnimClip.h:47
bool getNeuralRetargetEnabled() const
Return whether neural retarget is preferred when a provider is available.
Definition AnimClip.h:95
void setAutoRootScale(bool enabled)
Enable automatic root translation scaling from skeleton extents.
Definition AnimClip.h:41
int getMatchedBoneCount() const
Number of target bones mapped by the most recent retarget operation.
Definition AnimClip.h:107
void setNeuralModelPath(const std::string &path)
Filesystem path to a MeshRet-compatible ONNX model for neural skinned retarget. Empty path selects th...
Definition AnimClip.h:86
void setNormalizedNameMatching(bool enabled)
Enable exact-then-normalized automatic bone-name matching.
Definition AnimClip.h:34
bool getSkinnedInteractionPreserve() const
Return whether skinned interaction preservation is enabled.
Definition AnimClip.h:63
float getInteractionCorrectionWeight() const
Return the interaction IK blend weight.
Definition AnimClip.h:74
void setInteractionContactThreshold(float distance)
Absolute source-space distance below which a sensor pair counts as interacting. Values <= 0 select 8%...
Definition AnimClip.cpp:715
void setRootBones(const std::string &sourceBone, const std::string &targetBone)
Select the source and target pelvis/root used for proportional translation.
Definition AnimClip.cpp:698
bool getNormalizedNameMatching() const
Return whether normalized automatic bone-name matching is enabled.
Definition AnimClip.h:36
void setNeuralBackend(const std::string &backend)
Backend hint: "auto" (default), "onnx", or "tensor". Unknown values are treated as "auto".
Definition AnimClip.h:100
3D bone hierarchy + bind-pose local TRS for skeletal animation. Independent of ik::Skeleton3D (FABRIK...
Definition AnimSkeleton.h:16
Pins the active VM and a stable diagnostic source for one expose() TU.
Definition SquirrelBindContext.h:32
Definition Animation.cpp:58
void exposeAnimCurveLibraryBindings(ssq::Table &table)
Register the owned scalar animation curve library and checked loader.
Definition AnimationCurveBindings.cpp:25
eve::Result< int > loadAnimationTrackBatch(std::span< const AnimationTrackInput > inputs, const AnimSkeleton &skeleton, int workerCount)
Decode independent clips in parallel, then publish all or none in input order.
Definition AnimClipBinary.cpp:85
void exposeAnimClipBindings(ssq::Table &table)
Register AnimClip's authoring and playback-neutral Squirrel surface.
Definition AnimationClipBindings.cpp:29
eve::Result< void > loadAnimationTracks(AnimClip &destination, std::span< const std::byte > bytes, const AnimSkeleton &skeleton)
Atomically replace a clip from the little-endian eve.animation-tracks/1 format (EVAC,...
Definition AnimClipBinary.cpp:112
std::unique_ptr< T > Owned
C++ owning storage used by an object factory.
Definition RuntimeRegistry.h:33
ssq::Table projectResult(HSQUIRRELVM vm, Result< void > &&result)
Consume and project a void native Result using the common schema.
Definition SquirrelBinding.cpp:470