THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 04/10/2012 at 09:29, xxxxxxxx wrote:
import c4d
import struct
# return the number of active particles
def P_count(buffer) :
count=0
for i in range(len(buffer)/88) :
index=i*88
bits=int(struct.unpack("B",buffer[index+80:index+81])[0])
count+=(bits!=0)
return count
# return the ALIVE value of the particle p (0 or 1)
def P_alive(p,buffer) :
index=p*88
bits=int(struct.unpack("B",buffer[index+80:index+81])[0])
return (bits & 2) >> 1
# return the VISIBLE value of the particle p (0 or 1)
def P_visible(p,buffer) :
index=p*88
bits=int(struct.unpack("B",buffer[index+80:index+81])[0])
return (bits & 1)
# returns the vector of the current position of particle p
def P_position(p,buffer) :
index=p*88
return c4d.Vector(struct.unpack("d",buffer[index:index+8])[0],struct.unpack("d",buffer[index+8:index+16])[0],struct.unpack("d",buffer[index+16:index+24])[0])
# returns the vector of the current direction of particle p
def P_direction(p,buffer) :
index=p*88
return c4d.Vector(struct.unpack("d",buffer[index+24:index+32])[0],struct.unpack("d",buffer[index+32:index+40])[0],struct.unpack("d",buffer[index+40:index+48])[0])
# returns the vector of the current wing of particle p
def P_wing(p,buffer) :
index=p*88
return c4d.Vector(struct.unpack("d",buffer[index+48:index+56])[0],struct.unpack("d",buffer[index+56:index+64])[0],struct.unpack("d",buffer[index+64:index+72])[0])
# returns the life of particle p (double)
def P_lifetime(p,buffer) :
index=p*88
return struct.unpack("d",buffer[index+72:index+80])
def main() :
emitter=op.GetObject()
p_tag=emitter.GetTag(c4d.Tparticle)
if p_tag is None: return
buffer=p_tag.GetLowlevelDataAddressW()
count=P_count(buffer) # gets the number of active particles
for i in range(count) :
print "Particle "+str(i) # print the particle number
print P_alive(i,buffer) # print the active state of the particle
print P_visible(i,buffer) # print the visibility of the particle
print P_position(i,buffer) # print the current position of the particle
print P_direction(i,buffer) # print the current direction of the particle
print P_wing(i,buffer) # print the current wing of the particle
print P_lifetime(i,buffer) # print the lifespan value of the particle
print " "
Now I only have two doubts.
The direction is not returning the particle direction but it is, in fact, returning a value that corresponds, somehow, to the direction of the emitter. What is this for?
And I don't know how to interpret the wing value.
Could someone help me out on this?