Hello everyone,
tl;dr Accessing path vertices via expression doesn't seem possible, but scripts can, so is it possible to do it by calling a script file inside the expression?
My goal is to access the number of vertices in various path objects and use this value in an expression. The expression is driving a trim path's offset property and the expression use relative naming so that I can copy the trim path to 500 other shape layers groups and have a different effect (speed of the offset) for each group depending on the number of vertices of each path.
I've been looking for a solution to this problem for quite some time now and my conclusion is that you simply cannot access path vertices via expression, whether the path is in a mask or a shape layer.
Is this correct?
With a mask on a solid layer and according to the After Effects Scripting Guide I should be able to do:
thisComp.layer("Black Solid 1").mask("Mask 1").maskPath.value
or
thisComp.layer("Black Solid 1").mask("Mask 1").maskPath.value.vertices
or
thisComp.layer("Black Solid 1").mask("Mask 1").maskPath.value.vertices.length
I also tried:
thisComp.layer("Black Solid 1").mask("Mask 1").maskPath.vertices.length
and so on...
But when debugging this with the source text of a text layer I only get "undefined" for the value and errors for the other expressions ("property named 'vertices' in Class 'Property' is missing or does not exist").
I'm pretty sure these are the correct methods since a lot of scripts are using those, including:
http://omino.com/pixelblog/2008/12/25/ae-mask-vertices-from-extendscript/
http://www.crgreen.com/aescripts/actual_scripts/Connect_Point_to_Mask_Vertex.jsx
http://aescripts.com/maskvertexexpression/
So if directly accessing the path arrays via expression is not possible, I was thinking about calling, in each expression, an external script which would then return the number of vertices there is in each arrays. It would look like something like this (pseudo-code):
arrayLength = content(thisProperty.propertyGroup(2).name).content("Path 1").value.vertices.length
return arrayLength
And then use the value I get from the script to adjust the speeds in my expressions:
time*arrayLength*thisComp.layer("Controller").effect("Speed")("Slider")
So is it possible to call a script file inside an expression? How?
If not, do you have any other suggestion?
Thanks.
Reference: After Effects CS6 Scripting Guide, page 172.