Created
February 6, 2020 08:48
-
-
Save davidlatwe/9c39e5ef05140d6ba98f0914ed46f5ed to your computer and use it in GitHub Desktop.
An example for demoing Pyblish-QML new feature "Post Collect"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pyblish.api | |
import pyblish_qml | |
class CreateToy(pyblish.api.ContextPlugin): | |
order = pyblish.api.CollectorOrder - 0.2 | |
def process(self, context): | |
instance = context.create_instance("Bear") | |
instance.data["family"] = "toy" | |
class CreateToyBox(pyblish.api.ContextPlugin): | |
order = pyblish.api.CollectorOrder + 0.4 | |
def process(self, context): | |
parent = context.create_instance("BearBox") | |
parent.data["family"] = "toyBox" | |
class CollectToyBoxData(pyblish.api.InstancePlugin): | |
order = pyblish.api.CollectorOrder + 0.5 | |
families = ["toyBox"] | |
class ValidateToy(pyblish.api.InstancePlugin): | |
order = pyblish.api.ValidatorOrder | |
families = ["toy"] | |
class ValidateToyBox(pyblish.api.InstancePlugin): | |
order = pyblish.api.ValidatorOrder | |
families = ["toyBox"] | |
class ExtractToy(pyblish.api.InstancePlugin): | |
order = pyblish.api.ExtractorOrder | |
families = ["toy"] | |
if __name__ == "__main__": | |
post_collect = pyblish.api.CollectorOrder + 0.4 | |
os.environ["PYBLISH_QML_POST_COLLECT"] = str(post_collect) | |
pyblish.api.deregister_all_plugins() | |
pyblish.api.deregister_all_paths() | |
pyblish.api.register_plugin(CreateToy) | |
pyblish.api.register_plugin(CreateToyBox) | |
pyblish.api.register_plugin(CollectToyBoxData) | |
pyblish.api.register_plugin(ValidateToy) | |
pyblish.api.register_plugin(ValidateToyBox) | |
pyblish.api.register_plugin(ExtractToy) | |
pyblish_qml.show() | |
while True: | |
# Keep server running | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment