-
Notifications
You must be signed in to change notification settings - Fork 58
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
Can't order Collectors negatively #210
Comments
Hey @tokejepsen, I can't reproduce this, it works fine here. Could you try this? import pyblish.api
count = {"#": 0}
class MyCollector(pyblish.api.Collector):
order = pyblish.api.Collector.order - 0.49
def process(self):
count["#"] += 1
pyblish.api.register_plugin(MyCollector)
import pyblish.util
pyblish.util.publish()
assert count["#"] == 1 |
I get this error in the Hiero integration, when I try to inject some data into the context; import pyblish.api
import hiero
@pyblish.api.log
class SelectProject(pyblish.api.Selector):
"""Inject the active project into context"""
version = (0, 1, 0)
def process(self, context):
context.set_data('activeProject', value=hiero.activeProject) If I renamed the plugin to |
I tried |
It's not very obvious at the moment, but you can't store anything but plain-old-data (POD) as data in the context or instances; that is, nothing that isn't JSON serialisable. As a test, you can ensure that whatever you store doesn't throw an exception when you pass it to If you need to store custom classes, you will need to implement a serialisation method on them and generally a deserialisation equivalent also, but its simpler to stick with the basics types, a.k.a. plain-old-data. Was this what caused the problem? In that case, the negative order shouldn't have any effect, could you confirm? |
I tried with just passing a plain string, and still got the problem. Can replicate in Maya with this plugin; import pyblish.api
@pyblish.api.log
class SelectActiveProject(pyblish.api.Selector):
""""""
order = pyblish.api.Collector.order - 0.1
def process(self, context):
context.set_data('activeProject', value='something') Initially the plugin doesn't show in the pyblish ui terminal, but if you comment out the |
Ok, I can replicate this. Will investigate. |
Investigate this.
The text was updated successfully, but these errors were encountered: