Activity › Forums › Adobe After Effects Expressions › scripting : creating comp
-
scripting : creating comp
Posted by Nicholas Joseph on January 18, 2011 at 1:22 pmhi everyone… newbee seeking help please. 🙂
Does anyone know how to get information from the project comp window and put it into a var/array?
for example..
I have 3 clips in my project window…lets say clip A,B,C and 2 comps…let call em’ comp1 and comp2. 🙂What I am trying to do is select items in the project window via script and precomp them into a new comp. So I select clipA and clipB and when I run the script it takes both of them and makes a new comp.
Also is there a way to create an array with the selected elements from the project window and list/print/displace the current items in the array?
thanks in advance for all your help 😉
Cheers
Martin Andersen replied 11 years ago 4 Members · 32 Replies -
32 Replies
-
Dan Ebberts
January 18, 2011 at 6:49 pmI’m not sure where you’re headed exactly, but this should give you an array of selected items in the project panel:
var mySelection = app.project.selection;
Dan
-
Nicholas Joseph
January 18, 2011 at 8:59 pmooOOO thats what I was looking for. Thankyou very much!!
It does select based on whats selected from the top down. Is there a way to have the array index be assigned based on what was selected first.eg. clip02 selected and then clip01 and clip03 and have clip02 be [0], clip01 be [1] and clip03 [2].
thanks again for your help.
-
Nicholas Joseph
January 18, 2011 at 9:09 pmI have about 100 or so source footage in my project and each one has a matching matte pass. What I am trying to create is a script that will set the beautyPass to index[0] and the alpha to [1]. Then I will have the script create a new comp with the name of [0] and put both [0] and [1] into that comp. then the script will apply a shift channels and blur to index[0] inside each new com.
Seems complicated but these shots are killing me. 🙁 SO I am trying to write this script to save whats left of the hair on my head. 🙂
thanks
-
Dan Ebberts
January 18, 2011 at 10:44 pmI don’t think selection order is available for project panel items.
Dan
-
Nicholas Joseph
January 19, 2011 at 12:35 amDan your my new best friend 🙂
I hope I can abuse this by asking you more questions. 🙂
What is the best way to learn how to script in AE? I am a MAYA TD but it seems AE is 10 times harder than scripting in Maya. Do you have any resources that you recommend?Im also stuck again…I created the array that holds my clips…how would I create a new comp with these. The way I was thinking is to just create a comp with the settings of my clips and duplicating the clips and moving it. Do you know if there is a command that will just take the selected elements and create a comp more intuitively?
Thanks again for all your help. I really appreciate it.
-
Dan Ebberts
January 19, 2011 at 1:07 amI can think of three ways to do it.
If you already have a comp set up with the right parameters, you can duplicate it, gut it, and add your array items as layers.
Or you can add your items to an existing comp and precomp the new layers.
Or, you can just create a new comp from scratch.
When I started learning scripting, I spent a lot of time with the Scripting Guide. I created a zillion simple scripts that each do just one thing, like create_text_layer.jsx, add_effect.jsx, import_footage.jsx, etc. It makes a pretty good reference, in case I forget how to do anything or just need to copy and paste a snippet. If you still have CS3, it came with a bunch of demo scripts that are fun to pick apart.
Dan
-
Nicholas Joseph
January 19, 2011 at 7:30 pmso…I used the addComp() command to create a new empty comp with my settings. How would I write the “take whats in my array and put it in the comp” code?
this is what I have:
var proj = app.project;
var selection = proj.selection;
app.project.itemCollection.addComp(scene01, 1280, 720, 1, 61, 30)I’m trying to figure out what to put in the for loop to get the “selection” content into the “scene01” comp.
Thanks again for all your help 🙂
-
Dan Ebberts
January 19, 2011 at 8:00 pmLike this:
{
var proj = app.project;
var selection = proj.selection;
var myComp = app.project.items.addComp("scene01", 1280, 720, 1, 61, 30)
for (var i = 0; i < selection.length; i++){
myComp.layers.add(selection[i]);
}
}
Dan
-
Nicholas Joseph
January 19, 2011 at 8:13 pmAwesome!!
does this only work with index. I create 2 folders and want the comp2 to be the child of comp1.
var proj = app.project;
var compFolder = app.project.items.addFolder(‘comp’);
var compFolder2= app.project.items.addFolder(‘comp2’);app.project.item(compFolder2).parentFolder = compFolder; //(error)
app.project.item(comp2).parentFolder = compFolder; //(error)
app.project.item(2).parentFolder = compFolder; //(works)I get an error with the last line because (‘compFolder2’) is not working. It works with (2) though. How would I use actual folder names or ids to call folders instead of index#.
thanks again for all your help. 🙂
-
Dan Ebberts
January 19, 2011 at 8:44 pmThis should work:
compFolder2.parentFolder = compFolder;
Dan
Reply to this Discussion! Login or Sign Up