ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to check if Time Remapping on a given layer is enabled or not.

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Nathan Churney
Expression to check if Time Remapping on a given layer is enabled or not.
on Sep 16, 2015 at 7:43:16 pm

Howdy. I have a for loop that goes through a large number of layers and returns a result based on what the timeRemap value of that layer is. The problem comes when one of the layers within that set doesn't have timeRemap enabled, the expression gives an error and disables itself saying the layer doesn't have time remapping on and can't use the time remap property. I'm trying to write a little bit of code that checks out if a layer has timeRemapped enabled or not so it can skip the step of using the timeRemap property entirely on an un-remapped layer. So, a simplified version of my code currently looks like this:

for (var x=1, x <= 10, x++){
var y == y + thisComp.layer(x).timeRemap;//*this is the line of code that gives me an error when it encounters un-time-remapped layers*//
}


My "solution", provided someone can tell me code to check if layers are time remapped or not

for (var x=1, x <= 10, x++){
if(//*here would be the bit of code checking if time remap is enabled for layer(x)*// == true){
var y == y + thisComp.layer(x).timeRemap;//*nestled in the if-then, it'll only perform this line if time remapping is enabled*//
}else{
//*empty statement, for layers without time remap enabled*//
}
}


Any ideas on the bit of code, or an alternate solution?


Return to posts index


Walter Soyka
Re: Expression to check if Time Remapping on a given layer is enabled or not.
on Sep 16, 2015 at 8:56:53 pm

You can use try/catch [link] to look for a time-remapping value and recover if execution of that line fails.

See another example here:
https://forums.creativecow.net/readpost/2/1061942

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Nathan Churney
Re: Expression to check if Time Remapping on a given layer is enabled or not.
on Sep 16, 2015 at 9:37:28 pm

Awesome! Got it working. Thanks!


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]