[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [3817] trunk/py/scripts/addons/ io_anim_bvh: Fix for [#32792] BVH exporter crashes on rigs with multiple roots.
Bastien Montagne
montagne29 at wanadoo.fr
Sat Oct 6 15:24:09 CEST 2012
Revision: 3817
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-extensions&revision=3817
Author: mont29
Date: 2012-10-06 13:24:08 +0000 (Sat, 06 Oct 2012)
Log Message:
-----------
Fix for [#32792] BVH exporter crashes on rigs with multiple roots.
In this situation, the script creates a dummy root bone... But code was buggy (and import of non-rotating bones was too).
Modified Paths:
--------------
trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
trunk/py/scripts/addons/io_anim_bvh/import_bvh.py
Modified: trunk/py/scripts/addons/io_anim_bvh/export_bvh.py
===================================================================
--- trunk/py/scripts/addons/io_anim_bvh/export_bvh.py 2012-10-04 14:18:07 UTC (rev 3816)
+++ trunk/py/scripts/addons/io_anim_bvh/export_bvh.py 2012-10-06 13:24:08 UTC (rev 3817)
@@ -99,7 +99,7 @@
if my_children:
# store the location for the children
- # to het their relative offset
+ # to get their relative offset
# Write children
for child_bone in my_children:
@@ -124,15 +124,23 @@
write_recursive_nodes(key, indent)
else:
- # Write a dummy parent node
+ # Write a dummy parent node, with a dummy key name
+ # Just be sure it's not used by another bone!
+ i = 0
+ key = "__%d" % i
+ while key in children:
+ i += 1
+ key = "__%d" % i
file.write("ROOT %s\n" % key)
file.write("{\n")
file.write("\tOFFSET 0.0 0.0 0.0\n")
file.write("\tCHANNELS 0\n") # Xposition Yposition Zposition Xrotation Yrotation Zrotation
- key = None
indent = 1
- write_recursive_nodes(key, indent)
+ # Write children
+ for child_bone in children[None]:
+ serialized_names.append(child_bone)
+ write_recursive_nodes(child_bone, indent)
file.write("}\n")
Modified: trunk/py/scripts/addons/io_anim_bvh/import_bvh.py
===================================================================
--- trunk/py/scripts/addons/io_anim_bvh/import_bvh.py 2012-10-04 14:18:07 UTC (rev 3816)
+++ trunk/py/scripts/addons/io_anim_bvh/import_bvh.py 2012-10-06 13:24:08 UTC (rev 3817)
@@ -35,7 +35,7 @@
'rest_head_local', # localspace rest location for the head of this node
'rest_tail_world', # worldspace rest location for the tail of this node
'rest_tail_local', # worldspace rest location for the tail of this node
- 'channels', # list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, lock triple then rot triple
+ 'channels', # list of 6 ints, -1 for an unused channel, otherwise an index for the BVH motion data lines, loc triple then rot triple
'rot_order', # a triple of indices as to the order rotation is applied. [0,1,2] is x/y/z - [None, None, None] if no rotation.
'rot_order_str', # same as above but a string 'XYZ' format.
'anim_data', # a list one tuple's one for each frame. (locx, locy, locz, rotx, roty, rotz), euler rotation ALWAYS stored xyz order, even when native used.
@@ -45,7 +45,8 @@
'temp', # use this for whatever you want
)
- _eul_order_lookup = {(0, 1, 2): 'XYZ',
+ _eul_order_lookup = {(None, None, None): 'XYZ', # XXX Dummy one, no rotation anyway!
+ (0, 1, 2): 'XYZ',
(0, 2, 1): 'XZY',
(1, 0, 2): 'YXZ',
(1, 2, 0): 'YZX',
More information about the Bf-extensions-cvs
mailing list