Skip to content

Instantly share code, notes, and snippets.

@davidlatwe
Last active September 1, 2018 20:43
Show Gist options
  • Save davidlatwe/70e5ed3513f3af4ab1de624b20b63f4a to your computer and use it in GitHub Desktop.
Save davidlatwe/70e5ed3513f3af4ab1de624b20b63f4a to your computer and use it in GitHub Desktop.
import time
def make_plugins():
import pyblish.api
class CollectLongRun(pyblish.api.ContextPlugin):
order = pyblish.api.CollectorOrder
def process(self, context):
time.sleep(5)
context.create_instance("David")
# time.sleep(5)
context.create_instance("Bob")
class ValidateLongRun(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
def process(self, instance):
for i in range(2):
time.sleep(1)
class ValidateWarning(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
def process(self, instance):
self.log.warning("Buggy")
class ValidateLongRun2(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
def process(self, instance):
for i in range(3):
time.sleep(1)
class ValidateLongRun3(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
def process(self, instance):
for i in range(2):
time.sleep(1)
class ValidateError(pyblish.api.InstancePlugin):
order = pyblish.api.ValidatorOrder
def process(self, instance):
if instance.name == "David":
self.log.error("Nooooo")
raise Exception("Bad instance")
class ExtractSomeThing(pyblish.api.InstancePlugin):
order = pyblish.api.ExtractorOrder
def process(self, instance):
print("GoGo")
class IntegrateSomeThing(pyblish.api.InstancePlugin):
order = pyblish.api.IntegratorOrder
def process(self, instance):
print("GoGo")
pyblish.api.register_plugin(CollectLongRun)
pyblish.api.register_plugin(ValidateWarning)
pyblish.api.register_plugin(ValidateLongRun)
pyblish.api.register_plugin(ValidateLongRun2)
pyblish.api.register_plugin(ValidateLongRun3)
pyblish.api.register_plugin(ValidateError)
pyblish.api.register_plugin(ExtractSomeThing)
pyblish.api.register_plugin(IntegrateSomeThing)
make_plugins()
import pyblish_qml
pyblish_qml.show(foster=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment