[Bf-extensions-cvs] [c164c5d8] master: Pose Library: Usability pass/redesign

Dalai Felinto noreply at git.blender.org
Fri Dec 23 11:27:33 CET 2022


Commit: c164c5d8665588c9bd9db1929cddef592c93d773
Author: Dalai Felinto
Date:   Fri Dec 16 17:07:17 2022 +0100
Branches: master
https://developer.blender.org/rBAc164c5d8665588c9bd9db1929cddef592c93d773

Pose Library: Usability pass/redesign

This implements a redesign on how pose library is exposed to the
artists, unifying the experience within other assets.

We now try to constraint the different usages to specific editors,
and optimize the experience in each editor to those minimum requirements.

In simple terms this means to encourage the creation of assets in the
Action Editor or the Asset Browser, using assets in the Viewport.
Having the main functionality available at the click of a button,
and the advanced options available via (context) menus.

For the complete design see: T103265

------------------------------------------------

This implements:
* Viewport:
 - Remove Create Pose Asset.
 - Remove Copy Pose As Asset.
 - Remove Flip Pose checkbox.

* Asset Browser:
 - Add "Paste as New Asset" and "Create Pose Asset" to a new Asset menu.
 - Remove Pose Library panels.

* Context Menu:
 - Add Apply Pose Flipped.
 - Add separators.

* General:
 - Rename Paste/Copy As to Paste/Copy as

Follow ups:
 * Asset Browser: New catalog menu (D16820)
 * Asset Shelf (T102879)
 * Show shortcuts in the Pose Assets context menu (T103267)
 * "Update" operators (Paste as Update and Update Pose Asset)
 * Action Editor: Catalog pop-up for new created poses
 * Action Editor: Bring the Pose Library panel to the Animation tab

The update operators are welcome, but outside of the scope of the
usability change. If/when they are implemented, they will fit within the
Edit menu.

The Action Editor changes should be tackled shortly.

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

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

M	pose_library/gui.py
M	pose_library/operators.py

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

diff --git a/pose_library/gui.py b/pose_library/gui.py
index 1b2dd4fe..b0025546 100644
--- a/pose_library/gui.py
+++ b/pose_library/gui.py
@@ -8,6 +8,7 @@ import bpy
 from bpy.types import (
     AssetHandle,
     Context,
+    Menu,
     Panel,
     UIList,
     WindowManager,
@@ -39,17 +40,9 @@ class VIEW3D_PT_pose_library(PoseLibraryPanel, Panel):
     def draw(self, context: Context) -> None:
         layout = self.layout
 
-        row = layout.row(align=True)
-        row.operator("poselib.create_pose_asset").activate_new_action = False
-        if bpy.types.POSELIB_OT_restore_previous_action.poll(context):
-            row.operator("poselib.restore_previous_action", text="", icon='LOOP_BACK')
-        row.operator("poselib.copy_as_asset", icon="COPYDOWN", text="")
-
-        wm = context.window_manager
-        layout.prop(wm, "poselib_flipped")
-
         if hasattr(layout, "template_asset_view"):
             workspace = context.workspace
+            wm = context.window_manager
             activate_op_props, drag_op_props = layout.template_asset_view(
                 "pose_assets",
                 workspace,
@@ -94,7 +87,8 @@ def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
 
     layout.separator()
 
-    layout.operator("poselib.apply_pose_asset", text="Apply Pose")
+    layout.operator("poselib.apply_pose_asset", text="Apply Pose").flipped = False
+    layout.operator("poselib.apply_pose_asset", text="Apply Pose Flipped").flipped = True
 
     old_op_ctx = layout.operator_context
     layout.operator_context = 'INVOKE_DEFAULT'
@@ -102,6 +96,7 @@ def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
     props.flipped = wm.poselib_flipped
     layout.operator_context = old_op_ctx
 
+    layout.separator()
     props = layout.operator("poselib.pose_asset_select_bones", text="Select Pose Bones")
     props.flipped = wm.poselib_flipped
     props.select = True
@@ -109,70 +104,18 @@ def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
     props.flipped = wm.poselib_flipped
     props.select = False
 
+    if not is_pose_asset_view():
+        layout.separator()
+        layout.operator("asset.assign_action")
+
     layout.separator()
     if is_pose_asset_view():
         layout.operator("asset.open_containing_blend_file")
 
 
-class ASSETBROWSER_PT_pose_library_usage(PoseLibraryPanel, asset_utils.AssetBrowserPanel, Panel):
-    bl_region_type = "TOOLS"
-    bl_label = "Pose Library"
-    asset_categories = {'ANIMATIONS'}
-
-    @classmethod
-    def poll(cls, context: Context) -> bool:
-        return (
-            cls.pose_library_panel_poll(context)
-            and cls.asset_browser_panel_poll(context)
-        )
-
-    def draw(self, context: Context) -> None:
-        layout = self.layout
-        wm = context.window_manager
-
-        col = layout.column(align=True)
-        col.prop(wm, "poselib_flipped")
-        props = col.operator("poselib.apply_pose_asset", text="Apply")
-        props.flipped = wm.poselib_flipped
-        props = col.operator("poselib.blend_pose_asset", text="Interactive Blend")
-        props.flipped = wm.poselib_flipped
-
-        row = col.row(align=True)
-        props = row.operator("poselib.pose_asset_select_bones", text="Select", icon="BONE_DATA")
-        props.flipped = wm.poselib_flipped
-        props.select = True
-        props = row.operator("poselib.pose_asset_select_bones", text="Deselect")
-        props.flipped = wm.poselib_flipped
         props.select = False
 
 
-class ASSETBROWSER_PT_pose_library_editing(PoseLibraryPanel, asset_utils.AssetBrowserPanel, Panel):
-    bl_region_type = "TOOL_PROPS"
-    bl_label = "Pose Library"
-    asset_categories = {'ANIMATIONS'}
-
-    @classmethod
-    def poll(cls, context: Context) -> bool:
-        return (
-            cls.pose_library_panel_poll(context)
-            and cls.asset_browser_panel_poll(context)
-        )
-
-    def draw(self, context: Context) -> None:
-        layout = self.layout
-
-        col = layout.column(align=True)
-        col.enabled = bpy.types.ASSET_OT_assign_action.poll(context)
-        col.label(text="Activate & Edit")
-        col.operator("asset.assign_action")
-
-        # Creation
-        col = layout.column(align=True)
-        col.enabled = bpy.types.POSELIB_OT_paste_asset.poll(context)
-        col.label(text="Create Pose Asset")
-        col.operator("poselib.paste_asset", icon="PASTEDOWN")
-
-
 class DOPESHEET_PT_asset_panel(PoseLibraryPanel, Panel):
     bl_space_type = "DOPESHEET_EDITOR"
     bl_region_type = "UI"
@@ -191,6 +134,27 @@ class DOPESHEET_PT_asset_panel(PoseLibraryPanel, Panel):
         layout.operator("poselib.convert_old_poselib")
 
 
+def pose_library_list_item_asset_menu(self: UIList, context: Context) -> None:
+    layout = self.layout
+    layout.menu("ASSETBROWSER_MT_asset")
+
+
+class ASSETBROWSER_MT_asset(Menu):
+    bl_label = "Asset"
+
+    @classmethod
+    def poll(cls, context):
+        from bpy_extras.asset_utils import SpaceAssetInfo
+        return SpaceAssetInfo.is_asset_browser_poll(context)
+
+    def draw(self, context: Context) -> None:
+        layout = self.layout
+
+        layout.operator("poselib.paste_asset", icon='PASTEDOWN')
+        layout.separator()
+        layout.operator("poselib.create_pose_asset").activate_new_action = False
+
+
 ### Messagebus subscription to monitor asset library changes.
 _msgbus_owner = object()
 
@@ -228,10 +192,9 @@ def _on_blendfile_load_post(none, other_none) -> None:
 
 
 classes = (
-    ASSETBROWSER_PT_pose_library_editing,
-    ASSETBROWSER_PT_pose_library_usage,
     DOPESHEET_PT_asset_panel,
     VIEW3D_PT_pose_library,
+    ASSETBROWSER_MT_asset,
 )
 
 _register, _unregister = bpy.utils.register_classes_factory(classes)
@@ -251,6 +214,7 @@ def register() -> None:
 
     bpy.types.UI_MT_list_item_context_menu.prepend(pose_library_list_item_context_menu)
     bpy.types.ASSETBROWSER_MT_context_menu.prepend(pose_library_list_item_context_menu)
+    bpy.types.ASSETBROWSER_MT_editor_menus.append(pose_library_list_item_asset_menu)
 
     register_message_bus()
     bpy.app.handlers.load_pre.append(_on_blendfile_load_pre)
diff --git a/pose_library/operators.py b/pose_library/operators.py
index 7303c5a6..7723b5fd 100644
--- a/pose_library/operators.py
+++ b/pose_library/operators.py
@@ -203,7 +203,7 @@ class ASSET_OT_assign_action(Operator):
 
 class POSELIB_OT_copy_as_asset(PoseAssetCreator, Operator):
     bl_idname = "poselib.copy_as_asset"
-    bl_label = "Copy Pose As Asset"
+    bl_label = "Copy Pose as Asset"
     bl_description = "Create a new pose asset on the clipboard, to be pasted into an Asset Browser"
     bl_options = {"REGISTER"}
 
@@ -255,7 +255,7 @@ class POSELIB_OT_copy_as_asset(PoseAssetCreator, Operator):
 
 class POSELIB_OT_paste_asset(Operator):
     bl_idname = "poselib.paste_asset"
-    bl_label = "Paste As New Asset"
+    bl_label = "Paste as New Asset"
     bl_description = "Paste the Asset that was previously copied using Copy As Asset"
     bl_options = {"REGISTER", "UNDO"}



More information about the Bf-extensions-cvs mailing list