Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Variable family-matching algorithms #305
This enables the use of multiple families of an instance to be associated with a plug-in, only when said families are a subset of the families supported by a plug-in.
That's a mouth full!
Let's see an example.
from pyblish import api class GenericPlugin(api.InstancePlugin): # Support both models and rigs families = ["model", "rig"] def process(self, instance): # Applies to both models and rigs assert "parent_GRP" in instance class SpecificPlugin(api.InstancePlugin): # Support models, but only low-poly models families = ["model", "low"] match = api.Subset def process(self, instance): # Applies to only low-poly models assert instance.data["polyCount"] < 500
In this example,
This is different from
# 1. Include on any match assert set(["a", "b"]).intersection(["b", "c"]) # 2. Include on all match assert set(["a", "b"]).issubset(["a", "b", "c"]) # 3. Include on exact match (note order is independent) assert set(["a", "b"]) == set(["b", "a"])
The default value for this parameter is
class EdgeCasePlugin(api.InstancePlugin): families = ["model", "low", "level21"] match = api.Exact def process(self, instance): assert "specialMember" in instance
Yeah, if you wanted to match by something else than the
Aha, ok. I think that'd be a good topic for a separate feature request. It'd be an entirely new feature, so we'll need to narrow down use-cases and consequences. Off the top of my head, I might worry about every collection of plug-ins defining their own algorithm, making external plug-ins that much less usable, understandable and interchangeable.
Does this feature request at least fulfil the initial requirement from the forums?