Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is "Path" supposed to be in the "Perspective" view? #289

Open
darkvertex opened this issue May 8, 2018 · 7 comments
Open

What is "Path" supposed to be in the "Perspective" view? #289

darkvertex opened this issue May 8, 2018 · 7 comments

Comments

@darkvertex
Copy link
Contributor

I instinctively thought that "Path" in the Perspective view represented the path to the relevant plugin, but actually it just points to the plugin.py from the pyblish_base code, for all of my plugins:

screenshot from 2018-05-08 15-49-29

Is that right or is it a little bug?

@tokejepsen
Copy link
Member

The path is supposed to point to the originating python file.

How are you registering your plugins?

@darkvertex
Copy link
Contributor Author

darkvertex commented May 8, 2018

I have this method as part of a larger class where I can define class variables PYBLISH_MODULES (importable Python modules with Plugins within) and PYBLISH_PLUGIN_CLASSES (list of class objects in the same file):

    def registerPlugins(self):
        """Register given Pyblish plugins."""
        pyblish.api.deregister_all_plugins()
        pyblish.api.deregister_all_paths()

        def isPyblishPlugin(obj):
            return inspect.isclass(obj) and issubclass(obj, pyblish.api.Plugin)

        for klass in self.PYBLISH_PLUGIN_CLASSES:
            if issubclass(klass, pyblish.api.Plugin):
                pyblish.api.register_plugin(klass)

        for module in self.PYBLISH_PLUGIN_MODULES:
            for _, klass in inspect.getmembers(module, isPyblishPlugin):
                pyblish.api.register_plugin(klass)

The reason I don't register paths instead of dealing with individual plugins is I couldn't find an easy way to reload() them. It made developing plugins painful if I had to restart Maya every time, but since I use register_plugin() when I source an external one, all I have to do is reload() my modules and refresh the UI and it's fine.

Perhaps there is a bug in how plugins registered with register_plugin() "discover" where they come from?

@tokejepsen
Copy link
Member

Have you tried using PYBLISHPLUGINPATH environment variable?

Pyblish will reload all plugins from the paths registered in thath environment variable.

@darkvertex
Copy link
Contributor Author

Pyblish will reload all plugins from the paths registered in thath environment variable.

When does the reload happen exactly? Each time the UI opens?

@tokejepsen
Copy link
Member

When does the reload happen exactly?

It reinitialized the plugins when you hit "Reset". It does this before collection.

@darkvertex
Copy link
Contributor Author

Cool! It definitely wasn't doing it for me last I tried registering plugins via register_plugin_path(), but I will try to see if the env var behaves differently.

@mottosso
Copy link
Member

mottosso commented May 8, 2018

Two issues here.

  1. It looks like "Path" doesn't work when a plug-in has been registered, as opposed to discovered from a path. This is a bug.
  2. Plug-ins discovered from a path are always reloaded whenever they are used. In fact, every time you hit Publish in the GUI (this applies to all GUIs and standalone) the plug-in is re-read anew. See here and you can see how the text is written as-is, bypassing Python's native module caching.

What you've experienced with it not reloading sounds like it could be a bug, would you be able to provide a small reproducible? How did you notice they weren't reloading? The pain you describe of having to restart Maya is exactly the reason for having them automatically reload each time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants