From 9a7d0db875af1ece1f7ed6e10664fddb94f5fb9e Mon Sep 17 00:00:00 2001 From: Julien Duroure Date: Wed, 4 Sep 2019 23:39:56 +0200 Subject: glTF importer: set track name from gltf animation name --- io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py | 3 ++- io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py | 3 ++- io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) (limited to 'io_scene_gltf2/blender') 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 d049afba..ef88bc37 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_bone.py @@ -53,7 +53,8 @@ class BlenderBoneAnim(): start_frame = bpy.context.scene.frame_start - simulate_stash(obj, bpy.data.actions[action_name], start_frame) + animation_name = gltf.data.animations[anim_idx].name + simulate_stash(obj, animation_name, bpy.data.actions[action_name], start_frame) gltf.actions_stashed[(obj.name, action_name)] = True 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 498cbc89..cf570a20 100755 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_node.py @@ -53,7 +53,8 @@ class BlenderNodeAnim(): start_frame = bpy.context.scene.frame_start - simulate_stash(obj, bpy.data.actions[action_name], start_frame) + animation_name = gltf.data.animations[anim_idx].name + simulate_stash(obj, animation_name, bpy.data.actions[action_name], start_frame) gltf.actions_stashed[(obj.name, action_name)] = True 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 c2ac3bed..888d88a4 100644 --- a/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py +++ b/io_scene_gltf2/blender/imp/gltf2_blender_animation_utils.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -def simulate_stash(obj, action, start_frame): +def simulate_stash(obj, gltf_animation_name, action, start_frame): # Simulate stash : # * add a track # * add an action on track @@ -20,7 +20,7 @@ def simulate_stash(obj, action, start_frame): # * remove active action from object tracks = obj.animation_data.nla_tracks new_track = tracks.new(prev=None) - new_track.name = action.name + new_track.name = gltf_animation_name if gltf_animation_name is not None else action.name strip = new_track.strips.new(action.name, start_frame, action) new_track.lock = True new_track.mute = True -- cgit v1.2.3