c4d_baseobject.h File Reference

Classes

struct  CPolygon
 
struct  Tangent
 
struct  Segment
 
struct  ObjectColorProperties
 
class  HierarchyHelp
 
class  BaseObject
 
class  CameraObject
 
class  PointObject
 
struct  CLine
 
class  LineObject
 
class  PolygonObject
 
class  SplineLengthData
 
class  SplineObject
 
class  Safety
 
struct  PolyInfo
 
struct  NgonNeighbor
 
struct  NgonNeighbor::NgonNeighborSegment
 
class  Neighbor
 
class  PolyTriangulate
 

Macros

#define MODE_ON
 
#define MODE_OFF
 
#define MODE_UNDEF
 
#define POLYOBJECT_VBO_VERTEX
 
#define POLYOBJECT_VBO_PHONG_NORMAL
 
#define POLYOBJECT_VBO_POLYGON_NORMAL
 
#define POLYOBJECT_VBO_DISPLACE_NORMAL
 
#define POLYOBJECT_VBO_STICK_TEXTURE
 
#define POLYOBJECT_VBO_COLOR
 
#define ToPoint(op)
 
#define ToPoly(op)
 
#define ToSpline(op)
 
#define POLY_TRIANG_CONSTRAINED_OUTLINE
 
#define POLY_TRIANG_QUADS
 
#define POLY_TRIANG_NGON
 
#define POLY_TRIANG_FORCE_VORONOI
 
#define POLY_TRIANG_FORCE_NGON
 
#define POLY_TRIANG_FILL_HOLES
 
#define TRIANGSTATE_SKIP_EDGE
 
#define TRIANGSTATE_MISSING_CONSTRAINT
 

Functions

BaseObjectGeneratePrimitive (BaseDocument *doc, Int32 type, const BaseContainer &bc, Float lod, Bool isoparm, BaseThread *bt=nullptr)
 
BaseObjectGenerateSplinePrimitive (BaseDocument *doc, Int32 type, const BaseContainer &bc, Float lod, BaseThread *bt=nullptr)
 
Vector CalcFaceNormal (const Vector *padr, const CPolygon &v)
 
Int32 CalcLOD (Int32 val, Float lod, Int32 min, Int32 max)
 
Bool DisjointMesh (PointObject *op)
 
SplineObjectFitCurve (Vector *padr, Int32 pcnt, Float error, BaseThread *bt)
 
Bool Triangulate (const Vector *padr, Int32 pcnt, CPolygon **vadr, Int32 *vcnt)
 
Bool TriangulateStandard (const Vector *padr, Int32 pcnt, Int32 *list, Int32 lcnt, CPolygon *&vadr, Int32 &vcnt, BaseThread *thread)
 
Bool TriangulateRegular (const Vector *pinp, Int32 pinp_cnt, Int32 *list, Int32 lcnt, Vector *&padr, Int32 &pcnt, CPolygon *&vadr, Int32 &vcnt, Float regular_width, BaseThread *thread)
 
BaseObjectGenerateText (BaseContainer *cp, BaseThread *bt, Bool separate)
 
Bool CheckDisplayFilter (BaseObject *op, DISPLAYFILTER filter)
 
Bool CheckEditorVisibility (BaseObject *op)
 
Int32 IntersectionTest (PolygonObject *op, BaseDraw *bd, Float x, Float y, const Matrix &mg, Float *z, MODELINGCOMMANDMODE mode, UChar *pPointSelect, Int32 lSelectCount)
 
Vector ComputeLightColor (BaseObject *op, Bool editor, Float reference)
 
Vector ComputeColorTemperatureRGB (Float temperature, Float reference, Bool normalize)
 
BaseObjectGetVirtualLineObject (BaseObject *op, HierarchyHelp *hh, const Matrix &mloc, Bool keep_spline, Bool recurse, Matrix *mres, Bool *dirty)
 
UVWTagGenerateUVW (BaseObject *op, const Matrix &opmg, TextureTag *tp, const Matrix &texopmg, BaseView *view)
 
void CutReal (BaseContainer &data, Int32 id, Float min, Float max)
 
void CutVector (BaseContainer &data, Int32 id, Float min, Float max)
 
Bool CalculateVisiblePoints (BaseDraw *bd, PolygonObject *op, Vector *padr, UChar *pset, Bool select_visibonly)
 

Macro Definition Documentation

◆ ToPoint

#define ToPoint (   op)

