Skip to content

Instantly share code, notes, and snippets.

@fusepilot
Last active September 27, 2016 13:34
Show Gist options
  • Save fusepilot/f18599d8c2489b8be1ac to your computer and use it in GitHub Desktop.
Save fusepilot/f18599d8c2489b8be1ac to your computer and use it in GitHub Desktop.
C4D Activate Camera on Frame Tag
import c4d
import re
"""
1. Create python tag on camera and add this code to it.
2. Duplicate tag to other cameras.
3. Rename your camera layers to match the frame you want it be be active on, e.g., cam-1, Camera01, 01.
"""
def main():
cam = op.GetObject()
bd = doc.GetActiveBaseDraw()
frame = doc.GetTime().GetFrame(doc.GetFps())
cam_name = cam.GetName()
cam_frame = int((re.findall('\d+', cam_name))[0])
if frame == cam_frame:
bd.SetSceneCamera(cam)
c4d.EventAdd()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment