Expressions/Scripts/Presets

Moderator: Paul Tuersley

 
HariVu
Topic Author
Posts: 2
Joined: Thu Mar 23, 2017 8:58 pm

Cut layer through Marker

Tue Mar 28, 2017 4:35 am

I'm trying to cut layer through markers in buttom layer.
But It's startTime at each marker only, not inPoint.
I know inPoint must equal a number, but i don't know how to fix it. Anyone help me out with it?
Thanks a lot!
I have this:

var thisComp = app.project.activeItem;
var myLayer = thisComp.selectedLayers[0];   

var numMarkers = myLayer.marker.numKeys; 

for (i = 1; i <= numMarkers; i++) {
    thisComp.layer(i).inPoint = myLayer.marker.keyTime(i);
    }

[url=<a]Image[/url]">
 
HariVu
Topic Author
Posts: 2
Joined: Thu Mar 23, 2017 8:58 pm

Re: Cut layer through Marker

Wed Mar 29, 2017 7:33 pm

Anyone can tell me the answer? 
 
runegan
Posts: 22
Joined: Fri Nov 04, 2016 3:18 pm
Contact:

Re: Cut layer through Marker

Thu Mar 30, 2017 1:29 am

I'm guessing you are trying to set the inPoint of the layers without moving the outPoint?
Your code works when used on comp/footage layers, but when used on solids the outpoint is also moved, but any keyframes stay in place, so the only thing you have to do is store the outPoint before setting the inPoint, then set the outPoint to the saved value.

var thisComp = app.project.activeItem;
var myLayer = thisComp.selectedLayers[0];

var numMarkers = myLayer.marker.numKeys;

for (i = 1; i <= numMarkers; i++) {
  var layer = thisComp.layer(i);
  var outPoint = layer.outPoint;
  layer.inPoint = myLayer.marker.keyTime(i);
  layer.outPoint = outPoint;
}


Hope that helps

Who is online

Users browsing this forum: No registered users and 1 guest