Originally posted by Marcus on Google Groups.
Hi folks,
I had some issues implementing a new selector and talked things over with Toke who gave me the idea of using an ID for instances to match Instance and Selector, much like we are with Family and Plugin.
The Problem
So the idea would be, in Maya, to tag a node in our scene with an attribute, much like we’ve been doing it so far.
{
"publishable": true,
"family": "demo.model"
}
The existence of these two attributes, along with the node having a type of “objSet”, would make Pyblish identify the node as being an instance.
However, because these two attributes are so generic, if we were to make a new selector and no longer wanted to use any other, we would have had to make up some other attributes so as to not have our instance get picked up by both selectors. E.g.
{
"myCustomIdentifier": true,
}
Ultimately ending up with lots of identifiers without any relation.
The Solution
The ID, on the other hand, would allow for an arbitrary amount of selectors, whilst still keeping them somewhat related by them all having an identical key, namely id, and variable value, such as pyblish.instance
An independent provider of Selectors could then occupy their own range of IDs, without risking to pick up the wrong instances from a scene.
{
"id": "pyblish.instance"
}
Whereas if I’m working on an extension for Pyblish with additional Selectors, I could use something like:
{
"id": "pyblish.napoleon.instance"
}
This way, the Napoleon selectors could remain discoverable but never accidentally pick up an instance that wasn’t intended for the Napoleon selectors.
And the same goes for anyone’s custom selectors. We could have any number of selectors, all active at the same time, and tag our instances however we please and have an appropriate selector come pick it up.
Customisable
The key id isn’t terribly unique either, and it’s possible that some studio may already be using this particular attribute on their objectSets or what not and thus can’t use Pyblish selectors.
So, the value of id may be configurable via the pyblish user-configuration.
identifier: "myId"
Conclusion
It’s a rather in-depth feature, so if you have any questions about what I’m talking about, here’s the place to talk about it. I’ll be demonstrating the feature in the Napoleon extension soon.