THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 27/12/2011 at 15:02, xxxxxxxx wrote:
AFAIK. Particle positions are stored in the object. Not the invisible particle tag.
So based on that. It seems like the first thing we have to do is get at the particle object first. And that's where I'm stuck with it.
I don't know how to convert the "BaseObject" type emitter to a "ParticleObject" type with python.
This is a simple example using C++:
//Basic particle object example
BaseObject *obj = doc->GetActiveObject();
if(!obj) return FALSE;
if(obj->GetType()==Oparticle) //If the active object is an emitter
ParticleObject *po = (ParticleObject* )obj; //Assign it to a particle type variable "po"
ParticleTag *pt = (ParticleTag* )obj->GetTag(Tparticle); //The invisible tag that stores the particles
LONG pcnt = po->GetParticleCount(); //Get the number of particles
LONG life = po->GetLifetime();
Particle *pc = (Particle* )pt->GetLowlevelDataAddressW();
Vector pos = pc->off; //Get the first particle's position
const Particle *p1 = NULL;
p1 = po->GetParticleR(pt,1); //Get the second particle in the array of particles
Vector p1pos = p1->off; //Get the second particle's position
const Particle *p10 = NULL;
p10 = po->GetParticleR(pt,10); //Get the 11th particle in the array of particles
Vector p10pos = p10->off; //Get the 11th particle's position
Everything works in this C++ example because it's getting the particle data from the ParticleObject.
I have no clue how to do the same thing with python. Because I don't know how to get at the ParticleObject with it.
All we seem to have access to is the BaseObject emitter object in python.