Page 1 of 1
Get layer from selected property?
Posted: July 5th, 2011, 12:58 pm
by byronnash
How can I determine what layer a property is applied to? I have tried the .parentProperty attribute but I can't seem to get it to work. Anyone have any pointers on this? Thanks.
Re: Get layer from selected property?
Posted: July 5th, 2011, 1:33 pm
by byronnash
OK, I found the answer. I wasn't going up high enough in the hierarchy. You can stack the parentProperty attribute.
Code: Select all
var comp = app.project.activeItem;
var mask = comp.selectedProperties[0];
maskLayer = mask.parentProperty.parentProperty;
Re: Get layer from selected property?
Posted: July 7th, 2011, 4:54 am
by Paul Tuersley
You can also navigate back down the property heirarchy using property.propertyGroup(). This will give you the layer object from any property:
Code: Select all
theProperty.propertyGroup(theProperty.propertyDepth)
Re: Get layer from selected property?
Posted: July 7th, 2011, 6:38 am
by byronnash
Thanks Paul, that is good to know.