FORUMS: list search recent posts

Marker Names to Text layers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Christoph Heimer
Marker Names to Text layers
on Apr 20, 2016 at 3:25:05 pm

Hi,

is there a script or an expression for the following case:
I'm supposed to make a lyric video animation and I set markers in Premiere on every sentence basically, sometimes even separate words.

It would be soo convenient if there was a way to import that track via copy paste to after effects with all the markers on it (so far it works) and then have text layers generated at the according time for all the layer markers. This has got to be possible somehow? :)

Best,
Christoph


Return to posts index

Dan Ebberts
Re: Marker Names to Text layers
on Apr 20, 2016 at 4:47:03 pm

It would be a fairly straightforward script to generate text layers from the markers of a selected layer, but would it work to just have one text layer displaying the text of the most recent marker? You could do that with an expression like this:


m = thisComp.layer("Marker Layer").marker;
txt = "";
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (time < m.key(n).time) n--;
if (n > 0) txt = m.key(n).comment;
}
txt



Dan



Return to posts index

Christoph Heimer
Re: Marker Names to Text layers
on Apr 20, 2016 at 5:02:28 pm

Hey,

no this won't work for me I suppose. I need the quicker access to all the separate text layers so I can just easily move them around in space and scale, maybe change the font etc. It's so much easier when it's separate layers then keyframing all this on one layer... So there's no existing solution for this yet?



Return to posts index


Dan Ebberts
Re: Marker Names to Text layers
on Apr 20, 2016 at 6:09:20 pm

Something like this should be close:


function BuildTextLayers(){
var myComp = app.project.activeItem;
if ((myComp == null || ! (myComp instanceof CompItem))){
alert ("No comp active.");
return;
}
var myLayers = myComp.selectedLayers;
if (myLayers.length == 0){
alert ("No layer selected.");
return;
}
var myLayer = myLayers[0];
var myMarker = myLayer.property("Marker");
if (myMarker.numKeys == 0){
alert ("Selected layer has no markers.");
return;
}
var txt;

for (var i =1; i <= myMarker.numKeys; i++){
myTextLayer = myComp.layers.addText(myMarker.keyValue(i).comment);
myTextLayer.startTime = myMarker.keyTime(i);
}
}
BuildTextLayers();



Dan



Return to posts index

Dan Ebberts
Re: Marker Names to Text layers
on Apr 20, 2016 at 6:11:17 pm

That wasn't quite right. Try this one:


function BuildTextLayers(){
var myComp = app.project.activeItem;
if ((myComp == null) || ! (myComp instanceof CompItem)){
alert ("No comp active.");
return;
}
var myLayers = myComp.selectedLayers;
if (myLayers.length == 0){
alert ("No layer selected.");
return;
}
var myLayer = myLayers[0];
var myMarker = myLayer.property("Marker");
if (myMarker.numKeys == 0){
alert ("Selected layer has no markers.");
return;
}
var txt;

for (var i =1; i <= myMarker.numKeys; i++){
myTextLayer = myComp.layers.addText(myMarker.keyValue(i).comment);
myTextLayer.startTime = myMarker.keyTime(i);
}
}
BuildTextLayers();



Dan



Return to posts index

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