c4d.BaseDraw

This class represents a Cinema 4D window and cannot be instantiated.

Definition

class c4d.BaseDraw

Inheritance

Members

BaseDraw.__init__()

New in version R17.053.

Initialize a new base draw.

Note

Useful for situations when there is no base draw available. It is used for instance in Mograph’s Camera shader.

Return type:c4d.BaseDraw
Returns:A new base draw.
BaseDraw.GetParameterData(id)

Get a new parameter object.

Parameters:id (int) – A parameter ID. See the dbasedraw.h description file.
Return type:Any
Returns:The parameter data for id. The type depends on the id.
BaseDraw.GetFrameScreen()

Used in the Extended GL mode. This mode is not documented. See c4d_gl.h for definitions.

Return type:dict{cl: int, ct: int, cr: int, cb: int, }
Returns:A dict or None.

Indicates if the camera link is enabled.

Return type:bool
Returns:True if a scene camera is used, and False if the editor camera is used.
BaseDraw.SetSceneCamera(op=None, animate=False)

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

Parameters:
BaseDraw.GetSceneCamera(doc)

Returns the current scene camera from the passed document, or None if no scene camera is used.

Parameters:doc (c4d.documents.BaseDocument) – The document to get the scene camera from.
Return type:c4d.BaseObject
Returns:The scene camera.
BaseDraw.GetEditorCamera()

Returns the editor camera.

Return type:c4d.BaseObject
Returns:The editor camera. Guaranteed to never be None.
BaseDraw.GetDisplayFilter()

Returns the current display filter. This is a bit field derived from the DISPLAYFILTER values. To set the display filter use the description flags with GeListNode.__setitem__() or C4DAtom.SetParameter().

For instance the following script switches the Filter “Subdivision Surface”:

bd = doc.GetActiveBaseDraw()
displayFilter = bd.GetDisplayFilter()

if displayFilter & c4d.DISPLAYFILTER_HYPERNURBS:
    bd[c4d.BASEDRAW_DISPLAYFILTER_HYPERNURBS] = False
    print "Switched Off Subdivision Surface Display Filter"
else:
    bd[c4d.BASEDRAW_DISPLAYFILTER_HYPERNURBS] = True
    print "Switched On Subdivision Surface Display Filter"

bd.Message(c4d.MSG_CHANGE)
c4d.EventAdd()

Note the difference between the filters “Subdivision Surface” and “SDS Mesh”.

Return type:int
Returns:A bit field with the following flags:
DISPLAYFILTER_NONE None.
DISPLAYFILTER_NULL Null.
DISPLAYFILTER_POLYGON Polygon.
DISPLAYFILTER_SPLINE Spline.
DISPLAYFILTER_GENERATOR Generator.
DISPLAYFILTER_HYPERNURBS Subdivision Surface.
DISPLAYFILTER_UNUSED1 Unused.
DISPLAYFILTER_DEFORMER Deformer.
DISPLAYFILTER_CAMERA Camera.
DISPLAYFILTER_LIGHT Light.
DISPLAYFILTER_SCENE Scene.
DISPLAYFILTER_PARTICLE Particle.
DISPLAYFILTER_OTHER Other.
DISPLAYFILTER_GRID Grid.
DISPLAYFILTER_HORIZON Horizon.
DISPLAYFILTER_WORLDAXIS World axis.
DISPLAYFILTER_BOUNDS Bounding-box.
DISPLAYFILTER_HUD HUD.
DISPLAYFILTER_SDS HN mesh.
DISPLAYFILTER_HIGHLIGHTING Highlighting.
DISPLAYFILTER_MULTIAXIS Multi-select axis.
DISPLAYFILTER_OBJECTHANDLES Highlight handles.
DISPLAYFILTER_HANDLEBANDS Axis bands.
DISPLAYFILTER_SDSCAGE HN cage.
DISPLAYFILTER_NGONLINES N-gon lines.
DISPLAYFILTER_JOINT Joint objects.
DISPLAYFILTER_OBJECTHIGHLIGHTING Private.
DISPLAYFILTER_GUIDELINES Axis Guidelines.
DISPLAYFILTER_POI Navigation cross.
DISPLAYFILTER_GRADIENT Gradient.
DISPLAYFILTER_BASEGRID Base grid.
DISPLAYFILTER_HANDLES Handles.
BaseDraw.GetEditState()

