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:
authorlucas veber <lucky3>2022-02-23 14:07:38 +0300
committerBastien Montagne <bastien@blender.org>2022-02-23 14:10:29 +0300
commitb1356069278fbc2238272dc51e84b064b177b49f (patch)
treebf9153056e4d021947b61ef6b916b12b98e769aa
parentb2adbc6ba56d9e4380325866b8a3ae6d2d907a39 (diff)
Fbx Import: Fix redundancy in action names
This commit aims at fixing the (very) redundant action names when importing animation data from Fbx files. By default importing actions from an animated Fbx skeleton file leads to this: **skeleton_name|skeleton_name|action_name|skeleton_name|action_name** It works this way: **id_data.name|stack_name|layer_name** These containers are generally made of the exact same strings multiple time. This is a proposal to avoid such redundancy by stripping the "layer_name" in case it's identical to the "stack_name" I'm not sure yet if one of them could be always skipped, I haven't experienced cases when they are different. With this patch actions are named: **skeleton_name|skeleton_name|action_name** It could still be improved, since the "id_data.name" is generally the armature name, already contained in the "stack_name". But sometimes it's not (for Shape Keys for example: Key|skeleton_name|action_name) Maybe more checks could be added to avoid redundancy even more. Just to open the discussion about it... Reviewed By: mont29 Differential Revision: https://developer.blender.org/D14130
-rw-r--r--io_scene_fbx/__init__.py2
-rw-r--r--io_scene_fbx/import_fbx.py5
2 files changed, 5 insertions, 2 deletions
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index 3837be6a..53e1fe85 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -21,7 +21,7 @@
bl_info = {
"name": "FBX format",
"author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
- "version": (4, 29, 0),
+ "version": (4, 29, 1),
"blender": (2, 90, 0),
"location": "File > Import-Export",
"description": "FBX IO meshes, UV's, vertex colors, materials, textures, cameras, lamps and actions",
diff --git a/io_scene_fbx/import_fbx.py b/io_scene_fbx/import_fbx.py
index f62bf795..1978797e 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -764,7 +764,10 @@ def blen_read_animations(fbx_tmpl_astack, fbx_tmpl_alayer, stacks, scene, anim_o
key = (as_uuid, al_uuid, id_data)
action = actions.get(key)
if action is None:
- action_name = "|".join((id_data.name, stack_name, layer_name))
+ if stack_name == layer_name:
+ action_name = "|".join((id_data.name, stack_name))
+ else:
+ action_name = "|".join((id_data.name, stack_name, layer_name))
actions[key] = action = bpy.data.actions.new(action_name)
action.use_fake_user = True
# If none yet assigned, assign this action to id_data.