Find the next layer in stack that has the same parent
In short, I'm trying to see if there is a way in expressions to find the next layer up the stack that shares a parent. The caveat is that the only thing I can reliably know is that those layers (and only those layers) will share parent. They might not share any part of their name and they might not be next to each other in the layer stack.
I sort of figure it would be something like:
"Look one layer up. Does that layer have the same parent? Yes - look at property x. No - go to next layer up. Does that layer have the same parent..." (and so on). I'm not sure how one would code "keep looking till you find something or reach the top" but I think there has to be a way to do this.
For context: I'm making a template of sorts for the other motion graphic designers on my team. The template is several boxes that can have their Y-size animated on or off based on two sliders of their parented layer: one for animation percentage and one for time offset. The offset is based on an artificial 'index' of sorts (just a slider that looks one layer up and adds 1 to that layer's 'index' slider). I'm trying to make the template as "user error" proof as possible, so I'm anticipating that the box layers will likely be renamed and moved around in the layer stack. As such, I'd like the expression to not just look one layer up, but to find the next layer up in the stack that has the same parent (since only the box layers would be parented to the control layer).
