Sort list of layers

I want to sort a list of layers before render (because of “layers are placed on top of each other in the order listed, with the first layer on the bottom and the last layer on the top”), but I don’t see how that would be possible. The only thing I thought of for getting closer to my goal is using the name field of the layers to put in real values as names, but I don’t see how to use that data afterwards to sort the layers list.

Any ideas?

Mmm right now I can’t think of an easy solution either.

But based on what do you want to order the layers ? Can you say a little more or show the composition ?
From your description (first on bottom and last on top) one could wanna think you just wanna reverse the list ? If yes there is reverse list that would work.

Another solution would have been to use the Make Dictionary and Get Items from Dictionary nodes with a custom number list, but those nodes only accept text as inputs. Which leads me to a question to the Vuo team, would it be much work to allow Make Dictionary to work with any kind of values ? Or should we create a feature request for it if possible but more work ?

Thanks  

In the composition, the layers are created from amplitude data. I want that data to accompany the layers (so far by using the layer’s name field) so I can sort the layers afterwards according to the amplitude data, before their rendering.

Edit : removed my method posted here since it contained some errors and was way less accurate than @MartinusMagneson his custom nodes and method he shared after : Node Set: Magneson’s List Tools  

Thanks for the input.

It’s possible to sort the data before turning the data into layers, but once it’s a list of layers, sorting is not possible anymore: the list can be reversed or shuffled, but not sorted. If sorting a list a layers was possible, the layer’s scale data could be used (or rotation, or translation) for the sorting.

But, ultimately, I would need the list of layers to have more the one “column” so each layer (column 1) could be accompanied by other data (column 2, column 3, etc). The data in column 2 or column 3, etc, could be used to sort the layers.  

Try this: https://community.vuo.org/t/-/6100

You’ll have to be careful about what triggers what, and it would be entirely on your own risk, but look at the demo comp (which I don’t know where went) and give it a shot.

3 Likes

Thanks!

Which leads me to a question to the Vuo team, would it be much work to allow Make Dictionary to work with any kind of values ?

I think Editor support for dictionaries (lists of key/value pairs) is meant to cover that. We got dictionaries working just enough for the few nodes that use them, like Calculate, but it would be better if they worked with all data types.

1 Like

The result of this discussion:

Similar to what I’ve been doing for the past year, but now the “biggest” layers are at the bottom.

3 Likes

Wow! Real nice!

1 Like