fix for error and other minor changes found while looking into bug [#23813].

This commit is contained in:
Campbell Barton
2010-09-20 05:01:31 +00:00
parent ffd366e862
commit 69d72046e2

View File

@@ -307,7 +307,7 @@ def bvh_node_dict2objects(context, bvh_nodes, IMPORT_START_FRAME=1, IMPORT_LOOP=
# Parent the objects
for bvh_node in bvh_nodes.values():
bvh_node.temp.makeParent(bvh_node_child.temp for bvh_node_child in bvh_node.children, 1, 0) # ojbs, noninverse, 1 = not fast.
bvh_node.temp.makeParent([bvh_node_child.temp for bvh_node_child in bvh_node.children], 1, 0) # ojbs, noninverse, 1 = not fast.
# Offset
for bvh_node in bvh_nodes.values():
@@ -360,12 +360,10 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
arm_ob.select = True
scn.objects.active = arm_ob
print(scn.objects.active)
bpy.ops.object.mode_set(mode='OBJECT', toggle=False)
bpy.ops.object.mode_set(mode='EDIT', toggle=False)
# Get the average bone length for zero length bones, we may not use this.
average_bone_length = 0.0
nonzero_count = 0
@@ -382,22 +380,14 @@ def bvh_node_dict2armature(context, bvh_nodes, ROT_MODE='XYZ', IMPORT_START_FRAM
# Normal operation
average_bone_length = average_bone_length / nonzero_count
#XXX - sloppy operator code
bpy.ops.armature.delete()
bpy.ops.armature.select_all()
bpy.ops.armature.delete()
# XXX, annoying, remove bone.
while arm_data.edit_bones:
arm_ob.edit_bones.remove(arm_data.edit_bones[-1])
ZERO_AREA_BONES = []
for name, bvh_node in bvh_nodes.items():
# New editbone
bpy.ops.armature.bone_primitive_add(name="Bone")
bone = bvh_node.temp = arm_data.edit_bones[-1]
bone.name = name
# arm_data.bones[name]= bone
bone = bvh_node.temp = arm_data.edit_bones.new(name)
bone.head = bvh_node.rest_head_world
bone.tail = bvh_node.rest_tail_world