.match
Control how families are matched amongst plug-ins and instances.
Introduction
The way instances are associated with plug-ins are via their families.
Instances and plug-ins may support one or more families, and instances matching one or more of these families are said to be associated with it.
An instance may be associated via a plug-in in 1 of 3 ways.
Intersection
Subset
Exact
By default, an instance of any family within the supported families of a plug-in is a match. This is called Intersection and stems from basic set theory.
assert set(["a", "b"]).intersection(["b", "c"])This is useful in the most general case, of one plug-in supporting many different - possibly unrelated - families. Such as one plug-in supporting both models and rigs, say for an established naming convention across both families.
Subset on the other hand means the families of an Instance must be a subset of the supported families of any plug-in.
Again the concept is borrowed from set theory.
assert set(["a", "b"]).issubset(["a", "b", "c"])This can be useful when instances are specialised, such as being a lowpoly family of a model, or animation family of a rig.
Finally, there is Exact which captures edge-cases or otherwise highly context sensitive instances, such as an animation rig in shot05.
The algorithm is as follows.
Usage
Decide whether your plug-in targets many unrelated families, or specialises in a few, then associate an algorithm with this plug-in.
Example
In this example, SpecificPlugin is associated to instances whose family(ies) are a subset of the supported families model and low. If the instance does not have at least both of these, it is not a match.
This is different from GenericPlugin, where only one of the families of an instance need to match any of the supported families of a plug-in. This is called intersection.
The last possible value is Exact which means an instance only matches when families of both instance and plug-ins match exactly.
Last updated