pyblish / pyblish-qml

Pyblish QML frontend for Maya 2013+, Houdini 11+, Nuke 8+ and more
GNU Lesser General Public License v3.0
114 stars 44 forks source link

Instance comment #370

Closed davidlatwe closed 3 years ago

davidlatwe commented 3 years ago

Hi all, it's been a long time :)

Feature

Commenting on each instance.

312c9b55-3767-4e7c-8809-f32b2de54bce

This feature is requested by my colleague, and I thought this maybe worth to share.

Example Code ```python import pyblish.api import pyblish_qml.api class CreateInstance(pyblish.api.ContextPlugin): order = 0 def process(self, context): instance_names = [ "foo", "bar", ] for name in instance_names: context.create_instance(name) class OpenComment(pyblish.api.ContextPlugin): order = 0.1 def process(self, context): context.data["comment"] = "" for instance in context: instance.data["comment"] = "" class ValidateContextComment(pyblish.api.ContextPlugin): order = 1 def process(self, context): if not context.data.get("comment"): self.log.warning("Context has no comment.") class ValidateInstanceComment(pyblish.api.InstancePlugin): order = 1 def process(self, instance): if not instance.data.get("comment"): self.log.warning("Instance %r has no comment." % instance.name) class ComposeComment(pyblish.api.ContextPlugin): order = 2 def process(self, context): con_comment = context.data.get("comment", "") self.log.debug(con_comment) for instance in context: int_comment = "%s\n----------\n%s" % ( con_comment, instance.data.get("comment", "") ) instance.data["comment"] = int_comment self.log.info(int_comment) pyblish.api.deregister_all_plugins() pyblish.api.deregister_all_paths() pyblish.api.register_plugin(CreateInstance) pyblish.api.register_plugin(OpenComment) pyblish.api.register_plugin(ValidateContextComment) pyblish.api.register_plugin(ValidateInstanceComment) pyblish.api.register_plugin(ComposeComment) pyblish_qml.api.show() ```

Fix

In commit 8240de4ee87bb470b1d718a80de143f849e28d87, fixed the issue that looks like below. The icon of log message is missing at level like Info or Warning.

image

BigRoy commented 3 years ago

This is looking really nice! :)

davidlatwe commented 3 years ago

Really glad you all like this feature !

mottosso commented 3 years ago

Happy to pull the trigger once you're happy @davidlatwe, great work.