Dynamic add/delete function?
Posted: May 29th, 2013, 6:16 am
Hello guys,
i have tried to solve the following problem myself and most likely i am making matters much more complicated than they actually have to be. Here is what i want to do:
Let's say, i have a variable in my user interface called NumberOfTextLayers that the user can put a number in for. When i click an update button, i want the script to look for the amount of text layers within the selected comp and compare this amount to the value of NumberOfTextLayers. It then needs to either add or delete text layers with the same property as the ones in the comp to match the Number of Layers specified in the variable.
I still have a bit of a problem of understanding the concept of loops. I tried several approaches of looping through arrays to get the indexes for the layers that need to be deleted or added, but its... tricky.
If you know how such a loop would have to be setup or if you have a better idea, please let me know.
i have tried to solve the following problem myself and most likely i am making matters much more complicated than they actually have to be. Here is what i want to do:
Let's say, i have a variable in my user interface called NumberOfTextLayers that the user can put a number in for. When i click an update button, i want the script to look for the amount of text layers within the selected comp and compare this amount to the value of NumberOfTextLayers. It then needs to either add or delete text layers with the same property as the ones in the comp to match the Number of Layers specified in the variable.
I still have a bit of a problem of understanding the concept of loops. I tried several approaches of looping through arrays to get the indexes for the layers that need to be deleted or added, but its... tricky.
If you know how such a loop would have to be setup or if you have a better idea, please let me know.