Open alainxi opened 1 week ago
@alainxi it's not the prettiest - but I believe it may work to set an instance/class attribute, e.g. self.my_value = "HELLO"
on the first load and re-use the attribute in the others because the plugin instance is technically shared with the multiple loads. The Clip Loader logic in some editorial integrations like Resolve or Hiero I believe tend to abuse that hack a little.
At the same time - it wouldn't be a tremendous redesign in AYON to implement the loader to actually trigger a load_multiple()
method on the Loader Plug-in that by default does what it does now per product. One could then override load_multiple
if they want to override the behavior on what it does when running on many products.
However, this has always been held off to implement due to a bigger refactor on the load system being in the backlog which we'd rather focus if time allows.
Thanks @BigRoy !
Is there an existing issue for this?
Please describe the feature you have in mind and explain what the current shortcomings are?
Inside a DCC, the Ayon-->Load gui allows to select a product group, and apply a load plugin to all the members of that group (let’s say 20 products).
But, if the load plugin displays a popup to ask a question to the user (example : “Are you sure ?” ), the current behaviour is to display the popup 20 times (it appears one by one, each time you close the previous one, so there doesn’t seem to be a risk of race condition).
It would be easier for the user, to only see the 1st popup, and the 19 remaining invocations of the plugin would get the same answer.
How would you imagine the implementation of the feature?
When you select a group of products, while being in Ayon’s Load gui (called by AnyDCC–>Ayon menu–>Load), if you chose one of the Load item in the RMB menu, it will execute the load process for each product contained inside the product group. It would be useful for the first load process to give some information to the next load processes.
Here is an example (it’s the same for every DCC). Publish products in a way that can be seen as a group by Aton (for example export a TextureSet from Substance Painter, it will produce several image products under a group) Open Blender, open Ayon–>Load, select the product group (which contains several images). Right–>Mouse–>Button–>Load in Compositor. (see my screenshot below)
It works all right, all images are loaded, because the load plugin was executed several times (one time for each image).
Now let’s say we would prefer to execute the load plugin only once for the whole group, instead of executing once for each image, because there is some slow process to do, or because we want to ask a question to the user (using a QtWidget) only once. I guess it’s not possible to execute load plugin only once for the whole group. So, the next best thing, is to execute the QtWidget popup on the first execution of the load plugin (the first image of the group), and find a way to give the answer to all the next executions of the same load plugin.
Another example, in Maya, when using “Load imagePlane”, there is a QtWidget that asks for confirmation (I don’t have maya, but seeing the source code I think it is). Let’s say we want to load a lot of imagePlanes at once, and only answer to the confirmation popup once, instead of replying for each and every imagePlane (which would be tedious if there was a lot of imagePlane).
https://github.com/ynput/ayon-maya/blob/2d9d6e417463da526a54a255b5ed8bdfe70647dd/client/ayon_maya/plugins/load/load_image_plane.py#L185
Are there any labels you wish to add?
Describe alternatives you've considered:
No response
Additional context:
No response