Copy link to clipboard
Copied
In AE I'm getting the error 'Can not “set value” with this property, because the property or a parent property is hidden.'
When trying to move a layer like this:
var theComp = app.project.activeItem;
for (var i = 1; i <= theComp.numLayers; i++) {
var curLayer = theComp.layer(i)
if (!curLayer.parent) {
var layerPos = curLayer.transform.position.value;
$.writeln("pos: ")
$.writeln(layerPos[0] + ", " + layerPos[1] + ", " + layerPos[2])
var moveX = 285
var moveY = 239
curLayer.transform.xPosition.setValue(layerPos[0] - moveX);
}
}
I am getting the same error as in https://community.adobe.com/t5/after-effects/after-effects-error-can-not-set-value-with-this-propert...
even though it seems like I am using the solution from that answer.
Any idea what I might be missing?
Copy link to clipboard
Copied
I copied the code from the other answer and it magically worked. So no need to reply. Thank you.
Copy link to clipboard
Copied
Additional remark: If you want your code to work with both layers whose dimensions are separated AND layer where this is not the case, make sure to check position.dimensionsSeparated to know if the dimensions are separated or not (and then set either the position or the x and y position props accordingly)
https://ae-scripting.docsforadobe.dev/properties/property/#property-dimensionsseparated