Skip to content
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

Compound Plug-ins #162

Open
mottosso opened this issue Feb 28, 2015 · 0 comments
Open

Compound Plug-ins #162

mottosso opened this issue Feb 28, 2015 · 0 comments
Labels
Milestone

Comments

@mottosso
Copy link
Member

Prelude

One of the problems-to-be-solved regarding #143 was in regards to maintaining the current behaviour of plug-ins being triggered according to the Selection > Validation > Extraction > Conform pattern.

Compound plug-ins is a potential solution to this problem, while at the same time opening up the door for users to extend upon the behaviour on their own.

Goal

To facilitate grouping of common or related plug-ins during processing.

The typical scenario is when looking to trigger a plug-in upon the completion of a series of other plug-ins; such as "All validators" or "All selectors". Much like it's working currently, but programmable and compatible with an event-driven approach.

definition: Compound, a group\series of plug-ins.

Implementation

Compounds are first defined and then registered with Pyblish.

# Definition
compound = pyblish.api.Compound(name=MyCompound”)
compound.register_plugin(Myplugin)

# Registration
pyblish.api.register_compound(compound)

The name given to the compound is then accessible to the on slot of a plug-in.

class MyPlugin(...):
    on = "MyCompound::after"

Compounds would form the foundation of the re-implementation of the current system, but in an event-driven way; Validators being a component that encapsulates all plug-ins derived from the Validator superclass, whereas Selectorsbeing the component encapsulating all plug-ins derived from the Selector superclass and so on.

This could then be extended upon to facilitate the creation of arbitrary groups of plug-ins.

# Group plug-ins related to mesh-processing; of any type.
compund = pyblish.api.Compound(name="MeshPlugins")

for plugin in pyblish.api.discover():
    for family in plugin.families:
        if "mesh" in family.lower():
            compound.register_plugin(plugin)

pyblish.api.register_compound(compound)

Which may then be used as.

class PreMeshValidator(...):
    on = "MeshPlugins::before"

Compounds and Overlap

Membership isn’t mutually exclusive. That is, a plug-in may be part of multiple compounds.

This is similar to the objectSet of Maya, or Group of Softimage and facilitates the creation of an unlimited amount of compounds that may be mixed and matched in arbitrary ways.

@mottosso mottosso added this to the 2.0 milestone Feb 28, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant