0

I have many files with a similar layer structure, but the layer structure is not exactly the same in each of these files.

Each file has layers inside of layers; in other words, nested layers. One of these layers is called "mat outline", but the exact location changes from file to file. Again, it could be a sublayer, or a sublayer of a sublayer. I don't know in advance.

How do I find this layer called "mat outline" in a given file?

I know how to write a nested for-loop that will look at every layer and sublayer down the nested structure, and I can definitely find it. But isn't there an easier way?

Can I write "layers.layers" and get an object that is all sublayers of all layers?

If there is no other way, then I will proceed writing nested for-loops. I just want to be sure I'm not doing unncessary work.

7
  • Usually you would write the search as recursive.
    – joojaa
    Nov 30, 2021 at 17:37
  • At the moment, the concept of a recursive search is a little beyond my scripting abilities, but I can learn it if this is the only way to efficiently do the search.
    – Chris
    Nov 30, 2021 at 17:43
  • I didn't see one approach that would be helpful. I saw someone who sifted through all the layers and sublayers, and they constructed an object called "all-layers" that consists of all the sublayers from the bottom of the nest/ or tree structure. In other words, this object is the flattened representation of the whole nested structure. I could then do various searches through "all-layers" for different desired sublayers, and I only need to consruct "all-layers" once. That would save time.
    – Chris
    Nov 30, 2021 at 17:47
  • Think of it like calling search for each member. Usually you dont want to flatten the list because it can get obsoleted.
    – joojaa
    Nov 30, 2021 at 17:48
  • Try using the traverse scene function in following post: graphicdesign.stackexchange.com/questions/104077/…
    – joojaa
    Nov 30, 2021 at 18:01

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.