MCPcopy Create free account
hub / github.com/Netflix/void-model / extract_skeleton_data

Function extract_skeleton_data

data_generation/scripts/extract_pk_data.py:31–57  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

29folder = fbx_folder_path.split('/')[-1]
30
31def extract_skeleton_data():
32 armature = None
33 for obj in bpy.data.objects:
34 if obj.type == 'ARMATURE':
35 armature = obj
36 break
37 if armature is None:
38 raise Exception("No armature found")
39 frame_data = []
40 scene = bpy.context.scene
41 start_frame = scene.frame_start
42 end_frame = scene.frame_end
43 scale = list(armature.scale)
44 for frame in range(start_frame, end_frame + 1):
45 scene.frame_set(frame)
46 cur_frame = {}
47 for bone in armature.pose.bones:
48 location = list(bone.location)
49 location = [l * s for l,s in zip(location, scale)]
50 if bone.rotation_mode == 'QUATERNION':
51 rotation = list(bone.rotation_quaternion)
52 else:
53 quat = bone.rotation_euler.to_quaternion()
54 rotation = list(quat)
55 cur_frame[bone.name] = rotation + location
56 frame_data.append(cur_frame)
57 return frame_data
58
59def extract_object_data():
60 object_data = {}

Callers 1

extract_pk_data.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected