[Bf-extensions-cvs] [9189c459] master: glTF importer: avoid crash on invalid glTF file with multiple same target path animation

Julien Duroure noreply at git.blender.org
Wed Nov 13 22:38:37 CET 2019


Commit: 9189c4595844752b8a534d132eed153a8ea991e4
Author: Julien Duroure
Date:   Wed Nov 13 22:37:56 2019 +0100
Branches: master
https://developer.blender.org/rBA9189c4595844752b8a534d132eed153a8ea991e4

glTF importer: avoid crash on invalid glTF file with multiple same target path animation

===================================================================

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py

===================================================================

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index eb7e130c..f72b94b8 100755
--- a/io_scene_gltf2/__init__.py
+++ b/io_scene_gltf2/__init__.py
@@ -15,7 +15,7 @@
 bl_info = {
     'name': 'glTF 2.0 format',
     'author': 'Julien Duroure, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
-    "version": (1, 1, 7),
+    "version": (1, 1, 8),
     'blender': (2, 81, 6),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
index cc9c3aa1..4feed76a 100644
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py
@@ -46,7 +46,11 @@ def restore_animation_on_object(obj, anim_name):
     obj.animation_data.action = None
 
 def make_fcurve(action, co, data_path, index=0, group_name=None, interpolation=None):
-    fcurve = action.fcurves.new(data_path=data_path, index=index)
+    try:
+        fcurve = action.fcurves.new(data_path=data_path, index=index)
+    except:
+        # Some non valid files can have multiple target path
+        return None
 
     if group_name:
         if group_name not in action.groups:



More information about the Bf-extensions-cvs mailing list