Script for switching active cameras [SOLVED]

On 18/08/2015 at 18:47, xxxxxxxx wrote:

Is there any way to programmatically select a camera and set it to active view?

I'm looking for the script property that relates to the little target button which allows you to look through a camera rather than the default editor camera. I'm sure there has to be a property that distinguishes whether it's on or not I but haven't been able to find any information about it, so I'm not sure if we have access to it or not.

On 19/08/2015 at 06:18, xxxxxxxx wrote:

On 19/08/2015 at 06:19, xxxxxxxx wrote:

Look at the code I just posted in 'Command line parameter problem'. I think you answer is in there 🙂

On 19/08/2015 at 09:33, xxxxxxxx wrote:


welcome to the PluginCafe forums.
Here's a small script switching to a selected camera (or editor camera, if none selected).

import c4d
from c4d import gui
def main() :
    cam = doc.GetActiveObject()
    bd = doc.GetActiveBaseDraw()
    if (cam.GetType() != c4d.Ocamera) :
        cam = None # switch to editor camera, if no camera selected
if __name__=='__main__':

On 22/08/2015 at 21:44, xxxxxxxx wrote:

Thank you Andreas!

SetSceneCamera() is exactly what I was looking for, I knew it had to be there but for some reason I couldn't find it.

😕 🙂