Cloning Elements

Very simple way to quickly replicate elements

CloneElements CloneElements CloneElements CloneElements

With the .clone() method you can easily create new element that you can place in you tree and modifies them.

Find an example below where we take a Uniform layer inside the compo and then create a copy of it, then with this copy we can change its parameter here for example we change the label of the layer and the color generated by the Uniform:

from random import random

Original = script.parentElement.layers["Uniform"]
UniformClone = Original.clone()
UniformClone.label = "UniformCopy"
UniformClone.generator.color.blue.set(random())
script.parentElement.layers.append(UniformClone)