BaseDraw Class Reference

#include <c4d_basedraw.h>

Inheritance diagram for BaseDraw:

Detailed Description

Represents a view window that can be drawn into.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.
Warning
The BaseDraw parameters must only be accessed with GetParameter() / SetParameter(), not directly using the data container. GetParameterData() convenience method can be used to get parameters.

Public Member Functions

void GetDrawport (maxon::DrawportRef &drawport) const
 
void GetDrawportContext (maxon::DrawportContextRef &context) const
 
void GetViewportImage (maxon::ImageRef &viewportImage) const
 
void RenderViewportWithoutPostEffects (maxon::ImageRef &image, const maxon::ColorProfile &colorProfile) const
 
- Public Member Functions inherited from BaseView
void GetFrame (Int32 *cl, Int32 *ct, Int32 *cr, Int32 *cb)
 
void GetSafeFrame (Int32 *cl, Int32 *ct, Int32 *cr, Int32 *cb)
 
Matrix GetMg ()
 
Matrix GetMi ()
 
const MatrixGetBaseMatrix () const
 
void SetBaseMatrix (const Matrix &m)
 
Float GetPlanarRotation () const
 
void SetPlanarRotation (Float r)
 
Bool TestPoint (Float x, Float y)
 
Bool TestPointZ (const Vector &p)
 
Bool TestClipping3D (const Vector &mp, const Vector &rad, const Matrix &mg, Bool *clip2d, Bool *clipz)
 
Bool ClipLine2D (Vector *p1, Vector *p2)
 
Bool ClipLineZ (Vector *p1, Vector *p2)
 
Vector WS (const Vector &p) const
 
Vector SW (const Vector &p) const
 
Vector SW_Reference (Float x, Float y, const Vector &wp) const
 
Vector WC (const Vector &p) const
 
Vector CW (const Vector &p) const
 
Vector SC (const Vector &p) const
 
Vector CS (const Vector &p, Bool z_inverse) const
 
Vector WC_V (const Vector &v) const
 
Vector CW_V (const Vector &v) const
 
Vector WS_V (const Vector &v, const Vector &p) const
 
Vector SW_V (const Vector &v, const Vector &p) const
 
Float PW_S (Float z, Bool horizontal) const
 
Float WP_S (Float z, Bool horizontal) const
 
Float PW_W (const Vector &p, Bool horizontal) const
 
Float WP_W (const Vector &p, Bool horizontal) const
 
Bool ZSensitiveNear () const
 
Float ZSensitiveNearClipping () const
 
Bool ZSensitiveFar () const
 
Float ZSensitiveFarClipping () const
 
Vector ProjectPointOnLine (const Vector &p, const Vector &v, Float mouse_x, Float mouse_y, Float *offset=nullptr, Int32 *err=nullptr)
 
Vector ProjectPointOnPlane (const Vector &p, const Vector &v, Float mouse_x, Float mouse_y, Int32 *err=nullptr)
 
Bool BackfaceCulling (const Vector &n, const Vector &p)
 
Int32 GetProjection ()
 
StereoCameraInfoGetStereoInfo () const
 
void GetViewParameter (Vector *offset, Vector *scale, Vector *scale_z) const
 
Int32 GetColorSpace () const
 
- Public Member Functions inherited from BaseList2D
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
String GetName () const
 
void SetName (const maxon::String &name)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot ()
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName ()
 
BaseList2DGetMain () const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot ()
 
GeListHeadGetHiddenShaderRoot ()
 
maxon::NimbusForwardRef GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusForwardRefPrivateGetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::NimbusForwardRef > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
GeListNodeGetPred ()
 
GeListNodeGetDown ()
 
GeListNodeGetUp ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
GeListHeadGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData ()
 
BaseDocumentGetDocument ()
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated ()
 
Int32 GetInfo () const
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 

Static Public Member Functions

static Int32 GetColorSpaceFromDocumentIndex ()
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 

Private Member Functions

 BaseDraw ()
 
 ~BaseDraw ()
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
BaseContainerGetDataInstance ()
 

Get Parameter

GeData GetParameterData (Int32 id)
 

Camera

Bool HasCameraLink ()
 
BaseObjectGetSceneCamera (const BaseDocument *doc)
 
void SetSceneCamera (BaseObject *op, Bool animate=false)
 
BaseObjectGetEnvironmentObject () const
 
BaseObjectGetSkyObject () const
 
BaseObjectGetBackgroundObject () const
 
BaseObjectGetForegroundObject () const
 
BaseObjectGetEditorCamera ()
 
const AtomArrayGetXRefObjects () const
 
Bool DrawsPyro () const
 
Bool DrawsVolume () const
 

Initialization

void InitClipbox (Int32 left, Int32 top, Int32 right, Int32 bottom, Int32 flags)
 
void InitView (BaseContainer *camera, const Matrix &op_m, Float sv, Float pix_x, Float pix_y, Bool fitview)
 
void InitializeView (BaseDocument *doc, BaseObject *cam, Bool editorsv)
 
void InitLegacyDrawport ()
 
void DrawEnd ()
 
static void PrepareActionSelections (const BaseDocument *doc, Bool withChildren)
 

Color/Transparency

Vector GetObjectColor (const BaseDrawHelp *bh, BaseObject *op, Bool lines=false, Bool usedInBaseDraw=true, Int instanceIndex=0) const
 
Vector CheckColor (const Vector &col)
 
void SetTransparency (Int32 trans)
 
Int32 GetTransparency () const
 

Drawing Setup

void SetPen (const Vector &col, Int32 flags=0)
 
void SetPointSize (Float pointsize)
 
Float GetHandleSize (DRAWHANDLE type) const
 
void SetLightList (Int32 mode)
 

Color Conversion

Vector ConvertColor (const Vector &c)
 
Vector ConvertColorReverse (const Vector &c)
 

Z-Buffer/Depth Setup

void LineZOffset (Int32 offset)
 
void SetDepth (Bool enable)
 

Matrix Transform

void SetMatrix_Projection ()
 
void SetMatrix_Screen ()
 
void SetMatrix_Screen (Int32 zoffset)
 
void SetMatrix_Screen (Int32 zoffset, const Matrix4d *m)
 
void SetMatrix_Camera ()
 
void SetMatrix_Matrix (BaseObject *op, const Matrix &mg)
 
void SetMatrix_Matrix (BaseObject *op, const Matrix &mg, Int32 zoffset)
 

2D Drawing

void DrawPoint2D (const Vector &p)
 
void DrawLine2D (const Vector &p1, const Vector &p2)
 
void DrawHandle2D (const Vector &p, DRAWHANDLE type=DRAWHANDLE::SMALL)
 
void DrawCircle2D (Int32 mx, Int32 my, Float rad)
 
void DrawHUDText (Int32 x, Int32 y, const maxon::String &txt)
 
void DrawMultipleHUDText (const maxon::BaseArray< HUDTextEntry > &texts)
 
void SetRedrawHelper (const maxon::DrawportRedrawHelperRef &redrawHelper)
 
const maxon::DrawportRedrawHelperRef & GetRedrawHelper () const
 
const maxon::BaseArray< EditorLight > & GetEditorLights () const
 

3D Drawing

void DrawHandle (const Vector &vp, DRAWHANDLE type, Int32 flags)
 
void DrawHandleWorld (const Vector &vp, const Vector &col, DRAWHANDLE type)
 
void DrawPointArray (Int32 cnt, const Vector32 *vp, const Float32 *vc=nullptr, Int32 colcnt=0, const Vector32 *vn=nullptr)
 
void DrawLine (const Vector &p1, const Vector &p2, Int32 flags)
 
void DrawArc (const Vector &pos, Float radius, Float angle_start, Float angle_end, Int32 subdiv=32, Int32 flags=0)
 
void DrawPoly (const Vector *vp, const Vector *vf, const Vector *vn, Int32 anz, Int32 flags)
 
void DrawTexture (const BaseBitmap *bmp, const Vector *padr4, const Vector *cadr, const Vector *vnadr, const Vector *uvadr, Int32 pntcnt, DRAW_ALPHA alphamode, DRAW_TEXTUREFLAGS flags)
 
void DrawCircle (const Matrix &m)
 
void DrawBox (const Matrix &m, Float size, const Vector &col, Bool wire)
 
void DrawBoundingBox (BaseObject *op, const Matrix &mg, BaseDrawHelp *bh, Bool shading, Vector *colorOverride=nullptr)
 
void DrawPolygon (const Vector *p, const Vector *f, Bool quad)
 
void DrawSphere (const Vector &off, const Vector &size, const Vector &col, Int32 flags)
 
void DrawArrayEnd ()
 

Object Drawing

DRAWRESULT DrawPolygonObject (BaseDrawHelp *bh, BaseObject *op, DRAWOBJECT flags, BaseObject *parent=nullptr, const Vector &col=Vector(.5))
 
DRAWRESULT DrawObject (BaseDrawHelp *bh, BaseObject *op, DRAWOBJECT flags, DRAWPASS drawpass, BaseObject *parent=nullptr, const Vector &col=Vector(.5))
 
void DrawAnimationPath (BaseDocument *doc, BaseObject *op, const Matrix &upmg, Bool showActivation, Bool global, DRAWPASS drawpass, const BaseDrawHelp *bh)
 
void DrawBoxEdges (BaseDocument *doc, BaseObject *op, const Matrix &mg, Bool inversez, Bool inherit, Int32 vis, Bool child)
 
Bool DrawHighlight (BASEDRAW_HIGHLIGHT flags)
 
Bool DrawPostPass ()
 
Bool DrawSceneHook (BaseDocument *doc, BaseDrawHelp *bh, BaseThread *bt, SCENEHOOKDRAW flags, Int32 start=LIMIT< Int32 >::MAX, Int32 end=LIMIT< Int32 >::MIN)
 

Line Strip Drawing

void LineStripBegin ()
 
void LineStripEnd ()
 
void LineStrip (const Vector &vp, const Vector &vc, Int32 flags)
 

Polyline Drawing

Bool InitDrawXORPolyLine ()
 
void FreeDrawXORPolyLine ()
 
void DrawXORPolyLine (const Float32 *p, Int32 cnt)
 
void BeginDrawXORPolyLine ()
 
void EndDrawXORPolyLine (Bool blit)
 

Highlight Pass

Bool GetHighlightPassColor (const BaseDrawHelp &bh, Bool lineObject, Vector &col) const
 

View Undo

void InitUndo (BaseDocument *doc)
 
void DoUndo (BaseDocument *doc)
 

Draw Parameters

void SetDrawParam (Int32 id, const GeData &data)
 
GeData GetDrawParam (Int32 id) const
 

Miscellaneous

void AddMessageHook (BaseDrawMessageHook fn)
 
Bool AddToPostPass (BaseObject *op, BaseDrawHelp *bh)
 
DISPLAYFILTER GetDisplayFilter () const
 
void SetDisplayFilter (DISPLAYFILTER displayFilter)
 
DISPLAYMODE GetReductionMode () const
 
void SetDrawPass (DRAWPASS drawPass)
 
DRAWPASS GetDrawPass () const
 
Bool GetDrawStatistics (maxon::DataDictionary &statistics) const
 
DRAWFLAGS GetDrawFlags () const
 
DISPLAYEDITSTATE GetEditState ()
 
EditorWindowGetEditorWindow ()
 
void GetGridStep (Float &step, Float &fade)
 
const Matrix4dGetViewMatrix (Int32 n)
 
Vector4d ScreenToClipSpace (const Vector &screenCoordinates, Int32 sampleLocation) const
 
Bool IsViewOpen (BaseDocument *doc)
 
void OverrideCamera (StereoCameraInfo *si)
 
Bool PointInRange (const Vector &p, Int32 x, Int32 y, Float range=10.0_f) const
 
void SetClipPlaneOffset (Float o)
 
void SetTexture (BaseBitmap *bm, Bool tile, DRAW_ALPHA alphamode, DRAW_TEXTUREFLAGS flags)
 
DRAW_TEXTUREFLAGS GetPreferredHUDTextureFlags () const
 
Float SimpleShade (const Vector &p, const Vector &n)
 
Bool TestBreak ()
 

Extended GL Mode

Bool IsOpenGL () const
 
Bool IsEnhancedOpenGL () const
 
Int32 GetFrameScreen (Int32 *cl, Int32 *ct, Int32 *cr, Int32 *cb)
 

GPU Renderer

Bool IsMarkedAsGPURenderer ()
 
Bool IsGPURenderer ()
 
Bool IsMarkedAsCPURenderer ()
 
Bool IsCPURenderer ()
 
void SetViewportRender (const maxon::Id &draw, const maxon::Id &pick)
 
void FrameFinished ()
 
void GetViewportRender (maxon::ViewportRenderRef &viewportRender, Bool draw) const
 

Alloc/Free

static BaseDrawAlloc ()
 
static void Free (BaseDraw *&bd)
 

Additional Inherited Members

- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ BaseDraw()

BaseDraw ( )
private

◆ ~BaseDraw()

~BaseDraw ( )
private

Member Function Documentation

◆ GetData()

BaseContainer GetData ( )
private

Internal.

Warning
The BaseDraw parameters must only be accessed with GetParameter() / SetParameter(), not directly using the data container. GetParameterData() convenience method can be used to get parameters.

◆ SetData()

void SetData ( const BaseContainer bc,
Bool  add = true 
)
private

Internal.

Warning
The BaseDraw parameters must only be accessed with GetParameter() / SetParameter(), not directly using the data container. GetParameterData() convenience method can be used to get parameters.

◆ GetDataInstance()

BaseContainer* GetDataInstance ( )
private

Internal.

Warning
The BaseDraw parameters must only be accessed with GetParameter() / SetParameter(), not directly using the data container. GetParameterData() convenience method can be used to get parameters.

◆ GetParameterData()

GeData GetParameterData ( Int32  id)

Convenience method to get parameters.
Here is his simple implementation:

{
GeData t_data;
return t_data;
}
GeData GetParameterData(Int32 id)
Bool GetParameter(const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
Definition: c4d_gedata.h:83
maxon::Int32 Int32
Definition: ge_sys_math.h:60
Represents a level within a DescID.
Definition: lib_description.h:289
Parameters
[in]idA parameter ID. See dbasedraw.h description file.
Returns
The parameter data for id.

◆ Alloc()

static BaseDraw* Alloc ( )
static

Allocates a base draw. Destroy the allocated base draw with Free(). Use AutoAlloc to automate the allocation and destruction based on scope. Private.

Note
Useful for situations when there is no base draw available. It is used for instance in Mograph's Camera shader.
Returns
The allocated base draw, or nullptr if the allocation failed.

◆ Free()

static void Free ( BaseDraw *&  bd)
static

Destructs base draws allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope. Private.

Parameters
[in,out]bdThe base draw to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ HasCameraLink()

Bool HasCameraLink ( )

Checks if the camera link is enabled.

Returns
true if a scene camera is used and false if the editor camera is used.

◆ GetSceneCamera()

BaseObject* GetSceneCamera ( const BaseDocument doc)

Gets the current scene camera from the passed document.

Parameters
[in]docThe document to get the scene camera from. The caller owns the pointed document.
Returns
The scene camera, or nullptr if no scene camera is used.

◆ SetSceneCamera()

void SetSceneCamera ( BaseObject op,
Bool  animate = false 
)

Sets a new scene camera. If op is nullptr, the editor camera is used.

Parameters
[in]opThe new camera.
[in]animatePrivate.

◆ GetEnvironmentObject()

BaseObject* GetEnvironmentObject ( ) const

Gets the environment object, which is at the highest position in the scene hierarchy, visible and enabled.

Since
R19
Returns
The highest environment object.

◆ GetSkyObject()

BaseObject* GetSkyObject ( ) const

Gets the sky object, which is at the highest position in the scene hierarchy, visible and enabled.

Since
R19
Returns
The highest sky object.

◆ GetBackgroundObject()

BaseObject* GetBackgroundObject ( ) const

Gets the background object, which is at the highest position in the scene hierarchy, visible and enabled.

Returns
The highest background object.

◆ GetForegroundObject()

BaseObject* GetForegroundObject ( ) const

Gets the foreground object, which is at the highest position in the scene hierarchy, visible and enabled.

Returns
The highest foreground object.

◆ GetEditorCamera()

BaseObject* GetEditorCamera ( )

Gets the editor camera.

Returns
The editor camera. Guaranteed to never be nullptr.

◆ GetXRefObjects()

const AtomArray& GetXRefObjects ( ) const

Gets all X-Ref objects.

Returns
An array of X-Ref objects.

◆ DrawsPyro()

Bool DrawsPyro ( ) const

Check if there will be a pyro preview drawn

Since
2023.200
Returns
True if there is at least one Pyro preview being drawn

◆ DrawsVolume()

Bool DrawsVolume ( ) const

Check if there will be a shaded volume object drawn

Since
2023.200
Returns
True if there is at least one shaded volume object being drawn

◆ InitClipbox()

void InitClipbox ( Int32  left,
Int32  top,
Int32  right,
Int32  bottom,
Int32  flags 
)

Used to render into a frame buffer with a different resolution than the editor view. Private.

Parameters
[in]leftThe left coordinate of the frame buffer.
[in]topThe top coordinate of the frame buffer.
[in]rightThe right coordinate of the frame buffer.
[in]bottomThe bottom coordinate of the frame buffer.
[in]flagsThe flag INIT_CLIPBOX_ADJUSTGLSIZE can be set.

◆ InitView()

void InitView ( BaseContainer camera,
const Matrix op_m,
Float  sv,
Float  pix_x,
Float  pix_y,
Bool  fitview 
)

Used to render into a frame buffer with a different resolution than the editor view. Private.

Parameters
[in]cameraThe camera's container. The caller owns the pointed container.
[in]op_mThe camera's matrix.
[in]svThe frame's ratio.
[in]pix_xThe frame's X size.
[in]pix_yThe frame's Y size.
[in]fitviewSet to true to fit the view.

◆ InitializeView()

void InitializeView ( BaseDocument doc,
BaseObject cam,
Bool  editorsv 
)

Used after rendering into a frame buffer with a different resolution than the editor view. Private.

Parameters
[in]docThe view's document. The caller owns the pointed document.
[in]camThe view's camera. The caller owns the pointed camera.
[in]editorsvSet to true to retain the view's ratio.

◆ InitLegacyDrawport()

void InitLegacyDrawport ( )

Must be called from an external renderer to make use of the BaseDraw (e.g. for drawing helper lines).

Since
R19.SP2 Private.

◆ DrawEnd()

void DrawEnd ( )

Private.

Since
R19

◆ PrepareActionSelections()

static void PrepareActionSelections ( const BaseDocument doc,
Bool  withChildren 
)
static

Private. Prepares the selected objects for rendering (i.e. sets the BIT_ACTIVESELECTIONDRAW bit).

◆ GetObjectColor()

Vector GetObjectColor ( const BaseDrawHelp bh,
BaseObject op,
Bool  lines = false,
Bool  usedInBaseDraw = true,
Int  instanceIndex = 0 
) const

Gets the wireframe color in the editor for the specified object.
Some types of objects have certain colors. For polygon objects the main color is taken into account.

Parameters
[in]bhThe base draw helper.The caller owns the pointed base draw helper.
[in]opThe object to get the wireframe color. The caller owns the pointed object.
[in]linesIf set to true and the object's color is set to Layer but the object is not assigned to a layer the color set for Shaded Wireframe is used.
Returns
The object color.

◆ CheckColor()

Vector CheckColor ( const Vector col)

Makes sure that a color has at least 15% difference to the background color.

Parameters
[in]colThe original color.
Returns
The new color, adjusted if needed.

◆ SetTransparency()

void SetTransparency ( Int32  trans)

Sets the transparency value for the following polygons drawing. The range is 0 to 255, where 255 is 100% transparent.
Use negative values for true transparencies and positive values for 'dotted' transparencies.

Parameters
[in]transThe transparency.

◆ GetTransparency()

Int32 GetTransparency ( ) const

Gets the current transparency value for polygons drawing. The range is 0 to 255, where 255 is 100% transparent.
Negative values are true transparencies and positive values are 'dotted' transparencies.

Returns
The current transparency.

◆ SetPen()

void SetPen ( const Vector col,
Int32  flags = 0 
)

Sets the pen color for the following drawing operations.

Parameters
[in]colThe new pen color.
[in]flagsFlag SET_PEN_USE_PROFILE_COLOR can be set.

◆ SetPointSize()

void SetPointSize ( Float  pointsize)

Sets the drawn point size.

Parameters
[in]pointsizeThe new point size.

◆ GetHandleSize()

Float GetHandleSize ( DRAWHANDLE  type) const

Gets the point size in pixels for a DRAWHANDLE size.

Parameters
[in]typeHandle type.
Returns
Point size in pixels.

◆ SetLightList()

void SetLightList ( Int32  mode)

Sets the lighting used by the draw functions.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]modeThe lighting mode: BDRAW_SETLIGHTLIST

◆ ConvertColor()

Vector ConvertColor ( const Vector c)

Converts colors from document color to viewport color profile.

Parameters
[in]cThe color to convert (document).
Returns
The converted color (viewport).

◆ ConvertColorReverse()

Vector ConvertColorReverse ( const Vector c)

Converts colors from viewport color to document color profile.

Parameters
[in]cThe color to convert (viewport).
Returns
The converted color (document).

◆ LineZOffset()

void LineZOffset ( Int32  offset)

Sets the current Z buffer offset. Use this to for example draw lines over shaded polygons in front of the screen.
A higher offset value means a higher draw priority in the Z-buffer. For example:

  • shaded polygon (level 0)
  • unselected edges (level 2)
  • selected edges (level 4)
Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]offsetThe new Z-buffer offset.

◆ SetDepth()

void SetDepth ( Bool  enable)

Enables/disables writing to the depth buffer. Private.

Parameters
[in]enabletrue if the depth buffer should be enabled for writing, otherwise false.

◆ SetMatrix_Projection()

void SetMatrix_Projection ( )

Internal.

◆ SetMatrix_Screen() [1/3]

void SetMatrix_Screen ( )

Sets the transformation matrix to screen coordinates, i.e. from (0, 0) to (width, height).

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().

◆ SetMatrix_Screen() [2/3]

void SetMatrix_Screen ( Int32  zoffset)

Sets the transformation matrix to screen coordinates, i.e. from (0, 0) to (width, height).

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]zoffsetSets the current Z buffer offset. Use this to for example draw lines over shaded polygons in front of the screen.
A higher zoffset value means a higher draw priority in the Z buffer. For example:
  • shaded polygon (level 0)
  • unselected edges (level 2)
  • selected edges (level 4)

◆ SetMatrix_Screen() [3/3]

void SetMatrix_Screen ( Int32  zoffset,
const Matrix4d m 
)

Private.

◆ SetMatrix_Camera()

void SetMatrix_Camera ( )

Sets the transformation matrix to the camera system.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().

◆ SetMatrix_Matrix() [1/2]

void SetMatrix_Matrix ( BaseObject op,
const Matrix mg 
)

Sets the transformation matrix to the given matrix mg.
The transformation matrix should transform coordinates passed to the draw functions into world coordinates.
For example for an object generator with local handle vectors the global matrix, or even better the matrix returned by BaseDrawHelp::GetMg(), should be used.
In case of a particle system, which calculates all its particles in global space, a unit matrix can be passed because the vectors are already in global space. Basically the matrix that transforms the vectors into global space should be passed.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]opA scene object or nullptr. If an object pointer is passed this is used to compare with an internal pointer to the last passed object pointer.
If the pointers differ no matrix comparison is required internally. Used for performance reasons. The caller owns the pointed object.
[in]mgThe new transformation matrix.

◆ SetMatrix_Matrix() [2/2]

void SetMatrix_Matrix ( BaseObject op,
const Matrix mg,
Int32  zoffset 
)

Sets the transformation matrix to the given matrix mg.
The transformation matrix should transform coordinates passed to the draw functions into world coordinates.
For example for an object generator with local handle vectors the global matrix, or even better the matrix returned by BaseDrawHelp::GetMg(), should be used.
In case of a particle system, which calculates all its particles in global space, a unit matrix can be passed because the vectors are already in global space. Basically the matrix that transforms the vectors into global space should be passed.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]opA scene object or nullptr. If an object pointer is passed this is used to compare with an internal pointer to the last passed object pointer.
If the pointers differ no matrix comparison is required internally. Used for performance reasons. The caller owns the pointed object.
[in]mgThe new transformation matrix.
[in]zoffsetSets the current Z buffer offset. Use this to for example draw lines over shaded polygons in front of the screen.
A higher zoffset value means a higher draw priority in the Z buffer. For example:
  • shaded polygon (level 0)
  • unselected edges (level 2)
  • selected edges (level 4)

◆ DrawPoint2D()

void DrawPoint2D ( const Vector p)

Draws a one-pixel point in the current pen color at p.

Note
Changes the matrix to screen with SetMatrix_Screen() prior to drawing.
Parameters
[in]pA point in screen space coordinate.

◆ DrawLine2D()

void DrawLine2D ( const Vector p1,
const Vector p2 
)

Draws a line in the current pen color between p1 and p2.

Note
Changes the matrix to screen with SetMatrix_Screen() prior to drawing.
Parameters
[in]p1The start point of the line in screen space coordinate.
[in]p2The end point of the line in screen space coordinate.

◆ DrawHandle2D()

void DrawHandle2D ( const Vector p,
DRAWHANDLE  type = DRAWHANDLE::SMALL 
)

Draws a handle at p.

Note
Changes the matrix to screen with SetMatrix_Screen() prior to drawing.
Parameters
[in]pA point in screen space coordinate.
[in]typeThe handle type: DRAWHANDLE

◆ DrawCircle2D()

void DrawCircle2D ( Int32  mx,
Int32  my,
Float  rad 
)

Draws a circle in the current pen color with a radius of rad and the center at (mx, my).

