Pose Library: expand "(de)select bones" operator poll function

Expand the "Select Bones" and "Deselect Bones" operator poll function to
only allow the operator to run when the selected asset is actually a
pose asset.
This commit is contained in:
Sybren A. Stüvel 2021-04-22 15:55:22 +02:00
parent ba1c769120
commit 2fa5b1d172
1 changed files with 4 additions and 2 deletions

View File

@ -282,12 +282,14 @@ class POSELIB_OT_paste_asset(Operator):
class PoseAssetUser:
@classmethod
def poll(cls, context: Context) -> bool:
return bool(
if not (
context.object
and context.object.mode == "POSE" # This condition may not be desired.
and context.asset_library
and context.asset_file_handle
)
):
return False
return context.asset_file_handle.id_type == 'ACTION'
def execute(self, context: Context) -> Set[str]:
asset: FileSelectEntry = context.asset_file_handle