getavalon / core

The safe post-production pipeline - https://getavalon.github.io/2.0
MIT License
218 stars 49 forks source link

Use specific Creator Plugin when multiple Creators exist for single family #507

Open BigRoy opened 4 years ago

BigRoy commented 4 years ago

Issue

When writing two Creator plug-ins that are targeted to the same resulting family there is unexpected behavior when using it with the Creator tool.

Both entries will individually show in the Creator, however whenever you trigger either of them both will be created. This is because the API triggers all Plugins based solely on the family matching, and it doesn't trigger a specific plugin

I recall the API was designed like this for a reason but can't remember why. Now, with the Creator tool built as it is the the resulting behavior is super confusing. Is there anyone relying on this behavior of it to trigger multiple Creator plugins for a specific family?

class CreateA(api.Creator):
    label = "A"
    family = "foobar"

    def process(self):
        print("A")

class CreateB(api.Creator):
    label = "B"
    family = "foobar"

    def process(self):
        print("B")

Now in the Creator tool create A or B, you will always see both plug-ins are triggered:

A
B

Proposal

I'd propose to have the first argument for api.Create to be the Creator plugin to trigger as opposed to the family name.

For backwards compatibility I'd then make it so whenever it does not get an instance of Creator but a string that it will keep the old behavior. This way any custom code built against the API will remain to work as is.

Then we'll just update the Creator tool to not trigger by family name but explicitly pass it the Plugin.

OR if the behavior is intended and we want to stick to it for specific reasons then likely we'd want to make the Creator UI less ambiguous that these double entries in the list are doing the exactly same thing - running both. Not sure what to do in that case, but it should at least be clearer what is going on then.

tokejepsen commented 4 years ago

Cant see why you'd need to have two plugins triggered. Voting for passing the Creator plugin with backwards compatibility.

mkolar commented 4 years ago

I agree with Toke. And just as he, I can't for the life of me think of a situation where you want two creators. Do you have a use case?

ddesmond commented 4 years ago

Had same behaviour when trying to do Imagesequence in Houdini, since i wanted RenderImageseqnce_MANTRA and RenderImageseqnce_ARNOLD. When created Houdini would spawn me both nodes. Case: Users want to be able to render localy some elements and not depend on deadline/farm.

davidlatwe commented 4 years ago

Just adding notes.

BigRoy commented 4 years ago

The api.create was originally from #291.

Actually the problem was there before too, the code had just moved.

Anyway... I'm still all for getting this corrected in the best way possible.