PropertyGroup object¶
app.project.item(index).layer(index).propertyGroupSpec
Description
The PropertyGroup object represents a group of properties. It can contain Property objects and other PropertyGroup objects. Property groups can be nested to provide a parent-child hierarchy, with a Layer object at the top (root) down to a single Property object, such as the mask feather of the third mask. To traverse the group hierarchy, use PropertyBase methods and attributes; see PropertyBase.propertyGroup(). For examples of how to access properties and property groups, see PropertyBase object.
PropertyGroup is a subclass of PropertyBase. All methods and attributes of PropertyBase, in addition to those listed below, are available when working with PropertyGroup.
PropertyGroup is a base class for Layer and MaskPropertyGroup. PropertyGroup attributes and methods are available when working with layer or mask groups.
Attributes¶
PropertyGroup.numProperties¶
app.project.item(index).layer(index).propertyGroupSpec.numProperties
Description
The number of indexed properties in this group.
For layers, this method returns a value of 3, corresponding to the mask, effect, and motion tracker groups, which are the indexed groups within the layer.
However, layers also have many other properties available only by name; see PropertyGroup.property().
Type
Integer; read-only.
Methods¶
PropertyGroup.addProperty()¶
app.project.item(index).layer(index).propertyGroupSpec.addProperty(name)
Description
Creates and returns a PropertyBase object with the specified name, and adds it to this group.
In general, you can only add properties to an indexed group (a property group that has the type PropertyType.INDEXED_GROUP
; see PropertyBase.propertyType).
The only exception is a text animator property, which can be added to a named group (a property group that has the type PropertyType.NAMED_GROUP
).
If this method cannot create a property with the specified name, it generates an exception.
To check that you can add a particular property to this group, call canAddProperty
before calling this method. (See PropertyGroup.canAddProperty().)
Warning
When you add a new property to an indexed group, the indexed group gets recreated from scratch, invalidating all existing references to properties.
One workaround is to store the index of the added property with property.propertyIndex.
Examples
This won’t work, as the slider object becomes invalid once we add the Color Control property:
var effectsProperty = layer.property("ADBE Effect Parade"); var slider = effectsProperty.addProperty("ADBE Slider Control"); var color = effectsProperty.addProperty("ADBE Color Control"); var sliderProperty = slider.property("ADBE Slider Control-0001"); // Object 'slider' is Invalid
This revised method will work:
var effectsProperty = layer.property("ADBE Effect Parade"); var slider = effectsProperty.addProperty("ADBE Slider Control"); var sliderIndex = slider.propertyIndex; // Store 'slider' effect index so it can be reused later var color = effectsProperty.addProperty("ADBE Color Control"); var sliderProperty = effectsProperty.property(sliderIndex).property("ADBE Slider Control-0001");
Parameters
|
The display name or match name of the property to add. (See PropertyBase.matchName). The following names are supported:
|
Returns
PropertyGroup.canAddProperty()¶
app.project.item(index).layer(index).propertyGroupSpec.canAddProperty(name)
Description
Returns true if a property with the given name can be added to this property group.
For example, you can only add mask to a mask group. The only legal input arguments are “mask” or “ADBE Mask Atom”.
maskGroup.canAddProperty("mask"); // returns true
maskGroup.canAddProperty("ADBE Mask Atom"); // returns true
maskGroup.canAddProperty("blend"); // returns false
Parameters
|
The display name or match name of the property to be checked. (See PropertyGroup.addProperty(). |
Returns
Boolean.
PropertyGroup.property()¶
app.project.item(index).layer(index).propertyGroupSpec.property(index)
app.project.item(index).layer(index).propertyGroupSpec.property(name)
Description
Finds and returns a child property of this group, as specified by either its index or name. A name specification can use the same syntax that is available with expressions. The following are all allowed and are equivalent:
mylayer.position;
mylayer("position");
mylayer.property("position");
mylayer(1);
mylayer.property(1);
Some properties of a layer, such as position and zoom, can be accessed only by name. When using the name to find a property that is multiple levels down, you must make more than one call to this method.
For example, the following call searches two levels down, and returns the first mask in the mask group: myLayer.property("ADBE Masks").property(1)
Parameters
|
The index for the child property, in this is an indexed group. An integer in the range [1..numProperties]. |
|
The name of the child property. This can be:
For supported property names, see the table below. |
Returns
PropertyBase object or null if no child property with the specified string name is found.
Properties accessible by name
From any Layer |
|
From an AVLayer |
|
From an AVLayer with a non-still source |
|
From an AVLayer with an audio component |
|
From a camera layer |
|
From a light layer |
|
From a 3D layer |
|
From a camera, light or 3D layer |
|
From a text layer |
|
From a PropertyGroup “ADBE Mask Parade” |
|
From a PropertyGroup “ADBE Mask Atom” |
|
Examples
If a layer named “myLayer” has a Box Blur effect, you can retrieve the effect in any of the following ways:
myLayer.property("Effects").property("Box Blur"); myLayer.property("Effects").property("boxBlur"); myLayer.property("Effects").property("ADBE Box Blur");
If a layer named “myLayer” has a mask named “Mask 1” you can retrieve it as follows:
myLayer.property("Masks").property("Mask1");
To get a Bulge Center value from a Bulge effect, you can use either of the following:
myLayer.property("Effects").property("Bulge").property("Bulge Center"); myLayer.property("Effects").property("Bulge").property("bulgeCenter");