AE ENHANCERS

Expressions/Scripts/Presets
It is currently Tue May 21, 2013 8:53 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Adding an animation preset with a script
PostPosted: Mon Mar 01, 2010 9:00 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Basically, I've created a custom effect (using the tutorial on AETuts) and now I'm wondering if I can implement this using Compify (Byron Nash, Edited and Improved by Paul Tuersley). What I want to do is create the comps and then have this animation preset applied. My first impressions are that it may be possible to apply an animation preset but because the effectsGroup of my custom effect isn't defined I may have some trouble.

It'd be nice to be able to direct these newly generated comps into a specified folder aswell.

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Adding an animation preset with a script
PostPosted: Mon Mar 01, 2010 9:18 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
OK ok ok...I was being a lazy idiot. I found the language I needed.

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Adding an animation preset with a script
PostPosted: Tue Mar 02, 2010 5:22 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
is it possible to just specify a folder name and set that as the parentFolder for an object?

For example:

Code:
var compFolder = app.project.item.name("CHAR PRECOMPS");
newComp.parentFolder = compFolder;


entire script (which I shamelessly canniballised from Compify (Byron Nash, Edited and Improved by Paul Tuersley):

Code:
//select comps in project window and make comps from them
//add line boil preset to layer within created comp

app.beginUndoGroup("Precomp and Lineboil");

var selItems = app.project.selection;//set selected import items to an array
var myColl = app.project.selection;//use the selection
var i = 0;

//remove unneeded characters from comp name
for (i; i<myColl.length; i++) {
//add suffux to comp name and remove the file extension
var curItem = myColl[i];
var curName = curItem.name.substring(0, curItem.name.length-16);

//set comp to footage item dimensions and framerate
var curWidth = curItem.width;
var curHeight = curItem.height;
var curAspect = curItem.pixelAspect;
var curDuration = curItem.duration;
var curRate =  curItem.frameRate;

//create comp and add layer and add preset
var newComp = projColl.addComp(curName + "_LB",curWidth,curHeight,curAspect,curDuration,curRate);//make new comp
var lcoll = newComp.layers;//variable for collection of layer objects in logoComp
lcoll.add(curItem);//add layer
var presetPath = "w:/Gumball/AE_Custom_Effects/CE_LINE_BOIL_V002.ffx";
var myPreset = File(presetPath);
newComp.layer(1).applyPreset(myPreset);

//direct comp to precomps folder
var compFolder = app.project.item.name("CHAR PRECOMPS");
newComp.parentFolder = compFolder;
}

app.endUndoGroup();

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
 Post subject: Re: Adding an animation preset with a script
PostPosted: Tue Mar 02, 2010 12:12 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
You can't access items in the project bin by name, but it's pretty simple to put together a little function to do it for you. Here's one what will find a folder with the specified name and return it (or null if the folder doesn't exist):
Code:

  function getFolder(theName){
    var myFolder = null;
    for (var i = 1; i <= app.project.numItems; i++){
      if (app.project.item(i).name == theName && app.project.item(i) instanceof FolderItem){
        myFolder = app.project.item(i);
        break;
      }
    }
    return myFolder;
  }



Then in your main routine, just do something like this:

Code:

var compFolder = getFolder("CHAR PRECOMPS");
if (compFolder == null) {
  // probably create the folder here
}else{
  newComp.parentFolder = compFolder;
}


Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: Adding an animation preset with a script
PostPosted: Fri Mar 05, 2010 5:07 am 
Offline

Joined: Mon Oct 22, 2007 3:57 am
Posts: 19
Location: Dublin, Ireland
Awesome! The great Dan Ebberts stikes again. Thanks a million for this, this is the first time I've tried writing a script but it certainly wont be the last. I'm a bit late for Lloyds class on FXPHD but I'm hoping to include something similar for next term. Thanks again.

_________________
It's not the dog in the fight, it's the fight in the dog that matters.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group