I am writing some scene assembly tool using C4D and c4dpy.
I am bringing in Alembic cameras and other geometry assets.
On the commandline.exe, there is no option to specify which camera I can render with so I am wondering if there is some python call I need to make to the C4D document before saving so that when I render the file, it knows which camera to use ?
I might be misunderstanding something here, but you can simply attach a camera to the render BaseDraw (which by default is the Perspective view port). See my example at the end of the post. You could also try to trigger the little active camera toggle option of the camera node, but if I remember correctly, this is not represented by BIT_ACTIVE like for a generator object, but in some weird special way. I know that it has been discussed on the old forum.
"""Simple example for creating a new render camera.
Run this in the script manager, it will create a new camera and set it as
the render camera.
# Get the render BaseDraw
bd = doc.GetRenderBaseDraw()
if not isinstance(bd, c4d.BaseDraw):
raise IOError("Could not access render BaseDraw.")
# Create a new camera object,
camera = c4d.BaseList2D(c4d.Ocamera)
if camera is None:
raise MemoryError("Could not instantiate camera object.")
# Inject the camera into the document and set it as the new render
if __name__ == "__main__":
You could use a Stage object and link the desired camera?
Stage[c4d.STAGEOBJECT_CLINK] = ...
The proper way, as pointed out by @zipit, to set the scene active camera is to use BaseDraw::SetSceneCamera(). Any other special weird way are needed or recommended.
without further feedback, we will consider this thread as solved by Wednesday and flag it accordingly.