I manage to obtain the result that I wanted by checking if the layer is 2D or 3D and manually targeting scale, position and anchor point. But if I select an effect’s property, I still have to figure out how to let the script know about it. Right now I’m manually putting the index of the effect’s property.
Here’s what I have so far:
function getPropertyValuesCount() {
var activeItem = app.project.activeItem;
if (!activeItem || !(activeItem instanceof CompItem)) {
alert("Please select a composition.");
return;
}
var selectedLayers = activeItem.selectedLayers;
if (selectedLayers.length === 0) {
alert("Please select a layer.");
return;
}
var selectedProperties = selectedLayers[0].selectedProperties;
if (selectedProperties.length === 0) {
alert("Please select a property.");
return;
}
var property = selectedProperties[0];
var layer = selectedLayers[0];
var valuesCount = 0;
var is3DLayer = layer.threeDLayer;
var isEffectProperty = property.propertyGroup(1).matchName.indexOf("ADBE Effect Parade");
if (property.propertyValueType !== PropertyValueType.NO_VALUE) {
try {
if (property.value && property.value.length) {
valuesCount = property.value.length;
// Check if the layer is 2D and the selected property is either Position or Scale
if (!is3DLayer && (property.matchName === "ADBE Position" || property.matchName === "ADBE Scale" || property.matchName === "ADBE Anchor Point")) {
valuesCount = 2;
}
// Check if the property is within an effect and has two values
if (isEffectProperty && valuesCount === 1 && typeof property.value[1] !== "undefined") {
valuesCount = 2;
}
} else {
valuesCount = 1;
}
} catch (e) {
alert(e.message);
return;
}
} else {
alert("The selected property has no value.");
return;
}
alert(valuesCount);
}
getPropertyValuesCount();