Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Publisher allow actions even when no failure occurred #736

Open
2 tasks done
BigRoy opened this issue Oct 30, 2023 · 1 comment
Open
2 tasks done

Enhancement: Publisher allow actions even when no failure occurred #736

BigRoy opened this issue Oct 30, 2023 · 1 comment
Labels
community Issues and PRs coming from the community members type: enhancement Improvement of existing functionality or minor addition

Comments

@BigRoy
Copy link
Collaborator

BigRoy commented Oct 30, 2023

Is there an existing issue for this?

  • 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?

  • 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]

@BigRoy BigRoy added type: enhancement Improvement of existing functionality or minor addition community Issues and PRs coming from the community members labels Oct 30, 2023
@BigRoy BigRoy transferred this issue from ynput/OpenPype Jul 3, 2024
@BigRoy
Copy link
Collaborator Author

BigRoy commented Sep 2, 2024

Just adding another use case:

  • Show "review" in web viewer / local video player

So that e.g. a published review can directly be opened from the publisher UI on successful publish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community Issues and PRs coming from the community members type: enhancement Improvement of existing functionality or minor addition
Projects
None yet
Development

No branches or pull requests

1 participant