TP_MasterSystem Class Reference

#include <c4d_particles.h>

Inheritance diagram for TP_MasterSystem:

Detailed Description

The master system is the main Thinking Particles engine class. There can only be one master system per document. This is the easiest way to get it:

TP_MasterSystem* GetTpMasterSystem(BaseDocument* doc)
{
if (!doc)
return nullptr;
if (!hook || hook->GetType() != ID_THINKINGPARTICLES)
return nullptr;
return static_cast<TP_MasterSystem*>(hook);
}

Private Member Functions

 TP_MasterSystem ()
 
 ~TP_MasterSystem ()
 

Particle/Particles

Int32 AllocParticle (void)
 
Int32 AllocParticles (Int32 num, Int32 *ids)
 
void FreeParticle (Int32 pid)
 
void FreeAllParticles (void)
 
Int32 NumParticles (void)
 

Particle Group

TP_PGroupAllocParticleGroup (void)
 
void FreeParticleGroup (TP_PGroup *&group)
 
Bool SetPGroupHierarchy (TP_PGroup *parent, TP_PGroup *group, TP_InsertMode mode)
 
Int32 GetParticleGroups (TP_PGroup *ingroup, TP_PGroupArray *gtab, TP_GetPGroupMode mode, Bool subgroups=true)
 
Int32 GetGroupParticleCount (TP_PGroup *ingroup, Bool subgroups=true)
 
BaseObjectGetVirtualObjects (TP_PGroup *ingroup, Bool inRender=true, Bool subgroups=true, HierarchyHelp *hh=nullptr)
 
BaseContainerGetGroupInfo (TP_PGroup *group)
 
TP_PGroupGetGroupFromInfo (BaseContainer *info)
 
Bool UpdateGroup (TP_PGroup *group, const BaseTime &timeDelta)
 

Particle Information/Bits

Bool Alive (Int32 pid)
 
Bool IsBorn (Int32 pid)
 
Bool IsDie (Int32 pid)
 
Bool EntersGroup (Int32 pid)
 
TP_PGroupGroup (Int32 pid)
 
Vector Position (Int32 pid)
 
Vector Velocity (Int32 pid)
 
Float Mass (Int32 pid)
 
TP_Spin Spin (Int32 pid)
 
Float Size (Int32 pid)
 
Vector Scale (Int32 pid)
 
BaseTime Age (Int32 pid)
 
BaseTime Life (Int32 pid)
 
Matrix Alignment (Int32 pid)
 
Int32 Randomseed (Int32 pid)
 
TP_PShapePtr Shape (Int32 pid)
 
Matrix Transform (Int32 pid)
 
UInt16 Flags (Int32 pid)
 
Float DTFactor (Int32 pid)
 

Set Particle Information/Bits

void SetPosition (Int32 pid, const Vector &p)
 
void SetVelocity (Int32 pid, const Vector &p)
 
void SetMass (Int32 pid, Float mass)
 
void SetSpin (Int32 pid, const TP_Spin &spin)
 
void SetAge (Int32 pid, const BaseTime &age)
 
void SetLife (Int32 pid, const BaseTime &life)
 
void SetGroup (Int32 pid, TP_PGroup *group)
 
void SetSize (Int32 pid, Float size)
 
void SetScale (Int32 pid, const Vector &scale)
 
void SetAlignment (Int32 pid, const Matrix &align)
 
void SetRandomseed (Int32 pid, Int32 seed)
 
void SetShape (Int32 pid, const TP_PShapePtr &shape, Bool deleteold=true)
 
void SetCollision (Int32 pid, Int32 collision)
 
void SetDTFactor (Int32 pid, Float dt)
 

Particle Data Channels

Bool AddDataChannel (GvDataID type, const maxon::String &str)
 
Bool RemoveDataChannel (Int32 chan)
 
Int32 NumDataChannels (void)
 
GvDataID DataChannelType (Int32 chan)
 
String DataChannelName (Int32 chan)
 
Int32 DataChannelUniqueID (Int32 chan)
 
Int32 DataChannelID (Int32 unique_id)
 
Bool SetData (Int32 pid, Int32 chan, void *data, GvValueID type)
 
Bool GetData (Int32 pid, Int32 chan, void *data, GvValueID type)
 
Bool SetDataFromPort (Int32 pid, Int32 chan, GvPort *p, GvRun *r)
 
Bool SetDataToPort (Int32 pid, Int32 chan, GvPort *p, GvRun *r)
 
BaseContainerGetDataChannelInfo (Int32 chan)
 
