Added Operator.poll_message_set(message, ...)
Operators can now set a message for why an operators poll function fails (ebe04bd3ca).
This means I can prevent pressing of buttons with a message, instead of having to allow pressing but then show an error in order to inform of the issues.
Implement poll function to prevent running things like export / the 3 modes without being in the right context.
@classmethod
def poll(cls, context):
if not SpaceAssetInfo.is_asset_browser_poll(context) or not context.asset_file_handle:
return False
if not context.asset_file_handle.local_id:
Operator.poll_message_set(
"Asset metadata from external asset libraries can't be "
"edited, only assets stored in the current file can"
)
return False
return True
https://wiki.blender.org/wiki/Reference/Release_Notes/3.0/Python_API
This means I can prevent pressing of buttons with a message, instead of having to allow pressing but then show an error in order to inform of the issues.
Implement poll function to prevent running things like export / the 3 modes without being in the right context.