-
Scripting: access all expressions in Comp /
Hello all,
I need to find a way to adress all expressions (activated / deactivated) in one Comp. My project is a custom expression-baker. With bigger expression rigs it is inconvenient to lasso-select all expression properties and then use the “Convert Expressions to keyframes” command. I want to bake & unbake all expressions with one click.
My solution so far was to build different kinds of for-loops, entering every property and every properties property checking if there is an (expressionActivated == true).
This works okay for selecting all active expressions, but if I want to select all inactive Expression, this does not work. Because a property with (expressionActivated == false) can also have no expression at all. Also it is not a very clean solution, because the script can not know how many branches the property-tree has before the expression.
I believe there must be a way to access all expressions in another way. But I can’t find any info about this in the Toolguide or other resources… The code I attached is just an example how I am doing it (selecting the properties) right now – it may not have much to do with the solution I am looking for.
Any hint would be very much appreciated!!!
var selectShapeProps_2 = function(c){
var shape = layer.content(c)for (var x = 1; x <= (shape.numProperties); x++){
try{
for (var i = 1; i <= (shape.content(x).numProperties); i++){
var prop = shape.content(x).property(i);
if (prop.expressionEnabled == true) {prop.selected = true};
}
for (var i = 1; i <= (shape.content(x).numProperties); i++){
for (var n = 1; n <= (shape.content(x).content(i).numProperties); n++){
var prop2 = shape.content(x).content(i).property(n);
if (prop2.expressionEnabled == true) {prop2.selected = true};
}
}
}catch(err){}
}
}