From e1b6cc2404cd3606a6e296910aa00610a9dcbae2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Tue, 23 Sep 2025 15:19:55 +0200 Subject: [PATCH] Anim: imported action slot named "Slot" when importing BVH/FBX files Always name the imported action slot "Slot" when importing BVH and FBX files, for ease of switching between imported Actions. Note: this is only adjusting the old Python-based FBX importer. Previously the slot would be named after the file itself (BVH) or had a combination of the animated object, the animation "stack", and the animation "layer" (FBX). This meant that every imported animation would get another slot name, making Action switching tedious. Pull Request: https://projects.blender.org/blender/blender/pulls/146601 --- scripts/addons_core/io_anim_bvh/import_bvh.py | 8 +++++++- scripts/addons_core/io_scene_fbx/import_fbx.py | 10 ++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/scripts/addons_core/io_anim_bvh/import_bvh.py b/scripts/addons_core/io_anim_bvh/import_bvh.py index 5f3872a28cf..f999eece177 100644 --- a/scripts/addons_core/io_anim_bvh/import_bvh.py +++ b/scripts/addons_core/io_anim_bvh/import_bvh.py @@ -518,7 +518,13 @@ def bvh_node_dict2armature( arm_ob_adt = arm_ob.animation_data_create() action = bpy.data.actions.new(name=bvh_name) - action_slot = action.slots.new(arm_ob.id_type, arm_ob.name) + # Always use the same name for the slot. The Armature is named after the + # BVH file, and so when importing multiple files to get multiple Actions + # for a single character, it is likely that all but one of the Armatures + # is going to be deleted again. It should be simple to switch between + # imported Actions while keeping Slot auto-assignment, which means that + # all Actions should use the same slot name. + action_slot = action.slots.new(arm_ob.id_type, "Slot") arm_ob_adt.action = action arm_ob_adt.action_slot = action_slot diff --git a/scripts/addons_core/io_scene_fbx/import_fbx.py b/scripts/addons_core/io_scene_fbx/import_fbx.py index 9f688620b37..e86a781527d 100644 --- a/scripts/addons_core/io_scene_fbx/import_fbx.py +++ b/scripts/addons_core/io_scene_fbx/import_fbx.py @@ -1098,8 +1098,14 @@ def blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, anim_o actions[key] = action = bpy.data.actions.new(action_name) action.use_fake_user = True - # Create an Action Slot. Curves created via action.fcurves will automatically be assigned to it. - action.slots.new(id_data.id_type, action_name) + # Always use the same name for the slot. It should be simple + # to switch between imported Actions while keeping Slot + # auto-assignment, which means that all Actions should use + # the same slot name. As long as there's no separate + # indicator for the "intended object name" for this FBX + # animation, this is the best Blender can do. Maybe the + # 'stack name' would be a better choice? + action.slots.new(id_data.id_type, "Slot") # If none yet assigned, assign this action to id_data. if not id_data.animation_data: