TP_MasterSystem
¶
The master system is the main TP engine class. There can only be one master system per document. You can get it with
BaseDocument.GetParticleSystem()
.
c4d.modules.thinkingparticles.
TP_MasterSystem
¶
TP_MasterSystem.AllocParticle()
TP_MasterSystem.AllocParticles()
TP_MasterSystem.FreeParticle()
TP_MasterSystem.FreeAllParticles()
TP_MasterSystem.AllocParticleGroup()
TP_MasterSystem.FreeParticleGroup()
TP_MasterSystem.SetPGroupHierarchy()
TP_MasterSystem.GetRootGroup()
TP_MasterSystem.GetParticleGroups()
TP_MasterSystem.GetGroupParticleCount()
TP_MasterSystem.GetVirtualObjects()
TP_MasterSystem.GetGroupInfo()
TP_MasterSystem.GetGroupFromInfo()
TP_MasterSystem.NumParticles()
TP_MasterSystem.Alive()
TP_MasterSystem.IsBorn()
TP_MasterSystem.IsDie()
TP_MasterSystem.EntersGroup()
TP_MasterSystem.Group()
TP_MasterSystem.Position()
TP_MasterSystem.Velocity()
TP_MasterSystem.Mass()
TP_MasterSystem.Spin()
TP_MasterSystem.Size()
TP_MasterSystem.Scale()
TP_MasterSystem.Age()
TP_MasterSystem.Life()
TP_MasterSystem.Alignment()
TP_MasterSystem.Randomseed()
TP_MasterSystem.Transform()
TP_MasterSystem.Flags()
TP_MasterSystem.DTFactor()
TP_MasterSystem.Color()
TP_MasterSystem.SetPosition()
TP_MasterSystem.SetVelocity()
TP_MasterSystem.SetMass()
TP_MasterSystem.SetSpin()
TP_MasterSystem.SetAge()
TP_MasterSystem.SetLife()
TP_MasterSystem.SetGroup()
TP_MasterSystem.SetSize()
TP_MasterSystem.SetScale()
TP_MasterSystem.SetAlignment()
TP_MasterSystem.SetRandomseed()
TP_MasterSystem.SetCollision()
TP_MasterSystem.SetDTFactor()
TP_MasterSystem.SetColor()
TP_MasterSystem.AddDataChannel()
TP_MasterSystem.RemoveDataChannel()
TP_MasterSystem.NumDataChannels()
TP_MasterSystem.DataChannelType()
TP_MasterSystem.DataChannelName()
TP_MasterSystem.DataChannelUniqueID()
TP_MasterSystem.DataChannelID()
c4d.BaseList2D
TP_MasterSystem.
AllocParticle
(
)
¶
Allocates a particle.
Return type: | int |
---|---|
Returns: | The particle ID of the allocated particle, or NOTOK if the allocation failed. |
TP_MasterSystem.
AllocParticles
(
num
)
¶
Allocates num particles and stores their particles IDs.
Note
The count of allocated particles might be unequal to num due to the limit in the settings Max Particles . Change it to increase the count of allocatable particles.
![]()
Parameters: | num ( int ) – The number of particles to allocate. |
---|---|
Return type: | list of int |
Returns: | The list with the allocated particle IDs. |
TP_MasterSystem.
FreeParticle
(
pid
)
¶
Allocates num particles and stores their particles IDs.
Note
Normally this should not be used. Instead you should use
SetLife()
with a negative time, so that the particle in question dies immediately.
Parameters: | pid ( int ) – Particle ID of the particle to free. Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
TP_MasterSystem.
FreeAllParticles
(
)
¶
Frees all particles.
Note
Normally this should not be used. Instead you should use
SetLife()
with a negative time, so that the particle in question dies immediately.
TP_MasterSystem.
AllocParticleGroup
(
)
¶
Allocates a new particle group. Must be freed with
FreeParticleGroup()
, or inserted into the list with
SetPGroupHierarchy()
.
Return type: | c4d.modules.thinkingparticles.TP_PGroup |
---|---|
Returns: | The new particle group. |
TP_MasterSystem.
FreeParticleGroup
(
group
)
¶
Frees a particle group, removing it from the list.
Parameters: | group ( c4d.modules.thinkingparticles.TP_PGroup ) – The group to free. |
---|
TP_MasterSystem.
SetPGroupHierarchy
(
parent
,
group
,
mode
)
¶
Performs a hierarchy action on a particle group.
Parameters: |
|
---|
TP_MasterSystem.
GetRootGroup
(
)
¶
Returns the root group.
Return type: | c4d.modules.thinkingparticles.TP_PGroup |
---|---|
Returns: | The root group. |
TP_MasterSystem.
GetParticleGroups
(
ingroup
,
mode
[
,
subgroups=True
]
)
¶
Returns the particle groups in ingroup , specified by mode .
Parameters: |
|
||||||
---|---|---|---|---|---|---|---|
Return type: |
list of
|
||||||
Returns: |
The root group. |
TP_MasterSystem.
GetGroupParticleCount
(
ingroup
[
,
subgroups=True
]
)
¶
Calculates the number of particles in the ingroup group .
Parameters: |
|
---|---|
Return type: |
int |
Returns: |
The number of particles. |
TP_MasterSystem.
GetVirtualObjects
(
ingroup[, inRender=True][, subgroups=True][, hh=None]
)
¶
Creates the virtual object hierarchy for a particle group, i.e. an object group containing all particles. Used by the ParticleGeometry object.
Parameters: |
|
---|---|
Return type: | |
Returns: |
Virtual object or None if there was an error. |
TP_MasterSystem.
GetGroupInfo
(
group
)
¶
Retrieves the group information for a group .
Parameters: | group ( c4d.modules.thinkingparticles.TP_PGroup ) – Group to get the information for. |
---|---|
Return type: | c4d.BaseContainer |
Returns: | The group information for the group. |
TP_MasterSystem.
GetGroupFromInfo
(
info
)
¶
Retrieves a group from the information in info .
Parameters: | info ( c4d.BaseContainer ) – The information to search for. |
---|---|
Return type: | c4d.modules.thinkingparticles.TP_PGroup |
Returns: | The retrieved group or None if no group matched. |
TP_MasterSystem.
UpdateGroup
(
group
,
timeDelta
)
¶
New in version R16.050.
Updates a group at a given time difference since the last update. Use a default timeDelta of 0 to update at the current time.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if the update was done successfully, otherwise False . |
TP_MasterSystem.
NumParticles
(
)
¶
Retrieves the number of allocated particles. All particles IDs are less than this value.
Return type: | int |
---|---|
Returns: | Number of particles. |
TP_MasterSystem.
Alive
(
pid
)
¶
Retrieves the alive bit of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | bool |
Returns: | True if the particle is alive, otherwise False . |
TP_MasterSystem.
IsBorn
(
pid
)
¶
Retrieves the is-born bit of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | bool |
Returns: | True if the particle was just born, otherwise False . |
TP_MasterSystem.
IsDie
(
pid
)
¶
Retrieves the is-die bit of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | bool |
Returns: | True if the particle just died, otherwise False . |
TP_MasterSystem.
EntersGroup
(
pid
)
¶
Retrieves the enters-group bit of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | bool |
Returns: | True if the particle just entered a group, otherwise False . |
TP_MasterSystem.
Group
(
pid
)
¶
Retrieves the group of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | bool |
Returns: | The group that the particle currently is in, otherwise None . |
TP_MasterSystem.
Position
(
pid
)
¶
Retrieves the position of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Vector |
Returns: | Particle position. |
TP_MasterSystem.
Velocity
(
pid
)
¶
Retrieves the velocity of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Vector |
Returns: | Particle velocity. |
TP_MasterSystem.
Mass
(
pid
)
¶
Retrieves the mass of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | float |
Returns: | Particle mass. |
TP_MasterSystem.
Spin
(
pid
)
¶
Retrieves the spin of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | float |
Returns: | Particle spin. |
TP_MasterSystem.
Size
(
pid
)
¶
Retrieves the size of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | float |
Returns: | Particle size. |
TP_MasterSystem.
Scale
(
pid
)
¶
Retrieves the scale of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Vector |
Returns: | Particle scale. |
TP_MasterSystem.
Age
(
pid
)
¶
Retrieves the age of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.BaseTime |
Returns: | Particle age. |
TP_MasterSystem.
Life
(
pid
)
¶
Retrieves the lifetime of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.BaseTime |
Returns: | Particle lifetime. |
TP_MasterSystem.
Alignment
(
pid
)
¶
Retrieves the alignment matrix of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Matrix |
Returns: | Particle alignment matrix. |
TP_MasterSystem.
Randomseed
(
pid
)
¶
Retrieves the random seed of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Matrix |
Returns: | Particle random seed. |
TP_MasterSystem.
Transform
(
pid
)
¶
Retrieves the transformation matrix of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Matrix |
Returns: | Particle transformation matrix. |
TP_MasterSystem.
Flags
(
pid
)
¶
Retrieves the transformation matrix of a particle.
Note
These are private. Use the functions like
Alive()
instead.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Matrix |
Returns: | Particle flags. |
TP_MasterSystem.
DTFactor
(
pid
)
¶
Retrieves the delta time factor of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | float |
Returns: | Particle flags. |
TP_MasterSystem.
Color
(
pid
)
¶
New in version R16.038.
Retrieves the color of a particle.
Parameters: | pid ( int ) – Particle ID. |
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
NumParticles()
.
|
Return type: | c4d.Vector |
Returns: | Particle color. |
TP_MasterSystem.
SetPosition
(
pid
,
p
)
¶
Retrieves the delta time factor of a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetVelocity
(
pid
,
p
)
¶
Sets the velocity for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetMass
(
pid
,
mass
)
¶
Sets the mass for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetSpin
(
pid
,
axis
,
speed
)
¶
Sets the spin for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetAge
(
pid
,
age
)
¶
Sets the age for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetLife
(
pid
,
life
)
¶
Sets the age for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetGroup
(
pid
,
group
)
¶
Inserts a particle into another group.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetSize
(
pid
,
size
)
¶
Sets the size for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetScale
(
pid
,
scale
)
¶
Sets the size for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetAlignment
(
pid
,
align
)
¶
Sets the alignment matrix for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetRandomseed
(
pid
,
seed
)
¶
Sets the alignment matrix for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetCollision
(
pid
,
collision
)
¶
Sets the collision handling information for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetDTFactor
(
pid
,
dt
)
¶
Sets the delta time factor for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetColor
(
pid
,
color
)
¶
New in version R16.038.
Sets the color for a particle.
Parameters: |
|
---|---|
Raises: |
IndexError
– If
pid
is out of range :
0<=pid<
|
TP_MasterSystem.
SetPData
(
pid
,
chan
,
value
)
¶
Sets the data channel value for a particle:
pid = 1 chan = 0 ms.SetPData(pid, chan, "Hello World!")
Parameters: |
|
---|---|
Raises: |
|
Return type: |
bool |
Returns: |
True on success, otherwise False . |
TP_MasterSystem.
GetPData
(
pid
,
chan
)
¶
Sets the data channel value for a particle:
pid = 1 chan = 0 value = ms.GetPData(pid, chan, "Hello World!")
Parameters: |
|
---|---|
Raises: |
|
Return type: |
any |
Returns: |
Depends on the type of the channel. |
TP_MasterSystem.
AddDataChannel
(
type
,
str
)
¶
Adds a new data channel.
Parameters: |
|
---|---|
Return type: |
bool |
Returns: |
True if succesful, otherwise False . |
TP_MasterSystem.
RemoveDataChannel
(
chan
)
¶
Removes a data channel.
Parameters: | chan ( int ) – Channel index. |
---|---|
Raises: |
IndexError
– If
chan
is out of range :
0<=chan<
NumDataChannels()
.
|
Return type: | bool |
Returns: | True if successful, otherwise False . |
TP_MasterSystem.
NumDataChannels
(
)
¶
Retrieves the data channel count.
Return type: | int |
---|---|
Returns: | Number of data. |
TP_MasterSystem.
DataChannelType
(
chan
)
¶
Retrieves the data type of a data channel.
Parameters: | chan ( int ) – Channel index. |
---|---|
Raises: |
IndexError
– If
chan
is out of range :
0<=chan<
NumDataChannels()
.
|
Return type: | int |
Returns: | Data type of channel chan . |
TP_MasterSystem.
DataChannelName
(
chan
)
¶
Retrieves the name of a data channel.
Parameters: | chan ( int ) – Channel index. |
---|---|
Raises: |
IndexError
– If
chan
is out of range :
0<=chan<
NumDataChannels()
.
|
Return type: | str |
Returns: | Number of data. |
TP_MasterSystem.
DataChannelUniqueID
(
chan
)
¶
Retrieves a unique ID for a data channel that’s independent of its index.
Parameters: | chan ( int ) – Channel index. |
---|---|
Raises: |
IndexError
– If
chan
is out of range :
0<=chan<
NumDataChannels()
.
|
Return type: | int |
Returns: | Unique ID of channel chan . |
TP_MasterSystem.
DataChannelID
(
unique_id
)
¶
Retrieves the index of a data channel from its unique ID.
Parameters: | unique_id ( int ) – Channel ID. |
---|---|
Return type: | int |
Returns: | Data channel index. |
TP_MasterSystem.
GetOperatorID
(
op
)
¶
Retrieves an ID for op
Parameters: | op ( c4d.modules.graphview.GvNode ) – A node. |
---|---|
Return type: | int |
Returns: | ID for op . |
TP_MasterSystem.
GetDirty
(
)
¶
A dirty counter for the master system. This can be used to see if anything has changed. Use
SetDirty()
to increment the counter.
Return type: | long |
---|---|
Returns: | Dirty counter. Is incremented when something changes in the system. |
TP_MasterSystem.
SetDirty
(
)
¶
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.