Pyblish By Example
1.8
1.8
  • Introduction
  • Hello World
  • Quickstart
  • Files
  • Coordination
  • Architecture
  • Branching I
  • Branching II
  • Branching III
  • Sharing
  • Validating I
  • Validating II
  • CVEI I
  • CVEI II
  • CVEI III
  • CVEI IV
  • Data
  • Report I
  • Report II
  • Report III
  • Report IV
  • Report V
  • Callback I
  • Callback II
  • Callback III
  • Logging
  • Filtering
  • Next Steps
Powered by GitBook
On this page

Was this helpful?

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.

import pyblish.api

class MyPlugin(pyblish.api.ContextPlugin):
  hosts = ["maya"]

  def process(self, context):
    from maya import cmds
    cmds.headsUpMessage("Hello from Pyblish")

pyblish.api.register_plugin(MyPlugin)

import pyblish.util
pyblish.util.publish()
# Hello from Pyblish

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().

import pyblish.api
pyblish.api.register_host("myhost")
PreviousArchitectureNextBranching II

Last updated 5 years ago

Was this helpful?