? getParticlesLoc.patch ? source/creator/winbuildinfo.h ? tools/Blender.pyc ? tools/__init__.pyc ? tools/bcolors.pyc ? tools/btools.pyc Index: source/blender/python/api2_2x/Effect.c =================================================================== RCS file: /cvsroot/bf-blender/blender/source/blender/python/api2_2x/Effect.c,v retrieving revision 1.23 diff -u -r1.23 Effect.c --- source/blender/python/api2_2x/Effect.c 30 Nov 2005 20:18:54 -0000 1.23 +++ source/blender/python/api2_2x/Effect.c 7 Aug 2006 18:46:33 -0000 @@ -1389,37 +1389,82 @@ /*****************************************************************************/ static PyObject *Effect_getParticlesLoc( BPy_Effect * self, PyObject * args ) { - Object *ob; + Object *object_iter; + Effect *eff, *eff1; PartEff *paf; - Particle *pa; + Particle *pa=0; + PyObject *list; + float p_time, c_time, vec[3],cfra, m_time; int a; - PyObject *list; - float p_time, c_time, vec[3], cfra; - - if( !PyArg_ParseTuple( args, "f", &cfra) ) + short disp ; + +if( !PyArg_ParseTuple( args, "f", &cfra) ) return EXPP_ReturnPyObjError( PyExc_TypeError, "expected float argument" ); - ob = self->object; - paf = (PartEff *)self->effect; + object_iter = G.main->object.first; + if( !object_iter ) + return ( EXPP_ReturnPyObjError( PyExc_AttributeError, + "Scene contains no object" ) ); + +/* as we need to update the particles system we try to retrieve + the object to which the effect is connected */ + eff1 =(Effect *) self->effect; + +while( object_iter ) { + if( object_iter->effect.first != NULL ) { + eff = object_iter->effect.first; + if (eff == eff1) { break;} + /* not really needed as there no more than one effect by object */ + eff = eff->next; + } + object_iter = object_iter->id.next; + } +/*get the particles data */ +paf= (PartEff *)eff; + +/* particles->disp reduce the display number of particles */ +/* as we want the complete list ... */ +if (paf->disp<100) {disp= paf->disp; paf->disp=100;} + +build_particle_system(object_iter); +pa= paf->keys; + +paf->disp=disp; - pa = paf->keys; - if( !pa ) - return EXPP_ReturnPyObjError( PyExc_AttributeError, - "Particles location: no keys" ); - - if( ob->ipoflag & OB_OFFS_PARTICLE ) - p_time= ob->sf; +if(pa==NULL) { +return ( EXPP_ReturnPyObjError + ( PyExc_AttributeError, + " Particles Location : no Keys" ) );} + +/* if object is in motion */ + if( object_iter->ipoflag & OB_OFFS_PARTICLE ) + p_time= object_iter->sf; else p_time= 0.0; - - c_time= bsystem_time( ob, 0, cfra, p_time ); + list = PyList_New( 0 ); if( !list ) return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" ); - + + c_time= bsystem_time( object_iter, 0, cfra, p_time ); + for( a=0; atotpart; a++, pa += paf->totkey ) { - if( c_time > pa->time && c_time < pa->time+pa->lifetime ) { + + if(paf->flag & PAF_STATIC ) + { + m_time= pa->time+pa->lifetime+paf->staticstep-1; + for(c_time= pa->time; c_timestaticstep) { + where_is_particle(paf, pa, c_time, vec); + if( PyList_Append( list, Py_BuildValue("[fff]", + vec[0], vec[1], vec[2]) ) < 0 ) { + Py_DECREF( list ); + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "Couldn't append item to PyList" ); + } + } +} else if( c_time > pa->time && c_time < pa->time+pa->lifetime ) + { // printf("ctime %c",c_time); where_is_particle(paf, pa, c_time, vec); if( PyList_Append( list, Py_BuildValue("[fff]", vec[0], vec[1], vec[2]) ) < 0 ) {