Pose library: remove the `poselib_flipped` property from the window manager

Remove the custom property `WindowManager.poselib_flipped`, as the
checkbox for it was removed in rBAc164c5d86655 already.

This also removes the `poselib.apply_pose_asset_for_keymap` and
`poselib.blend_pose_asset_for_keymap` operators, as they are no longer
necessary.
This commit is contained in:
Sybren A. Stüvel 2023-01-03 14:49:15 +01:00
parent befe29be4d
commit 5aae6aa679
Notes: blender-bot 2023-02-13 13:43:49 +01:00
Referenced by issue blender/blender#103435, Pose Blend to support flipping poses
4 changed files with 1 additions and 71 deletions

View File

@ -35,10 +35,6 @@ addon_keymaps: List[Tuple[bpy.types.KeyMap, bpy.types.KeyMapItem]] = []
def register() -> None:
bpy.types.WindowManager.poselib_flipped = bpy.props.BoolProperty(
name="Flip Pose",
default=False,
)
bpy.types.WindowManager.poselib_previous_action = bpy.props.PointerProperty(type=bpy.types.Action)
operators.register()
@ -51,10 +47,6 @@ def unregister() -> None:
keymaps.unregister()
operators.unregister()
try:
del bpy.types.WindowManager.poselib_flipped
except AttributeError:
pass
try:
del bpy.types.WindowManager.poselib_previous_action
except AttributeError:

View File

@ -54,8 +54,6 @@ class VIEW3D_PT_pose_library(PoseLibraryPanel, Panel):
drag_operator="poselib.blend_pose_asset",
)
drag_op_props.release_confirm = True
drag_op_props.flipped = wm.poselib_flipped
activate_op_props.flipped = wm.poselib_flipped
def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
@ -81,7 +79,6 @@ def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
return
layout = self.layout
wm = context.window_manager
layout.separator()
@ -91,15 +88,12 @@ def pose_library_list_item_context_menu(self: UIList, context: Context) -> None:
old_op_ctx = layout.operator_context
layout.operator_context = 'INVOKE_DEFAULT'
props = layout.operator("poselib.blend_pose_asset", text="Blend Pose")
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
props = layout.operator("poselib.pose_asset_select_bones", text="Deselect Pose Bones")
props.flipped = wm.poselib_flipped
props.select = False
if not is_pose_asset_view():

View File

@ -16,7 +16,7 @@ def register() -> None:
km = wm.keyconfigs.addon.keymaps.new(name="File Browser Main", space_type="FILE_BROWSER")
# DblClick to apply pose.
kmi = km.keymap_items.new("poselib.apply_pose_asset_for_keymap", "LEFTMOUSE", "DOUBLE_CLICK")
kmi = km.keymap_items.new("poselib.apply_pose_asset", "LEFTMOUSE", "DOUBLE_CLICK")
addon_keymaps.append((km, kmi))

View File

@ -386,60 +386,6 @@ class POSELIB_OT_pose_asset_select_bones(PoseAssetUser, Operator):
return cls.bl_description.replace("Select", "Deselect")
# This operator takes the Window Manager's `poselib_flipped` property, and
# passes it to the `POSELIB_OT_blend_pose_asset` operator. This makes it
# possible to bind a key to the operator and still have it respect the global
# "Flip Pose" checkbox.
class POSELIB_OT_blend_pose_asset_for_keymap(Operator):
bl_idname = "poselib.blend_pose_asset_for_keymap"
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
_rna = bpy.ops.poselib.blend_pose_asset.get_rna_type()
bl_label = _rna.name
bl_description = _rna.description
del _rna
@classmethod
def poll(cls, context: Context) -> bool:
return bpy.ops.poselib.blend_pose_asset.poll(context.copy())
def execute(self, context: Context) -> Set[str]:
flipped = context.window_manager.poselib_flipped
return bpy.ops.poselib.blend_pose_asset(context.copy(), 'EXEC_DEFAULT', flipped=flipped)
def invoke(self, context: Context, event: Event) -> Set[str]:
flipped = context.window_manager.poselib_flipped
return bpy.ops.poselib.blend_pose_asset(context.copy(), 'INVOKE_DEFAULT', flipped=flipped)
# This operator takes the Window Manager's `poselib_flipped` property, and
# passes it to the `POSELIB_OT_apply_pose_asset` operator. This makes it
# possible to bind a key to the operator and still have it respect the global
# "Flip Pose" checkbox.
class POSELIB_OT_apply_pose_asset_for_keymap(Operator):
bl_idname = "poselib.apply_pose_asset_for_keymap"
bl_options = {"REGISTER", "UNDO", "INTERNAL"}
_rna = bpy.ops.poselib.apply_pose_asset.get_rna_type()
bl_label = _rna.name
bl_description = _rna.description
del _rna
@classmethod
def poll(cls, context: Context) -> bool:
if context.copy is None:
# This can happen when the asset browser is configured with a
# non-existing asset library path.
return False
if not asset_utils.SpaceAssetInfo.is_asset_browser(context.space_data):
return False
return bpy.ops.poselib.apply_pose_asset.poll(context.copy())
def execute(self, context: Context) -> Set[str]:
flipped = context.window_manager.poselib_flipped
return bpy.ops.poselib.apply_pose_asset(context.copy(), 'EXEC_DEFAULT', flipped=flipped)
class POSELIB_OT_convert_old_poselib(Operator):
bl_idname = "poselib.convert_old_poselib"
bl_label = "Convert Legacy Pose Library"
@ -507,8 +453,6 @@ class POSELIB_OT_convert_old_object_poselib(Operator):
classes = (
ASSET_OT_assign_action,
POSELIB_OT_apply_pose_asset_for_keymap,
POSELIB_OT_blend_pose_asset_for_keymap,
POSELIB_OT_convert_old_poselib,
POSELIB_OT_convert_old_object_poselib,
POSELIB_OT_copy_as_asset,