TP_PShapeInterface Struct Reference

#include <c4d_particles.h>

Detailed Description

Callback interface for nodes that register shapes.
The easiest way to create this is to implement the TP_BaseShape class:
This class is only forward-declared in c4d_particles.h, so as long as the linker approves this is fine.
Example:

{
public:
TP_BaseShape() { si.base = this; }
{
// ...
}
TP_PShape* GetShape(TP_PShapePtr &shape , TP_MasterSystem *msys, Int32 pid, Int32 owner_id)
{
// ...
}
{
// ...
}
{
// ...
}
{
// ...
}
};
PyCompilerFlags * flags
Definition: ast.h:14
Definition: c4d_baselist.h:3067
Definition: c4d_basedocument.h:498
Definition: c4d_baseobject.h:225
Definition: c4d_baseobject.h:180
Definition: c4d_particles.h:401
Definition: c4d_particles.h:747
Wrapper around a TP_PShapeI pointer.
Definition: c4d_particles.h:275
Py_ssize_t * shape
Definition: abstract.h:315
maxon::Int32 Int32
Definition: ge_sys_math.h:60
maxon::Float Float
Definition: ge_sys_math.h:66
const char * doc
Definition: pyerrors.h:226
Definition: c4d_particles.h:445
TP_PShapePtr(TP_BaseShape::* GetShapeClone)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, COPYFLAGS flags, AliasTrans *trn)
Definition: c4d_particles.h:457
TP_BaseShape * base
Base class pointer.
Definition: c4d_particles.h:446
BaseObject *(TP_BaseShape::* GetShapeVirtualObjects)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, BaseDocument *doc, HierarchyHelp *hh)
Definition: c4d_particles.h:487
TP_PShapePtr(TP_BaseShape::* GetShape)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, Int32 owner_id)
Definition: c4d_particles.h:476
Float(TP_BaseShape::* GetShapeScale)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
Definition: c4d_particles.h:496
void(TP_BaseShape::* FreeShape)(TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
Definition: c4d_particles.h:504

In the TP_MSG_GET_PSHAPEINTERFACE message then simply set the passed pointer TP_PShapeInterface to &baseshape.si, for a global TP_BaseShape baseshape object that was previously created.
Thinking Particles will then call the shape functions as needed.

Public Attributes

TP_BaseShapebase
 
TP_PShapePtr(TP_BaseShape::* GetShapeClone )(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, COPYFLAGS flags, AliasTrans *trn)
 
TP_PShapePtr(TP_BaseShape::* GetShape )(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, Int32 owner_id)
 
BaseObject *(TP_BaseShape::* GetShapeVirtualObjects )(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, BaseDocument *doc, HierarchyHelp *hh)
 
Float(TP_BaseShape::* GetShapeScale )(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
 
void(TP_BaseShape::* FreeShape )(TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
 

Member Data Documentation

◆ base

TP_BaseShape* base

Base class pointer.

◆ GetShapeClone

TP_PShapePtr(TP_BaseShape::* GetShapeClone) (const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, COPYFLAGS flags, AliasTrans *trn)

Return a clone of shape.

Parameters
[in]shapeThe particle shape pointer structure of the particle shape handle.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()
[in]flagsThe flags: COPYFLAGS
[in]trnAn alias translator for the operation. Can be nullptr. The caller owns the pointed AliasTrans.
Returns
The particle shape pointer structure of the cloned particle shape. The caller owns the pointed TP_PShapePtr.

◆ GetShape

TP_PShapePtr(TP_BaseShape::* GetShape) (const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, Int32 owner_id)

Return the shape associated with shape. Normally this is the same object, so a typical implementation would be:

{
if (shape->Get()->owner_id == owner_id)
return TP_ShapePtr(shape);
return nullptr;
}
Parameters
[in]shapeThe particle shape pointer structure of the particle shape handle.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()
[in]owner_idThe owner ID.
Returns
The particle shape pointer structure. The shape handler owns the pointed shape.

◆ GetShapeVirtualObjects

BaseObject*(TP_BaseShape::* GetShapeVirtualObjects) (const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, BaseDocument *doc, HierarchyHelp *hh)

Return a real BaseObject for shape.

Parameters
[in]shapeThe particle shape pointer structure of the particle shape handle.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()
[in]docThe current document. The caller owns the pointed BaseDocument.
[in]hhA hierarchy helper for the operation. The caller owns the pointed HierarchyHelp.
Returns
The particle shape object. The particle shape handler owns the pointed object.

◆ GetShapeScale

Float(TP_BaseShape::* GetShapeScale) (const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)

Return the scale of the particle shape.

Parameters
[in]shapeThe particle shape pointer structure of the particle shape handle.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()
Returns
The particle shape scale.

◆ FreeShape

void(TP_BaseShape::* FreeShape) (TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)

Free the particle shape.

Parameters
[in]shapeThe particle shape pointer structure of the particle shape handle.
[in]msysThe master system. The caller owns the pointed TP_MasterSystem.
[in]pidThe particle ID: 0 <= pid < msys->NumParticles()