AE ENHANCERS

Expressions/Scripts/Presets
It is currently Wed May 22, 2013 12:33 am

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Trouble linking Slider to a Shape layer parameter
PostPosted: Wed Jun 27, 2012 1:51 pm 
Offline

Joined: Wed Jun 27, 2012 9:08 am
Posts: 2
Hi everyone, this is my first post here.

I’ve been using AE professionally for 10 years, but am only recently delving into scripting. It’s definitely not my forte, but I’ve managed to cob together a couple simple scripts.
Now I’ve started working on something more complicated and have run into trouble with one section.

I have a Shape layer (rectangle) selected and when I run the script, it adds a Null layer and adds a Slider control to the Null.
I want to use this slider to control the Roundness parameter of the Shape layer.
I’ve tried quite a few things, and always get various errors. And after a few hundred tries, I'm feeling defeated.

I’m sure I’m going about this all wrong, since this Java script stuff is so new to me and I find it very hard to understand.
Anyway, here’s the code I’ve got at the moment.
(btw, I'm using After Effects CS5.5 on a Mac)

Code:

//start with a Shape layer that is selected


var picOrigComp = app.project.activeItem;
var curLayer = picOrigComp.selectedLayers[0];


//Create Null layer and rename CONTROLS
mySolid = picOrigComp.layers.addNull();
var controlNULL = mySolid;
controlNULL.name = "CONTROLS";

////Add slider controls

var ctrlLayer = picOrigComp.selectedLayers[0];

var slider = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Slider Control")
slider.property(1).setValueAtTime(0, 0);
slider.name = "Frame Roundness";

var slider = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Slider Control")
slider.property(1).setValueAtTime(0, 0);
slider.name = "Stroke Thickness";

var color = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Color Control");
color.property(1)
color.name = "Stroke Color";

//define null and shape layers
var roundCtrl = app.project.activeItem.layer("CONTROLS").property("Effects").property("Frame Roundness").property("Slider");
var roundShape = app.project.activeItem.layer("Shape Layer 1");

//link slider to shape layer's roundness control....   hopefully?
var shapeOrig = roundShape.property("ADBE Root Vectors Group");
var shapeNew = shapeOrig.addProperty("ADBE Vector Group");
var shapeRnd =  shapeNew.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Rect");
shapeRnd.property("ADBE Vector Rect - Roundness").setValue(roundCtrl);



If anyone can point out my problem(s), I'd sure appreciate the help. :)

Thanks,
Mark


Top
 Profile  
 
 Post subject: Re: Trouble linking Slider to a Shape layer parameter
PostPosted: Wed Jun 27, 2012 2:03 pm 
Offline

Joined: Sat Jun 26, 2004 10:01 am
Posts: 298
Location: Folsom, CA
You need to create the link by setting an expression for the Roundness property that points to the slider. I'd create the expression by hand first, copy it, and paste it into a variable in your script:

var myExpr = "(expression goes here);

So instead of using .setValue(roundCtrl) you would use .expression=myExpr

Hope that helps.

Dan

_________________
http://www.motionscript.com


Top
 Profile  
 
 Post subject: Re: Trouble linking Slider to a Shape layer parameter
PostPosted: Wed Jun 27, 2012 2:14 pm 
Offline

Joined: Wed Jun 27, 2012 9:08 am
Posts: 2
Thanks Dan. I'll give that a try.


Mark


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 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