Closed mottosso closed 9 years ago
+1 for this. Gets me slightly confused every time I start a new selector.
I'm all for it.
You're welcome to use the alias under pyblish.api.Collector
, but for now, I'd consider this accepted and will start phasing off the Selector
alias.
Just as a note, I'll be keeping both available and won't remove anything until there has been a few versions in which using Selector
will trigger DeprecationWarnings
that we can all see and be aware of, so don't worry if you are still using it.
Here's how the alias works.
import pyblish.api
class MyCollector(pyblish.api.Collector):
...
Which technically is just this.
api.py
import pyblish.plugin
Collector = pyblish.plugin.Selector
And so will still work if you do any isinstance()
or other comparisons.
Does this work with the naming of the plugins as well? so select_data.py
is collect_data.py
?
No, that's a good point, it won't work with that..
At the risk of putting you on thin ice, this is where that is configured. https://github.com/pyblish/pyblish/blob/master/pyblish/config.yaml#L46
ok, I might have a look at that when I get the time:)
Had a thought about this, and this is completely experimental, but seems to work fine.
>>> import pyblish.api
>>> pyblish.api.config["selectors_regex"] = r'^collect_.*\\.py$'
>>> pyblish.api.discover()
[<class 'collect_something.CollectSomething'>]
Which means, that in your userSetup.py
, you can add the first two lines and that would be it.
Note that you would have to do this for each host; e.g. both Maya and Nuke, if you wanted them both to refer to collectors this way.
Also note that this change would be completely forwards compatible; as in, when we actually do add "collectors_regex" to the configuration, this will simply do nothing and the behaviour will stay in place.
+1 for me (even though it seem to have been accepted already). It makes much more sense this way.
Implemented in 1.1
Does this concern only the Class, or the plugin file names as well (as Toke was asking)? Just want to make how it is at the end
It's purely cosmetic. You can choose to use Collector
wherever you are currently using Selector
and you will get the same behaviour, including in the naming of files.
Perfect. thanks
Should
Selector
instead be calledCollector
?Reasoning
The reason being that what a
Selector
does is collecting information about an asset.Origin
The name originally came from database-land in which "select" refers to picking out a particular piece of data from a set of data. Not unlike
Selection
in Pyblish.