Int32 GetDataChannelFromInfo (BaseContainer *info)
 

Callbacks

void Reg_FreeParticle_CB (TP_FreeParticle_CB *cb)
 
void UReg_FreeParticle_CB (TP_FreeParticle_CB *cb)
 
void Reg_DeletePShape_CB (TP_FreePShape_CB *cb)
 
void UReg_DeletePShape_CB (TP_FreePShape_CB *cb)
 

Operator Link Table

Int32 GetOperatorID (GvNode *op)
 
GvOperatorDataGetOperator (Int32 id)
 

Dirty

UInt32 GetDirty (void) const
 
void SetDirty (void)
 

Collision

Bool CheckCollision (Int32 collision, Int32 pid, Float t, Vector &pos, Vector &vel, TP_Spin &spin, Float dt, Float &ct)
 

Particle Shape

TP_PShapePtr GetShapeClone (const TP_PShapePtr &shape, Int32 pid, COPYFLAGS flags, AliasTrans *trn)
 
TP_PShapePtr GetShape (const TP_PShapePtr &shape, Int32 pid, Int32 owner_id)
 
BaseObjectGetShapeVirtualObjects (const TP_PShapePtr &shape, Int32 pid, BaseDocument *doc, HierarchyHelp *hh)
 
Float GetShapeScale (const TP_PShapePtr &shape, Int32 pid)
 
void FreeShape (TP_PShapePtr &shape, Int32 pid)
 

Collider Cache

GeColliderCacheColliderCache (Int32 pid)
 

Color Property

Vector32 Color (Int32 pid)
 
void SetColor (Int32 pid, const Vector32 &color)
 

Additional Inherited Members

- Public Member Functions inherited from BaseSceneHook
Bool InitDisplayControl (BaseSceneHook *node, BaseDocument *doc, BaseDraw *bd, const AtomArray *active)
 
void FreeDisplayControl ()
 
Bool DisplayControl (BaseDocument *doc, BaseObject *op, BaseObject *chainstart, BaseDraw *bd, BaseDrawHelp *bh, ControlDisplayStruct &cds) const
 
- Public Member Functions inherited from BaseList2D
const CharGetViewportRenderId (VIEWPORT_RENDER_ID typeId) const
 
BaseList2DGetNext ()
 
BaseList2DGetPred ()
 
void SetBit (Int32 mask)
 
Bool GetBit (Int32 mask) const
 
void DelBit (Int32 mask)
 
void ToggleBit (Int32 mask)
 
Int32 GetAllBits () const
 
void SetAllBits (Int32 bits)
 
void SetBitEx (Int32 mask, Int32 flags)
 
BaseContainer GetData ()
 
void SetData (const BaseContainer &bc, Bool add=true)
 
const BaseContainerGetDataInstance () const
 
BaseContainerGetDataInstance ()
 
const BaseContainerGetDataInstanceRef () const
 
BaseContainerGetDataInstanceRef ()
 
String GetName () const
 
void SetName (const maxon::String &name)
 
String GetBubbleHelp ()
 
Bool TransferGoal (BaseList2D *dst, Bool undolink)
 
Bool TransferMarker (BaseList2D *dst) const
 
Bool Scale (Float scale)
 
Bool Edit ()
 
void GetIcon (IconData *dat)
 
GeListHeadGetNLARoot ()
 
BaseList2DAnimationLayerRemap (BaseObject **layer=nullptr)
 
String GetTypeName ()
 
BaseList2DGetMain () const
 
void InsertTrackSorted (CTrack *track)
 
Bool AddEventNotification (BaseList2D *bl, NOTIFY_EVENT eventid, NOTIFY_EVENT_FLAG flags, const BaseContainer *data)
 
Bool RemoveEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool FindEventNotification (BaseDocument *doc, BaseList2D *bl, NOTIFY_EVENT eventid)
 
Bool SetDescIDState (const DescID &id, DESCIDSTATE descidstate)
 
DESCIDSTATE GetDescIDState (const DescID &id, Bool tolerant) const
 
GeListHeadGetOverrideRoot ()
 
BaseOverrideGetFirstOverride ()
 
GeListHeadGetShaderRepositoryRoot ()
 
GeListHeadGetHiddenShaderRoot ()
 
maxon::NimbusInterface * GetNimbusRef (const maxon::Id &spaceId) const
 
maxon::Result< maxon::NimbusInterface * > GetOrCreateNimbusRef (const maxon::Id &spaceId)
 
void RemoveNimbusRef (const maxon::Id &spaceId)
 
