glTF importer: Fix animation import when names was too long

This commit is contained in:
Julien Duroure 2019-06-01 22:26:29 +02:00
parent c7aa80f40a
commit e2cfe666ad
3 changed files with 13 additions and 1 deletions

View File

@ -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',

View File

@ -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:

View File

@ -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