Skip to content
Snippets Groups Projects
Commit 9a7d0db8 authored by Julien Duroure's avatar Julien Duroure
Browse files

glTF importer: set track name from gltf animation name

parent 42f1e694
No related branches found
No related tags found
No related merge requests found
......@@ -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, 56),
"version": (0, 9, 57),
'blender': (2, 81, 6),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment