Repository: khronosgroup/gltf-blender-io
Issue: Division by zero when exporting object parented to bone scaled to 0

**Describe the bug**
Object bone-parented to bone
Bone has animation in which, at some frames, scales to 0
This causes a division by zero error on exporting

**To Reproduce**

Simply export this file

[PoseBoneScaleZero.zip](https://github.com/KhronosGroup/glTF-Blender-IO/files/4202941/PoseBoneScaleZero.zip)

You should get the following error:

` 191, in __gather_children
    bone_tail = [0, blender_bone.length / blender_bone.matrix.to_scale()[1], 0]
ZeroDivisionError: float division by zero`

**Version**
Operating system: Windows-10-10.0.18362-SP0 64 Bits
Graphics card: GeForce GTX 1080 with Max-Q Design/PCIe/SSE2 NVIDIA Corporation 4.5.0 NVIDIA 441.87

**Blender Version**
Broken: version: 2.83 (sub 2), branch: master, commit date: 2020-01-29 19:38, hash: `rBc3001812dc02`

Changed files:
addons/io_scene_gltf2/blender/exp/gltf2_blender_gather_nodes.py

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 22a5e492..2eaf56f5 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
@@ -29,6 +29,7 @@ from ..com.gltf2_blender_extras import generate_extras
 from io_scene_gltf2.io.com import gltf2_io
 from io_scene_gltf2.io.com import gltf2_io_extensions
 from io_scene_gltf2.io.exp.gltf2_io_user_extensions import export_user_extensions
+from io_scene_gltf2.io.com.gltf2_io_debug import print_console
 
 
 def gather_node(blender_object, blender_scene, export_settings):
@@ -188,7 +189,10 @@ def __gather_children(blender_object, blender_scene, export_settings):
             if trans is None:
                 trans = [0, 0, 0]
             # bones go down their local y axis
-            bone_tail = [0, blender_bone.length / blender_bone.matrix.to_scale()[1], 0]
+            if blender_bone.matrix.to_scale()[1] >= 1e-6:
+                bone_tail = [0, blender_bone.length / blender_bone.matrix.to_scale()[1], 0]
+            else:
+                bone_tail = [0,0,0] # If scale is 0, tail == head
             child_node.translation = [trans[idx] + bone_tail[idx] for idx in range(3)]
 
             parent_joint.children.append(child_node)
@@ -341,7 +345,19 @@ def __gather_trans_rot_scale(blender_object, export_settings):
     else:
         # matrix_local = matrix_parent_inverse*location*rotation*scale
         # Decomposing matrix_local gives less accuracy, but is needed if matrix_parent_inverse is not the identity.
-        trans, rot, sca = gltf2_blender_extract.decompose_transition(blender_object.matrix_local, export_settings)
+
+
+        if blender_object.matrix_local[3][3] != 0.0:
+            trans, rot, sca = gltf2_blender_extract.decompose_transition(blender_object.matrix_local, export_settings)
+        else:
+            # Some really weird cases, scale is null (if parent is null when evaluation is done)
+            print_console('WARNING', 'Some nodes are 0 scaled during evaluation. Result can be wrong')
+            trans = blender_object.location
+            if blender_object.rotation_mode in ['QUATERNION', 'AXIS_ANGLE']:
+                rot = blender_object.rotation_quaternion
+            else:
+                rot = blender_object.rotation_euler.to_quaternion()
+            sca = blender_object.scale
 
     trans = gltf2_blender_extract.convert_swizzle_location(trans, None, None, export_settings)
     rot = gltf2_blender_extract.convert_swizzle_rotation(rot, export_settings)