maxon::Result< maxon::HashMap< maxon::Id, maxon::ForwardRef< maxon::NimbusRef > > > GetAllNimbusRefs () const
 
Bool IsNodeBased () const
 
void GetMarkerStampEx (UInt32 *l1, UInt32 *l2)
 
const GeMarkerGetMarker () const
 
void SetMarker (const GeMarker &m)
 
Bool AddUniqueID (Int32 appid, const Char *const mem, Int bytes)
 
Bool FindUniqueID (Int32 appid, const Char *&mem, Int &bytes) const
 
Int32 GetUniqueIDCount () const
 
Bool GetUniqueIDIndex (Int32 idx, Int32 &id, const Char *&mem, Int &bytes) const
 
Bool SetAnimatedParameter (CTrack *track, const DescID &id, const GeData &t_data1, const GeData &t_data2, Float mix, DESCFLAGS_SET flags)
 
Bool GetAnimatedParameter (const DescID &id, GeData &t_data1, GeData &t_data2, Float &mix, DESCFLAGS_GET flags)
 
BaseShaderGetFirstShader () const
 
void InsertShader (BaseShader *shader, BaseShader *pred=nullptr)
 
void ClearKeyframeSelection ()
 
Bool FindKeyframeSelection (const DescID &id)
 
Bool SetKeyframeSelection (const DescID &id, Bool selection)
 
Bool KeyframeSelectionContent ()
 
LayerObjectGetLayerObject (BaseDocument *doc)
 
Bool SetLayerObject (LayerObject *layer)
 
const LayerDataGetLayerData (BaseDocument *doc, Bool rawdata=false)
 
Bool SetLayerData (BaseDocument *doc, const LayerData &data)
 
GeListHeadGetCTrackRoot ()
 
CTrackGetFirstCTrack ()
 
CTrackFindCTrack (const DescID &id)
 
- Public Member Functions inherited from GeListNode
GeListNodeGetNext ()
 
GeListNodeGetPred ()
 
GeListNodeGetDown ()
 
GeListNodeGetUp ()
 
GeListNodeGetDownLast ()
 
void InsertBefore (GeListNode *bl)
 
void InsertAfter (GeListNode *bl)
 
void InsertUnder (GeListNode *bl)
 
void InsertUnderLast (GeListNode *bl)
 
void Remove ()
 
GeListHeadGetListHead ()
 
Int32 GetNodeID (Int32 index=0) const
 
template<typename CAST >
const CAST * GetNodeData (Int32 index=0) const
 
template<typename CAST >
CAST * GetNodeData (Int32 index=0)
 
void SetCustomData (GeListNode *node)
 
GeListNodeGetCustomData ()
 
BaseDocumentGetDocument ()
 
Int32 GetBranchInfo (BranchInfo *info, Int32 max, GETBRANCHINFO flags)
 
Bool IsDocumentRelated ()
 
Int32 GetInfo ()
 
Bool GetNBit (NBIT bit) const
 
UInt32 GetNBitMask (Int32 index) const
 
Bool ChangeNBit (NBIT bit, NBITCONTROL bitmode)
 
- Public Member Functions inherited from C4DAtom
Int32 GetType () const
 
Int32 GetRealType () const
 
Int32 GetDiskType () const
 
Bool IsInstanceOf (Int32 id) const
 
Int32 GetClassification () const
 
Bool Message (Int32 type, void *data=nullptr)
 
Bool MultiMessage (MULTIMSG_ROUTE flags, Int32 type, void *data)
 
C4DAtomGetClone (COPYFLAGS flags, AliasTrans *trn)
 
Bool CopyTo (C4DAtom *dst, COPYFLAGS flags, AliasTrans *trn)
 
Bool Read (HyperFile *hf, Int32 id, Int32 level)
 
Bool Write (HyperFile *hf)
 
Bool ReadObject (HyperFile *hf, Bool readheader)
 
Bool WriteObject (HyperFile *hf)
 
Bool GetDescription (Description *description, DESCFLAGS_DESC flags)
 
Bool GetParameter (const DescID &id, GeData &t_data, DESCFLAGS_GET flags)
 
Bool SetParameter (const DescID &id, const GeData &t_data, DESCFLAGS_SET flags)
 
DynamicDescriptionGetDynamicDescription ()
 
Bool GetEnabling (const DescID &id, const GeData &t_data, DESCFLAGS_ENABLE flags, const BaseContainer *itemdesc)
 
Bool TranslateDescID (const DescID &id, DescID &res_id, C4DAtom *&res_at)
 
