Maximum Recursion depth exceeded while calling a Python object
When attempting to export this file [model.zip](https://github.com/KhronosGroup/glTF-Blender-IO/files/4440350/model.zip), I get a `Recursion Error: maximum recursion depth exceeded while calling a Python object`

It seems like the problem is that there are many different objects in the scene, as it works, when I combine them into one object

Full stacktrace: 
[blender.log](https://github.com/KhronosGroup/glTF-Blender-IO/files/4440353/blender.log)

Blender version: 2.82a




diff --git a/addons/io_scene_gltf2/blender/exp/gltf2_blender_extract.py b/addons/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
index 35f31c50..e2d224ce 100644
--- a/addons/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
+++ b/addons/io_scene_gltf2/blender/exp/gltf2_blender_extract.py
@@ -409,63 +409,70 @@ def extract_primitives(glTF, blender_mesh, library, blender_object, blender_vert
 
             bone_count = 0
 
-            if blender_vertex_groups is not None and vertex.groups is not None and len(vertex.groups) > 0 and export_settings[gltf2_blender_export_keys.SKINS]:
-                joint = []
-                weight = []
-                vertex_groups = vertex.groups
-                if not export_settings['gltf_all_vertex_influences']:
-                    # sort groups by weight descending
-                    vertex_groups = sorted(vertex.groups, key=attrgetter('weight'), reverse=True)
-                for group_element in vertex_groups:
-
-                    if len(joint) == 4:
-                        bone_count += 1
-                        joints.append(joint)
-                        weights.append(weight)
-                        joint = []
-                        weight = []
-
-                    #
-
-                    joint_weight = group_element.weight
-                    if joint_weight <= 0.0:
-                        continue
-
-                    #
-
-                    vertex_group_index = group_element.group
-
-                    if vertex_group_index < 0 or vertex_group_index >= len(blender_vertex_groups):
-                        continue
-                    vertex_group_name = blender_vertex_groups[vertex_group_index].name
+            # Skin must be ignored if the object is parented to a bone of the armature
+            # (This creates an infinite recursive error)
+            # So ignoring skin in that case
+            if blender_object and blender_object.parent_type == "BONE" and blender_object.parent.name == armature.name:
+                bone_max = 0 # joints & weights will be ignored in following code
+            else:
+                # Manage joints & weights
+                if blender_vertex_groups is not None and vertex.groups is not None and len(vertex.groups) > 0 and export_settings[gltf2_blender_export_keys.SKINS]:
+                    joint = []
+                    weight = []
+                    vertex_groups = vertex.groups
+                    if not export_settings['gltf_all_vertex_influences']:
+                        # sort groups by weight descending
+                        vertex_groups = sorted(vertex.groups, key=attrgetter('weight'), reverse=True)
+                    for group_element in vertex_groups:
+
+                        if len(joint) == 4:
+                            bone_count += 1
+                            joints.append(joint)
+                            weights.append(weight)
+                            joint = []
+                            weight = []
+
+                        #
+
+                        joint_weight = group_element.weight
+                        if joint_weight <= 0.0:
+                            continue
+
+                        #
+
+                        vertex_group_index = group_element.group
+
+                        if vertex_group_index < 0 or vertex_group_index >= len(blender_vertex_groups):
+                            continue
+                        vertex_group_name = blender_vertex_groups[vertex_group_index].name
+
+                        joint_index = None
+
+                        if armature:
+                            skin = gltf2_blender_gather_skins.gather_skin(armature, export_settings)
+                            for index, j in enumerate(skin.joints):
+                                if j.name == vertex_group_name:
+                                    joint_index = index
+                                    break
 
-                    joint_index = None
+                        #
+                        if joint_index is not None:
+                            joint.append(joint_index)
+                            weight.append(joint_weight)
 
-                    if armature:
-                        skin = gltf2_blender_gather_skins.gather_skin(armature, export_settings)
-                        for index, j in enumerate(skin.joints):
-                            if j.name == vertex_group_name:
-                                joint_index = index
-                                break
-
-                    #
-                    if joint_index is not None:
-                        joint.append(joint_index)
-                        weight.append(joint_weight)
-
-                if len(joint) > 0:
-                    bone_count += 1
+                    if len(joint) > 0:
+                        bone_count += 1
 
-                    for fill in range(0, 4 - len(joint)):
-                        joint.append(0)
-                        weight.append(0.0)
+                        for fill in range(0, 4 - len(joint)):
+                            joint.append(0)
+                            weight.append(0.0)
 
-                    joints.append(joint)
-                    weights.append(weight)
+                        joints.append(joint)
+                        weights.append(weight)
 
-            for fill in range(0, bone_max - bone_count):
-                joints.append([0, 0, 0, 0])
-                weights.append([0.0, 0.0, 0.0, 0.0])
+                for fill in range(0, bone_max - bone_count):
+                    joints.append([0, 0, 0, 0])
+                    weights.append([0.0, 0.0, 0.0, 0.0])
 
             #
 
diff --git a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py b/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
index 3b0fab2d..548c5299 100644
--- a/addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py
+++ b/addons/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)
 
['addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py', 'addons/io_scene_gltf2/blender/exp/gltf2_blender_extract.py']