FORUMS: list search recent posts

changing a property on every group inside shape layers via scripting?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Peter Zeet
changing a property on every group inside shape layers via scripting?
on Jul 2, 2016 at 12:00:29 am

Hello!

I have 65 shape layers previously converted from text layer, and I need to access every single group's position to add a wiggle (so basically, every converted letter, which is now a group inside the shape layer). Sometimes instead of wiggling the position, the opacity may need to be set the same value, etc.
As the client keeps giving more and more words which needs to be converted into shape layer, and all that digging into the group's transform props can take forever, I'm wondering how should a script be to loop through all the groups from the selected layers and add a wiggle (or whatever, I'd change depending on the needs).

edit: I don't know if it's even possible to batch convert text to shape layer and perform the adding the wiggle?

thanks!!


Return to posts index

Dan Ebberts
Re: changing a property on every group inside shape layers via scripting?
on Jul 2, 2016 at 12:48:35 am

Navigating a shape layer's hierarchy can be tricky, but here's a simple example where you have converted a text layer to a shape layer and have the shape layer selected:


var myLayer = app.project.activeItem.selectedLayers[0];
if (myLayer instanceof ShapeLayer){
var myContents = myLayer.property("Contents");
for (var i = 1; i <= myContents.numProperties; i++){
myContents.property(i).property("Transform").property("Position").expression = "wiggle(1,25)";
}
}


Throw in groups and things get more complicated, especially if the script can't assume the exact contents of the shape layer. Could be a bit of work.

Dan



Return to posts index

Peter Zeet
Re: changing a property on every group inside shape layers via scripting?
on Jul 2, 2016 at 1:00:16 am

thanks!!
I gave a try selecting just 3 shape layers, but the script only works on the first selected layer. I guess that's due to the tricky nature of the shape layers contents and groups, right?

anyway, it will save a lot of time, thanks!!


Return to posts index


Dan Ebberts
Re: changing a property on every group inside shape layers via scripting?
on Jul 2, 2016 at 1:17:09 am

I haven't tested this, but you could do multiple selected layers like this:


var myLayers = app.project.activeItem.selectedLayers;
var myLayer;
for (var i = 0; i < myLayers.length; i++){
myLayer = myLayers[i];
if (myLayer instanceof ShapeLayer){
var myContents = myLayer.property("Contents");
for (var j = 1; j <= myContents.numProperties; j++){
myContents.property(j).property("Transform").property("Position").expression = "wiggle(1,25)";
}
}
}



Dan



Return to posts index

Peter Zeet
Re: changing a property on every group inside shape layers via scripting?
on Jul 2, 2016 at 1:27:22 am

yay!! works perfectly, again, thanks!!!


Return to posts index

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