Note
Changes the matrix to screen with SetMatrix_Screen() prior to drawing.
Parameters
[in]mxThe X coordinate of the circle's center in screen space coordinate.
[in]myThe Y coordinate of the circle's center in screen space coordinate.
[in]radThe circle's radius.

◆ DrawHandle()

void DrawHandle ( const Vector vp,
DRAWHANDLE  type,
Int32  flags 
)

Draws a handle at vp.

Parameters
[in]vpA point. The coordinate must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]typeThe handle type: DRAWHANDLE
[in]flagsThe legacy drawing flags: LEGACY_DRAW_FLAGS, NOCLIP_D or NOCLIP_Z.

◆ DrawHandleWorld()

void DrawHandleWorld ( const Vector vp,
const Vector col,
DRAWHANDLE  type 
)

Draws a handle at vp.

Parameters
[in]vpA point in world coordinate.
[in]colHandle color.
[in]typeThe handle type: DRAWHANDLE

◆ DrawPointArray()

void DrawPointArray ( Int32  cnt,
const Vector32 vp,
const Float32 vc = nullptr,
Int32  colcnt = 0,
const Vector32 vn = nullptr 
)

Draws an array of points with individual colors.

Note
The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
Parameters
[in]cntThe number of points.
[in]vpAn array of point coordinates. The caller owns the pointed array.
[in]vcAn array of point color elements. The caller owns the pointed array.
[in]colcntThe number of color elements, for example 3 for RGB.
[in]vnReserved for future use. The caller owns the pointed array.

◆ DrawLine()

void DrawLine ( const Vector p1,
const Vector p2,
Int32  flags 
)

Draws a line in the current pen color between p1 and p2.

Parameters
[in]p1The start point in world space coordinate.
[in]p2The end point in world space coordinate.
[in]flagsThe legacy drawing flags: LEGACY_DRAW_FLAGS, NOCLIP_D or NOCLIP_Z.

◆ DrawArc()

void DrawArc ( const Vector pos,
Float  radius,
Float  angle_start,
Float  angle_end,
Int32  subdiv = 32,
Int32  flags = 0 
)

Draws an arc (section of a circle) in the current pen color at pos.

Parameters
[in]posThe position of the rectangle that defines the arc. The coordinate must be in screen space.
[in]radiusThe arc's radius.
[in]angle_startThe start of the angle in radians.
[in]angle_endThe end of the angle in radians.
[in]subdivThe range between angle_start and angle_end is divided into subdiv line segments.
[in]flagsThe legacy drawing flags: LEGACY_DRAW_FLAGS, NOCLIP_D or NOCLIP_Z.

◆ DrawPoly()

void DrawPoly ( const Vector vp,
const Vector vf,
const Vector vn,
Int32  anz,
Int32  flags 
)

Draws a colored and shaded polygon using the points in vp, the colors in vf and the normals in vn.
Only triangles and quadrangles are accepted. The colors are interpolated between the points. The shading is determined by SetLightList().

Note
The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
Parameters
[in]vpAn array of point coordinates. The caller owns the pointed array.
[in]vfAn array of point colors. The caller owns the pointed array.
[in]vnAn array of point normals. The caller owns the pointed array.
[in]anzThe number of points. Must be either 3 (for triangles) or 4 (for quadrangles).
[in]flagsThe legacy drawing flags: LEGACY_DRAW_FLAGS, NOCLIP_D or NOCLIP_Z.

◆ DrawTexture()

void DrawTexture ( const BaseBitmap bmp,
const Vector padr4,
const Vector cadr,
const Vector vnadr,
const Vector uvadr,
Int32  pntcnt,
DRAW_ALPHA  alphamode,
DRAW_TEXTUREFLAGS  flags 
)

Draws a colored and shaded texture polygon using the points in padr4, the colors in cadr, the normals in vnadr and the UV coordinates in uvadr.
Only triangles and quadrangles are accepted. The colors are interpolated between the points and mutiplied with the texture color. The shading is determined by SetLightList(). The texture must live at least until the frame redraw has completed. Otherwise DRAW_TEXTUREFLAGS::TEMPORARY has to be set.

Parameters
[in]bmpThe texture to draw. The caller owns the pointed bitmap.
[in]padr4An array of point coordinates. The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]cadrAn array of colors. Must have 4 items regardless of pntcnt.
[in]vnadrAn array of point normals. Must have 4 items regardless of pntcnt.
[in]uvadrAn array of UV coordinates. Must have 4 items regardless of pntcnt.
[in]pntcntThe number of points in padr4. Must be either 3 (triangle) or 4 (quadrangle).
[in]alphamodeThe alpha channel mode: DRAW_ALPHA
[in]flagsA combination of these flags: DRAW_TEXTUREFLAGS

◆ DrawCircle()

void DrawCircle ( const Matrix m)

Draws an ellipse in the current pen color. The ellipse is specified by the matrix m, where m.v1 and m.v2 are the axis vectors and m.off is the center position. (m.v3 is not used.)

Parameters
[in]mA matrix describing the ellipse. The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

◆ DrawBox()

void DrawBox ( const Matrix m,
Float  size,
const Vector col,
Bool  wire 
)

Draws a box. The eight points of the box are defined as:

p[0] = m * Vector(-size, -size, -size);
p[1] = m * Vector( size, -size, -size);
p[2] = m * Vector( size, -size, size);
p[3] = m * Vector(-size, -size, size);
p[4] = m * Vector(-size, size, -size);
p[5] = m * Vector( size, size, -size);
p[6] = m * Vector( size, size, size);
p[7] = m * Vector(-size, size, size);
const char * m
Definition: abstract.h:692
Py_ssize_t size
Definition: bytesobject.h:86
unsigned char * p
Definition: floatobject.h:87
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:145
Note
To get arbitrary cubic forms, set size to 0.5 and multiply the vectors in the matrix by the length.
Parameters
[in]mA matrix describing the box. The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]sizeThe size of the box.
[in]colThe color of the box.
[in]wireIf true the box is drawn as wireframe.

◆ DrawBoundingBox()

void DrawBoundingBox ( BaseObject op,
const Matrix mg,
BaseDrawHelp bh,
Bool  shading,
Vector colorOverride = nullptr 
)

Draws the bounding box of given BaseObject (op).

Parameters
[in]opBaseObject used to extract the bounding box.
[in]mgGlobal Matrix for the BoundingBox (may differ from op)
[in]bhThe base draw help. The caller owns the pointed base draw help..
[in]shadingIf true the shader is applied
[in]colorOverrideUse specified color. If null, object color is used.

◆ DrawPolygon()

void DrawPolygon ( const Vector p,
const Vector f,
Bool  quad 
)