Get the edit state. This is a bit field derived from the the edit state description flags in dbasedraw.h. To set the display filter use the description flags with GeListNode.__setitem__() or C4DAtom.SetParameter().

Return type:int
Returns:A bit field with the following flags:
DISPLAYEDITSTATE_NONE None.
DISPLAYEDITSTATE_SDS SDS edit state.
DISPLAYEDITSTATE_DEFORM Deformed edit state.
DISPLAYEDITSTATE_DOCUMENT Document edit state.
BaseDraw.IsViewOpen(doc)

Checks if the current tool can use the curent SDS/Deformed editing state.

Parameters:doc (c4d.documents.BaseDocument) – The current document.
Return type:bool
Returns:True if the view is open, otherwise False.
BaseDraw.InitializeView(doc, cam, editorsv)

Used after rendering into a framebuffer with different resolution than the editor view.

Parameters:
BaseDraw.InitClipbox(left, top, right, bottom, flags)

Used to render into a framebuffer with different resolution than the editor view.

Parameters:
  • left (int) – Left coordinate of the framebuffer.
  • top (int) – Top coordinate of the framebuffer.
  • right (int) – Right coordinate of the framebuffer.
  • bottom (int) – Bottom coordinate of the framebuffer.
  • flags (int) –

    Flags:

    INIT_CLIPBOX_ADJUSTGLSIZE Adjust the size of the frame buffer.
BaseDraw.InitView(camera, op_m, sv, pix_x, pix_y, fitview)

Used to render into a framebuffer with different resolution than the editor view.

Parameters:
  • camera (c4d.BaseContainer) – The camera’s container.
  • op_m (c4d.Matrix) – The camera’s matrix.
  • sv (float) – The frame’s ratio.
  • pix_x (float) – The frame’s X size.
  • pix_y (float) – The frame’s Y size.
  • fitview (bool) – Set this to True to fit the view.
BaseDraw.AddToPostPass(op, bh)

Adds the object op to DRAWPASS_XRAY. For example:

def Draw(self, op, drawpass, bd, bh):
  if drawpass==c4d.DRAWPASS_OBJECT:
    bd.AddToPostPass(op, bh)
    ok = True
  elif drawpass==c4d.DRAWPASS_XRAY:
    ok = True

  if ok==False:
    return c4d.DRAWRESULT_OK

The object in this example is drawn both in regular and X-ray passes.

Note

This example is only relevant to ObjectData plugins.

Parameters:
Return type:

bool

Returns:

True if successful, otherwise False.

BaseDraw.GetObjectColor(bh, op)

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

Parameters:
Return type:

c4d.Vector

Returns:

The object color.

BaseDraw.CheckColor(col)

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

Parameters:col (c4d.Vector) – The original vector.
Return type:c4d.Vector
Returns:The new color, adjusted if needed.
BaseDraw.SetTransparency(trans)

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

Parameters:trans (int) – The transparency.
BaseDraw.GetTransparency()

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

Return type:int
Returns:The transparency.
BaseDraw.PointInRange(p, x, y)

Returns True 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:
  • p (c4d.Vector) – A point in world space.
  • x (int) – Screen x coordinate.
  • y (int) – Screen y coordinate.
Return type:

bool

Returns:

True if the point is within range, otherwise True.

BaseDraw.SetPen(col, flags=0)

Sets the pen color for following drawing operations.

Parameters:
  • col (c4d.Vector) – The new color.
  • flags (int) –
    SET_PEN_USE_PROFILE_COLOR Set this flag if the color is already in the color space of the BaseDraw. Otherwise the color will be converted.
BaseDraw.SetPointSize(pointsize)

Sets the drawn point size.

Parameters:pointsize (float) – The new point size.
BaseDraw.SimpleShade(p, n)

A quick shading algorithm that only takes the angle to the camera and a default light into account. You pass a point and a normal in world space and get back the intensity. Can be combined with DrawPolygon() to draw simple shaded polygons.

Parameters:
Return type:

float

Returns:

The intensity of the light. Between 0 and 1.

BaseDraw.ConvertColor(c)

