Fix BVH import bone tail calculation with multiple children
When importing a BVH file with a parent node that has more than one child that have offsets within `0.001 * global_scale` of the parent node, the length of the parent node is considered to be zero. For example: A parent node with `OFFSET 0 -0.1077 0`, two children with `OFFSET 0 -0.1074 0`, and a global scale of `1.0`, the parent node's length would be considered zero, therefore adding `global_scale / 10` (`0.1` in this case) to the y component of the offset. The resulting tail offset would then be `OFFSET 0 -0.0077 0`. Ref !105492
This commit is contained in:
committed by
Campbell Barton
parent
b13e085109
commit
e2ff0a45aa
@@ -322,7 +322,7 @@ def read_bvh(context, file_path, rotate_mode='XYZ', global_scale=1.0):
|
||||
rest_tail_local += bvh_node_child.rest_head_local
|
||||
|
||||
bvh_node.rest_tail_world = rest_tail_world * (1.0 / len(bvh_node.children))
|
||||
bvh_node.rest_tail_local = rest_tail_local * (1.0 / len(bvh_node.children))
|
||||
bvh_node.rest_tail_local = bvh_node.rest_head_local + (rest_tail_local * (1.0 / len(bvh_node.children)))
|
||||
|
||||
# Make sure tail isn't the same location as the head.
|
||||
if (bvh_node.rest_tail_local - bvh_node.rest_head_local).length <= 0.001 * global_scale:
|
||||
|
||||
Reference in New Issue
Block a user