ynput / ayon-core

Apache License 2.0
25 stars 31 forks source link

Enhancement: Publisher allow runtime instances to have icon specified for publish reports #738

Open BigRoy opened 11 months ago

BigRoy commented 11 months ago

Is there an existing issue for this?

Please describe the feature you have in mind and explain what the current shortcomings are?

Instances that get created during the CollectorOrder of publishing instead of directly in the CreateContext are unable to specify an icon for the Publish validation reports.

The Creator plugins can set an icon that gets used as icon for the instances during those reports. A runtime instance does not have a Creator plugin - just a pyblish collector plugin so can't do the same.

runtime_instance_icon

How would you imagine the implementation of the feature?

Like with the older publisher it'd be great if instances can provide an icon in their data: instance.data["icon"].

I would even take this further and say that that could even be nice for instances that are created by Creator plugins too - so that potentially a special "icon collector" could even have instances of the same Creator given different icons depending on some settings - but that's not the primary concern of this issue but could be a bonus if the implementation was like this:

Pseudocode:

icon = instance.data.get("icon") or instance_creator.icon

That way the icon could always be overridden by the instance data at runtime.

Are there any labels you wish to add?

Describe alternatives you've considered:

A workaround might be to get the CreateContext from instance.context and force the runtime instance identifier onto a fake Creator, etc. but the hack would be complex and would remain a hacky workaround.

Additional context:

Came up on discord here

[cuID:OP-7220]

MustafaJafar commented 10 months ago

is that instance a child of CreatedInstance class ? as that class doesn't include an icon property ..also, do publisher UI is able to make use of that property if included ? please, correct me if I'm wrong.

BigRoy commented 10 months ago

The runtime instance is not CreatedInstance no.

It's an instance during publish created with context.create_instance() similar to here but I'm using it for a different use case for Bootstrapping e.g. certain usd dependency layers that are based off the one instance - so the issue isn't 'workfile instance' related at all like the example code I shared of blender (which is using the old publisher still)