diff --git a/comfy_extras/sam3d_body/export/glb_openpose.py b/comfy_extras/sam3d_body/export/glb_openpose.py index 68685c2ac..b1e456d53 100644 --- a/comfy_extras/sam3d_body/export/glb_openpose.py +++ b/comfy_extras/sam3d_body/export/glb_openpose.py @@ -905,6 +905,8 @@ def build_glb_openpose( animations: List[dict] = [] scene_root_indices: List[int] = [] + samplers: List[dict] = [] + channels: List[dict] = [] for track_i, (person_k, frame_indices) in enumerate(tracks): body_seq = _extract_openpose_keypoints(pose_data, frame_indices, person_k) n_frames = body_seq.shape[0] @@ -1105,8 +1107,6 @@ def build_glb_openpose( times = np.asarray(frame_indices, dtype=np.float32) / float(fps) time_acc = w.add_scalar_f32(times) - samplers: List[dict] = [] - channels: List[dict] = [] for j in range(K): t_j = kp_seq[:, j, :].astype(np.float32) if (np.ptp(t_j, axis=0) < 1e-6).all(): @@ -1167,8 +1167,9 @@ def build_glb_openpose( "target": {"node": person_root_idx, "path": "translation"}, }) + if samplers: animations.append({ - "name": f"track{track_i:02d}", + "name": "all_tracks", "samplers": samplers, "channels": channels, }) diff --git a/comfy_extras/sam3d_body/export/glb_skeletal.py b/comfy_extras/sam3d_body/export/glb_skeletal.py index 124ffa80d..6204c1067 100644 --- a/comfy_extras/sam3d_body/export/glb_skeletal.py +++ b/comfy_extras/sam3d_body/export/glb_skeletal.py @@ -284,6 +284,8 @@ def build_glb_skeletal( for e in range(NEXPR): expr_morph_accs.append(w.add_vec3_f32_no_minmax(eb[e])) + samplers: List[dict] = [] + channels: List[dict] = [] for track_i, (person_k, frame_indices) in enumerate(tracks): person_root = {"name": f"track{track_i:02d}", "children": []} nodes.append(person_root) @@ -484,9 +486,6 @@ def build_glb_skeletal( times = np.asarray(frame_indices, dtype=np.float32) / float(fps) time_acc = w.add_scalar_f32(times) - samplers: List[dict] = [] - channels: List[dict] = [] - for j in range(NJ): t_j = local_t[:, j, :] q_j = local_q[:, j, :] @@ -556,8 +555,9 @@ def build_glb_skeletal( "target": {"node": body_mesh_node_idx, "path": "weights"}, }) + if samplers: animations.append({ - "name": f"track{track_i:02d}", + "name": "all_tracks", "samplers": samplers, "channels": channels, })