Converts colors from document color profile to viewport color profile.

Parameters:c (c4d.Vector) – The color to convert (document).
Return type:c4d.Vector
Returns:The converted color (viewport).
BaseDraw.ConvertColorReverse(c)

Converts colors from viewport color profile to document color profile.

Parameters:c (c4d.Vector) – The color to convert (viewport).
Return type:c4d.Vector
Returns:The converted color (document).
BaseDraw.LineZOffset(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 function only affects the new draw functions below it, i.e. DrawHandle(), DrawTexture(), DrawCircle(), DrawBox(), and DrawSphere().

Parameters:offset (int) – The new Z buffer offset.
BaseDraw.SetDepth(enable)

Enables/disables writing to the depth buffer.

Parameters:enable (bool) – True to enable depth buffer writing, otherwise False.
BaseDraw.SetMatrix_Projection()

For internal use only.

BaseDraw.SetMatrix_Screen(offset=-1)

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

Note

This function only affects the new draw functions below it, i.e. DrawHandle(), DrawTexture(), DrawCircle(), DrawBox(), and DrawSphere().

Parameters:offset (int) –

Sets 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)
BaseDraw.SetMatrix_Camera()

Sets the transformation matrix to the camera system.

Note

This function only affects the new draw functions below it, i.e. DrawHandle(), DrawTexture(), DrawCircle(), DrawBox(), and DrawSphere().

BaseDraw.SetMatrix_Matrix(op, mg, zoffset)

Sets the transformation matrix to the given matrix mg. The matrix should transform coordinates passed to the draw functions into world coordinates.

Parameters:
  • op (c4d.BaseObject) – A scene object. If passed this is used to compare if the same object is still used.
  • mg (c4d.Matrix) – The new transformation matrix.
  • zoffset (int) –

    Sets 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)
BaseDraw.SetClipPlaneOffset(o)

New in version R14.014.

Offsets the OpenGL clipping planes by this offset.

Parameters:o (float) – The offset.
BaseDraw.DrawPoint2D(p)

Draws a one-pixel point in the current pen color at p. The coordinates must be in screen space.

Note

Changes the matrix to screen with SetMatrix_Screen() prior to drawing.

Parameters:p (c4d.Vector) – A point.
BaseDraw.DrawLine2D(p1, p2)

Draws a line in the current pen color between p1 and p2. The coordinates must be in screen space.

Note

Changes the matrix to screen with SetMatrix_Screen() prior to drawing.

Parameters:
BaseDraw.DrawHandle2D(p, type=DRAWHANDLE_SMALL)

Draws a standard handle (orange dot) at p. The coordinates must be in screen space.

Note

Changes the matrix to screen with SetMatrix_Screen() prior to drawing.

Parameters:
  • p (c4d.Vector) – A point.
  • type (int) –

    The handle type. Possible values are:

    DRAWHANDLE_MINI Tiny point.
    DRAWHANDLE_SMALL Small point.
    DRAWHANDLE_MIDDLE Medium point.
    DRAWHANDLE_BIG Big point. Handle used by object generators and deformers.
    DRAWHANDLE_CUSTOM Custom handle.
    DRAWHANDLE_POINTSIZE Use the point size to draw the handle.
    DRAWHANDLE_SELPOINTSIZE Use the size of selected points to draw the handle.
BaseDraw.DrawCircle2D(mx, my, rad)

Draws a circle in the current pen color with a radius of rad and the center at (mx, my). The coordinates must be in screen space.

Note

Changes the matrix to screen with SetMatrix_Screen() prior to drawing.

Parameters:
  • mx (int) – Center x coordinate.
  • my (int) – Center y coordinate.
  • rad (float) – The radius.
BaseDraw.DrawLine(p1, p2, flags)

Draws a line in the current pen color between p1 and p2. The coordinates must be in world space.

Parameters:
  • p1 (c4d.Vector) – The start point.
  • p2 (c4d.Vector) – The end point.
  • flags (int) –

    Flags:

    NOCLIP_D Clip against the view border.
    NOCLIP_Z Z clipping.
BaseDraw.DrawHandle(vp, type, flags)

Draws a standard handle (orange dot) at vp. The coordinates must be in world space.

