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
This commit is contained in:
Dalai Felinto 2022-12-16 17:07:17 +01:00
parent 47d5a5ca18
commit c164c5d866
Notes: blender-bot 2023-11-07 15:58:00 +01:00
Referenced by commit 5aae6aa6: Pose library: remove the `poselib_flipped` property from the window manager
Referenced by issue blender/blender#103265, Pose Library: Usability pass/redesign
Referenced by commit 5aae6aa6, Pose library: remove the `poselib_flipped` property from the window manager
Referenced by issue #104529, Pose Library not functional in 3.5
2 changed files with 34 additions and 70 deletions

View File

@ -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)

View File

@ -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"}