fix: FBX carried the scene frame range (1..250), mangling every clip

bake_anim exports the SCENE range, not the action's, and retarget.py only set that
inside qc_render() — which runs AFTER the export (and never at all with --no-qc).
So every clip was wrong in one of two ways:
  short clips gained a frozen tail  — 98f wan_walk_t1 exported as 250f
  long clips were TRUNCATED         — 317f gymnasts_d exported as 250f, losing 2.2s
(the second is the clip Review #2 signed off as '317f green'; the BVH had 317, the
FBX quietly dropped the tail — nobody checked the FBX.)

Pin scene.frame_start/end to the trimmed clip range before export. Verified by
re-export + import: wan_walk_t1 2..99, wan_dig_t3 2..99, gymnasts_d 2..318.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
type-two 2026-07-25 21:44:12 +10:00
parent d6af7b3ebe
commit 1b72fa8196

View File

@ -251,6 +251,10 @@ def main():
# imported action reads '<Armature>|<name>' — the same shape Mixamo's anim-only FBXs use. # imported action reads '<Armature>|<name>' — the same shape Mixamo's anim-only FBXs use.
bpy.context.scene.name = name bpy.context.scene.name = name
target.animation_data.action.name = name target.animation_data.action.name = name
# bake_anim exports the SCENE frame range, not the action's. Left at Blender's factory 1..250
# this silently mangled every clip: shorter ones gained a frozen tail (98f clip -> 250f), longer
# ones were truncated (the 317f gymnasts clip lost 67 frames / 2.2s). Pin it to the real range.
bpy.context.scene.frame_start, bpy.context.scene.frame_end = f0, f1
export_fbx(target, fbx) export_fbx(target, fbx)
# sanity: the FBX action must carry keys on the driven bones # sanity: the FBX action must carry keys on the driven bones
assert target.animation_data and target.animation_data.action, "no baked action on target" assert target.animation_data and target.animation_data.action, "no baked action on target"