Cloning Elements

Cloning Elements

Very simple way to quickly replicate elements

With the .clone() you can easily create new element that you can place in you tree and modifies them
below is a example 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)

See Also: