About
A CameraObject represents a camera in Cinema 4D. It is based on BaseObject (see BaseObject Manual).
CameraObject objects are an instance of Ocamera
.
Access
A CameraObject is typically obtained from a BaseDraw representing a viewport window. This BaseDraw is obtained from the a BaseDocument.
See also BaseDocument Editor Windows.
if (bd == nullptr)
if (camera == nullptr)
if (camera == nullptr)
Definition: c4d_basedraw.h:754
BaseObject * GetEditorCamera()
Definition: c4d_basedraw.h:874
BaseObject * GetSceneCamera(const BaseDocument *doc)
Definition: c4d_basedraw.h:835
String GetName() const
Definition: c4d_baselist.h:2381
Definition: c4d_baseobject.h:225
Definition: string.h:1235
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:67
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:210
const char * doc
Definition: pyerrors.h:226
- Note
- Cinema 4D can use any object as a "camera" so the returned BaseObject may or may not be a CameraObject. One can check if it is a CameraObject with C4DAtom::IsInstanceOf().
Also a generator can contain a CameraObject. To get the real camera from that generator a message has to be sent to that generator:
PyObject * obj
Definition: complexobject.h:60
#define MSG_GETREALCAMERADATA
Sent to get a real camera object from a generator. The corresponding data is GetRealCameraData.
Definition: c4d_baselist.h:569
Message struct for the MSG_GETREALCAMERADATA message.
Definition: c4d_baselist.h:883
BaseObject * res
Set a camera object to provide a real camera for a generator.
Definition: c4d_baselist.h:889
Allocation/Deallocation
CameraObject objects are created with the usual tools:
A new or existing camera can be set as the active scene camera:
if (camera == nullptr)
doc->InsertObject(camera,
nullptr,
nullptr);
camera->
SetName(
"The new camera"_s);
if (bd)
void SetSceneCamera(BaseObject *op, Bool animate=false)
Definition: c4d_basedraw.h:842
void SetName(const maxon::String &name)
Definition: c4d_baselist.h:2387
void SetMg(const Matrix &m)
Definition: c4d_baseobject.h:488
Definition: c4d_baseobject.h:1266
static CameraObject * Alloc()
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:145
Properties
The parameters of a CameraObject are edited as usual with C4DAtom::GetParameter() and C4DAtom::SetParameter(). The parameter IDs are defined in Ocamera.h
.
- Warning
- Some parameters of the camera are "virtual" (CAMERAOBJECT_FOV and CAMERAOBJECT_FOV_VERTICAL) and cannot be accessed in any situation.
For some parameters dedicated functions exist.
Projection
These functions access the camera projection setting:
Bool SetProjection(Int32 projection)
#define Ocamera
Camera - CameraObject.
Definition: ge_prepass.h:1036
@ Pparallel
Definition: ocamera.h:10
Zoom
These functions set the camera zoom value:
Offset
These functions set the camera position. This is the midpoint for orthogonal projections (Front/Back/Top/Bottom etc.).
- Note
- This is the same as setting the position with BaseObject::SetAbsPos().
Aperture
These functions set the camera aperture value:
Focus
These functions set the camera focus value:
Stereoscopic Camera
A CameraObject can also store information about the stereoscopic cameras it represents.
The stereo camera information is stored in a StereoCameraInfo structure object:
if (bd == nullptr)
{
}
Py_ssize_t i
Definition: abstract.h:645
Bool StereoGetCameraInfo(BaseDocument *doc, BaseDraw *bd, RenderData *rd, Int32 n, StereoCameraInfo &info, Int32 flags) const
Int32 StereoGetCameraCount(BaseDocument *doc, BaseDraw *bd, RenderData *rd, Int32 flags) const
Definition: c4d_basedocument.h:144
maxon::Int32 Int32
Definition: ge_sys_math.h:60
_Py_clock_info_t * info
Definition: pytime.h:197
Stereoscopic camera information.
Definition: c4d_videopostdata.h:343
Further Reading