UInt32 GetDirty (DIRTYFLAGS flags) const
 
void SetDirty (DIRTYFLAGS flags)
 
UInt32 GetHDirty (HDIRTYFLAGS mask) const
 
void SetHDirty (HDIRTYFLAGS mask)
 
- Static Public Member Functions inherited from BaseList2D
static BaseList2DAlloc (Int32 type)
 
static void Free (BaseList2D *&bl)
 
- Static Public Attributes inherited from BaseList2D
static const Int32 SETBIT_FLAG_NODIRTY
 
static const Int32 SETBIT_FLAG_REMOVE
 

Constructor & Destructor Documentation

◆ TP_MasterSystem()

TP_MasterSystem ( )
private

◆ ~TP_MasterSystem()

~TP_MasterSystem ( )
private

Member Function Documentation

◆ AllocParticle()

Int32 AllocParticle ( void  )

Allocates a particle.

Returns
The particle ID of the allocated particle, or NOTOK if the allocation failed.

◆ AllocParticles()

Int32 AllocParticles ( Int32  num,
Int32 ids 
)

Allocates num particles and stores their particles IDs in the ids array.

Parameters
[in]numThe number of particles to allocate.
[out]idsAn array of num Int32 elements. Filled with the allocated particle IDs. The caller owns the pointed array.
Returns
The number of particles allocated, or NOTOK if the allocation failed.

◆ FreeParticle()

void FreeParticle ( Int32  pid)

Frees a particle.

Note
Normally this should not be used. Instead SetLife() should be uses with a negative time, so that the particle in question dies immediately.
Parameters
[in]pidThe particle ID of the particle to free: 0 <= pid < NumParticles()

◆ FreeAllParticles()

void FreeAllParticles ( void  )

Frees all particles.

Note
Normally this should not be used. Instead SetLife() should be uses with a negative time, so that the particles dies immediately.

◆ NumParticles()

Int32 NumParticles ( void  )

Retrieves the number of allocated particles. All particles IDs are less than this value.

Returns
The number of particles.

◆ AllocParticleGroup()

TP_PGroup* AllocParticleGroup ( void  )

Allocates a new particle group. Must be freed with FreeParticleGroup(), or inserted into the list with SetPGroupHierarchy().

Returns
The allocate particle group. The caller owns the pointed TP_PGroup.

◆ FreeParticleGroup()

void FreeParticleGroup ( TP_PGroup *&  group)

Frees a particle group, removing it from the list.

Parameters
[in,out]groupThe group to free. Set to nullptr afterwards.

◆ SetPGroupHierarchy()

Bool SetPGroupHierarchy ( TP_PGroup parent,
TP_PGroup group,
TP_InsertMode  mode 
)

Performs a hierarchy action on a particle group.

Parameters
[in]parentThe parent parameter. The caller owns the pointed TP_PGroup.
[in]groupThe group to act on. The caller owns the pointed TP_PGroup.
[in]modeThe hierarchy action: TP_InsertMode
Returns
true if successful, otherwise false.

◆ GetParticleGroups()

Int32 GetParticleGroups ( TP_PGroup ingroup,
TP_PGroupArray gtab,
TP_GetPGroupMode  mode,
Bool  subgroups = true 
)

Returns the particle groups in ingroup, specified by mode, into the gtab list.
Example:

PluginSceneHook* hook = doc->FindSceneHook(ID_THINKINGPARTICLES);
if (hook && hook->GetType() == ID_THINKINGPARTICLES)
{
Int32 gcnt = tpm->GetParticleGroups(nullptr, &groups, TP_GETPGROUP_ALL, false);
// For subgroups
//Int32 gcnt = tpm->GetParticleGroups(nullptr,&groups, TP_GETPGROUP_ALL, true);
TP_PGroup *grp = (TP_PGroup*)groups.GetIndex(0); // grp is the "All" group
//To iterate
//for (Int32 i=0; i<gcnt; i++)
//{
// TP_PGroup *grp = (TP_PGroup*)groups.GetIndex(i);
//}
}
Parameters
[in]ingroupThe in-group parameter. The caller owns the pointed TP_PGroup.
[out]gtabThe specified groups are added to this list. The caller owns the pointed TP_PGroup.
[in]modeThe mode: TP_GetPGroupMode
[in]subgroupsIf true sub-groups are included.
Returns
The number of groups added to gtab.

◆ GetGroupParticleCount()

Int32 GetGroupParticleCount ( TP_PGroup ingroup,
Bool  subgroups = true 
)

Calculates the number of particles in ingroup.

Parameters
[in]ingroupThe in-group parameter. The caller owns the pointed TP_PGroup.
[in]subgroupsIf true sub-groups are included.
Returns
The number of particles in the specified group.

◆ GetVirtualObjects()

BaseObject* GetVirtualObjects ( TP_PGroup ingroup,
Bool  inRender = true,
Bool  subgroups = true,
HierarchyHelp hh = nullptr 
)

Creates the virtual object hierarchy for a particle group, i.e. an object group containing all particles. Used by the ParticleGeometry object.

Parameters
[in]ingroupThe in-group parameter. The caller owns the pointed TP_PGroup.
[in]inRendertrue if this is for rendering, otherwise the objects are built for the editor view.
[in]subgroupsIf true sub-groups are included.
[in]hhThe hierarchy helper for the virtual object generation. The caller owns the pointed HierarchyHelp.
Returns
The virtual object, or nullptr if there was an error.

◆ GetGroupInfo()

BaseContainer* GetGroupInfo ( TP_PGroup group)

Retrieves the group information for a group.

Parameters
[in]groupThe group to get the information for. The caller owns the pointed TP_PGroup.
Returns
The group information for group. The caller owns the pointed TP_PGroupInfo.

◆ GetGroupFromInfo()

TP_PGroup* GetGroupFromInfo ( BaseContainer info)

Retrieves a group from the information in info.

Parameters
[in]infoThe group information to search for. The caller owns the pointed TP_PGroupInfo.
Returns
The retrieved group, or nullptr if no group matched. The master system owns the pointed TP_PGroup.

◆ UpdateGroup()

Bool UpdateGroup ( TP_PGroup group,
const BaseTime timeDelta 
)

Updates a group at a given time difference since the last update. Use a default timeDelta of 0 to update at the current time.

Since
R16.050
Parameters
[in]groupThe group to update. The caller owns the pointed TP_PGroup.
[in]timeDeltaThe time difference since the last update.
Returns
true if the update was done successfully, otherwise false.

◆ Alive()

Bool Alive ( Int32  pid)

Retrieves the alive bit of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
true if the particle is alive, otherwise false.

◆ IsBorn()

Bool IsBorn ( Int32  pid)

Retrieves the is-born bit of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
true if the particle was just born, otherwise false.

◆ IsDie()

Bool IsDie ( Int32  pid)

Retrieves the is-die bit of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
true if the particle just died, otherwise false.

◆ EntersGroup()

Bool EntersGroup ( Int32  pid)

Retrieves the enters-group bit of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
true if the particle just entered a group, otherwise false.

◆ Group()

TP_PGroup* Group ( Int32  pid)

Retrieves the group of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The group that the particle currently is in. The master system owns the pointed TP_PGroup.

◆ Position()

Vector Position ( Int32  pid)

Retrieves the position of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle position.

◆ Velocity()

Vector Velocity ( Int32  pid)

Retrieves the velocity of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle velocity.

◆ Mass()

Float Mass ( Int32  pid)

Retrieves the mass of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle mass.

◆ Spin()

TP_Spin Spin ( Int32  pid)

Retrieves the spin of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle spin.

◆ Size()

Float Size ( Int32  pid)

Retrieves the size of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle size.

◆ Scale()

Vector Scale ( Int32  pid)

Retrieves the scale of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle scale.

◆ Age()

BaseTime Age ( Int32  pid)

Retrieves the age of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle age.

◆ Life()

BaseTime Life ( Int32  pid)

Retrieves the lifetime of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle lifetime.

◆ Alignment()

Matrix Alignment ( Int32  pid)

Retrieves the alignment matrix of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle alignment matrix.

◆ Randomseed()

Int32 Randomseed ( Int32  pid)

Retrieves the random seed of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle random seed.

◆ Shape()

TP_PShapePtr Shape ( Int32  pid)

Retrieves the shape of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle shape. The master system owns the pointed TP_PShapePtr.

◆ Transform()

Matrix Transform ( Int32  pid)

Retrieves the transformation matrix of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle transformation matrix.

◆ Flags()

UInt16 Flags ( Int32  pid)

Retrieves the flags of a particle.

Note
These returned flags are private. Use the functions like Alive() instead.
Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle flags.

◆ DTFactor()

Float DTFactor ( Int32  pid)

Retrieves the delta time factor of a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle delta time factor.

◆ SetPosition()

void SetPosition ( Int32  pid,
const Vector p 
)

Sets the position for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]pThe new particle position.

◆ SetVelocity()

void SetVelocity ( Int32  pid,
const Vector p 
)

Sets the velocity for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]pThe new particle velocity.

◆ SetMass()

void SetMass ( Int32  pid,
Float  mass 
)

Sets the mass for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]massThe new particle mass.

◆ SetSpin()

void SetSpin ( Int32  pid,
const TP_Spin spin 
)

Sets the spin for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]spinThe new particle spin.

◆ SetAge()

void SetAge ( Int32  pid,
const BaseTime age 
)

Sets the age for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]ageThe new particle age.

◆ SetLife()

void SetLife ( Int32  pid,
const BaseTime life 
)

Sets the lifetime for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]lifeThe new particle lifetime.

◆ SetGroup()

void SetGroup ( Int32  pid,
TP_PGroup group 
)

Inserts a particle into another group.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]groupThe group to place the particle in. The pointed group must belong to this master system.

◆ SetSize()

void SetSize ( Int32  pid,
Float  size 
)

Sets the size for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]sizeThe new particle size.

◆ SetScale()

void SetScale ( Int32  pid,
const Vector scale 
)

Sets the scale for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]scaleThe new particle scale.

◆ SetAlignment()

void SetAlignment ( Int32  pid,
const Matrix align 
)

Sets the alignment matrix for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]alignThe new particle alignment matrix.

◆ SetRandomseed()

void SetRandomseed ( Int32  pid,
Int32  seed 
)

Sets the random seed for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]seedThe new particle random seed.

◆ SetShape()

void SetShape ( Int32  pid,
const TP_PShapePtr shape,
Bool  deleteold = true 
)

Sets the shape for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]shapeThe new particle shape.
TP_PShapeI::owner_id should be set to GetOperatorID() for the node responsible for the shape handling.
This node should be prepared to provide a TP_PShapeInterface via the TP_MSG_GET_PSHAPEINTERFACE message.
[in]deleteoldIf true the old shape is deleted.

◆ SetCollision()

void SetCollision ( Int32  pid,
Int32  collision 
)

Sets the collision handling information for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]collisionThe collision ID.
This is the GetOperatorID() for the node responsible for the collision handling.
This node should be prepared to provide a TP_CollisionInterface via the TP_MSG_GET_COLLISIONINTERFACE message.

◆ SetDTFactor()

void SetDTFactor ( Int32  pid,
Float  dt 
)

Sets the delta time factor for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]dtThe new particle delta time factor.

◆ AddDataChannel()

Bool AddDataChannel ( GvDataID  type,
const maxon::String str 
)

Adds a data channel.

Parameters
[in]typeThe channel data type: GvDataID
[in]strThe channel name.
Returns
true if successful, otherwise false.

◆ RemoveDataChannel()

Bool RemoveDataChannel ( Int32  chan)

Removes a data channel.

Parameters
[in]chanThe channel index: 0 <= chan < NumDataChannels()
Returns
true if successful, otherwise false.

◆ NumDataChannels()

Int32 NumDataChannels ( void  )

Retrieves the data channel count.

Returns
The number of data channels.

◆ DataChannelType()

GvDataID DataChannelType ( Int32  chan)

Retrieves the data type of a data channel.

Parameters
[in]chanThe channel index: 0 <= chan < NumDataChannels()
Returns
The data type of channel chan.

◆ DataChannelName()

String DataChannelName ( Int32  chan)

Retrieves the name of a data channel.

Parameters
[in]chanThe channel index: 0 <= chan < NumDataChannels()
Returns
The data channel name.

◆ DataChannelUniqueID()

Int32 DataChannelUniqueID ( Int32  chan)

Retrieves a unique ID for a data channel that is independent of its index.

Parameters
[in]chanThe channel index: 0 <= chan < NumDataChannels()
Returns
A unique ID for channel chan.

◆ DataChannelID()

Int32 DataChannelID ( Int32  unique_id)

Retrieves the index of a data channel from its unique ID.

Parameters
[in]unique_idThe unique channel ID.
Returns
The data channel index.

◆ SetData()

Bool SetData ( Int32  pid,
Int32  chan,
void *  data,
GvValueID  type 
)

Sets the data channel for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]chanThe channel index: 0 <= chan < NumDataChannels()
[in]dataThe data to set. Points to GV data. The layout of the pointed data is determined by type.
[in]typeDetermines the type of data.
Returns
true if successful, otherwise false.

◆ GetData()

Bool GetData ( Int32  pid,
Int32  chan,
void *  data,
GvValueID  type 
)

Retrieves the data channel for a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]chanThe channel index: 0 <= chan < NumDataChannels()
[out]dataFilled with the retrieved data. Points to GV data. The layout of the pointed data is determined by type.
[in]typeDetermines the type of data.
Returns
true if successful, otherwise false.

◆ SetDataFromPort()

Bool SetDataFromPort ( Int32  pid,
Int32  chan,
GvPort p,
GvRun r 
)

Sets the data channel for a particle, getting the data from a GV port.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]chanThe channel index: 0 <= chan < NumDataChannels()
[in]pThe port with the data to set. The caller owns the pointed GvPort.
[in]rThe run helper. The caller owns the pointed GvRun.
Returns
true if successful, otherwise false.

◆ SetDataToPort()

Bool SetDataToPort ( Int32  pid,
Int32  chan,
GvPort p,
GvRun r 
)

Retrieves the data channel for a particle, storing the data in a GV port.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]chanThe channel index: 0 <= chan < NumDataChannels()
[out]pThe retrieved data is set in this port. The caller owns the pointed GvPort.
[in]rThe run helper. The caller owns the pointed GvRun.
Returns
true if successful, otherwise false.

◆ GetDataChannelInfo()

BaseContainer* GetDataChannelInfo ( Int32  chan)

Retrieves the channel information for a data channel.

Warning
The returned object needs to be free with DeleteObj(info) afterwards.
Parameters
[in]chanThe channel index: 0 <= chan < NumDataChannels()
Returns
The channel information for chan. The caller owns the pointed TP_DataChannelInfo.

◆ GetDataChannelFromInfo()

Int32 GetDataChannelFromInfo ( BaseContainer info)

Retrieves a data channel index from the information in info.

Parameters
[in]infoThe information to search for. The caller owns the pointed TP_DataChannelInfo.
Returns
The retrieved channel index, or NOTOK if no channel matched.

◆ Reg_FreeParticle_CB()

void Reg_FreeParticle_CB ( TP_FreeParticle_CB cb)

Registers a free-particle callback.

Parameters
[in]cbThe callback to register.

◆ UReg_FreeParticle_CB()

void UReg_FreeParticle_CB ( TP_FreeParticle_CB cb)

Unregisters a free-particle callback.

Parameters
[in]cbThe callback to unregister.

◆ Reg_DeletePShape_CB()

void Reg_DeletePShape_CB ( TP_FreePShape_CB cb)

Registers a delete-shape callback.

Parameters
[in]cbThe callback to register.

◆ UReg_DeletePShape_CB()

void UReg_DeletePShape_CB ( TP_FreePShape_CB cb)

Unregisters a delete-shape callback.

Parameters
[in]cbThe callback to unregister.

◆ GetOperatorID()

Int32 GetOperatorID ( GvNode op)

Retrieves an ID for op that can later be used with GetOperator() to get op back.

Warning
The ID is only valid during a limited time.
Parameters
[in]opA node. The caller owns the pointed node.
Returns
An operator ID for op.

◆ GetOperator()

GvOperatorData* GetOperator ( Int32  id)

Retrieves the operator for an ID previously acquired with GetOperatorID().

Parameters
[in]idThe operator ID, as returned by GetOperatorID().
Returns
The retrieved operator, or nullptr. The GV world owns the pointed object.

◆ GetDirty()

UInt32 GetDirty ( void  ) const

A dirty counter for the master system. This can be used to see if anything has changed. Use SetDirty() to increment the counter.

Returns
The dirty counter, incremented when something changes in the system.

◆ SetDirty()

void SetDirty ( void  )

Increments the dirty counter, i.e. tells anyone using GetDirty() that something has changed.

Note
This has to be used whenever an operator affects particle shapes, like the ObjectShape operator does.

◆ CheckCollision()

Bool CheckCollision ( Int32  collision,
Int32  pid,
Float  t,
Vector pos,
Vector vel,
TP_Spin spin,
Float  dt,
Float ct 
)

Finds the node responsible for collision, the one that called SetCollision(), and tells it to evaluate the passed collision parameters.

Note
Normally Thinking Particles evaluates this function automatically for registered collisions.
Parameters
[in]collisionThe collision ID. This is GetOperatorID() for the node responsible for the collision.
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]tTime to evaluate the collision at. Collisions are detected between t - dt and t.
[in]posAssigned the new position of the object if there is a collision.
[out]velAssigned the new velocity of the object if there is a collision.
[out]spinAssigned the new spin of the object if there is a collision.
[in]dtThe time since the last evaluation, i.e. the time to look backwards for collisions.
[in]ctThe collision time, if there was a collision. This is generally less than t.
Returns
true if there was a collision, otherwise false.

