[Bf-extensions-cvs] [a2c3cfdd] master: Group FCurves by bone name when importing from FBX or BVH

Nils Hasler noreply at git.blender.org
Tue Mar 8 16:20:05 CET 2022


Commit: a2c3cfdd764b1d84f5fb31454813bd0dd9c05ebe
Author: Nils Hasler
Date:   Tue Mar 8 16:17:07 2022 +0100
Branches: master
https://developer.blender.org/rBAa2c3cfdd764b1d84f5fb31454813bd0dd9c05ebe

Group FCurves by bone name when importing from FBX or BVH

When importing an animation from FBX or BVH the fcurves are currently shown as a very long list in the dope sheet.

When you manually create a keyframe they are grouped by bone name, which is much more user friendly. This patch groups imported animations by bone name too.

The changes are trivial:

* In the FBX case it was falsely using the object name to group all curves rather than the bone name.
* The BVH importer simply wasn't using the grouping feature at all.

Reviewed By: mont29

Maniphest Tasks: T82472

Differential Revision: https://developer.blender.org/D11269

===================================================================

M	io_anim_bvh/__init__.py
M	io_anim_bvh/import_bvh.py
M	io_scene_fbx/__init__.py
M	io_scene_fbx/import_fbx.py

===================================================================

diff --git a/io_anim_bvh/__init__.py b/io_anim_bvh/__init__.py
index 43e582d5..8f712e3d 100644
--- a/io_anim_bvh/__init__.py
+++ b/io_anim_bvh/__init__.py
@@ -5,7 +5,7 @@
 bl_info = {
     "name": "BioVision Motion Capture (BVH) format",
     "author": "Campbell Barton",
-    "version": (1, 0, 0),
+    "version": (1, 0, 1),
     "blender": (2, 81, 6),
     "location": "File > Import-Export",
     "description": "Import-Export BVH from armature objects",
diff --git a/io_anim_bvh/import_bvh.py b/io_anim_bvh/import_bvh.py
index cd30ad11..2f335513 100644
--- a/io_anim_bvh/import_bvh.py
+++ b/io_anim_bvh/import_bvh.py
@@ -569,7 +569,7 @@ def bvh_node_dict2armature(
 
             # For each location x, y, z.
             for axis_i in range(3):
-                curve = action.fcurves.new(data_path=data_path, index=axis_i)
+                curve = action.fcurves.new(data_path=data_path, index=axis_i, action_group=bvh_node.name)
                 keyframe_points = curve.keyframe_points
                 keyframe_points.add(num_frame)
 
@@ -615,7 +615,7 @@ def bvh_node_dict2armature(
 
             # For each euler angle x, y, z (or quaternion w, x, y, z).
             for axis_i in range(len(rotate[0])):
-                curve = action.fcurves.new(data_path=data_path, index=axis_i)
+                curve = action.fcurves.new(data_path=data_path, index=axis_i, action_group=bvh_node.name)
                 keyframe_points = curve.keyframe_points
                 keyframe_points.add(num_frame)
 
diff --git a/io_scene_fbx/__init__.py b/io_scene_fbx/__init__.py
index cf7b75a8..39a7815c 100644
--- a/io_scene_fbx/__init__.py
+++ b/io_scene_fbx/__init__.py
@@ -5,7 +5,7 @@
 bl_info = {
     "name": "FBX format",
     "author": "Campbell Barton, Bastien Montagne, Jens Restemeier",
-    "version": (4, 33, 1),
+    "version": (4, 34, 1),
     "blender": (3, 2, 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 7efd3ab1..731ad388 100644
--- a/io_scene_fbx/import_fbx.py
+++ b/io_scene_fbx/import_fbx.py
@@ -591,7 +591,7 @@ def blen_read_animations_action_item(action, item, cnodes, fps, anim_offset, glo
             bl_obj = item.bl_obj
 
         # We want to create actions for objects, but for bones we 'reuse' armatures' actions!
-        grpname = item.bl_obj.name
+        grpname = bl_obj.name
 
         # Since we might get other channels animated in the end, due to all FBX transform magic,
         # we need to add curves for whole loc/rot/scale in any case.



More information about the Bf-extensions-cvs mailing list