Need help with C4D Python - Change camera view to camera from editor cam


#1

Hey yall, i’ve run into a wall here.
I’m writing a Python script to generate a new camera with specific settings, and then to change from the default “editor cam” over to the new generated camera.
It’s setting the new camera as the active scene camera, i’m having issues with.
Most likely, i don’t understand “SetSceneCamera”.

I’ve written:
MainCam = c4d.BaseObject(c4d.0camera)
doc.InsertObject(MainCam)

c4d.BaseDraw.SetSceneCamera(MainCam)

Here it gives an error and says that SetSceneCamera doesn’t apply to a “c4d.CameraObject” object.

Can anyone help me out with this one? Thanks :slight_smile:


#2
MainCam = c4d.BaseObject(c4d.Ocamera)
doc.InsertObject(MainCam)

bd = doc.GetActiveBaseDraw()
bd.SetSceneCamera(MainCam)

c4d.EventAdd()