Draws a manually shaded triangle or quadrangle.
The corner points are given as an array of vectors in p, and the corner colors as a corresponding array of Vectors in f. If quad is false there should be 3 elements in each array, otherwise 4. The colors are interpolated between the corners.

Parameters
[in]pAn array of point coordinates. The caller owns the pointed array. The points coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]fAn array of point colors. The caller owns the pointed array.
[in]quadIf true the number of points must be 4, otherwise it must be 3.

◆ DrawSphere()

void DrawSphere ( const Vector off,
const Vector size,
const Vector col,
Int32  flags 
)

Draws a sphere at position off of size specified by the size vector in each direction and color specified by col.

Parameters
[in]offThe position of the sphere. The point coordinate must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]sizeThe size of the sphere.
[in]colThe color of the sphere.
[in]flagsThe flags: NOCLIP_D or NOCLIP_Z and/or BDRAW_DRAW_SPHERE_FLAGS_NO_SHADING.

◆ DrawArrayEnd()

void DrawArrayEnd ( )

Each DrawPolygon() puts the polygon into an internal array and draws the polygons when the array is full or an OpenGL state changes (e.g. the matrix). DrawArrayEnd() forces this operation.

◆ DrawPolygonObject()

DRAWRESULT DrawPolygonObject ( BaseDrawHelp bh,
BaseObject op,
DRAWOBJECT  flags,
BaseObject parent = nullptr,
const Vector col = Vector(.5) 
)

Draws the polygon object op.

Parameters
[in]bhThe base draw help. The caller owns the pointed base draw help.
[in]opThe polygon object to draw. The caller owns the pointed object.
[in]flagsThe flags: DRAWOBJECT
[in]parentThis is used for the viewport filter.
Take the Floor object for example, it displays a polygon object in the viewport. If parent is set to nullptr the drawn polygon is considered by the viewport filter.
If the Floor object has been passed to parent the Floor object is considered by the viewport filter instead.
[in]colThe object's color.
Returns
The result of drawing the polygon object: DRAWRESULT

◆ DrawObject()

DRAWRESULT DrawObject ( BaseDrawHelp bh,
BaseObject op,
DRAWOBJECT  flags,
DRAWPASS  drawpass,
BaseObject parent = nullptr,
const Vector col = Vector(.5) 
)

Draws the object op.

Parameters
[in]bhThe base draw help. The caller owns the pointed base draw help.
[in]opThe object to draw. The caller owns the pointed object.
[in]flagsThe flags: DRAWOBJECT
[in]drawpassThe draw pass: DRAWPASS
[in]parentThis is used for the viewport filter.
Take the Floor object for example, it displays a polygon object in the viewport. If parent is set to nullptr the drawn polygon is considered by the viewport filter.
If the Floor object has been passed to parent the Floor object is considered by the viewport filter instead.
[in]colThe object's color.
Returns
The result of drawing the object: DRAWRESULT

◆ DrawAnimationPath()

void DrawAnimationPath ( BaseDocument doc,
BaseObject op,
const Matrix upmg,
Bool  showActivation,
Bool  global,
DRAWPASS  drawpass,
const BaseDrawHelp bh 
)

◆ DrawBoxEdges()

void DrawBoxEdges ( BaseDocument doc,
BaseObject op,
const Matrix mg,
Bool  inversez,
Bool  inherit,
Int32  vis,
Bool  child 
)

◆ DrawHighlight()

Bool DrawHighlight ( BASEDRAW_HIGHLIGHT  flags)

Private.

Since
R19

◆ DrawPostPass()

Bool DrawPostPass ( )

Private.

Since
R19

◆ DrawSceneHook()

Bool DrawSceneHook ( BaseDocument doc,
BaseDrawHelp bh,
BaseThread bt,
SCENEHOOKDRAW  flags,
Int32  start = LIMIT<Int32>::MAX,
Int32  end = LIMIT<Int32>::MIN 
)

Private.

Since
R21

◆ LineStripBegin()

void LineStripBegin ( )

Starts a new colored line strip.
Draw several line strip segments with LineStrip() calls and then finish the line strip with LineStripEnd().

◆ LineStripEnd()

void LineStripEnd ( )

Finishes line strips started with LineStripBegin().

◆ LineStrip()

void LineStrip ( const Vector vp,
const Vector vc,
Int32  flags 
)

Draws a line strip from the point vp of the last call to LineStrip() to the current vp. The line strip is colored with a gradient from the last vc to the new vc.

Warning
This method must be enclosed between LineStripBegin() and LineStripEnd() calls.
Parameters
[in]vpThe point coordinate. The coordinate must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().
[in]vcThe point color.
[in]flagsThe legacy drawing flags: LEGACY_DRAW_FLAGS.

◆ InitDrawXORPolyLine()

Bool InitDrawXORPolyLine ( )

Deprecated. Initializes the view to draw XOR poly line (set the correct projection matrices).

See also
Example in DrawXORPolyLine()
Returns
true if successful, otherwise false.

◆ FreeDrawXORPolyLine()

void FreeDrawXORPolyLine ( )

Deprecated. Frees drawing XOR poly line (restore the old projection matrices).

◆ DrawXORPolyLine()

void DrawXORPolyLine ( const Float32 p,
Int32  cnt 
)

Deprecated. Draws a XOR poly line. Example:

Float32* p = nullptr;
points = (Float*)NewMemClear(2*count*sizeof(Float));
if (p==nullptr)
return false;
p[2*0+0] = 0.f;
p[2*0+1] = 0.f;
p[2*1+0] = 100.f;
p[2*1+1] = 100.f;
bd->InitDrawXORPolyLine();
bd->BeginDrawXORPolyLine();
bd->DrawXORPolyLine(points, count);
bd->EndDrawXORPolyLine(false);
bd->FreeDrawXORPolyLine();
Py_ssize_t count
Definition: abstract.h:640
#define NewMemClear(T, cnt)
Definition: defaultallocator.h:204
maxon::Float32 Float32
Definition: ge_sys_math.h:68
maxon::Float Float
Definition: ge_sys_math.h:66
void DeleteMem(T *&p)
Definition: defaultallocator.h:257
Parameters
[in]pThe pointer to the line points array. The format of the array is 2*cnt*sizeof(Float32) (2 Float32 per point).
[in]cntThe number of line points.

◆ BeginDrawXORPolyLine()

void BeginDrawXORPolyLine ( )