◆ GetShapeClone()

TP_PShapePtr GetShapeClone ( const TP_PShapePtr shape,
Int32  pid,
COPYFLAGS  flags,
AliasTrans trn 
)

Finds the node responsible for shape, as specified by TP_PShapeI::owner_id, and tells it to return a clone of shape.

Note
Normally Thinking Particles evaluates this function automatically for registered shapes.
Warning
The returned shape must be free with FreeShape() afterwards.
Parameters
[in]shapeThe particle shape. The caller owns the pointed shape.
[in]pidThe particle ID: 0 <= pid < 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 shape.

◆ GetShape()

TP_PShapePtr GetShape ( const TP_PShapePtr shape,
Int32  pid,
Int32  owner_id 
)

Finds the node responsible for shape, as specified by TP_PShapeI::owner_id, and tells it to return the shape associated with shape. (Normally this is the same object.)

Note
Normally Thinking Particles evaluates this function automatically for registered shapes.
Parameters
[in]shapeThe particle shape. The caller owns the pointed shape.
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]owner_idThe owner ID.
Returns
The shape. The shape handler owns the pointed shape.

◆ GetShapeVirtualObjects()

BaseObject* GetShapeVirtualObjects ( const TP_PShapePtr shape,
Int32  pid,
BaseDocument doc,
HierarchyHelp hh 
)

Finds the node responsible for shape, as specified by TP_PShapeI::owner_id, and tells it to return a BaseObject shape for shape.

Note
Normally Thinking Particles evaluates this function automatically for registered shapes.
Parameters
[in]shapeThe particle shape. The caller owns the pointed shape.
[in]pidThe particle ID: 0 <= pid < 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 GetShapeScale ( const TP_PShapePtr shape,
Int32  pid 
)

Finds the node responsible for shape, as specified by TP_PShapeI::owner_id, and tells it to return the scale of shape.

Note
Normally Thinking Particles evaluates this function automatically for registered shapes.
Parameters
[in]shapeThe particle shape. The caller owns the pointed shape.
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The shape scale.

◆ FreeShape()

void FreeShape ( TP_PShapePtr shape,
Int32  pid 
)

Finds the node responsible for shape, as specified by TP_PShapeI::owner_id, and tells it to free shape.

Note
Normally Thinking Particles evaluates this function automatically for registered shapes.
Parameters
[in]shapeThe particle shape. The caller owns the pointed shape.
[in]pidThe particle ID: 0 <= pid < NumParticles()

◆ ColliderCache()

GeColliderCache* ColliderCache ( Int32  pid)

Retrieves a collider cache for the shape associated with a particle.

Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The collider cache, or nullptr. The system owns the pointed collider cache.

◆ Color()

Vector32 Color ( Int32  pid)

Retrieves the color for a particle.

Since
R16.038
Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
Returns
The particle color.

◆ SetColor()

void SetColor ( Int32  pid,
const Vector32 color 
)

Sets the color for a particle.

Since
R16.038
Parameters
[in]pidThe particle ID: 0 <= pid < NumParticles()
[in]colorThe particle color.
ID_THINKINGPARTICLES
#define ID_THINKINGPARTICLES
Thinking Particles scene hook ID.
Definition: c4d_particles.h:10
TP_MasterSystem::GetParticleGroups
Int32 GetParticleGroups(TP_PGroup *ingroup, TP_PGroupArray *gtab, TP_GetPGroupMode mode, Bool subgroups=true)
Definition: c4d_particles.h:831
TP_PGroupArray::GetIndex
TP_PGroup * GetIndex(Int i) const
Definition: c4d_particles.h:145
BaseSceneHook
Definition: c4d_basedocument.h:38
Int32
maxon::Int32 Int32
Definition: ge_sys_math.h:45
TP_PGroup
Represents a particle group.
Definition: c4d_particles.h:1441
BaseDocument::FindSceneHook
BaseSceneHook * FindSceneHook(Int32 id) const
Definition: c4d_basedocument.h:1223
TP_MasterSystem
Definition: c4d_particles.h:735
TP_PGroupArray
Definition: c4d_particles.h:117
C4DAtom::GetType
Int32 GetType() const
Definition: c4d_baselist.h:1343
BaseDocument
Definition: c4d_basedocument.h:479
TP_GETPGROUP_ALL
@ TP_GETPGROUP_ALL
All groups.
Definition: c4d_particles.h:178