Animation Keys (Y-Setup)
Add this script to a "Batch Script" editor (F10) and execute it with Script > Run.
The script is an extension of → "Camera Operations (Y-Setup)" and works as a batch script instead of a simulation script. The camera positions are cached, translated into animation keys, and added to the → "Curve Editor". The script is for Y-based axis setups. If you have a Z-based axis setup go to → "Animation Keys (Z-Setup)".
# Load Python's math module import math # Get the camera "SceneCamera01" and a focus object "Cube01" # Initialize standard values camera = scene.getCamera("SceneCamera01") focusObject = scene.getObject("Cube01") objectPosition = focusObject.getParameter("Position") frame = scene.getCurrentFrame() radius = 1.5 cycles = 3.0 verticalPosition = 0.5 orientation = 0 positionCache = [] indexCounter = 0  # Create/get the camera's animation curves for XYZ positions curvePosX = camera.getParameterCurve("Position.X") curvePosY = camera.getParameterCurve("Position.Y") curvePosZ = camera.getParameterCurve("Position.Z")  # Make the camera look at the "focusObject" node's position camera.setParameter("LookAt", objectPosition) # Clockwise or counter-clockwise? if (orientation == 0): sign = 1 else : sign = -1 # Define the simulation range simRange = scene.getMaxFrames() - scene.getMinFrame()  # Calculate how many degrees the camera covers within a single frame degPerFrame = (360.0 / simRange) * cycles # Go through the simulation range for i in range(0, simRange + 1):  # Convert the result from degrees to radians radians = (sign * degPerFrame * math.pi / 180.0) * float(i)  # Calculate the XZ coordinates based on the available values xCoord = math.cos(radians) * radius + objectPosition.getX() zCoord = math.sin(radians) * radius + objectPosition.getZ()  # Assemble a position vector and store the values positionCache.append(Vector.new(xCoord, verticalPosition, zCoord)) # Go through the stored position values for entry in positionCache:  # Calculate the current time based on frame and FPS currentTime = float(indexCounter) / scene.getFps()  # Add new keys for XYZ and define their values and key types at the current time keyX = Key.new() keyY = Key.new() keyZ = Key.new()  keyX.time = currentTime keyX.value = entry.x keyX.type = KEY_TYPE_TCB  curvePosX.addKey(keyX) keyY.time = currentTime keyY.value = entry.y keyY.type = KEY_TYPE_TCB  curvePosY.addKey(keyY) keyZ.time = currentTime keyZ.value = entry.z keyZ.type = KEY_TYPE_TCB  curvePosZ.addKey(keyZ)  # Increment the counter indexCounter += 1
Â