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()
HierarchyHelp
Definition: c4d_baseobject.h:175
TP_PShapeInterface::base
TP_BaseShape * base
Base class pointer.
Definition: c4d_particles.h:435
TP_BaseShape
Definition: c4d_particles.h:390
BaseObject
Definition: c4d_baseobject.h:220
Float
maxon::Float Float
Definition: ge_sys_math.h:51
TP_PShapeInterface
Definition: c4d_particles.h:433
AliasTrans
Definition: c4d_baselist.h:2972
TP_PShapeInterface::GetShapeVirtualObjects
BaseObject *(TP_BaseShape::* GetShapeVirtualObjects)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, BaseDocument *doc, HierarchyHelp *hh)
Definition: c4d_particles.h:476
TP_PShapeInterface::GetShapeScale
Float(TP_BaseShape::* GetShapeScale)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
Definition: c4d_particles.h:485
TP_PShapeInterface::FreeShape
void(TP_BaseShape::* FreeShape)(TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid)
Definition: c4d_particles.h:493
TP_PShapePtr
Wrapper around a TP_PShapeI pointer.
Definition: c4d_particles.h:263
Int32
maxon::Int32 Int32
Definition: ge_sys_math.h:45
TP_PShapeI::owner_id
Int32 owner_id
Owner ID of the shape. This is TP_MasterSystem::GetOperatorID() for the node responsible for the shap...
Definition: c4d_particles.h:244
TP_PShapeInterface::GetShapeClone
TP_PShapePtr(TP_BaseShape::* GetShapeClone)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, COPYFLAGS flags, AliasTrans *trn)
Definition: c4d_particles.h:446
TP_PShapePtr::Get
TP_PShapeI * Get() const
Definition: c4d_particles.h:365
TP_MasterSystem
Definition: c4d_particles.h:735
TP_PShapeInterface::GetShape
TP_PShapePtr(TP_BaseShape::* GetShape)(const TP_PShapePtr &shape, TP_MasterSystem *msys, Int32 pid, Int32 owner_id)
Definition: c4d_particles.h:465
BaseDocument
Definition: c4d_basedocument.h:479