Deprecated. Begins drawing an XOR poly line (sets the view's context as current context).

See also
Example in DrawXORPolyLine().

◆ EndDrawXORPolyLine()

void EndDrawXORPolyLine ( Bool  blit)

Deprecated. Ends the drawing of a XOR poly line (makes nullptr the current context).

See also
Example in DrawXORPolyLine().
Parameters
[in]blitSet to true to use blitting.

◆ GetHighlightPassColor()

Bool GetHighlightPassColor ( const BaseDrawHelp bh,
Bool  lineObject,
Vector col 
) const

Gets the color in which the object is to draw in the highlight pass.
If the object is selected or highlighted the function returns true and the color is returned in col.

Note
This function should only be called in the highlight pass.
Parameters
[in]bhThe base draw help.
[in]lineObjectMust be set to true, if the object is a line object.
[in]colAssigned the highlight color.
Returns
true if the object is selected or highlighted and the color col is assigned.
false if drawing the object can be skipped.

◆ InitUndo()

void InitUndo ( BaseDocument doc)

Call before a change is made to the view to add the old setting to the undo buffer for the view. (This undo buffer is separate from the normal undo buffer.)

Parameters
[in]docThe view's document. The caller owns the pointed document.

◆ DoUndo()

void DoUndo ( BaseDocument doc)

Performs an undo operation in the view. This is the same as the user selecting Undo View from within Cinema 4D.

Parameters
[in]docThe view's document. The caller owns the pointed document.

◆ SetDrawParam()

void SetDrawParam ( Int32  id,
const GeData data 
)

Sets draw parameters.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]idThe draw parameter ID: DRAW_PARAMETER
[in]dataThe new draw parameter data to set.

◆ GetDrawParam()

GeData GetDrawParam ( Int32  id) const

Gets draw parameters.

Note
This method only affects the new 3D drawing methods below it, i.e. DrawLine(), LineStrip(), DrawHandle(), DrawPoly(), DrawTexture(), DrawCircle(), DrawBox(), DrawPolygon() and DrawSphere().
Parameters
[in]idThe draw parameter ID: DRAW_PARAMETER
Returns
The draw parameter data.

◆ AddMessageHook()

void AddMessageHook ( BaseDrawMessageHook  fn)

Adds a message hook to the base draw.
This hook is called when the user chooses 'Adapt View', changes the scene camera or if the base draw is deleted. Private.

Parameters
[in]fnThe message hook.

◆ AddToPostPass()

Bool AddToPostPass ( BaseObject op,
BaseDrawHelp bh 
)

Adds the object op to DRAWPASS::XRAY::
Example:

DRAWRESULT MyObject::Draw(BaseObject* op, DRAWPASS drawpass, BaseDraw* bd, BaseDrawHelp* bh)
{
if (drawpass==DRAWPASS::OBJECT)
{
bd->AddToPostPass(op, bh);
ok = true;
}
else if (drawpass==DRAWPASS::XRAY)
{
....
}
}
Definition: c4d_basedraw.h:40
Definition: c4d_basedraw.h:754
Bool AddToPostPass(BaseObject *op, BaseDrawHelp *bh)
Definition: c4d_basedraw.h:1601
Definition: c4d_baseobject.h:225
DRAWPASS
Definition: ge_prepass.h:3504
@ OBJECT
Object pass.
@ XRAY
X-Ray pass.
DRAWRESULT
Definition: ge_prepass.h:4355
PyObject * op
Definition: object.h:520

The object in this example is drawn both in the object and X-ray pass.

Parameters
[in]opThe object to add to the X-ray pass. The caller owns the pointed object.
[in]bhThe base draw helper. The caller owns the pointed base draw helper.
Returns
true if the object was successfully added to the X-ray pass, otherwise false.

◆ GetDisplayFilter()

DISPLAYFILTER GetDisplayFilter ( ) const

Gets the current display filter.
This is a bit field derived from the BASEDRAW_DISPLAYFILTER_* description flags in dbasedraw.h. To set the display filter you have to use the description flags with SetParameter().

Returns
A bit field with the following flags: DISPLAYFILTER

◆ SetDisplayFilter()

void SetDisplayFilter ( DISPLAYFILTER  displayFilter)

Sets the current display filter. Private.

Parameters
[in]displayFilterThe new display filter.

◆ GetReductionMode()

DISPLAYMODE GetReductionMode ( ) const

Gets the reduction mode of the base draw.

Returns
The reduction mode: DISPLAYMODE

◆ SetDrawPass()

void SetDrawPass ( DRAWPASS  drawPass)

Sets the current drawpass.

Parameters
[in]drawPassThe new drawpass: DRAWPASS

◆ GetDrawPass()

DRAWPASS GetDrawPass ( ) const

Gets the current drawpass.

Returns
The current drawpass: DRAWPASS

◆ GetDrawStatistics()

Bool GetDrawStatistics ( maxon::DataDictionary &  statistics) const

Private. Gets drawport geometry statistics.

Parameters
[out]statisticsThe container filled with the statistics: DRAW_STATISTIC
Returns
true if statistics were returned successfully, otherwise false.

◆ GetDrawFlags()

DRAWFLAGS GetDrawFlags ( ) const

Gets the draw flags.

Returns
The draw flags.

◆ GetEditState()

DISPLAYEDITSTATE GetEditState ( )

Gets the current edit state.
This is a bit field derived from the edit state description flags in dbasedraw.res. To set the display filter you have to use the description flags with SetParameter().

Returns
The edit state: DISPLAYEDITSTATE

◆ GetEditorWindow()

EditorWindow* GetEditorWindow ( )

Gets the EditorWindow for this base draw.

Returns
The EditorWindow. Cinema 4D owns the pointed EditorWindow.

◆ GetGridStep()

void GetGridStep ( Float step,
Float fade 
)

Gets the grid spacing and the transparency value of the minor grid that fade when the user zoom in or out with dynamic grid.

Parameters
[out]stepIs assigned the workplane grid spacing.
[out]fadeIs assigned the transparency value of the minor grid.

◆ GetViewMatrix()

const Matrix4d& GetViewMatrix ( Int32  n)

Gets the view matrix.

Parameters
[in]nThe type of view matrix to get: DRAW_GET_VIEWMATRIX
Returns
The view matrix.

◆ ScreenToClipSpace()

Vector4d ScreenToClipSpace ( const Vector screenCoordinates,
Int32  sampleLocation 
) const

Transforms screen space coordinates to clip space. The screen origin is in the upper left corner, the origin of the clip space is in the lower left corner.

Parameters
[in]screenCoordinatesCoordinates in screen space.
Returns
The transformed vector in clip space.

◆ IsViewOpen()

Bool IsViewOpen ( BaseDocument doc)

Checks if a view is open. A view is open if it is anywhere in the layout, i.e. even if it is hidden as a tab or behind another window.

