From 1b72fa8196cfb16133ae73dcd0d6735ec152170e Mon Sep 17 00:00:00 2001 From: type-two Date: Sat, 25 Jul 2026 21:44:12 +1000 Subject: [PATCH] fix: FBX carried the scene frame range (1..250), mangling every clip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- retarget.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/retarget.py b/retarget.py index 764f3b9..a32c103 100644 --- a/retarget.py +++ b/retarget.py @@ -251,6 +251,10 @@ def main(): # imported action reads '|' — the same shape Mixamo's anim-only FBXs use. bpy.context.scene.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) # 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"