def split_armature(name):
amt = bpy.data.armatures[name]
name = name.replace('Amt','')
bones = amt.bones
root_bones = [bone for bone in bones if not bone.parent]
for i in range(len(root_bones)):
bpy.ops.object.add(
type='ARMATURE',
enter_editmode=True,
location=(i * 2,0,0))
ob_new = bpy.context.object
ob_new.show_x_ray = False
ob_new.name = "%s_%d" % (name, i)
amt_new = ob_new.data
amt_new.name = '%s_%d_Amt' % (name, i)
copy_bone_tree(root_bones[i] ,amt_new)
bpy.ops.object.mode_set(mode="OBJECT")
ob_new.rotation_euler = (math.tan(1),0,0)
bpy.ops.object.select_all(action="DESELECT")
obj = bpy.data.objects[name]
scene = bpy.context.scene
scene.objects.unlink(obj)
return False
评论列表
文章目录