FORUMS: list search recent posts

Shape layer property customization via ExtendScript

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Krishna Moorthy
Shape layer property customization via ExtendScript
on Nov 8, 2016 at 1:02:55 pm

Hi, I have to access the size position and roundness values of a shape layer so that I can change those values to the ones I desire.

The code snippet I tries is:

var shapeLayer = pipComp.layers.addShape(); // adding a shape layer to the pipComp
var contents = shapeLayer.property("ADBE Root Vectors Group"); // Accessing the contents of the shape layer
var shapeRect = contents.addProperty("ADBE Vector Shape - Rect"); // Adding a rectangle to the shape layer
var shapeFill = contents.addProperty("ADBE Vector Graphic - Fill");
var rectSize = shapeLayer.property("ADBE Vector Rect Size");
var rectPosition = shapeLayer.property("ADBE Vector Rect Position");
var rectRoundness = shapeLayer.property("ADBE Vector Rect Roundness");
rectSize.setValue([600, 400]);
rectPosition.setValue([0.0, -90]);
rectRoundness.setValue(10);


ESTK throws an error stating, "null is not an object" at this line

rectSize.setValue([600, 400]);

and the code terminates execution. How can I solve this to achieve what I am looking for. Kindly, Help!!


Thanks in advance,
Krishna


Return to posts index

Dan Ebberts
Re: Shape layer property customization via ExtendScript
on Nov 8, 2016 at 1:45:52 pm

This should work:

var pipComp = app.project.activeItem;
var shapeLayer = pipComp.layers.addShape(); // adding a shape layer to the pipComp
var contents = shapeLayer.property("ADBE Root Vectors Group"); // Accessing the contents of the shape layer
var shapeRect = contents.addProperty("ADBE Vector Shape - Rect"); // Adding a rectangle to the shape layer
var shapeFill = contents.addProperty("ADBE Vector Graphic - Fill");
shapeRect = contents.property("ADBE Vector Shape - Rect"); // adding fill invalidates shapeRect
var rectSize = shapeRect.property("ADBE Vector Rect Size");
var rectPosition = shapeRect.property("ADBE Vector Rect Position");
var rectRoundness = shapeRect.property("ADBE Vector Rect Roundness");
rectSize.setValue([600, 400]);
rectPosition.setValue([0.0, -90]);
rectRoundness.setValue(10);


Dan



Return to posts index

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