-
Stop code running, until precomp isn’t ready
Hi, my problem is this: I’m writing a script. in a for cycle, it generates 6 layers, pre-comp them, generate 6 (similar) layers, pre-comp them, etc, everything is ok. But, I want 2 layers (not all the 6) to pre-comp, before pre-comp the 6 layers, and want to do some stuff with layers, and the pre-comped 2 before the ‘bigger’ pre-comping. The problem is – as I see – that the pre-comping of the 2 is not ready, when the script want to use it, so I need something, a trick or whatever, what stops the code of the for cycle, when the AE is working on pre-comping.
I tried to make a recursive function, with the new (2 layers pre-comp) name but it isn’t work – I know it’s ugly, but…
I write it down, in the code section, I don’t want to write the full code, it was perfect, before the 2 layers precomp stuff. Google didn’t help me, thank you the answers!
var testPrecomp = function(){
if(typeof(mainComp.layers.byName('preCompTwo')) === 'object'){
//Do the job
}else{
testPrecomp();
}
};