Hey Miguel,

Happy to answer questions here, just want to point out that we have a
dedicated forum for questions surrounding Pyblish here:

   - https://forums.pyblish.com/

Just so we’re seeing the same thing, here’s what I’ve done to set things up.

Microsoft Windows [Version 10.0.17134.48]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\marcus
$ mkdir pyblish
$ cd pyblish
$ c:\Python27\python.exe -m pip install pyblish-base pyblish-maya --target .
Collecting pyblish-base
Collecting pyblish-maya
...
Successfully installed pyblish-base-1.6.1 pyblish-maya-2.1.4
$ set PYTHONPATH=%cd%
$ "c:\Program Files\Autodesk\Maya2018\bin\maya.exe"

Next I ran the entire script you linked to in Maya’s Script Editor, and
here’s what I got.

pyblish.util.publish()
pyblish: Registered C:\Users\marcus\pyblish\pyblish_maya\plugins
Pyblish loaded successfully.# pyblish.ExtractRig : Exporting Bruce to
C:\Users\marcus\maya\scenes\temp\20180604T181853Z\rig\Bruce\Bruce.ma #
# pyblish.IntegrateRig : Computing output directory.. # #
pyblish.IntegrateRig : Copying
C:\Users\marcus\maya\scenes\temp\20180604T181853Z\rig\Bruce to
C:\Users\marcus\maya\scenes\public\v003.. # # pyblish.IntegrateRig :
Copied successfully! #

Now, to your question, the host attribute is one you can use to filter a
series of plug-ins with. For example, if you have plug-ins on your
PYBLISHPLUGINPATH for both Maya and Nuke, then putting ["maya"] as a host
for your plug-in would cause this plug-in to only run if the host maya has
been registered.

class ExtractRig(pyblish.api.InstancePlugin):
  order = pyblish.api.ExtractorOrder
  families = ["rig"]
  hosts = ["maya"]

At the top of the script, there is a call to pyblish_maya.setup() which
leads to here:

   -
   https://github.com/pyblish/pyblish-maya/blob/master/pyblish_maya/lib.py#L26

And that in turn is what registers maya as a host, and is what causes that
ExtractRig plug-in to get through the filter.

If you replace that call with your registerHosts() function..

# Install Pyblish for Autodesk Maya#pyblish_maya.setup()
def register_host():
    """Register supported hosts"""
    print(pyblish.api.registered_hosts())
    pyblish.api.register_host("mayabatch")
    pyblish.api.register_host("mayapy")
    pyblish.api.register_host("maya")
    print(pyblish.api.registered_hosts())

register_host()

...

..you should be seeing the same output as above.

Could you try this and let me know what you get?

Best,
Marcus
​

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCmzZa91rj3U0s7Qcj%3DcZqjGz_384Kebq%3DL%2BTqyGe-ovg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to