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* GetShapeClone(TP_PShapePtr &shape , TP_MasterSystem *msys, Int32 pid, Int32 flags, AliasTrans *trn)
{
// ...
}
TP_PShape* GetShape(TP_PShapePtr &shape , TP_MasterSystem *msys, Int32 pid, Int32 owner_id)
{
// ...
}
{
// ...
}
{
// ...
}
void FreeShape(TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
{
// ...
}
};

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()