Branching I
Now that you know how to arrange plug-ins, let's have a look at how to manage the control flow of publishing.
1
import pyblish.api
2
3
class MyPlugin(pyblish.api.ContextPlugin):
4
hosts = ["maya"]
5
6
def process(self, context):
7
from maya import cmds
8
cmds.headsUpMessage("Hello from Pyblish")
9
10
pyblish.api.register_plugin(MyPlugin)
11
12
import pyblish.util
13
pyblish.util.publish()
14
# Hello from Pyblish
Copied!
hosts is a requirement attribute and limits plug-ins to a particular scenario.
In this case, the plug-in will only run when publishing from within Autodesk Maya. These are some examples of available values for the hosts attribute.
  • python
  • maya
  • houdini
  • nuke
  • modo
  • unknown
You can register your own host, if for example you would like to extend Pyblish for use in additional software, by using register_host().
1
import pyblish.api
2
pyblish.api.register_host("myhost")
Copied!
Last modified 1yr ago
Copy link