Casts a BaseObject* to a PointObject*.

◆ ToPoly

#define ToPoly (   op)

Casts a BaseObject* to a PolygonObject*.

◆ ToSpline

#define ToSpline (   op)

Casts a BaseObject* to a SplineObject*.

Function Documentation

◆ GeneratePrimitive()

BaseObject* GeneratePrimitive ( BaseDocument doc,
Int32  type,
const BaseContainer bc,
Float  lod,
Bool  isoparm,
BaseThread bt = nullptr 
)

Creates a built-in Cinema 4D primitive objects.

Parameters
[in]docThe document for the primitive object. The caller owns the pointed document.
[in]typeThe primitive type: Primitive Types
[in]bcThe settings for the primitive.
[in]lodThe level of detail to use for the primitive.
[in]isoparmPass true to create a isoparm of the object.
[in]btThe thread to test for a break or nullptr. The caller owns the pointed thread.
Returns
The primitive object or nullptr if failed. The caller owns the pointed object.

◆ GenerateSplinePrimitive()

BaseObject* GenerateSplinePrimitive ( BaseDocument doc,
Int32  type,
const BaseContainer bc,
Float  lod,
BaseThread bt = nullptr 
)

Creates a built-in Cinema 4D primitive spline objects.

Parameters
[in]docThe document for the spline primitive object. The caller owns the pointed document.
[in]typeThe spline primitive type: Spline Primitive Types
[in]bcThe settings for the spline primitive.
[in]lodThe level of detail to use for the primitive.
[in]btThe thread to test for a break or nullptr. The caller owns the pointed thread.
Returns
The primitive spline object or nullptr if failed. The caller owns the pointed object.

◆ CalcFaceNormal()

Vector CalcFaceNormal ( const Vector padr,
const CPolygon v 
)

Calculates the normal of a polygon.

Parameters
[in]padrThe points array.
[in]vThe polygon.
Returns
The face's normal.

◆ CalcLOD()

Int32 CalcLOD ( Int32  val,
Float  lod,
Int32  min,
Int32  max 
)

Helper function to modify a user chosen subdivision value.
Example:

Int32 sub = CalcLOD(data.GetInt32(TUBEOBJECT_SUB, 1), hh->GetLOD(), 1, 1000);
Int32 CalcLOD(Int32 val, Float lod, Int32 min, Int32 max)
maxon::Int32 Int32
Definition: ge_sys_math.h:60
Parameters
[in]valThe user chosen LOD value.
[in]lodThe LOD value, from BaseDocument::GetLOD().
[in]minThe minimum LOD.
[in]maxThe maximum LOD.
Returns
The level of detail.

◆ DisjointMesh()

Bool DisjointMesh ( PointObject op)

Separates the mesh of the object to make each polygon/line segment independent.
Each polygon/line will be given its own points thereby separating them so they can be moved independently, such as the Explosion object.

Parameters
[in]opThe Point object to disjoint. The caller owns the pointed Point object.
Returns
true if the mesh was disjointed successfully, otherwise false.

◆ FitCurve()

SplineObject* FitCurve ( Vector padr,
Int32  pcnt,
Float  error,
BaseThread bt 
)

Creates a Spline object that has the best fit through the given points.

Parameters
[in]padrThe points to fit a curve to. The caller owns the pointed array.
[in]pcntThe number of points in the point array padr.
[in]errorSets how closely the curve must match the passed points. The range for this is 0 to MAXRANGE. The lower the value then the closer the curve will match.
[in]btThe current thread, or nullptr for the main Cinema 4D thread. The caller owns the pointed thread.
Returns
A Spline object that fits the given points, or nullptr if failed. The caller owns the pointed Spline object.

◆ Triangulate()

Bool Triangulate ( const Vector padr,
Int32  pcnt,
CPolygon **  vadr,
Int32 vcnt 
)

Turns the polygon mesh into triangles.

Parameters
[in]padrThe points of the object to triangulate. The caller owns the pointed array.
[in]pcntThe number of points in the points array padr.
[out]vadrThe polygons for the object. Assigned the triangulated polygons. The caller owns the pointed array.
Can be assigned nullptr, always check.
[out]vcntAssigned the triangulated count i.e. the number of polygons in the returned polygons array vadr.
Returns
true if turning the polygons into triangles was successful, otherwise false.

◆ TriangulateStandard()

Bool TriangulateStandard ( const Vector padr,
Int32  pcnt,
Int32 list,
Int32  lcnt,
CPolygon *&  vadr,
Int32 vcnt,
BaseThread thread 
)

Triangulates the spline described by (padr,pcnt) and (list,lcnt) returning the result in (vadr,vcnt).

Warning
The returned data vadr must be freed with DeleteMem()
Parameters
[in]padrThe input points. The caller owns the pointed array.
[in]pcntThe number of input points in padr.
[in]listThe input segments. A list with a Int32 for each segment, telling its length within the point array padr. The caller owns the pointed array.
[in]lcntThe number of input segments in list.
[out]vadrAssigned the output polygon array. The caller owns the pointed array.
[out]vcntThe number of polygons in vadr.
[in]threadThe current thread, or nullptr for the main Cinema 4D thread. The caller owns the pointed thread.
Returns
true if the spline was triangulated successfully, otherwise false.

◆ TriangulateRegular()

Bool TriangulateRegular ( const Vector pinp,
Int32  pinp_cnt,
Int32 list,
Int32  lcnt,
Vector *&  padr,
Int32 pcnt,
CPolygon *&  vadr,
Int32 vcnt,
Float  regular_width,
BaseThread thread 
)

Triangulates the spline described by (pinp,pinp_cnt) and (list,lcnt) returning the result in (padr,pcnt) and (vadr,vcnt). Generates new points in a regular mesh specified by regular_width.

Warning
The returned data (padr,vadr) must be freed with DeleteMem().
Parameters
[in]pinpThe input points. The caller owns the pointed array.
[in]pinp_cntThe number of input points in pinp.
[in]listThe input segments. A list with a Int32 for each segment, telling its length within the point array padr. The caller owns the pointed array.
[in]lcntThe number of input segments in list.
[out]padrAssigned the output point array. The caller owns the pointed array.
[out]pcntThe number of output points in padr.
[out]vadrAssigned the output polygon array. The caller owns the pointed array.
[out]vcntThe number of output polygons in vadr.
[in]regular_widthThe width of the regular mesh.
[in]threadThe current thread, or nullptr for the main Cinema 4D thread. The caller owns the pointed thread.
Returns
true if the spline was triangulated successfully, otherwise false.

◆ GenerateText()

BaseObject* GenerateText ( BaseContainer cp,
BaseThread bt,
Bool  separate 
)

Creates a text object.

Parameters
[in]cpThe container with settings for the text object.
[in]btThe current thread, or nullptr for the main Cinema 4D thread. The caller owns the pointed thread.
[in]separatetrue if the letters should be separate, otherwise false.
Returns
The created text object or nullptr if failed. The caller owns the pointed object.

◆ CheckDisplayFilter()

Bool CheckDisplayFilter ( BaseObject op,
DISPLAYFILTER  filter 
)

Checks if an object is covered by a display filter.
Example:

BaseDraw* bd = doc->GetActiveBaseDraw();
// Get the BaseDraw's display filter
if (CheckDisplayFilter(op, filter))
{
// Use object
}
Bool CheckDisplayFilter(BaseObject *op, DISPLAYFILTER filter)
Definition: c4d_basedraw.h:754
DISPLAYFILTER GetDisplayFilter() const
Definition: c4d_basedraw.h:1608
DISPLAYFILTER
Definition: ge_prepass.h:4537
const char * doc
Definition: pyerrors.h:226
PyObject * op
Definition: object.h:520
Parameters
[in]opThe object to check. The caller owns the pointed object.
[in]filterThe filter bitmask: DISPLAYFILTER
Returns
true if the object is included in a display filter, otherwise false.

◆ CheckEditorVisibility()

Bool CheckEditorVisibility ( BaseObject op)

Checks if an object is visible in the viewport including evaluation of parent hierarchies and layers. Combine with CheckDisplayFilter() to get the visibility in a certain BaseDraw.

Since
R16.050
Parameters
[in]opThe object to check.
Returns
true if the object state is visible, otherwise false.

◆ IntersectionTest()

Int32 IntersectionTest ( PolygonObject op,
BaseDraw bd,
Float  x,
Float  y,
const Matrix mg,
Float z,
MODELINGCOMMANDMODE  mode,
UChar pPointSelect,
Int32  lSelectCount 
)

Checks for a polygon intersection at position (x/y) in the view bd with object op and global matrix mg.
The resulting Z depth is assigned to z.

