rename script
This commit is contained in:
@@ -94,11 +94,9 @@ def generate_humanoid_skeleton(target, name, bonedict, childdict):
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
for edit_bone in bpy.context.object.data.edit_bones:
|
||||
target_bone_head_dict[edit_bone.name] = [x for x in edit_bone.head]
|
||||
|
||||
# Add the armature
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='OBJECT')
|
||||
|
||||
# Add the armature
|
||||
bpy.ops.object.armature_add(enter_editmode=True)
|
||||
obj = bpy.data.objects["Armature"]
|
||||
obj.name = name
|
||||
@@ -146,7 +144,7 @@ def constrain_DM_skeleton(bonedict):
|
||||
|
||||
# Spine
|
||||
spine_con = skel.pose.bones['spine'].constraints.new('COPY_ROTATION')
|
||||
spine_con.target = bpy.data.objects[skel_name]
|
||||
spine_con.target = bpy.data.objects[target]
|
||||
spine_con.subtarget = bonedict['spine'].target_name
|
||||
|
||||
# Fixing rotation in elbow and knee joints:
|
||||
@@ -309,16 +307,23 @@ def generate_frame(arm):
|
||||
return result
|
||||
|
||||
def generate_frames(arm):
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='EDIT')
|
||||
# Select all bones
|
||||
bpy.data.objects[skel_name].select_set(True)
|
||||
bpy.ops.armature.select_all(action='SELECT')
|
||||
|
||||
if bpy.ops.object.mode_set.poll():
|
||||
bpy.ops.object.mode_set(mode='POSE')
|
||||
|
||||
frames = []
|
||||
loopText = "none"
|
||||
|
||||
for frame in range(bpy.context.scene.frame_end + 1):
|
||||
for frame in range(bpy.context.scene.frame_start, bpy.context.scene.frame_end + 1):
|
||||
# for frame in range(bpy.context.scene.frame_end + 1):
|
||||
bpy.context.scene.frame_set(frame)
|
||||
# Apply visual transform to pose
|
||||
bpy.ops.pose.visual_transform_apply()
|
||||
# bpy.context.view_layer.update()
|
||||
frames.append(generate_frame(arm))
|
||||
|
||||
# Output in dictionary format for easy json dump
|
||||
Reference in New Issue
Block a user