I’m looking into a way to replace many objects with new ones in a composition, and swapObjects.js seemed like the solution. However, if it does swap the x and y coordinates of the objects, it does not seem to swap the position in the layer stack. Rather, it seems to keep the previous stacking order of each object. This makes it a lot less useful when using it to place objects in an existing and sometimes complex composition.
For instance, I want to swap the blue square for the red-yellow object:

Here is what swapObjects.js does (the red-yellow object stays on top):

Expected result: the object would place itself between the two white squares, just like the blue square was:

Hope this makes sense. Any idea of a direction to look at in order to change this behaviour? Thanks!
I’m looking into a way to replace many objects with new ones in a composition, and swapObjects.js seemed like the solution. However, if it does swap the x and y coordinates of the objects, it does not seem to swap the position in the layer stack. Rather, it seems to keep the previous stacking order of each object. This makes it a lot less useful when using it to place objects in an existing and sometimes complex composition.
For instance, I want to swap the blue square for the red-yellow object:

Here is what swapObjects.js does (the red-yellow object stays on top):

Expected result: the object would place itself between the two white squares, just like the blue square was:

Hope this makes sense. Any idea of a direction to look at in order to change this behaviour? Thanks!