Skip to content

AnimationBuilder inserts identity scale keys instead of rest pose scale when scale track is missing #191

@nicugnm

Description

@nicugnm

Missing scale tracks default to (1,1,1) instead of skeleton rest pose scale

Description

When building an animation that contains translation and/or rotation keys but no scale keys for a bone, AnimationBuilder generates two implicit scale keys using ScaleKey::identity() ((1,1,1)).

This happens in CopyRaw() when _src.size() == 0, where PushBackIdentityKey() is called for scale tracks:

if (_src.size() == 0) {
PushBackIdentityKey<SrcKey, _DestTrack>(_track, 0.f, _dest);
PushBackIdentityKey<SrcKey, _DestTrack>(_track, _duration, _dest);
}

PushBackIdentityKey() constructs the key using:

_SrcKey::identity()

For scale keys, this resolves to:

ScaleKey::identity() { return math::Float3::one(); } // (1,1,1)

Problem

This ignores the skeleton’s rest pose scale. If the rest pose scale is not (1,1,1) (e.g. negative or non-uniform scales like (-1.43, 1, 1)), the generated animation will override the rest pose scale and produce incorrect results.

Expected behavior

When a scale track is missing, the builder should use the skeleton rest pose scale for that joint, not a hardcoded identity scale.

Impact

This breaks animations for rigs that rely on non-identity rest pose scales, even when scale is intentionally not animated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions