@tokejepsen tokejepsen released this Aug 21, 2017 · 106 commits to master since this release

Assets 2

Targets Workflow

This release enables assigning targets to plugins. Targets are registered globally so you can enable and disable plugins based on targets.
This workflow helps when needing to run plugins from the same host but with different sets of plugins. Possible use cases could be submitting to a render farm, or publishing to a different location.

Targets work the same way as families, so a wildcard of * enables the plugin for all targets. Since all plugins are registered with * as targets, this workflow is backwards compatible with existing plugins that has not overwritten the targets attribute.

Example

import pyblish.api
import pyblish.util

class StudioPlugin(pyblish.api.ContextPlugin):

    targets = ["studio"]

    def process(self, context):
        self.log.info("Publishing to studio library.")

class ProjectPlugin(pyblish.api.ContextPlugin):

    def process(self, context):
        self.log.info("Publishing to project library.")


pyblish.api.register_plugin(StudioPlugin)
pyblish.api.register_plugin(ProjectPlugin)

# Publishing with ProjectPlugin only.
pyblish.util.publish()

# Publishing with ProjectPlugin and StudioPlugin.
pyblish.api.register_target("studio")
pyblish.util.publish()