diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2020-05-12 19:43:44 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2020-05-12 19:43:44 +0300 |
commit | 72227fc13ba354695244a600b0d8b6a0b5d6f460 (patch) | |
tree | b15de779585b5a38e539b876a1b8831054f0ea5c /io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py | |
parent | 64d34396670d825f03131903ef6cef4332adf653 (diff) |
glTF exporter: prevent infinite recursion when mesh is skinned and parenting to same bone
Avoid this by do not skin if object is parented to a bone of the armature that skin the object: keep only parenting to bone
Diffstat (limited to 'io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py')
-rwxr-xr-x | io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py index 3b0fab2d..548c5299 100755 --- a/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py +++ b/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py @@ -409,6 +409,15 @@ def __gather_skin(blender_object, export_settings): if not any(vertex.groups is not None and len(vertex.groups) > 0 for vertex in blender_mesh.vertices): return None + # Prevent infinite recursive error. A mesh can't have an Armature modifier + # and be bone parented to a bone of this armature + # In that case, ignore the armature modifier, keep only the bone parenting + if blender_object.parent is not None \ + and blender_object.parent_type == 'BONE' \ + and blender_object.parent.name == modifiers["ARMATURE"].object.name: + + return None + # Skins and meshes must be in the same glTF node, which is different from how blender handles armatures return gltf2_blender_gather_skins.gather_skin(modifiers["ARMATURE"].object, export_settings) |