Parent to layer above (or below)

Hi everyone, I’m new to Automation Toolkit and I can’t figure out how to create a simple automation that can parent a group selected layer to the one above (or below), i.e. if I select layers 2 and 4, I want that layer 2 to be linked to layer 1 and layer 4 to layer 3. Can someone help me?

Thanks
Daniele

Hi @Daniele, welcome to the forum!

It’s great that you’re reaching out for help as you get started with Automation Toolkit.

To parent each selected layer to the one above it, you can follow these streamlined steps:

  1. Loop through the layers in the active composition.
  2. Identify the selected layers.
  3. For each selected layer, calculate the index of the layer directly above it. This is simply the current layer’s index minus 1. For example, if a selected layer is at index 5, the layer above it is at index 4.
  4. Create a variable to store this calculated index.
  5. Loop through all layers in the composition again.
  6. When you find a layer whose index matches the stored index, set it as the parent of the current selected layer.

This process ensures each selected layer is correctly parented to the layer immediately above it.

Here’s an automation for this process:
Parent Above.zip (1.6 KB)

Feel free to ask if you have any more questions or need further assistance!

Best,
Alon

Hi Alon,
thank you very much, it works perfectly!

Daniele