-
Is there a scripting equivalent to reveal a layers position property? Like the shortcut “P”? – AE Scripting
I’ve hit a wall on this one.
I’m making some custom scripts. This one is a simple camera rig. It works fine but I wanted to add some functionality to it to save myself a few clicks.
Once the layers have been created, I’d like them to reveal certain properties in the UI.Question 1:
Is there a scripting equivalent to the keyboard shortcut “P”?… Or similar shortcuts to reveal a layers Transform Properties?Question 2:
Can you programmatically create a One-Node Camera instead of the default Two-Node Camera?
I went through the AE scripting guide and found no way of setting the type of Camera.Any help is much appreciated.
Thanks in advance.
-Jasonvar myComp = app.project.activeItem;
if (myComp != null && (myComp instanceof CompItem)){var w = myComp.width /2;
var h = myComp.height /2;
var newCamera = myComp.layers.addCamera("Camera", [w,h]); //make a new camera
newCamera.position.setValue([w,h,-1900]);
var myLayer = myComp.selectedLayers;
if (myLayer) {
var PosNull = myComp.layers.addNull();
PosNull.source.name = "Cam_Pos";
PosNull.threeDLayer = true;
PosNull.position.setValue([w,h]);
PosNull.enabled = true;var RotNull = myComp.layers.addNull();
RotNull.source.name = "Cam_Rot";
RotNull.threeDLayer = true;
RotNull.position.setValue([w,h]);
RotNull.enabled = true;newCamera.parent = PosNull; //parenting
PosNull.parent = RotNull;var Lock3D = '[0,0,0]'; //lock unwanted properties
var Lock1D = '[0]';
var LockScale = '[100,100,100]';RotNull.anchorPoint.expression = Lock3D;
RotNull.position.expression = Lock3D;
RotNull.scale.expression = LockScale;PosNull.anchorPoint.expression = Lock3D;
PosNull.scale.expression = LockScale;
PosNull.orientation.expression = Lock3D;
PosNull.xRotation.expression = Lock1D;
PosNull.yRotation.expression = Lock1D;
PosNull.zRotation.expression = Lock1D;/* PosNull.position.selected = true; //Selecting works, but Layer does not twirl down
RotNull.orientation.selected = true;
RotNull.xRotation.selected = true;
RotNull.yRotation.selected = true;
RotNull.zRotation.selected = true; */} else {
alert("Please select at least one layer");
}
} else {
alert("Please select an active comp to use this script");
}