Parameters:
  • vp (c4d.Vector) – A point.
  • type (int) –

    The handle type. Valid types are:

    DRAWHANDLE_MINI Tiny point.
    DRAWHANDLE_SMALL Small point.
    DRAWHANDLE_MIDDLE Medium point.
    DRAWHANDLE_BIG Big point. Handle used by object generators and deformers.
    DRAWHANDLE_CUSTOM Custom handle.
    DRAWHANDLE_POINTSIZE Use the point size to draw the handle.
    DRAWHANDLE_SELPOINTSIZE Use the size of selected points to draw the handle.
  • flags (int) – Private, set to 0.
BaseDraw.DrawPoints(vp, vc, colcnt=0, vn=None)

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:
  • vp (any) – An iteratable object with Vector as elements for the point coordinates.
  • vc (any) –

    An iteratable object with floats as elements for the points color.

    Changed in version R18.057.

    Can be None.

  • colcnt (int) – The number of color elements, for example 3 for RGB.
  • vn (any) –

    Reserved for future use.

    Changed in version R18.057.

    Can be None.

BaseDraw.DrawTexture(bmp, padr4, cadr, vnadr, uvadr, pntcnt, alphamode, 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 a triangle or a quadrangle is accepted. The colors are interpolated between the points and mutiplied with the texture color. The shading is determined by SetLightList().

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:
  • bmp (c4d.bitmaps.BaseBitmap) – The texture to draw.
  • padr4 (list of Vector) – An iteratable object with Vector as elements for the points coordinates.
  • cadr (list of Vector) – An iteratable object with Vector as elements for the colors. Must have 4 items regardless of pntcnt.
  • vnadr (list of Vector) – An iteratable object with Vector as elements for the point normals. Must have 4 items regardless of pntcnt.
  • uvadr (list of Vector) – An iteratable object with Vector as elements for the UV coordinates. Must have 4 items regardless of pntcnt.
  • pntcnt (int) – The number of points in padr4. Must be either 3 (triangle) or 4 (quadrangle).
  • alphamode (int) –

    The alpha channel mode:

    DRAW_ALPHA_NONE No alpha.
    DRAW_ALPHA_INVERTED Generates inverted alpha.
    DRAW_ALPHA_NORMAL Generates alpha channel from the image’s alpha channel. If no alpha channel exists, the alpha value is set to 100%.
    DRAW_ALPHA_FROM_IMAGE Generates the alpha channel from the RGB image information.
    DRAW_ALPHA_NORMAL_FROM_IMAGE Generates the alpha channel from the image’s alpha channel. If no alpha channel exists, the alpha value is generated from the RGB image.
  • flags (int) –

    A combination of these flags:

    DRAW_TEXTUREFLAGS_NONE None.
    DRAW_TEXTUREFLAGS_COLOR_IMAGE_TO_LINEAR Converts the embedded color profile to linear color space.
    DRAW_TEXTUREFLAGS_COLOR_SRGV_TO_LINEAR Converts from sRGB color space to linear color space.
    DRAW_TEXTUREFLAGS_IMAGE_TO_SRGB Converts the embedded color profile to sRGB color space.
    DRAW_TEXTUREFLAGS_COLOR_LINEAR_TO_SRGB Converts from linear color space to sRGB color space.
    DRAW_TEXTUREFLAGS_COLOR_CORRECTION_MASK Color correction mask.
    DRAW_TEXTUREFLAGS_USE_PROFILE_COLOR Use profile color.
    DRAW_TEXTUREFLAGS_ALLOW_FLOATINGPOINT Allow floating point textures (if supported).
    DRAW_TEXTUREFLAGS_TILE Allow tiling.
    DRAW_TEXTUREFLAGS_INTERPOLATION_NEAREST Nearest texture interpolation.
    DRAW_TEXTUREFLAGS_INTERPOLATION_LINEAR Linear texture interpolation.
    DRAW_TEXTUREFLAGS_INTERPOLATION_LINEAR_MIPMAP MIP map texture interpolation.
    DRAW_TEXTUREFLAGS_INTERPOLATION_MASK Texture interpolation mask.
BaseDraw.DrawBox(m, size, col, wire)

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

p = [c4d.Vector() for x in xrange(8)]
p[0] = c4d.Vector(-size, -size, -size)
p[1] = c4d.Vector( size, -size, -size)
p[2] = c4d.Vector( size, -size,  size)
p[3] = c4d.Vector(-size, -size,  size)
p[4] = c4d.Vector(-size,  size, -size)
p[5] = c4d.Vector( size,  size, -size)
p[6] = c4d.Vector( size,  size,  size)
p[7] = c4d.Vector(-size,  size,  size)

To get arbitrary cubic forms, set size to 0.5 and multiply the vectors in the matrix by the length.

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:
  • m (c4d.Matrix) – A matrix describing the box.
  • size (float) – The size of the box.
  • col (c4d.Vector) – The color of the box.
  • wire (bool) – If this is True a wireframe is drawn.
BaseDraw.DrawCircle(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.) The coordinates must be in world space.

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:m (c4d.Matrix) – A matrix describing the circle.
BaseDraw.DrawArc(pos, radius, angle_start, angle_end, subdiv=32, flags=0)

New in version R14.014.

Draws an arc (section of a circle) in the current pen color at pos. The coordinates must be in screen space.

Parameters:
  • pos (c4d.Vector) – Position of the rectangle that defines the arc.
  • radius (float) – The radius.
  • angle_start (float) – Start of the angle in radians.
  • angle_end (float) – End of the angle in radians.
  • subdiv (int) – The range between angle_start and angle_end is divided into subdiv line segments.
  • flags (int) –

    New in version R16.021.

    Flags:

    NOCLIP_D Clip against the view border.
    NOCLIP_Z Z clipping.
BaseDraw.DrawPolygon(p, f)

Draws a manually shaded triangle or quadrangle. The corner points are given as a list of Vectors in p, and the corner colors as a corresponding list of Vectors in f. Example:

p = ( c4d.Vector(0,0,0), c4d.Vector(100,0,0), c4d.Vector(50,100,0) )
f = ( c4d.Vector(1,0,0), c4d.Vector(0,0,1), c4d.Vector(0,1,0) )
bd.DrawPolygon(p, f)

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:
  • p (list of Vector) – A list of points.
  • f (list of type Vector) – A list of points.
BaseDraw.DrawSphere(off, size, col, flags)

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

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:
  • off (c4d.Vector) – Position coordinate.
  • size (c4d.Vector) – Sphere size.
  • col (c4d.Vector) – The color.
  • flags (int) –

    Flags:

    NOCLIP_D Clip against the view border.
    NOCLIP_Z Z clipping.
BaseDraw.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). With this method you can force this operation.

