Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Duroure <julien.duroure@gmail.com>2019-06-01 23:26:29 +0300
committerJulien Duroure <julien.duroure@gmail.com>2019-06-01 23:26:29 +0300
commite2cfe666ad05e9d08d1a24e27d558c9a5a96749d (patch)
treecca80b2c819da6c9d5cc6ce3108ecd62f71dbcf3 /io_scene_gltf2/blender
parentc7aa80f40ae438618498bc678409a4260f4356ab (diff)
glTF importer: Fix animation import when names was too long
Diffstat (limited to 'io_scene_gltf2/blender')
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py6
-rwxr-xr-xio_scene_gltf2/blender/imp/gltf2_blender_animation_node.py6
2 files changed, 12 insertions, 0 deletions
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