Camera Iris Shape and Iris Rotation

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
Hans Meiser
Posts: 3
Joined: August 14th, 2012, 1:33 pm

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?
dfred
Posts: 29
Joined: July 23rd, 2010, 11:49 pm

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';
Hans Meiser
Posts: 3
Joined: August 14th, 2012, 1:33 pm

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?
dfred
Posts: 29
Joined: July 23rd, 2010, 11:49 pm

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
Hans Meiser
Posts: 3
Joined: August 14th, 2012, 1:33 pm

Thank you dfred, this makes it a lot more clearer.
Paul Tuersley
Posts: 704
Joined: June 5th, 2004, 7:59 am
Location: London, UK

This script is very useful for finding the correct property paths:
http://www.redefinery.com/ae/view.php?i ... mePropPath
Post Reply