BaseDraw.DrawPolygonObject(bh, op, flags)

Draws a polygon object into the view.

Parameters:
  • bh (c4d.plugins.BaseDrawHelp) – Needs to be passed along.
  • op (c4d.BaseObject) – The object.
  • flags (int) –

    Flags:

    DRAWOBJECT_NONE None.
    DRAWOBJECT_FORCELINES Force wireframe display, independent of view settings.
    DRAWOBJECT_NOBACKCULL Force no backface culling, independent of view settings.
    DRAWOBJECT_LOCALMATRIX Object will be drawn relative to the currently processed object (used when called from the Draw() function in an object.
    DRAWOBJECT_EDITMODE Object is drawn in edit-mode style.
    DRAWOBJECT_FORCEBASE The draw call is only executed for the base class, and thus not for the instanciated object, if passed to BaseDraw.DrawObject() and the object type is an instance of either Opoint or Opolygon. This way, a draw call can be invoked from points/polygons derived object without running into a recursion.
    DRAWOBJECT_FORCEPOINTS Force points display.
    DRAWOBJECT_NO_EOGL No Extended OpenGL.
    DRAWOBJECT_USE_OBJECT_COLOR Use the object’s color.
    DRAWOBJECT_USE_CUSTOM_COLOR Use a custom color.
    DRAWOBJECT_XRAY_ON Enables X-Ray mode.
    DRAWOBJECT_XRAY_OFF Disables X-Ray mode.
    DRAWOBJECT_IMMEDIATELY Draws an object immediately. Usually all objects are collected in a Z-depth sorted list before drawing. This flag is used for objects which are immediately deleted after drawing.
    DRAWOBJECT_Z_OFFSET Do not change the Z offset.
    DRAWOBJECT_PRIVATE_ANY Private.
BaseDraw.DrawObject(bh, op, flags, drawpass, parent)

Draws a polygon object into the view.

Parameters:
  • bh (c4d.plugins.BaseDrawHelp) – Needs to be passed along.
  • op (c4d.BaseObject) – The object.
  • flags (int) –

    Flags:

    DRAWOBJECT_NONE None.
    DRAWOBJECT_FORCELINES Force wireframe display, independent of view settings.
    DRAWOBJECT_NOBACKCULL Force no backface culling, independent of view settings.
    DRAWOBJECT_LOCALMATRIX Object will be drawn relative to the currently processed object (used when called from the Draw() function in an object.
    DRAWOBJECT_EDITMODE Object is drawn in edit-mode style.
    DRAWOBJECT_FORCEBASE The draw call is only executed for the base class, and thus not for the instanciated object, if passed to BaseDraw.DrawObject() and the object type is an instance of either Opoint or Opolygon. This way, a draw call can be invoked from points/polygons derived object without running into a recursion.
    DRAWOBJECT_FORCEPOINTS Force points display.
    DRAWOBJECT_NO_EOGL No Extended OpenGL.
    DRAWOBJECT_USE_OBJECT_COLOR Use the object’s color.
    DRAWOBJECT_USE_CUSTOM_COLOR Use a custom color.
    DRAWOBJECT_XRAY_ON Enables X-Ray mode.
    DRAWOBJECT_XRAY_OFF Disables X-Ray mode.
    DRAWOBJECT_IMMEDIATELY Draws an object immediately. Usually all objects are collected in a Z-depth sorted list before drawing. This flag is used for objects which are immediately deleted after drawing.
    DRAWOBJECT_Z_OFFSET Do not change the Z offset.
    DRAWOBJECT_PRIVATE_ANY Private.
  • drawpass (int) –

    Drawpass:

    DRAWPASS_OBJECT Object pass.
    DRAWPASS_BOX Box pass.
    DRAWPASS_HANDLES Handle pass.
    DRAWPASS_HIGHLIGHTS Highlights pass.
    DRAWPASS_XRAY X-Ray pass.
  • parent (c4d.BaseObject) – The parent object, can be None.
BaseDraw.DrawScene(flags)

Draw a scene into the framebuffer.

Parameters:flags (int) – Private.
Return type:bool
Returns:Success of drawing the scene.
BaseDraw.GetReductionMode()

Private.

Return type:bool
Returns:True on success, otherwise False.
BaseDraw.GetDrawPass()

New in version R14.041.

Gets the current drawpass.

Return type:int
Returns:One of the following flags:
DRAWPASS_OBJECT Object pass.
DRAWPASS_BOX Box pass.
DRAWPASS_HANDLES Handle pass.
DRAWPASS_HIGHLIGHTS Highlights pass.
DRAWPASS_XRAY X-Ray pass.
BaseDraw.GetHighlightPassColor(bh, lineObject)

New in version R19.

Returns the color in which the object has to be drawn in the highlight pass.

Note

This function should only be called in the highlight pass.

Parameters:
  • bh (c4d.plugins.BaseDrawHelp) – The base draw help.
  • lineObject (int) – Must be set to True if the object is a line object.
Return type:

c4d.Vector

Returns:

The highlight color, or None if drawing the object can be skipped.

BaseDraw.GetHighlightFramebuffer(vMin=c4d.Vector(-1), vMax=c4d.Vector(1))

New in version R19.

Returns the framebuffer in which the highlights are drawn and sets the bounding box of the highlight area (vMin and vMax).
Both vectors must be in clip space [-1, 1] on all axes. They should be passed when the bounding box is known for the current object to speed up the calculation of the highlights and outlines.

Note

This function should only be called in the highlight pass.

Parameters:
  • vMin (c4d.Vector) – The minimum position of the bounding box.
  • vMax (c4d.Vector) – The maximum position of the bounding box.
Return type:

PyCObject

Returns:

The highlight framebuffer if successful, otherwise None.

BaseDraw.SetLightList(mode)

Sets the lighting used by the draw functions.

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Note

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

Parameters:mode (int) –

The lighting mode:

BDRAW_SETLIGHTLIST_NOLIGHTS No lights.
BDRAW_SETLIGHTLIST_SCENELIGHTS Scene lights.
BDRAW_SETLIGHTLIST_QUICKSHADING Quick shading.
Return type:bool
Returns:True on success, otherwise False.
BaseDraw.InitUndo(doc)

Called 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:doc (c4d.documents.BaseDocument) – The view’s document.
BaseDraw.DoUndo(doc)

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

Parameters:doc (c4d.documents.BaseDocument) – The view’s document.
BaseDraw.SetDrawParam(id, data)

Sets draw parameters.

Note

The coordinates must be in the space defined by SetMatrix_Screen(), SetMatrix_Camera() or SetMatrix_Matrix().

Parameters:
  • id (int) – Parameter ID.
  • data (any) – Depends on the parameter ID.
BaseDraw.GetDrawParam(id)

Gets draw parameters.

Parameters:id (int) – Parameter ID.
Return type:Any
Returns:Depends on the parameter ID.
BaseDraw.TestBreak()

Checks for thread breaks in the draw.

Return type:bool
Returns:True if a stopping condition has occurred, otherwise False.
BaseDraw.GetEditorWindow()

Get the editor window of the BaseDraw.

Return type:c4d.gui.EditorWindow
Returns:The editor window of the base draw.
BaseDraw.SetTexture(bm, tile, alphamode, flags)

Set a texture used by the vertex buffer.

Parameters:
  • bm (c4d.bitmaps.BaseBitmap) – The texture’s bitmap.
  • tile (bool) – Enable tiling.
  • alphamode (int) –

    Alpha channel mode:

    DRAW_ALPHA_NONE No alpha.
    DRAW_ALPHA_INVERTED Generates inverted alpha.
    DRAW_ALPHA_NORMAL Generates alpha channel from the image’s alpha channel. If no alpha channel exists, the alpha value is set to 100%.
    DRAW_ALPHA_FROM_IMAGE Generates the alpha channel from the RGB image information.
    DRAW_ALPHA_NORMAL_FROM_IMAGE Generates the alpha channel from the image’s alpha channel. If no alpha channel exists, the alpha value is generated from the RGB image.
  • flags (int) – Private, set to 0.
BaseDraw.GetGridStep()

New in version R14.014.

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

Return type:tuple(float, float)
Returns:The workplane grid spacing and the transparency value of the minor grid.
BaseDraw.GetViewMatrix(n)

New in version R14.014.

Gets the view matrix.

Parameters:n (int) –

View matrix to get:

DRAW_GET_VIEWMATRIX_PROJECTION Projection matrix.
DRAW_GET_VIEWMATRIX_PROJECTION_LARGE_Z Projection matrix without consideration of the set clipping planes. The following values for near and far clipping are used instead: near=`1`, far=`100000` for perspective projection and near=`-1000000`, far=`1000000` for other projection types.
DRAW_GET_VIEWMATRIX_INV_CAMERA Inverse camera matrix.
DRAW_GET_VIEWMATRIX_MODELVIEW_PROJECTION Projection*View*Model matrix. Slow.
Return type:tuple(16*float)
Returns:The view matrix (4x4 matrix).
BaseDraw.DrawHUDText(x, y, txt)

New in version R18.020.

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

Parameters:
  • x (int) – The left X coordinate to draw the text at.
  • y (int) – The upper Y coordinate to draw the text at.
  • txt (str) – The text to draw.
BaseDraw.DrawMultipleHUDText(texts)

New in version R18.020.

Draws many 2D text into the viewport at once.

Parameters:texts (list of dict{'_txt': str, '_position': c4d.Vector}) – The list of text entries and their screen space positions to draw to the HUD.
BaseDraw.IsMarkedAsGPURenderer()

New in version R19.024.

Checks if the view is marked as GPU Renderer.

Return type:bool
Returns:True if the view is marked to run the GPU Renderer, otherwise False.
BaseDraw.IsGPURenderer()

New in version R19.024.

Checks if the view is running the GPU Renderer.

Return type:bool
Returns:True if the view is running the GPU renderer, otherwise False.