-
Conditional Expression
Hello, I’m new to these forums and new to expression scripting. I wrote a script which got half my problem solved, but I can’t take it to the next level and was hoping someone here might offer the right tip.
The Problem: Arrange a bunch of layers (like 400) along the x axis with a consistent space between the edges of the layers (which have different widths) WITH the condition to do it for different widths if certain conditions apply. I figured out the first part, but the conditional part elludes me.
english script:
IF the previous layer’s name contains (or starts with) “door” OR the current layer’s name contains (or starts with) “door” THEN set the x position to (half the width of the previous layer + half the width of the current layer+200+ x position of previous layer)
// this would put 200 pixels between the sides of each layer… the or could be a separate if else i suppose.ELSE IF the current layer’s name contains (or starts with) “WallThing” THEN set the x position to (half the width of the previous layer + half the width of the current layer+100+ x position of previous layer)
// this would put 100 pixels between the sides of the previous layer and the current layer if the current contains “WallThing”ELSE IF the previous layer’s name contains (or starts with) “WallThing” THEN set the x position to (half the width of the index-2 layer + half the width of the current layer+200+ x position of previous layer)
// this would basically irgnore the WallThing layer and put 200 pixels between the sides of the index-2 layer and the current layer if the index-1 contains “WallThing”OTHERWISE set the x position to (half the width of the index-1 layer + half the width of the current layer+400+ x position of previous layer)
// this would put 400 pixels between the sides of the index-1 layer and the current layerThat’s it. If you can’t read a portion of the name, can it be done by way the full name? if not that, can it be done with the layer type? (comp vs. footage) Will the width read the width of a comp if a precomp is on the layer above?
Is it possible to make the pixel amounts global type of variables or controlled by a singular unit is some manner?
And is there a better than the manual reference for this stuff? Not like a full course, but a basic reference?
Thank you!