ayon-core
ayon-core copied to clipboard
Enhancement: Publisher allow actions even when no failure occurred
Is there an existing issue for this?
- [X] I have searched the existing issues.
Please describe the feature you have in mind and explain what the current shortcomings are?
The Pyblish API actions allow defining actions for Plugins on different states, e.g. on = "failed"
but also on = "all"
, like:
-
all
: Always -
processed
: After plug-in has been processed -
failed
: After plug-in has been processed, and failed -
succeeded
: After plug-in has been processed, and succeeded
I'd actually like these to also be available in the New Publisher UI.
We're looking to e.g. add an action for succeeded published to be able to run actions even on successful publishes (preferably per instance; even though that is not Pyblish native behavior).
For example, in the Publish Success report page we'd love to be able to:
- Show publish in Loader
- Show in Explorer
This originated from artists requesting:
Would be nice if after a publish I can directly jump to the published files to check them.
By exposing Pyblish's actions API and functionality 1 to 1 this would become easily possible.
How would you imagine the implementation of the feature?
Similar to publish validation report pages the Publish Report (before full publish, but on successful validation) and the Publish Success Report pages would also show the actions per instance.
For easy access it'd also be preferred to be able to right click the instance left hand side to pick the actions there instead of requiring to select the individual plug-ins.
Psuedocode could be:
import pyblish.api
class ShowInExplorerAction(pyblish.api.Action):
label = "Repair"
on = "succeeded" # This action is only available on success
icon = "explore"
def process(self, context, plugin):
"""Processes instance or context, depending on where it was put in
`context.actions` or `instance.actions`
"""
for instance in context:
if instance.data.get("published_representations"):
browse_to_published_files(instance)
class MyPlugin(pyblish.api.InstancePlugin):
label = "My plugin"
order = pyblish.api.IntegratorOrder + 0.4
actions = [ShowInExplorerAction]
hosts = ["*"]
def process(self, instance):
pass
Are there any labels you wish to add?
- [X] I have added the relevant labels to the enhancement request.
Describe alternatives you've considered:
An alternative approach is to allow Pyblish Plugins to inject e.g. custom actions into instance.data["actions"]
or even a instance.actions
attribute so that we can actually apply actions per instance instead of per plug-in. That way e.g. a plug-in could expose it to only those instances that have any published instances, e.g.:
import pyblish.api
class ShowInExplorerAction(pyblish.api.Action):
label = "Repair"
on = "succeeded" # This action is only available on success
icon = "explore"
def process(self, instance_or_context):
"""Processes instance or context, depending on where it was put in
`context.actions` or `instance.actions`
"""
instance = instance_or_context
browse_to_published_files(instance)
class AddPublishAction(pyblish.api.InstancePlugin):
label = "Add publish instance actions"
order = pyblish.api.IntegratorOrder + 0.4
hosts = ["*"]
def process(self, instance):
if instance.data.get("published_representations"):
instance.actions.append(ShowInExplorerAction)
Additional context:
No response
[cuID:OP-7357]