Parameters
[in]opThe polygon object to check. The caller owns the pointed polygon object.
[in]bdThe base draw to check the intersection in. The caller owns the pointed base draw.
[in]xThe X coordinate to check.
[in]yThe Y coordinate to check.
[in]mgThe global matrix of the object.
[out]zAssigned the Z coordinate of the intersection if found.
[in]modeThe intersection mode: MODELINGCOMMANDMODE
[in]pPointSelectAn optional point selection. The caller owns the pointed array.
[in]lSelectCountThe number of points in pPointselect.
Returns
The intersection result.

◆ ComputeLightColor()

Vector ComputeLightColor ( BaseObject op,
Bool  editor,
Float  reference 
)

Computes the color of a light source. Private.

◆ ComputeColorTemperatureRGB()

Vector ComputeColorTemperatureRGB ( Float  temperature,
Float  reference,
Bool  normalize 
)

Computes the color of a light source. Private.

◆ GetVirtualLineObject()

BaseObject* GetVirtualLineObject ( BaseObject op,
HierarchyHelp hh,
const Matrix mloc,
Bool  keep_spline,
Bool  recurse,
Matrix mres,
Bool dirty 
)

Gets a LineObject or SplineObject from a spline generator.

Parameters
[in]opThe spline object. The caller owns the pointed base object.
[in]hhThe HierarchyHelp usually passed from ObjectData::GetVirtualObjects(). The caller owns the pointed hierarchy help.
[in]mlocThe local matrix of the spline object.
[in]keep_splinetrue to generate a SplineObject or false for a LineObject.
[in]recurseIf true and the object op itself did not generate a line object then Cinema 4D will search through all children and caches of op if any of those objects generates the line form.
Note
The caches are always searched.
If a spline is placed in An array object and the array under the generator then GetVirtualLineObject() will return the first "arrayed" spline.
For example, a Spline is put into a Null object placed under the generator.
With recurse==false then GetVirtualLineObject() return nullptr, if recurse==true then it would find the first child Spline of the Null object.
Parameters
[out]mresAssigned the local matrix of the object that created the line form.
[out]dirtyAssigned true if the object that generated the spline was modified. In this case the generator knows that it must rebuild its cache.
Returns
The LineObject or SplineObject from a spline generator. The caller owns the pointed base object.

◆ GenerateUVW()

UVWTag* GenerateUVW ( BaseObject op,
const Matrix opmg,
TextureTag tp,
const Matrix texopmg,
BaseView view 
)

Generates a UVW tag for an object.

Parameters
[in]opThe object to generate the UVW coordinates for. The caller owns the pointed base object.
[in]opmgThe object's global matrix.
[in]tpThe texture tag to generate the UVW coordinates from. The caller owns the pointed texture tag.
[in]texopmgThe global matrix of the object that carries the texture tag.
[in]viewThe current view or nullptr. The caller owns the pointed base view.
Returns
The created UVW tag or nullptr if the texture type is already UV or if failed. If nullptr then the UVW tag must retrieved from the object itself. The caller owns the pointed UVW tag.

◆ CutReal()

void CutReal ( BaseContainer data,
Int32  id,
Float  min,
Float  max 
)

Limits the float value with the specified id in the container data between min and max.

Parameters
[in]dataThe container with the value.
[in]idThe ID of the float value.
[in]minThe minimum value.
[in]maxThe maximum value.

◆ CutVector()

void CutVector ( BaseContainer data,
Int32  id,
Float  min,
Float  max 
)

Limits the vector value with the specified id in the container data between min and max.

Parameters
[in]dataThe container with the value.
[in]idThe ID of the vector value.
[in]minThe minimum value.
[in]maxThe maximum value.

◆ CalculateVisiblePoints()

Bool CalculateVisiblePoints ( BaseDraw bd,
PolygonObject op,
Vector padr,
UChar pset,
Bool  select_visibonly 
)

Checks which points in the points array padr of op are visible in the view bd.

Parameters
[in]bdThe base draw to check. The caller owns the pointed base draw.
[in]opThe polygon object to check. The caller owns the pointed polygon object.
[in]padrThe points array. The caller owns the pointed points array.
[in]psetAssigned an array of size PointObject::GetPointCount() with the visibility status for each point:
1 if the point is visible otherwise 0 .
[in]select_visibonlyIf true only points that are truly visible are included, otherwise e.g. points from the back of an object are included.
Returns
true if successful, otherwise false.