About
A BaseView object represents a viewport window. Such a BaseView can be obtained from the active BaseDocument to get information on the viewport window. The class BaseDraw is based on BaseView. It can be used to draw something in a viewport window via a "Draw" function.
- Warning
- It is only allowed to draw into the viewport inside a "Draw" function. See Draw Manual.
Access
The BaseDraw windows used to display the active BaseDocument can be accessed with:
- BaseDocument::GetActiveBaseDraw(): Returns the BaseDraw of the currently active editor window.
- BaseDocument::GetRenderBaseDraw(): Returns the BaseDraw that should be used as the render view. This function should be used in NodeData based plugins.
- BaseDocument::GetBaseDrawCount(): Returns the number of current editor windows.
- BaseDocument::GetBaseDraw(): Returns the BaseDraw with the given index.
- BaseDocument::ForceCreateBaseDraw(): Called to enforce at least one BaseDraw is available.
See BaseDocument Editor Windows.
Such a BaseDraw can be used to access the scene camera.
BaseDraw*
const baseDraw =
doc->GetActiveBaseDraw();
if (baseDraw == nullptr)
BaseObject* const cameraObject = baseDraw->GetEditorCamera();
const Matrix cameraMatrix = cameraObject->GetMg();
Matrix targetPosition = activeObject->GetMg();
targetPosition.
off = cameraMatrix.off + (900.0 * cameraMatrix.sqmat.v3);
activeObject->SetMg(targetPosition);
#define MAXON_SOURCE_LOCATION
Definition: memoryallocationbase.h:69
maxon::Mat3< maxon::Vector64 > Matrix
Definition: ge_math.h:159
const char * doc
Definition: pyerrors.h:226
V off
The translation vector.
Definition: matrix.h:263
Update
The viewport windows are redrawn if something in the active document changed:
- EventAdd(): Informs Cinema 4D that something in the active document changed. DrawViews() will be called.
- DrawViews(): Manually triggers the scene execution and a viewport redraw. Typically only used directly in ToolData based tools.
See also Core Messages Manual and Cinema 4D Threads Manual.
Properties
The parameters of a given BaseDraw are accessed as usual with C4DAtom::GetParameter() and C4DAtom::SetParameter(). The parameter IDs are defined in dbasedraw.h
- BaseDraw::GetParameterData(): Convenience function to access parameters.
const Float newScale = oldScale * 2.0;
NONE
Definition: asset_browser.h:1
@ BASEDRAW_DATA_SELECTED_NORMALS
Definition: dbasedraw.h:44
@ BASEDRAW_DATA_SHOWNORMALS
Definition: dbasedraw.h:30
@ BASEDRAW_DATA_NORMALS_SCALE
Definition: dbasedraw.h:69
#define ConstDescID(...)
Definition: lib_description.h:592
maxon::Float Float
Definition: ge_sys_math.h:57
@ BASEDRAW_PROJECTION_FRONT
Definition: dbasedraw.h:250
@ BASEDRAW_DATA_SDISPLAYACTIVE
Definition: dbasedraw.h:26
@ BASEDRAW_SDISPLAY_HIDDENLINE
Definition: dbasedraw.h:234
@ BASEDRAW_DATA_PROJECTION
Definition: dbasedraw.h:40
maxon::Int32 Int32
Definition: ge_sys_math.h:51
A BaseDraw defines also certain display filters that decide what element types are displayed in the viewport windows.
- BaseDraw::GetDisplayFilter(): Returns a bitfield that stores the current display filters.
- Note
- To edit the filter settings use the parameters defined in
dbasedraw.h
BaseDraw*
const bd =
doc->GetActiveBaseDraw();
if (bd == nullptr)
if (displayFilter && editorVisibiliy)
{
}
else
{
}
DISPLAYFILTER
Definition: ge_prepass.h:4573
#define ApplicationOutput(formatString,...)
Definition: debugdiagnostics.h:204
Bool CheckDisplayFilter(BaseObject *op, DISPLAYFILTER filter)
Bool CheckEditorVisibility(BaseObject *op)
maxon::Bool Bool
Definition: ge_sys_math.h:46
else
@ BASEDRAW_DISPLAYFILTER_HYPERNURBS
Definition: dbasedraw.h:192
HYPERNURBS
Subdivision Surface.
Definition: ge_prepass.h:4
Rotation
A viewport window with planar projection can be rotated:
- BaseView::GetPlanarRotation(): Returns the rotation of a planar view.
- BaseView::SetPlanarRotation(): Sets the rotation of a planar view.
{
BaseDraw*
const baseDraw =
doc->GetBaseDraw(
i);
if (baseDraw == nullptr)
baseDraw->SetPlanarRotation(0.0f);
}
Py_ssize_t i
Definition: abstract.h:645
Py_ssize_t count
Definition: abstract.h:640
Camera
A viewport window with a perspective projection displays the scene from the point of view of a camera. This camera is defined using an object. This can be a scene camera, a scene object or the editor camera.
- BaseDraw::HasCameraLink(): Returns true if a scene object is used to define the BaseDraw.
- BaseDraw::GetSceneCamera(): Returns the linked scene camera or object.
- BaseDraw::GetEditorCamera(): Returns the default editor camera.
- BaseDraw::SetSceneCamera(): Sets the given BaseObject as the scene camera.
- BaseView::GetMg(): Returns the global camera matrix.
- BaseView::GetMi(): Returns the inverse of the global camera matrix.
See also CameraObject Manual.
BaseDraw*
const bd =
doc->GetActiveBaseDraw();
if (bd == nullptr)
if (bd->HasCameraLink())
{
BaseObject*
const cam = bd->GetSceneCamera(
doc);
if (cam != nullptr)
}
else
{
BaseObject*
const camera = BaseObject::Alloc(
Ocamera);
if (camera == nullptr)
doc->InsertObject(camera,
nullptr,
nullptr);
bd->SetSceneCamera(camera);
}
#define Ocamera
Camera - CameraObject.
Definition: ge_prepass.h:1045
Scene Elements
The viewport also displays a background and some global light settings. Both the background and the global seetings are defines using scene elements.
- BaseDraw::GetSkyObject(): Returns the used sky object.
- BaseDraw::GetEnvironmentObject(): Returns the used environment object.
- BaseDraw::GetBackgroundObject(): Returns the used background object.
- BaseDraw::GetForegroundObject(): Returs the used foreground object.
BaseObject* const envObject = baseDraw->GetEnvironmentObject();
if (envObject)
{
GeData data;
const Vector color = data.GetVector();
}
BaseObject* const skyObject = baseDraw->GetSkyObject();
if (skyObject)
{
BaseTag*
const tag = skyObject->GetTag(
Ttexture);
if (tag)
{
GeData data;
C4DAtom*
const atom = data.GetLinkAtom(
doc);
BaseList2D*
const material =
static_cast<BaseList2D*
>(
atom);
if (material)
}
}
#define atom
Definition: graminit.h:72
#define Ttexture
Texture - TextureTag.
Definition: ge_prepass.h:1420
maxon::Vec3< maxon::Float64, 1 > Vector
Definition: ge_math.h:140
@ ENVIRONMENT_AMBIENT
Definition: oenvironment.h:6
@ TEXTURETAG_MATERIAL
Definition: ttexture.h:29
GPU Renderer
The GPU renderer of Cinema 4D can render inside a given BaseDraw window.
- BaseDraw::IsMarkedAsGPURenderer(): Returns true if the BaseDraw is used as a GPU renderer view.
- BaseDraw::IsGPURenderer(): Returns true if the BaseDraw is running the GPU renderer.
Drawing
Inside a "Draw" function one can use the following functions to draw into the viewport windows. See Draw Manual.
- Warning
- It is not allowed to draw in any other context.
While drawing one should check if the drawing thread has been aborted:
- BaseDraw::TestBreak(): Returns true if the drawing operation should be aborted.
{
{
err.DiagOutput();
err.DbgStop();
return false;
};
if (
node ==
nullptr ||
doc ==
nullptr || bd ==
nullptr || bh ==
nullptr)
if (bd->TestBreak())
return true;
PyCompilerFlags * flags
Definition: ast.h:14
SCENEHOOKDRAW
Definition: ge_prepass.h:3343
#define iferr_scope_handler
Definition: resultbase.h:1414
#define iferr_throw(ERR)
Definition: resultbase.h:1596
Drawing Pass
The viewport is drawn in several passes. One should check if the drawing operation is needed in the current pass. This is especially important for ObjectData::Draw().
- BaseDraw::GetDrawPass(): Returns the current drawing pass:
- BaseDraw::AddToPostPass(): Adds the object to XRAY.
Parameters
Several parameters configure the drawing operations that follow.
- BaseDraw::GetDrawParam(): Returns the value of the given parameter.
- BaseDraw::SetDrawParam(): Sets the value of the given parameter.
The parameters are:
- Note
- At the end of the drawing operation these parameters have to be restored.
bd->SetPen(
Vector { 1.0, 0.0, 0.0 });
#define DRAW_PARAMETER_LINEWIDTH
::Float Line width in pixels. (OpenGL only.)
Definition: c4d_basedraw.h:1519
#define NOCLIP_D
Clip against the view border.
Definition: c4d_basedraw.h:1139
Settings
The draw settings configure the drawing operations that follow.
- BaseDraw::SetPen(): Sets the pen color.
- BaseDraw::SetPointSize(): Sets the point size.
- Note
- The color used with BaseDraw::SetPen() may be obtained with GetViewColor(). See also Colors.
bd->SetMatrix_Matrix(
nullptr,
Matrix(), 6);
Random rnd;
{
const Float r = rnd.Get01();
const Float b = rnd.Get01();
bd->SetPen(color);
}
Py_ssize_t size
Definition: bytesobject.h:86
void Py_ssize_t * pos
Definition: dictobject.h:50
CUSTOM
Definition: lib_birender.h:6
const char const char grammar * g
Definition: parsetok.h:52
The light list defines what lights should influence the shading on 3D drawing operations. Typically used to disable lights.
- BaseDraw::SetLightList(): Sets the lighting mode.
Transparency settings for polygon drawing are defined with:
- BaseDraw::GetTransparency(): Returns the transparency.
- BaseDraw::SetTransparency(): Sets the transparency.
- ::HIGHLIGHT_TRANSPARENCY: A special constant that sets the (yellowish) highlight transparency mode.
See also DRAW_PARAMETER_ALPHA_THRESHOLD above.
Matrix
A drawing operation may be performed in screen, camera or world space. Before any drawing operation the operation space must be defined.
- BaseDraw::SetMatrix_Screen(): Sets the transformation matrix to screen coordinates.
- BaseDraw::SetMatrix_Camera(): Sets the transformation matrix to the camera system.
- BaseDraw::SetMatrix_Matrix(): Sets the transformation matrix to the given Matrix.
const Vector screenPos { 100, 100.0, 0.0 };
bd->SetMatrix_Screen();
bd->SetMatrix_Camera();
const Vector worldPos { 100.0, 100.0, 100.0 };
bd->SetMatrix_Matrix(
nullptr,
Matrix());
BIG
Large point.
Definition: ge_prepass.h:3
2D Drawing Operations
These functions perform drawing operations in 2D space:
- BaseDraw::DrawPoint2D(): Draws a 2D point.
- BaseDraw::DrawLine2D(): Draws a 2D line.
- BaseDraw::DrawHandle2D(): Draws a 2D handle.
- BaseDraw::DrawCircle2D(): Draws a 2D circle.
- Note
- To calculate screen space coordinates see Transformation.
bd->SetMatrix_Screen();
const Vector center { 100, 100, 0 };
const Vector tangentPoint { 150, 100, 0 };
bd->DrawLine2D(center, tangentPoint);
bd->DrawCircle2D((
Int32)center.x, (
Int32)center.y, tangentPoint.x - center.x);
bd->DrawPoint2D(center);
Text can easily be drawn with:
- BaseDraw::DrawHUDText(): Draws some text in the viewport using the style of the HUD.
- BaseDraw::DrawMultipleHUDText(): Draws multiple texts in the viewport using the style of the HUD.
- HUDTextEntry: A text element that should be drawn in the viewport.
- Note
- These functions are typically used with a scene hook.
const DRAWPASS pass = bd->GetDrawPass();
{
bd->SetTransparency(0);
HUDTextEntry entryA;
entryA._txt = "This is the first entry";
entryA._position =
Vector { 200, 220, 0 };
HUDTextEntry entryB;
entryB._txt = "This is the second entry";
entryB._position =
Vector { 200, 260, 0 };
bd->DrawMultipleHUDText(hudEntries);
}
Definition: basearray.h:415
MAXON_ATTRIBUTE_FORCE_INLINE ResultRef< T > Append(ARG &&x)
Appends a new element at the end of the array and constructs it using the forwarded value.
Definition: basearray.h:627
HIGHLIGHT_PASS_INV
Inverted highlight pass.
Definition: ge_prepass.h:4
DRAWPASS
Definition: ge_prepass.h:3542
OBJECT
Object mode.
Definition: lib_activeobjectmanager.h:2
#define iferr_return
Definition: resultbase.h:1531
General Drawing Operations
Depending on the current transformation matrix these operations can draw in 2D or 3D space.
The z-buffer is configured with:
- BaseDraw::LineZOffset(): Sets the current Z buffer offset.
These clipping flags used with 3D drawing operations:
- NOCLIP_D: Clip against the viewport window.
- NOCLIP_Z: Clip against near and far plane.
The drawing operations are:
- BaseDraw::DrawHandle(): Draws a handle.
- BaseDraw::DrawPointArray(): Draws a point array.
- BaseDraw::DrawLine(): Draws a line.
- BaseDraw::DrawArc(): Draws an arc.
- BaseDraw::DrawTexture(): Draws a given BaseBitmap. See BaseBitmap Manual.
- BaseDraw::DrawCircle(): Draws a circle.
- BaseDraw::DrawBox(): Draws a box.
- BaseDraw::DrawSphere(): Draws a sphere.
- BaseDraw::DrawPoly(): Draws a colored and shaded triangle or quadrangle.
- BaseDraw::DrawPolygon(): Draws a manually shaded triangle or quadrangle.
- BaseDraw::DrawBoundingBox(): Draws the bounding box of the given BaseObject.
AutoAlloc<GeClipMap> clipMap;
if (clipMap)
{
clipMap->Init(100, 50, 32);
clipMap->BeginDraw();
clipMap->SetColor(255, 0, 0, 64);
clipMap->FillRect(0, 0, 100, 50);
clipMap->SetColor(0, 0, 0, 255);
clipMap->TextAt(0, 11, "Hello World");
clipMap->EndDraw();
const BaseBitmap* const bitmap = clipMap->GetBitmap();
if (bitmap)
{
bd->SetMatrix_Screen();
bd->DrawTexture(bitmap, positions.GetFirst(), colors.GetFirst(), normals.GetFirst(), uvcoords.GetFirst(), 4, alpha, texture);
}
}
FROM_IMAGE
Generates the alpha channel from the RGB image information.
Definition: ge_prepass.h:3
DRAW_ALPHA
Definition: ge_prepass.h:3000
DRAW_TEXTUREFLAGS
Definition: ge_prepass.h:3013
Each BaseDraw::DrawPolygon() puts the polygon into an internal array. The drawing of this array can be triggered with:
- BaseDraw::DrawArrayEnd(): Draws the stored polygon array.
A simple shading value is often used with BaseDraw::DrawPoly() and BaseDraw::DrawPolygon():
- BaseDraw::SimpleShade(): Returns the light intensity based on the given normal and light direction.
const Vector color { 1.0, 0.0, 0.0 };
colors[0] = color * bd->SimpleShade(vertice[0], normals[0]);
colors[1] = color * bd->SimpleShade(vertice[1], normals[1]);
colors[2] = color * bd->SimpleShade(vertice[2], normals[2]);
colors[3] = color * bd->SimpleShade(vertice[3], normals[3]);
const Matrix& mg = bh->GetMg();
bd->SetMatrix_Matrix(
op, mg);
bd->SetTransparency(128);
bd->DrawPolygon(vertice, colors, true);
#define BDRAW_SETLIGHTLIST_NOLIGHTS
No lights.
Definition: c4d_basedraw.h:1014
PyObject * op
Definition: object.h:520
Objects
Complete polygon objects can be drawn with:
- BaseDraw::DrawPolygonObject(): Draws the given polygon object.
- BaseDraw::DrawObject(): Draws the given object.
BaseDocument*
const doc = bd->GetDocument();
const Bool docSet =
doc !=
nullptr;
if (docSet && isObjectPass)
{
BaseObject*
const activeObject =
doc->GetActiveObject();
const Bool activeObjectSet = activeObject !=
nullptr;
const Bool activeObjectIsNotOp = activeObject !=
op;
if (activeObjectSet && activeObjectIsNotOp)
{
if (activeObject->IsInstanceOf(
Opolygon))
{
bd->SetMatrix_Matrix(
nullptr,
Matrix());
}
}
}
OK
User has selected a font.
Definition: customgui_fontchooser.h:0
#define Opolygon
Polygon - PolygonObject.
Definition: ge_prepass.h:1041
Line Strip
The line strip functions allow to easily draw line paths:
- BaseDraw::LineStripBegin(): Begins the line strip.
- BaseDraw::LineStrip(): Draws a line from the last point to the given point.
- BaseDraw::LineStripEnd(): Ends the line strip.
Random randomGen;
bd->SetMatrix_Matrix(
nullptr,
Matrix());
bd->LineStripBegin();
{
const Float r = randomGen.Get01();
const Float g = randomGen.Get01();
const Float b = randomGen.Get01();
const Float x = randomGen.Get01() * 100;
const Float y = randomGen.Get01() * 100;
const Float z = randomGen.Get01() * 100;
}
bd->LineStripEnd();
PyObject * x
Definition: bytesobject.h:38
#define NOCLIP_Z
Z clipping.
Definition: c4d_basedraw.h:1140
XOR Lines
XOR lines are used with selection tools in the viewport. Typically one should use the LassoSelection class instead.
- Warning
- These functions have been marked as deprecated.
- BaseDraw::InitDrawXORPolyLine(): Initiates XOR drawing.
- BaseDraw::BeginDrawXORPolyLine(): Starts drawing an XOR polygon line.
- BaseDraw::DrawXORPolyLine(): Draws an XOR polygon line.
- BaseDraw::EndDrawXORPolyLine(): Ends drawing an XOR polygon line.
- BaseDraw::FreeDrawXORPolyLine(): Ends XOR drawing.
See also EditorWindow::DrawXORLine().
if (bd->InitDrawXORPolyLine())
{
bd->BeginDrawXORPolyLine();
bd->DrawXORPolyLine(point, 2);
bd->EndDrawXORPolyLine(true);
bd->FreeDrawXORPolyLine();
}
else
{
}
INMOVE
In move.
Definition: ge_prepass.h:9
NO_THREAD
Synchronous call.
Definition: ge_prepass.h:1
NO_ANIMATION
Ignore all animation.
Definition: ge_prepass.h:2
ONLY_ACTIVE_VIEW
Only redraw the active view.
Definition: ge_prepass.h:3
DRAWFLAGS
Definition: ge_prepass.h:2840
Bool DrawViews(DRAWFLAGS flags, BaseDraw *bd=nullptr)
Colors
Colors can be obtained and converted with:
- BaseDraw::ConvertColor(): Converts the given color from document color to viewport color profile.
- BaseDraw::ConvertColorReverse(): Converts the given color from viewport color to document color profile.
- BaseDraw::CheckColor(): Calculates the difference of the given color to VIEWCOLOR_C4DBACKGROUND and returns a color that is changed if needed.
- BaseDraw::GetObjectColor(): Returns the wireframe color of the given BaseObject.
- BaseDraw::GetHighlightPassColor(): Gets the color in which an object is drawn in the highlight pass.
const Vector color = bd->GetObjectColor(bh,
op);
bd->SetPen(color);
bd->SetMatrix_Matrix(
nullptr,
Matrix());
Matrix circleSettings = bh->GetMg();
circleSettings.
sqmat.v1 *= 200.0;
circleSettings.sqmat.v2 *= 200.0;
circleSettings.sqmat.v3 *= 200.0;
bd->DrawCircle(circleSettings);
SqrMat3< V > sqmat
The 3×3 matrix for rotation, scale and shear.
Definition: matrix.h:266
Frame
The dimensions of a viewport window are accessed with:
- BaseView::GetFrame(): Gets the frame dimensions in pixel.
- BaseView::GetSafeFrame(): Gets the dimensions of the safe frame.
baseDraw->GetFrame(&cl, &ct, &cr, &cb);
PrintFrameSize(cl, ct, cr, cb);
baseDraw->GetSafeFrame(&cl, &ct, &cr, &cb);
PrintFrameSize(cl, ct, cr, cb);
Stereo
These functions get and change the stereo settings for the given viewport window:
- BaseView::GetStereoInfo(): Returns the StereoCameraInfo data.
- BaseDraw::OverrideCamera(): Changes the stereoscopic camera data for this view.
Projection
A viewport window can display the scene using orthogonal or perspective projection:
- BaseDraw::GetViewMatrix(): Returns the requested view matrix, see DRAW_GET_VIEWMATRIX.
- BaseView::GetProjection(): Returns the projection type as defined in
ocamera.h
.
- BaseView::GetViewParameter(): Gets the parameters for the current projection.
- BaseView::GetBaseMatrix(): Returns the base matrix.
- BaseView::SetBaseMatrix(): Sets the base matrix.
Transformation
The following functions allow to transform a given point between world, screen and camera space:
- BaseView::WS(): Converts a world space point to screen space.
- BaseView::SW(): Converts a screen space point to world space.
- BaseView::SW_Reference(): Converts a screen space point to world space. The depth is based on the given argument.
- BaseView::WC(): Converts a world space point to camera space.
- BaseView::CW(): Converts a camera space point to world space.
- BaseView::SC(): Converts a screen space point to camera space.
- BaseView::CS(): Converts a camera space point to screen space.
- BaseView::WC_V(): Converts a world space vector to camera space.
- BaseView::CW_V(): Converts a camera space vector to world space.
- BaseView::WS_V(): Converts a world space vector to screen space.
- BaseView::SW_V(): Converts a screen space vector to world space.
const BaseObject*
const object =
doc->GetActiveObject();
if (object)
{
const Vector worldSpacePos =
object->GetMg().off;
const Vector screenSpacePos = bd->WS(worldSpacePos);
bd->DrawCircle2D((
Int32)screenSpacePos.x, (
Int32)screenSpacePos.y, 100);
}
const Bool res = ViewportSelect::PickObject(bd,
doc, xpos, ypos, 1,
{
ApplicationOutput(
"World Space Hit Point: " + String::VectorToString(worldSpacePos));
}
const char * m
Definition: abstract.h:692
Py_UCS4 * res
Definition: unicodeobject.h:1113
PyWideStringList * list
Definition: initconfig.h:447
maxon::SqrMat4< Vector4d64 > Matrix4d64
Double-precision Matrix4.
Definition: matrix4.h:17
Also sizes can be transformed:
- BaseView::PW_S(): Returns the size in world units for a single pixel at the given Z-depth.
- BaseView::WP_S(): Returns the size in pixels for a single world unit at the given Z-depth.
- BaseView::PW_W(): Returns the size in world units for a single pixel at the given screen space position.
- BaseView::WP_W(): Returns the size in screen space pixels for a single world unit at world position.
These 3D projection functions are typically used to handle mouse input in tools:
- BaseView::ProjectPointOnLine(): Returns the nearest point on the given line for a given mouse coordinate.
- BaseView::ProjectPointOnPlane(): Returns the nearest point on the given plane for a given mouse coordinate.
if (err == 0)
{
object->SetMg(mg);
}
#define EVMSG_ASYNCEDITORMOVE
The user moved something in the editor window. Managers should update things like position fields.
Definition: ge_prepass.h:2801
Bool GeSyncMessage(Int32 messageid, Int32 destid=0, UInt p1=0, UInt p2=0)
Testing and Clipping
The following tests can be performed:
- BaseDraw::PointInRange(): Returns true if the given screen space point is in hit range of the given world space point.
- BaseView::TestPoint(): Returns true if the given screen space point is visible.
- BaseView::TestPointZ(): Returns true if the given camera space point is visible.
- BaseView::TestClipping3D(): Returns true if the given bounding box is visible.
- BaseView::BackfaceCulling(): Returns true if the given face is visible.
const Matrix mg = polyObject->GetMg();
const Vector bbox = polyObject->GetMp();
const Vector rad = polyObject->GetRad();
if (bd->TestClipping3D(bbox, rad, mg, nullptr, nullptr))
{
color = bd->CheckColor(color);
bd->SetPen(color);
const Vector*
const points = polyObject->GetPointR();
const Int32 pointCount = polyObject->GetPointCount();
{
const Vector point = mg * points[
i];
const Vector screenSpacePos = bd->WS(point);
if (bd->TestPoint(screenSpacePos.x, screenSpacePos.y))
{
}
}
}
Int32 SAFEINT32(Float32 x)
Definition: apibasemath.h:275
A given line define by two points can be clipped:
- BaseView::ClipLine2D(): Clips the given line so that it fits within the view boundary.
- BaseView::ClipLineZ(): Clips the given line so that it does not come too close to or behind the camera.
A view can use near- and far-clipping:
- BaseView::ZSensitiveNear(): Returns true if the view has Z near-clipping.
- BaseView::ZSensitiveNearClipping(): Returns the near-clipping distance of the Z sensitive view.
- BaseView::ZSensitiveFar(): Returns true if the view has Z far-clipping.
- BaseView::ZSensitiveFarClipping(): Returns the far-clipping distance of the Z sensitive view.
Undo
A BaseDraw has its own undo buffer that stores changes:
- BaseDraw::InitUndo(): Stores the settings of the view in an undo buffer.
- BaseDraw::DoUndo(): Performs an undo operation.
{
BaseDraw*
const baseDraw =
doc->GetBaseDraw(
i);
if (baseDraw == nullptr)
baseDraw->SetPlanarRotation(0.0f);
}
Miscellaneous
Further functions are:
- BaseDraw::GetReductionMode(): Returns the used reduction mode, see ::DISPLAYMODE.
- BaseDraw::GetEditState(): Convenience function to check "Isoline Editing" and "Deformed Editing" viewport parameters. See ::DISPLAYEDITSTATE. For all parameters see Properties.
- BaseDraw::GetGridStep(): Gets the grid spacing and the transparency value.
- BaseDraw::IsViewOpen(): Returns true if the BaseDraw is open.
- BaseDraw::GetEditorWindow(): Returns the associated EditorWindow.
- BaseDraw::IsOpenGL(): Returns true if the BaseDraw is connected to the draw port.
- BaseDraw::GetDrawStatistics(): Gets a BaseContainer with OpenGL geometry statistics. See DRAW_STATISTIC.
maxon::DataDictionary stats;
if (!baseDraw->GetDrawStatistics(stats))
for (const auto& data : stats)
{
}
PyObject * value
Definition: abstract.h:715
PyObject * key
Definition: abstract.h:289
Definition: datatypebase.h:1234
Definition: datatypebase.h:770
PyObject ** type
Definition: pycore_pyerrors.h:34
BaseDrawHelp
BaseDrawHelp is a utility class that contains useful information. It is mostly used in the context of ObjectData::Draw(). An instance is typically handed over as an argument but can also be created on demand:
- BaseDrawHelp::Alloc(): Creates a new BaseDrawHelp object.
- BaseDrawHelp::Free(): Deletes the given BaseDrawHelp object.
The BaseDrawHelp object provides access to these properties:
- BaseDrawHelp::GetDocument(): Returns the relevant BaseDocument.
- BaseDrawHelp::GetActiveTag(): Returns the active BaseTag.
- BaseDrawHelp::GetViewSchedulerFlags(): Returns the flags passed to DrawViews(), see ::DRAWFLAGS.
Information on the BaseObject that is supposed to be drawn:
- BaseDrawHelp::GetMg(): Returns the global matrix of the object.
- BaseDrawHelp::SetMg(): Sets the matrix returned by the above function.
- BaseDrawHelp::IsActive(): Returns true if the current object is active.
- BaseDrawHelp::IsHighlight(): Returns true if the current object is highlighted.
A BaseObject may be drawn with a specific display mode as defined in Tdisplay.h
.
- BaseDrawHelp::GetDisplay(): Returns a container with the display mode.
- BaseDrawHelp::SetDisplay(): Sets the display mode for the object to be drawn.
BaseDrawHelp* bhelp = BaseDrawHelp::Alloc(bd, bh->GetDocument());
if (bhelp == nullptr)
BaseContainer displayOptions = bh->GetDisplay();
bhelp->SetDisplay(&displayOptions);
const Matrix originalMatrix = bh->GetMg();
bhelp->SetMg(originalMatrix);
BaseDrawHelp::Free(bhelp);
USE_CUSTOM_COLOR
Use a custom color.
Definition: ge_prepass.h:10
XRAY_OFF
Disables X-Ray mode.
Definition: ge_prepass.h:12
WIRE
Wireframe.
Definition: ge_prepass.h:3
FAILURE
Unknown.
Definition: ge_prepass.h:9
NO_EOGL
No Extended OpenGL.
Definition: ge_prepass.h:8
DRAWOBJECT
Definition: ge_prepass.h:4682
@ DISPLAYTAG_SDISPLAYMODE
Definition: tdisplay.h:6
Further Reading