[Bf-extensions-cvs] [e2cfe666] master: glTF importer: Fix animation import when names was too long

Julien Duroure noreply at git.blender.org
Sun Jun 2 04:20:07 CEST 2019


Commit: e2cfe666ad05e9d08d1a24e27d558c9a5a96749d
Author: Julien Duroure
Date:   Sat Jun 1 22:26:29 2019 +0200
Branches: master
https://developer.blender.org/rBAe2cfe666ad05e9d08d1a24e27d558c9a5a96749d

glTF importer: Fix animation import when names was too long

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

M	io_scene_gltf2/__init__.py
M	io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
M	io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py

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

diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py
index 2e2b6ae2..fdf25c39 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": (0, 9, 18),
+    "version": (0, 9, 19),
     'blender': (2, 80, 0),
     'location': 'File > Import-Export',
     'description': 'Import-Export as glTF 2.0',
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
index 2cb196ab..d049afba 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py
@@ -250,6 +250,12 @@ class BlenderBoneAnim():
             name = animation.name + "_" + obj.name
         else:
             name = "Animation_" + str(anim_idx) + "_" + obj.name
+        if len(name) >= 63:
+            # Name is too long to be kept, we are going to keep only animation name for now
+            name = animation.name
+            if len(name) >= 63:
+                # Very long name!
+                name = "Animation_" + str(anim_idx)
         if name not in bpy.data.actions:
             action = bpy.data.actions.new(name)
         else:
diff --git a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
index 6540edec..a1a23cca 100755
--- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
+++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py
@@ -80,6 +80,12 @@ class BlenderNodeAnim():
             name = animation.name + "_" + obj.name
         else:
             name = "Animation_" + str(anim_idx) + "_" + obj.name
+        if len(name) >= 63:
+            # Name is too long to be kept, we are going to keep only animation name for now
+            name = animation.name
+            if len(name) >= 63:
+                # Very long name!
+                name = "Animation_" + str(anim_idx)
         action = bpy.data.actions.new(name)
         # Check if this action has some users.
         # If no user (only 1 indeed), that means that this action must be deleted



More information about the Bf-extensions-cvs mailing list