Skip to content

0.2.8

Compare
Choose a tag to compare
@mottosso mottosso released this 07 Apr 10:57
· 782 commits to master since this release

This is mainly a maintenance update in an effort to improve stability and lay the ground for further development, and implemented #71 and #37 along the way.




Version 0.2.8

Here is the full changelist.

  • Feature: Repair
  • Feature: Compatible plug-ins updates interactively as you toggle instances.
  • Feature: Records and exceptions are embedded into the context object
  • Bugfix: Failing Selectors won't prohibit Extraction.
  • Enhancement: You can't close while publishing.
  • Enhancement: You can't crash the GUI. I dare you.
  • API: Added util.register_vendor_libraries
  • API: Added util.deregister_vendor_libraries
  • API: Changed util.invoke -> util.async



Repair

untitled

Upon a plug-in failing, a repair option is provided is the plug-in provides an implementation for repair.

class MyPlugin(...):
    def repair_context(self, context):
        ...
    def repair_instance(self, instance):
        ...

Caveat

Repairing a plug-in will attempt to repair instances that have any failures, even failures that did not originate from the given plug-in.

For example - PluginA causes an error in InstanceA, whereas PluginB causes and error in InstanceB. Repairing either will cause both instances to be repaired.

Finer control is planned for the upcoming Property Panel 2.0




Records and Exceptions

Everything printed to the terminal is now also accessible via the context object in the form of Results dictionaries.

A Result dictionary is just that, a Python dictionary of a particular layout and this layout can be found here.

And accessed like this.

# List of Result dictionaries.
results = context.data("results")
assert isinstance(results, list)

A little background on how these are injected; in a nutshell, for every process that takes place between a Plug-in and an Instance, a Result is generated. The Result then consists of a success message, along with any logging and exceptions raised during processing. Refer to the schema above for a full view on all data you have access to.

In practice, you may choose to make use of this data in a plug-in that runs last; such as Conform plug-in.

class ConformRecords(pyblish.api.Conformer):
    ...
    def process_context(self, context):
        with open("results.json", "w") as f:
            json.dump(context.data("results"), f)

If you are instead interested in exceptions, you can implement a post-validator.

class PostValidator(pyblish.api.Validator):
    order = pyblish.api.Validator.order + 0.5

The implementation remains the same, but will this time be written regardless of errors. One may be useful for archiving and metadata, whereas the other may serve as debugging resources.