Pose Library: Update to use the asset shelf (when enabled) #104546

Merged
Julian Eisel merged 33 commits from asset-shelf into main 2023-08-04 15:00:21 +02:00
Showing only changes of commit 1e9a0da49c - Show all commits

View File

@ -10,6 +10,7 @@ from bpy.types import (
Context,
Menu,
Panel,
UILayout,
UIList,
WindowManager,
WorkSpace,
@ -43,6 +44,26 @@ class VIEW3D_AST_pose_library(bpy.types.AssetShelf):
def asset_poll__(cls, asset: AssetHandle) -> bool:
return asset.file_data.id_type == 'ACTION'
@classmethod
def draw_context_menu(cls, _context: Context, _asset: AssetHandle, layout: UILayout):
# Make sure these operator properties match those used in `VIEW3D_PT_pose_library`.
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'
props = layout.operator("poselib.blend_pose_asset", text="Blend Pose")
layout.operator_context = old_op_ctx
layout.separator()
props = layout.operator("poselib.pose_asset_select_bones", text="Select Pose Bones")
props.select = True
props = layout.operator("poselib.pose_asset_select_bones", text="Deselect Pose Bones")
props.select = False
layout.separator()
layout.operator("asset.open_containing_blend_file")
class VIEW3D_PT_pose_library(PoseLibraryPanel, Panel):
bl_space_type = "VIEW_3D"