Releases: pyblish/pyblish-base
1.5.4
1.5.3
1.5.2
Publish with Targets
With this release you can now publish to specific targets with pyblish.util
.
from pyblish import api, util
class plugin(api.ContextPlugin):
targets = ["custom"]
def process(self, context):
self.log.info("Custom target publishing.")
api.register_plugin(plugin)
util.publish(targets=["custom"])
1.5.1
Targets Revision
The default target for plugins of *
was confusing when dealing with logic that exclusively targeted plugins.
Further the plugins_by_targets
has been revised to not assume a wildcard target to facilitate using the method outside of pyblish-base. This method is now exposed in the pyblish.api
as well.
1.5.0
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()
1.4.6
1.4.5
Command-line enhancements.
- Added
gui
option to command-line interface,python -m pyblish gui pyblish_lite
will launch Pyblish Lite in the current environment. - Passing
--data
via command-line also works with the newgui
option. PYBLISH_HOSTS
was introduced to enable registration of a host from environment variables.PYBLISH_GUI
was introduced, taking over forPYBLISHGUI
(which is still compatible, but deprecated)
Example
$ python -m pyblish_qml --data key value gui pyblish_qml
1.4.4
Maintenance release, this updates an internal (non-public) member of the logic.py
(plugins_by_families
) to include the newly added algorithms from 1.4.3
.
from pyblish import api, logic
class ClassD(api.ContextPlugin):
order = api.CollectorOrder
families = ["a", "b"]
match = api.Intersection
class ClassE(api.ContextPlugin):
order = api.CollectorOrder
families = ["a", "b"]
match = api.Subset
class ClassF(api.ContextPlugin):
order = api.CollectorOrder
families = ["a", "b"]
match = api.Exact
assert logic.plugins_by_families(
[ClassD, ClassE, ClassF], ["a"]) == [ClassD]
assert logic.plugins_by_families(
[ClassD, ClassE, ClassF], ["a", "b"]) == [ClassD, ClassE, ClassF]
assert logic.plugins_by_families(
[ClassD, ClassE, ClassF], ["a", "b", "c"]) == [ClassD, ClassE]
Thanks to @p4vv37 for the implementation!
1.4.3
Variable family-matching algorithms
This enables the use of multiple families of an instance to be associated with a plug-in, only when said families are a subset of the families supported by a plug-in.
That's a mouth full!
All algorithms
Algorithm | Description |
---|---|
Intersection | Include instances that match any supported family of plug-in (default) |
Subset | Include instances that match all supported families of a plug-in |
Exact | Include instances that include only supported families of a plug-in |
Example
Let's see an example.
from pyblish import api
class GenericPlugin(api.InstancePlugin):
# Support both models and rigs
families = ["model", "rig"]
def process(self, instance):
# Applies to both models and rigs
assert "parent_GRP" in instance
class SpecificPlugin(api.InstancePlugin):
# Support models, but only low-poly models
families = ["model", "low"]
match = api.Subset
def process(self, instance):
# Applies to only low-poly models
assert instance.data["polyCount"] < 500
In this example, SpecificPlugin
is associated to instances whose family(ies) are a subset of the supported families model
and low
. If the instance does not have at least both of these, it is not a match.
This is different from GenericPlugin
, where only one of the families of an instance need to match any of the supported families of a plug-in.
The match
parameter then is a matching algorithm, as provided by standard set functionality.
# 1. Include on any match
assert set(["a", "b"]).intersection(["b", "c"])
# 2. Include on all match
assert set(["a", "b"]).issubset(["a", "b", "c"])
# 3. Include on exact match (note order is independent)
assert set(["a", "b"]) == set(["b", "a"])
The default value for this parameter is api.Intersection
to preserve backwards compatibility. The last possible value is api.Exact
which means an instance only matches when families of both instance and plug-ins match exactly.
class EdgeCasePlugin(api.InstancePlugin):
families = ["model", "low", "level21"]
match = api.Exact
def process(self, instance):
assert "specialMember" in instance
See test_logic.py
for complete examples.
1.4.2
PYBLISHGUI
New signals being emitted.
Name | Description |
---|---|
pluginProcessed(result) |
Emitted each time a plug-in is processed |
PYBLISHGUI
New environment variable PYBLISHGUI
enables registration of graphical user interfaces, such as pyblish-lite and pyblish-qml, via the command-line.
$ set PYBLISHGUI=pyblish_qml,pyblish_lite
$ maya