Parameters
[in]docThe document for the operation. The caller owns the pointed document.
Returns
true if a view is open, otherwise false.

◆ OverrideCamera()

void OverrideCamera ( StereoCameraInfo si)

Changes the stereoscopic camera data for this view.

Parameters
[in]siThe stereoscopic camera data to set. The caller owns the pointed StereoCameraInfo.

◆ PointInRange()

Bool PointInRange ( const Vector p,
Int32  x,
Int32  y,
Float  range = 10.0_f 
) const

Checks if the screen point (x,y) is within a hit range of the world point p, i.e. if the screen point is close to the world points projection on the screen.

Parameters
[in]pA point in world space.
[in]xA screen X coordinate.
[in]yA screen Y coordinate.
[in]rangeRange in screen space.
Returns
true if the point is within range, otherwise false.

◆ SetClipPlaneOffset()

void SetClipPlaneOffset ( Float  o)

Offsets the OpenGL clipping planes by this offset.

Parameters
[in]oThe offset.

◆ SetTexture()

void SetTexture ( BaseBitmap bm,
Bool  tile,
DRAW_ALPHA  alphamode,
DRAW_TEXTUREFLAGS  flags 
)

Sets a texture used by the vertex buffer.

Parameters
[in]bmThe texture's bitmap. The caller owns the pointed bitmap.
[in]tileSet to true to enable tiling.
[in]alphamodeThe alpha channel mode: DRAW_ALPHA
[in]flagsThe draw texture flags: DRAW_TEXTUREFLAGS

◆ GetPreferredHUDTextureFlags()

DRAW_TEXTUREFLAGS GetPreferredHUDTextureFlags ( ) const

Gets the preferred texture flags for HUD drawing.

Returns
The preferred texture flags for HUD drawing.

◆ SimpleShade()

Float SimpleShade ( const Vector p,
const Vector n 
)

A quick shading algorithm that only takes the angle to the camera and a default light into account.
A point and a normal in world space are passed and an intensity is returned.

Note
Can be combined with DrawPolygon() to draw simple shaded polygons.
Parameters
[in]pA point in world space.
[in]nA normal in world space.
Returns
The intensity of the light. Between 0 and 1.

◆ TestBreak()

Bool TestBreak ( )

Checks for thread breaks in the draw.

Returns
true if a stopping condition has occurred, otherwise false.

◆ IsOpenGL()

Bool IsOpenGL ( ) const

Extended OpenGL mode. This mode is not documented. See c4d_gl.h for definitions.

◆ IsEnhancedOpenGL()

Bool IsEnhancedOpenGL ( ) const

Extended OpenGL mode. This mode is not documented. See c4d_gl.h for definitions.

◆ GetFrameScreen()

Int32 GetFrameScreen ( Int32 cl,
Int32 ct,
Int32 cr,
Int32 cb 
)

Extended OpenGL mode. This mode is not documented. See c4d_gl.h for definitions.

Returns
-2: no OpenGL window, -1: off-screen view, 0: system error, 1: success.

◆ DrawHUDText()

void DrawHUDText ( Int32  x,
Int32  y,
const maxon::String txt 
)

Draws text into the 2D viewport in the style of the HUD.

Since
R18
Parameters
[in]xThe left X coordinate to draw the text at.
[in]yThe upper Y coordinate to draw the text at.
[in]txtThe text to draw.

◆ DrawMultipleHUDText()

void DrawMultipleHUDText ( const maxon::BaseArray< HUDTextEntry > &  texts)

Draws many HUD text entries at once.

Since
R18
Parameters
[in]textsThe array of text entries and their screen space positions to draw to the HUD.

◆ SetRedrawHelper()

void SetRedrawHelper ( const maxon::DrawportRedrawHelperRef &  redrawHelper)

Sets the redraw helper that is used for all draw operations.

Parameters
[in]redrawHelperThe redraw helper.

◆ GetRedrawHelper()

const maxon::DrawportRedrawHelperRef& GetRedrawHelper ( ) const

Gets the redraw helper that is used for all draw operations.

Returns
The redraw helper.

◆ GetEditorLights()

const maxon::BaseArray<EditorLight>& GetEditorLights ( ) const

Gets the editor lights.

Returns
An array of editor lights.

◆ IsMarkedAsGPURenderer()

Bool IsMarkedAsGPURenderer ( )

Checks if the view is marked as GPU Renderer.

Since
R19
Returns
true if the view is marked to run the GPU Renderer, otherwise false.

◆ IsGPURenderer()

Bool IsGPURenderer ( )

Checks if the view is running the GPU Renderer.

Since
R19
Returns
true if the view is running the GPU renderer, otherwise false.

◆ IsMarkedAsCPURenderer()

Bool IsMarkedAsCPURenderer ( )

Returns true if the basedraw is marked as the CPU Renderer.

Since
R21
Returns
true if The basedraw is marked to run the CPU Renderer., otherwise false.

◆ IsCPURenderer()

Bool IsCPURenderer ( )

Returns true if the basedraw is running the CPU Renderer.

Since
R21
Returns
true if The basedraw is running the CPU renderer., otherwise false.

◆ SetViewportRender()

void SetViewportRender ( const maxon::Id draw,
const maxon::Id pick 
)

Private.

Since
R19

◆ FrameFinished()

void FrameFinished ( )

Private.

Since
R19

◆ GetViewportRender()

void GetViewportRender ( maxon::ViewportRenderRef &  viewportRender,
Bool  draw 
) const

Private.

Since
R19

◆ GetDrawport()

void GetDrawport ( maxon::DrawportRef &  drawport) const

Gets the underlying drawport.

Parameters
[out]drawportThe drawport.

◆ GetDrawportContext()

void GetDrawportContext ( maxon::DrawportContextRef &  context) const

Gets the underlying drawport context.

Parameters
[out]contextThe context.

◆ GetViewportImage()

void GetViewportImage ( maxon::ImageRef &  viewportImage) const

Gets the color framebuffer.

Parameters
[in]viewportImageThe image to write to.

◆ RenderViewportWithoutPostEffects()

void RenderViewportWithoutPostEffects ( maxon::ImageRef &  image,
const maxon::ColorProfile &  colorProfile 
) const

Renders the viewport to a 32 bit ImageRef without post effects.

Parameters
[in]imageThe image to write to.
[in]colorProfileUse this to force a color profile on the returned image. Defaults to current render space if passing an empty profile.

◆ GetColorSpaceFromDocumentIndex()

static Int32 GetColorSpaceFromDocumentIndex ( )
static

Gets the index for the BaseDraw colorspace "Use document settings".

Returns
Colorspace index.