[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [32018] trunk/blender/release/scripts/op/ io_anim_bvh/import_bvh.py: fix for error and other minor changes found while looking into bug [#23813 ].

Campbell Barton ideasman42 at gmail.com
Mon Sep 20 07:01:31 CEST 2010


Revision: 32018
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=32018
Author:   campbellbarton
Date:     2010-09-20 07:01:31 +0200 (Mon, 20 Sep 2010)

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

Modified Paths:
--------------
    trunk/blender/release/scripts/op/io_anim_bvh/import_bvh.py

Modified: trunk/blender/release/scripts/op/io_anim_bvh/import_bvh.py
===================================================================
--- trunk/blender/release/scripts/op/io_anim_bvh/import_bvh.py	2010-09-20 04:59:20 UTC (rev 32017)
+++ trunk/blender/release/scripts/op/io_anim_bvh/import_bvh.py	2010-09-20 05:01:31 UTC (rev 32018)
@@ -307,7 +307,7 @@
 
     # 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 @@
 
     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,23 +380,15 @@
         # Normal operation
         average_bone_length = average_bone_length / nonzero_count
 
+    # XXX, annoying, remove bone.
+    while arm_data.edit_bones:
+        arm_ob.edit_bones.remove(arm_data.edit_bones[-1])
 
-#XXX - sloppy operator code
-
-    bpy.ops.armature.delete()
-    bpy.ops.armature.select_all()
-    bpy.ops.armature.delete()
-
     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.new(name)
 
-        bone = bvh_node.temp = arm_data.edit_bones[-1]
-
-        bone.name = name
-#		arm_data.bones[name]= bone
-
         bone.head = bvh_node.rest_head_world
         bone.tail = bvh_node.rest_tail_world
 





More information about the Bf-blender-cvs mailing list