diff --git a/tools/convert-mesh/bin/convert-mesh.py b/tools/convert-mesh/bin/convert-mesh.py index 8a6f537e..1c1922eb 100644 --- a/tools/convert-mesh/bin/convert-mesh.py +++ b/tools/convert-mesh/bin/convert-mesh.py @@ -27,11 +27,10 @@ if len(mesh.uv_layers) > 0: texcoords = mesh.uv_layers.active.data print('Found texture coordinates') -# TODO: proper armature support armature = None bone_names = None -if 'armature' in bpy.data.objects: - armature = bpy.data.objects['armature'] +if type(obj.parent.data) is bpy.types.Armature: + armature = obj.parent print('Found armature with {} bones'.format(len(armature.data.bones))) bone_names = [b.name for b in armature.data.bones] @@ -175,8 +174,8 @@ if armature is not None: bones.append((p, tuple(b.head_local), tuple(map(tuple, b.matrix_local.to_3x3())))) poses = [] -if armature is not None: - for index, pose in enumerate(bpy.data.objects['armature'].pose_library.pose_markers): +if armature is not None and armature.pose_library is not None: + for index, pose in enumerate(armature.pose_library.pose_markers): print("Found pose", pose.name) # [rotation, scale, translation]