ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

copy markers from layer markers to comp markers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Roei Tzoref
copy markers from layer markers to comp markers
on Jul 13, 2016 at 1:10:29 pm

hey everybody.
I have a guide layer with layer markers and I have to manually at every comp set those markers to the comp markers.
won't you give a guy a hand?




Return to posts index

Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 4:39:51 pm

Strangely, scripting doesn't have direct access to comp markers. This hack should give you comp markers wherever you have markers on a selected layer, but I don't think there's any way to copy the comment:


var theComp = app.project.activeItem;
var theLayer = theComp.selectedLayers[0];
var theTimes = [];
for (var i = 1; i <= theLayer.property("Marker").numKeys; i++){
theTimes.push(theLayer.property("Marker").keyTime(i));
}
for (var i = 1; i <= theComp.numLayers; i++){
theComp.layer(i).selected = false;
}
for (var i = 0; i < theTimes.length; i++){
theComp.time = theTimes[i];
app.executeCommand(app.findMenuCommandId("Add Marker"));
}



Dan



Return to posts index

Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:13:30 pm

thank you Dan. at which property, and what composition should I copy this expression too?




Return to posts index


Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:21:11 pm

It's a script, not an expression.

Dan



Return to posts index

Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:38:48 pm

Got it! it Works! Dan let's make some money :) this could be very useful at Aescripts. first time I copy pasted a string to the script editor and saved it as a jsx - is that how you started :0




Return to posts index

Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:51:34 pm

>this could be very useful at Aescripts

It would need some work to make it user-proof, run in different languages, etc. I'm not sure there's any money to be made there.

>is that how you started :0

Not exactly. In the early days, I'd write the code in Notepad and just save it as a .jsx. Now I usually (unless it's a really short piece of code, like this one) use the ExtendScript editor, or Sublime Text.

Dan



Return to posts index


Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:42:36 pm

I was thinking of something. is there a way to make this script just add "1", "2", "3" etc. to the markers it copies to the comp? just to not leave them blank. that could improve it's purpose a lot




Return to posts index

Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:56:09 pm

>is there a way to make this script just add "1", "2", "3" etc. to the markers it copies to the comp?

Not that I know of.

Dan



Return to posts index

Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:50:25 pm

I am trying to have it close instead of loading that Jsx everytime.

tried copying it to the scripts folder and restarted Ae and it's not in File-Scripts.
copying it to the startup folder in scripts gave an error message when loading Ae.

is there a way for having it close. of course a docking or a window near by would be great but I am not spoiled. I just want it to be quicker than loading it every time with File->Scripts->Run Script File->clicking on it twice in my Explorer but if that's all I get I will take it.

Running Ae 13.8




Return to posts index


Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 7:55:01 pm

>I am trying to have it close

I'm not sure what you mean by that.

Dan



Return to posts index

Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 8:01:44 pm

about the money - I was slightly joking. I would like to make service to the community so I could help if you have an urge to do that. for free and the script could be for free too.

about loading the script and what I wrote in the previous comment: I want to load the script with as few steps as possible. I tried placing it in Ae Scripts folder and Startup and it's not making it appear under scripts (file->scripts). am I doing something wrong or it is not possible with the script that you provided?

now I have 4 steps to make:
1. click file
2. go to scripts
3. run script file
4. click twice at the script

anyway to make this shorter?




Return to posts index

Dan Ebberts
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 8:13:12 pm

>I tried placing it in Ae Scripts folder

That should work. You have to restart AE though. Then it should just be File > Scripts > select your script from the list.


Dan



Return to posts index


Roei Tzoref
Re: copy markers from layer markers to comp markers
on Jul 13, 2016 at 8:18:16 pm

I thought so too... tried it again and it works. probably I did something wrong before.

thank you Dan you did it again.

BTW I also posted a feature request to make copy layer markers to comp marker a feature. hope someone will notice. doing my little part. and of course If I ever come across somebody looking for a way to copy layer markers to comp markers - will give him that Jsx.

thanks.




Return to posts index

Roei Tzoref
Re: copy markers from layer markers to comp markers
on Nov 6, 2017 at 12:24:31 pm

Hi Dan and everyone.

returning to this thread after a while. 5 months after the initial post, Ae released the November update (Ae CC 2017 14.0) with extended scripting support to various things including Comp Markers.

so surely now there's a way to copy layer markers to comp markers and retain the comment, right? if I may be so bold to ask you to revise the script. of course if you feel this is a tool worth publishing and getting paid for, i would buy that tool but no scripting tool available.

Thank you.

Roei Tzoref
2D/VFX Generalist & Instructor
♫ AeBlues Tutorials ♫
http://www.tzoref.com


Return to posts index

Dan Ebberts
Re: copy markers from layer markers to comp markers
on Nov 6, 2017 at 4:51:50 pm

I fleshed it out a little:


function CopyLayerMarkersToComp(){
var theComp = app.project.activeItem;
if ((theComp == null) || ! (theComp instanceof CompItem)){
alert ("No comp active.");
return;
}
if (theComp.selectedLayers.length == 0){
alert("No layer selected.");
return;
}
var theLayer = theComp.selectedLayers[0];
var theMarker = new MarkerValue("");
var theTime;
for (var i = 1; i <= theLayer.property("Marker").numKeys; i++){
theTime = theLayer.property("Marker").keyTime(i);
theMarker = theLayer.property("Marker").keyValue(i);
theComp.markerProperty.setValueAtTime(theTime,theMarker);
}
}
CopyLayerMarkersToComp();



Dan



Return to posts index


Roei Tzoref
Re: copy markers from layer markers to comp markers
on Nov 6, 2017 at 8:13:41 pm

Great. thanks Dan for putting this out there.

Roei Tzoref
2D/VFX Generalist & Instructor
♫ AeBlues Tutorials ♫
http://www.tzoref.com


Return to posts index

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