Page 1 of 1

Camera Iris Shape and Iris Rotation

Posted: August 14th, 2012, 4:47 pm
by Hans Meiser
Hi folks!

I'm new to scripting and expressions in After Effects, but I'm learning.
Now, I wanted to extend the "Simple Camera Rig" based on Maltaanons script and everything went well so far. But now I have two options, I just can't get to work.

I want to define the iris shape and add a control for the iris rotation but I can't get both to work with the properties:

Code: Select all

    // Define Iris Shape
    newCamera.irisShape.setValue("Hexagon"); // Don't work and I don't know the right term to this

    // Add Iris Rotation Dial
    var irisRotValue = controlNull("Effects").addProperty("Angle Control");
    irisRotValue.name = "Iris Rotation";
    irisRotValue.angle.setValue(15);

    // Connect the dial with the property
    irisRotExpression = 'thisComp.layer("Camera Control").effect("Iris Rotation")("Angle")';
    newCamera.irisRotation.expression = irisRotExpression; // This throws an error and I don't know why. Previous options are working this way
Anyone who can give me a hint/solution to this, please?

Re: Camera Iris Shape and Iris Rotation

Posted: August 14th, 2012, 5:03 pm
by dfred
You need a numerical value (Hexagon is 6 because the divider counts as part of the list):

Code: Select all

newCamera.cameraOption.irisShape.setValue(6)
Try this as well:

Code: Select all

irisRotExpression = 'thisComp.layer("Camera Control").effect("Iris Rotation")("Angle").value';

Re: Camera Iris Shape and Iris Rotation

Posted: August 15th, 2012, 1:56 am
by Hans Meiser
Many thanks for the reply, dfred.

The setting for the hexagon worked perfekt. I never thought of using a numeric value, but on the other hand, it makes sense.
Unfortunately, the connect to the iris rotation don't work just with your correction alone.
But since I said, I'm lerning, I thought that maybe the "cameraOption" has to be in the connection as well. So, the adding of the cameraOption brought the correct result:

Code: Select all

newCamera.cameraOption.irisRotation.expression = irisRotExpression;
So, thanks again for putting me on the right track.

I'm not new to programming, but I find scripting in the AE ScriptEditor rather cumbersome because of the lack of hints and missing error explanation. Even more, when one is new to the SE specific terms. Are there any other editors out there that support the AE coding more?

Re: Camera Iris Shape and Iris Rotation

Posted: August 15th, 2012, 9:36 am
by dfred
Ah yes. I guess they can't list everything in the Scripting Guide, but some of the camera options are accessible directly from the camera level, but others are only available through "cameraOption":

Code: Select all

app.project.activeItem.layer("Camera 1").aperture
app.project.activeItem.layer("Camera 1").blurLevel
app.project.activeItem.layer("Camera 1").cameraOption.aperture
app.project.activeItem.layer("Camera 1").cameraOption.blurLevel
app.project.activeItem.layer("Camera 1").cameraOption.depthOfField
app.project.activeItem.layer("Camera 1").cameraOption.focusDistance
app.project.activeItem.layer("Camera 1").cameraOption.highlightGain
app.project.activeItem.layer("Camera 1").cameraOption.highlightSaturation
app.project.activeItem.layer("Camera 1").cameraOption.highlightThreshold
app.project.activeItem.layer("Camera 1").cameraOption.irisAspectRatio
app.project.activeItem.layer("Camera 1").cameraOption.irisDiffractionFringe
app.project.activeItem.layer("Camera 1").cameraOption.irisRotation
app.project.activeItem.layer("Camera 1").cameraOption.irisRoundness
app.project.activeItem.layer("Camera 1").cameraOption.irisShape
app.project.activeItem.layer("Camera 1").cameraOption.zoom
app.project.activeItem.layer("Camera 1").depthOfField
app.project.activeItem.layer("Camera 1").focusDistance
app.project.activeItem.layer("Camera 1").marker
app.project.activeItem.layer("Camera 1").opacity
app.project.activeItem.layer("Camera 1").orientation
app.project.activeItem.layer("Camera 1").pointOfInterest
app.project.activeItem.layer("Camera 1").position
app.project.activeItem.layer("Camera 1").scale
app.project.activeItem.layer("Camera 1").transform.appearsInReflections
app.project.activeItem.layer("Camera 1").transform.opacity
app.project.activeItem.layer("Camera 1").transform.orientation
app.project.activeItem.layer("Camera 1").transform.pointOfInterest
app.project.activeItem.layer("Camera 1").transform.position
app.project.activeItem.layer("Camera 1").transform.scale
app.project.activeItem.layer("Camera 1").transform.xPosition
app.project.activeItem.layer("Camera 1").transform.xRotation
app.project.activeItem.layer("Camera 1").transform.yPosition
app.project.activeItem.layer("Camera 1").transform.yRotation
app.project.activeItem.layer("Camera 1").transform.zPosition
app.project.activeItem.layer("Camera 1").transform.zRotation
app.project.activeItem.layer("Camera 1").xRotation
app.project.activeItem.layer("Camera 1").yRotation
app.project.activeItem.layer("Camera 1").zRotation
app.project.activeItem.layer("Camera 1").zoom

Re: Camera Iris Shape and Iris Rotation

Posted: August 15th, 2012, 11:42 am
by Hans Meiser
Thank you dfred, this makes it a lot more clearer.

Re: Camera Iris Shape and Iris Rotation

Posted: August 16th, 2012, 4:49 pm
by Paul Tuersley
This script is very useful for finding the correct property paths:
http://www.redefinery.com/ae/view.php?i ... mePropPath