Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2012-10-06 17:24:08 +0400
committerBastien Montagne <montagne29@wanadoo.fr>2012-10-06 17:24:08 +0400
commitdda5658325f247c4773ce43721d6a522b11d3048 (patch)
tree586915db5cc2f92d534727fce228ae0474534a92 /io_anim_bvh/export_bvh.py
parent762cffcfdca583f6911ad8ca2f0bb4f30004dfb5 (diff)
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).
Diffstat (limited to 'io_anim_bvh/export_bvh.py')
-rw-r--r--io_anim_bvh/export_bvh.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/io_anim_bvh/export_bvh.py b/io_anim_bvh/export_bvh.py
index fcddb63c..4d7f0b09 100644
--- a/io_anim_bvh/export_bvh.py
+++ b/io_anim_bvh/export_bvh.py
@@ -99,7 +99,7 @@ def write_armature(context,
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 @@ def write_armature(context,
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")