FORUMS: list search recent posts

AE scripting : Get nested layers or comps time at specific parent time

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Mathieu Robinet
AE scripting : Get nested layers or comps time at specific parent time
on Sep 29, 2017 at 10:41:30 pm

Hi,

There is several years than in work with expression and script in after effect but today i got a problem accessing nested components time.

In my script , i try to scan recursively a master comp and nested comps to find element.
At this point, no problem, but i want to scant at a specific time ....
It's ok for the master comp, but how can i get the current time of the nested comp ( with or without stretch or time remapping), corresponding of the current time of the master ?

I hope my question is clear ... let me know if you need detail.
Thanks for your help

Mr


Return to posts index

Mathieu Robinet
Re: AE scripting : Get nested layers or comps time at specific parent time
on Sep 30, 2017 at 12:33:22 pm

Hi,

it's look i got my own solution :

function nestedCompTime(cp,cpTime,lay){
//cp : ref master comp
//cpTime : time at to get result
// lay : the layer comp to analyse

var nestedTime=0;
if(lay.timeRemapEnabled ==true){
nestedTime=lay.property("Time Remap").valueAtTime(cpTime, false);
}else{
var LStart=lay.startTime;
var LStretch=lay.stretch;
nestedTime=(cpTime-LStart)/(LStretch/100);
}

return nestedTime;
}

so if i select (with all necessary tests of course) a child comp (B) included in the master com (A), i can get the good time in the child comp (B) like this

var masterCompA=app.project.activeItem;
var childCompB=masterCompA.selectedLayers[0];
var childTime=nestedCompTime(masterCompA,<i>anyTimeYouWant</i>,childCompB );


It's look great ... can someone confirm this solution is fine ?

Thanks

Mr


Return to posts index

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