diff options
author | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 03:11:50 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2011-02-21 03:11:50 +0300 |
commit | 9d2ee8055a510dd41036c780c6209dc4d7d80c72 (patch) | |
tree | c8cd725c5fadd186023a4090f7d08b71f6b7f53c /io_anim_bvh | |
parent | b01f11eed8fae9bd6257408fafc8569a6a0bc6aa (diff) |
fix for [#26148] Anomaly in bvh import
zero length bones had their tail offset in the wrong direction.
Diffstat (limited to 'io_anim_bvh')
-rw-r--r-- | io_anim_bvh/import_bvh.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py index 9a0126b3..d0f3fde8 100644 --- a/io_anim_bvh/import_bvh.py +++ b/io_anim_bvh/import_bvh.py @@ -263,6 +263,7 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0): # Make sure tail isnt the same location as the head. if (bvh_node.rest_tail_local - bvh_node.rest_head_local).length <= 0.001 * global_scale: + print("\tzero length node found:", bvh_node.name) bvh_node.rest_tail_local.y = bvh_node.rest_tail_local.y + global_scale / 10 bvh_node.rest_tail_world.y = bvh_node.rest_tail_world.y + global_scale / 10 @@ -383,10 +384,11 @@ def bvh_node_dict2armature(context, bvh_name, bvh_nodes, rotate_mode='XYZ', fram # ZERO AREA BONES. if (bone.head - bone.tail).length < 0.001: + print("\tzero length bone found:", bone.name) if bvh_node.parent: ofs = bvh_node.parent.rest_head_local - bvh_node.parent.rest_tail_local if ofs.length: # is our parent zero length also?? unlikely - bone.tail = bone.tail + ofs + bone.tail = bone.tail - ofs else: bone.tail.y = bone.tail.y + average_bone_length else: |