remove old particle system.

also removed quat, dquat, and sumohandle from the Object struct since they aren't used anywhere.
This commit is contained in:
2008-04-27 18:26:20 +00:00
parent 9ea254ca34
commit 57c1fbe557
24 changed files with 76 additions and 2542 deletions

View File

@@ -35,7 +35,6 @@
struct Effect;
struct ListBase;
struct PartEff;
struct Particle;
struct Group;
@@ -51,21 +50,16 @@ typedef struct pEffectorCache {
Object obcopy; /* for restoring transformation data */
} pEffectorCache;
struct Effect *add_effect(int type);
void free_effect(struct Effect *eff);
void free_effects(struct ListBase *lb);
struct Effect *copy_effect(struct Effect *eff);
void copy_act_effect(struct Object *ob);
void copy_effects(struct ListBase *lbn, struct ListBase *lb);
void deselectall_eff(struct Object *ob);
struct PartEff *give_parteff(struct Object *ob);
void where_is_particle(struct PartEff *paf, struct Particle *pa, float ctime, float *vec);
void build_particle_system(struct Object *ob);
/* particle deflector */
#define PE_WIND_AS_SPEED 0x00000001
struct PartEff *give_parteff(struct Object *ob);
struct ListBase *pdInitEffectors(struct Object *obsrc, struct Group *group);
void pdEndEffectors(struct ListBase *lb);
void pdDoEffectors(struct ListBase *lb, float *opco, float *force, float *speed, float cur_time, float loc_time, unsigned int flags);

View File

@@ -420,7 +420,6 @@ static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3]
dofluidsim = ((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
(ob->fluidsimSettings->type & OB_FLUIDSIM_DOMAIN)&&
(ob->fluidsimSettings->meshSurface) &&
(1) && (!give_parteff(ob)) && // doesnt work together with particle systems!
(me->totvert == ((Mesh *)(ob->fluidsimSettings->meshSurface))->totvert));
if (vertCos && !dofluidsim)
@@ -1916,8 +1915,7 @@ static void mesh_calc_modifiers(Object *ob, float (*inputVertexCos)[3],
* domain objects
*/
if((G.obedit!=ob) && !needMapping) {
if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) &&
(1) && (!give_parteff(ob)) ) { // doesnt work together with particle systems!
if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE)) {
if(ob->fluidsimSettings->type & OB_FLUIDSIM_DOMAIN) {
loadFluidsimMesh(ob,useRenderParams);
fluidsimMeshUsed = 1;
@@ -2550,14 +2548,7 @@ void makeDerivedMesh(Object *ob, CustomDataMask dataMask)
if (ob==G.obedit) {
editmesh_build_data(dataMask);
} else {
PartEff *paf= give_parteff(ob);
mesh_build_data(ob, dataMask);
if(paf) {
if((paf->flag & PAF_STATIC) || (ob->recalc & OB_RECALC_TIME)==0)
build_particle_system(ob);
}
}
}

View File

@@ -962,10 +962,6 @@ static float nla_time(float cfra, float unit)
/* global time */
cfra*= G.scene->r.framelen;
/* decide later... */
// if(no_speed_curve==0) if(ob && ob->ipo) cfra= calc_ipo_time(ob->ipo, cfra);
return cfra;
}

View File

@@ -568,35 +568,6 @@ static void build_dag_object(DagForest *dag, DagNode *scenenode, Object *ob, int
dag_add_relation(dag,node2,node,DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Texture On Curve");
}
}
else if(ob->type==OB_MESH) {
PartEff *paf= give_parteff(ob);
if(paf) {
ListBase *listb;
pEffectorCache *ec;
/* ob location depends on itself */
if((paf->flag & PAF_STATIC)==0)
dag_add_relation(dag, node, node, DAG_RL_OB_DATA, "Particle-Object Relation");
listb= pdInitEffectors(ob, paf->group); /* note, makes copy... */
if(listb) {
for(ec= listb->first; ec; ec= ec->next) {
Object *ob1= ec->ob;
PartDeflect *pd= ob1->pd;
if(pd->forcefield) {
node2 = dag_get_node(dag, ob1);
if(pd->forcefield==PFIELD_GUIDE)
dag_add_relation(dag, node2, node, DAG_RL_DATA_DATA|DAG_RL_OB_DATA, "Particle Field");
else
dag_add_relation(dag, node2, node, DAG_RL_OB_DATA, "Particle Field");
}
}
pdEndEffectors(listb); /* restores copy... */
}
}
}
psys= ob->particlesystem.first;
if(psys) {
@@ -1987,15 +1958,6 @@ static void dag_object_time_update_flags(Object *ob)
ob->shapeflag &= ~OB_SHAPE_TEMPLOCK;
}
}
else if(ob->effect.first) {
Effect *eff= ob->effect.first;
PartEff *paf= give_parteff(ob);
if(eff->type==EFF_WAVE)
ob->recalc |= OB_RECALC_DATA;
else if(paf && paf->keys==NULL)
ob->recalc |= OB_RECALC_DATA;
}
if((ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings)) {
// fluidsimSettings might not be initialized during load...
if(ob->fluidsimSettings->type & (OB_FLUIDSIM_DOMAIN|OB_FLUIDSIM_PARTICLE)) {

File diff suppressed because it is too large Load Diff

View File

@@ -84,7 +84,6 @@ void unlink_group(Group *group)
}
for(ob= G.main->object.first; ob; ob= ob->id.next) {
bActionStrip *strip;
PartEff *paf;
if(ob->dup_group==group) {
ob->dup_group= NULL;
@@ -95,12 +94,9 @@ void unlink_group(Group *group)
strip->object= NULL;
}
}
for(paf= ob->effect.first; paf; paf= paf->next) {
if(paf->type==EFF_PARTICLE) {
if(paf->group)
paf->group= NULL;
}
}
/* TODO - psys groups */
/* TODO - lamp groups */
/* TODO - render groups */
}
group->id.us= 0;
}

View File

@@ -991,7 +991,7 @@ static void lib_indirect_test_id(ID *id)
Object *ob= (Object *)id;
bActionStrip *strip;
Mesh *me;
PartEff *paf;
int a;
for (strip=ob->nlastrips.first; strip; strip=strip->next){
@@ -1004,10 +1004,6 @@ static void lib_indirect_test_id(ID *id)
LIBTAG(ob->mat[a]);
}
paf = give_parteff(ob);
if (paf)
LIBTAG(paf->group);
LIBTAG(ob->dup_group);
LIBTAG(ob->proxy);

View File

@@ -90,7 +90,6 @@
#include "BKE_constraint.h"
#include "BKE_curve.h"
#include "BKE_displist.h"
#include "BKE_effect.h"
#include "BKE_group.h"
#include "BKE_icons.h"
#include "BKE_ipo.h"
@@ -249,7 +248,6 @@ void free_object(Object *ob)
BLI_freelistN(&ob->defbase);
if(ob->pose)
free_pose(ob->pose);
free_effects(&ob->effect);
free_properties(&ob->prop);
object_free_modifiers(ob);
@@ -394,9 +392,7 @@ void unlink_object(Object *ob)
/* object is deflector or field */
if(ob->pd) {
if(give_parteff(obt))
obt->recalc |= OB_RECALC_DATA;
else if(obt->soft)
if(obt->soft)
obt->recalc |= OB_RECALC_DATA;
/* cloth */
@@ -906,8 +902,10 @@ Object *add_only_object(int type, char *name)
ob->type= type;
/* ob->transflag= OB_QUAT; */
#if 0 /* not used yet */
QuatOne(ob->quat);
QuatOne(ob->dquat);
#endif
ob->col[0]= ob->col[1]= ob->col[2]= 0.0;
ob->col[3]= 1.0;
@@ -998,11 +996,13 @@ void base_init_from_view3d(Base *base, View3D *v3d)
if (U.flag & USER_ADD_VIEWALIGNED) {
v3d->viewquat[0]= -v3d->viewquat[0];
if (ob->transflag & OB_QUAT) {
/* Quats arnt used yet */
/*if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, v3d->viewquat);
} else {
} else {*/
QuatToEul(v3d->viewquat, ob->rot);
}
/*}*/
v3d->viewquat[0]= -v3d->viewquat[0];
}
}
@@ -1146,7 +1146,6 @@ Object *copy_object(Object *ob)
obn->path= NULL;
obn->flag &= ~OB_FROMGROUP;
copy_effects(&obn->effect, &ob->effect);
obn->modifiers.first = obn->modifiers.last= NULL;
for (md=ob->modifiers.first; md; md=md->next) {
@@ -1439,7 +1438,7 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
{
float smat[3][3], vec[3];
float rmat[3][3];
float q1[4];
/*float q1[4];*/
/* size */
if(ob->ipo) {
@@ -1453,7 +1452,8 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
}
/* rot */
if(ob->transflag & OB_QUAT) {
/* Quats arnt used yet */
/*if(ob->transflag & OB_QUAT) {
if(ob->ipo) {
QuatMul(q1, ob->quat, ob->dquat);
QuatToMat3(q1, rmat);
@@ -1462,7 +1462,7 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
QuatToMat3(ob->quat, rmat);
}
}
else {
else {*/
if(ob->ipo) {
vec[0]= ob->rot[0]+ob->drot[0];
vec[1]= ob->rot[1]+ob->drot[1];
@@ -1472,7 +1472,7 @@ void object_to_mat3(Object *ob, float mat[][3]) /* no parent */
else {
EulToMat3(ob->rot, rmat);
}
}
/*}*/
Mat3MulMat3(mat, rmat, smat);
}

View File

@@ -172,7 +172,7 @@ static int ptcache_path(PTCacheID *pid, char *filename)
lib= (pid)? pid->ob->id.lib: NULL;
if (G.relbase_valid || lib) {
char dir[FILE_MAX], file[FILE_MAX]; /* we dont want the dir, only the file */
char file[FILE_MAX]; /* we dont want the dir, only the file */
char *blendfilename;
blendfilename= (lib)? lib->filename: G.sce;

View File

@@ -121,7 +121,7 @@
#include "BKE_customdata.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_effect.h" // for give_parteff
#include "BKE_effect.h" /* give_parteff */
#include "BKE_global.h" // for G
#include "BKE_group.h"
#include "BKE_image.h"
@@ -5093,7 +5093,7 @@ static void do_versions(FileData *fd, Library *lib, Main *main)
while(ob) {
ob->mass= 1.0f;
ob->damping= 0.1f;
ob->quat[1]= 1.0f;
/*ob->quat[1]= 1.0f;*/ /* quats arnt used yet */
ob= ob->id.next;
}

View File

@@ -523,25 +523,6 @@ static void write_userdef(WriteData *wd)
}
}
static void write_effects(WriteData *wd, ListBase *lb)
{
Effect *eff;
eff= lb->first;
while(eff) {
switch(eff->type) {
case EFF_PARTICLE:
writestruct(wd, DATA, "PartEff", 1, eff);
break;
default:
writedata(wd, DATA, MEM_allocN_len(eff), eff);
}
eff= eff->next;
}
}
static void write_particlesettings(WriteData *wd, ListBase *idbase)
{
ParticleSettings *part;
@@ -908,7 +889,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
/* direct data */
writedata(wd, DATA, sizeof(void *)*ob->totcol, ob->mat);
write_effects(wd, &ob->effect);
/* write_effects(wd, &ob->effect); */ /* not used anymore */
write_properties(wd, &ob->prop);
write_sensors(wd, &ob->sensors);
write_controllers(wd, &ob->controllers);

View File

@@ -743,19 +743,12 @@ enum {
#define B_AUTOTIMEOFS 3403 /* see B_OFSTIMEOFS, B_RANDTIMEOFS also */
#define B_FRAMEMAP 3404
#define B_NEWEFFECT 3405
#define B_PREVEFFECT 3406
#define B_NEXTEFFECT 3407
#define B_CHANGEEFFECT 3408
#define B_CALCEFFECT 3409
#define B_DELEFFECT 3410
#define B_RECALCAL 3411
#define B_RECALC_DEFL 3412
#define B_EFFECT_DEP 3413
#define B_FIELD_DEP 3414
#define B_FIELD_CHANGE 3415
#define B_PAF_SET_VG 3416
#define B_PAF_SET_VG1 3417
#define B_PARTBROWSE 3418
#define B_PARTDELETE 3419
#define B_PARTALONE 3420

View File

@@ -31,14 +31,5 @@
#ifndef PARTICLE_EFFECT_H
#define PARTICLE_EFFECT_H
/* effect.c */
extern Effect *add_effect(int type);
extern PartEff *give_parteff(Object *ob);
extern void where_is_particle(PartEff *paf, Particle *pa, float ctime, float *vec);
extern void free_effect(Effect *eff);
extern void free_effects(ListBase *lb);
extern void copy_effects(ListBase *lbn, ListBase *lb);
extern void build_particle_system(Object *ob);
#endif

View File

@@ -97,7 +97,7 @@ typedef struct Object {
float loc[3], dloc[3], orig[3];
float size[3], dsize[3];
float rot[3], drot[3];
float quat[4], dquat[4];
/* float quat[4], dquat[4]; (not used yet) */
float obmat[4][4];
float parentinv[4][4]; /* inverse result of parent, so that object doesn't 'stick' to parent */
float constinv[4][4]; /* inverse result of constraints. doesn't include effect of parent or object local transform */
@@ -149,10 +149,6 @@ typedef struct Object {
ListBase controllers;
ListBase actuators;
/* now used to store cache particles,
* should be renamed see effect.c (Campbell) */
void *sumohandle;
float bbsize[3];
short index; /* custom index, for renderpasses */
unsigned short actdef; /* current deformation group */

View File

@@ -561,34 +561,9 @@ struct PyMethodDef M_Effect_methods[] = {
/*****************************************************************************/
PyObject *M_Effect_New( PyObject * self, PyObject * args )
{
Effect *bleffect = 0;
Object *ob;
char *name = NULL;
if( !PyArg_ParseTuple( args, "s", &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
for( ob = G.main->object.first; ob; ob = ob->id.next )
if( !strcmp( name, ob->id.name + 2 ) )
break;
if( !ob )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"object does not exist" );
if( ob->type != OB_MESH )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"object is not a mesh" );
bleffect = add_effect( EFF_PARTICLE );
if( !bleffect )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't create Effect Data in Blender" );
BLI_addtail( &ob->effect, bleffect );
return EffectCreatePyObject( bleffect, ob );
printf("warning, static particles api removed\n");
Py_INCREF( Py_None );
return Py_None;
}
/*****************************************************************************/
@@ -597,86 +572,7 @@ PyObject *M_Effect_New( PyObject * self, PyObject * args )
/*****************************************************************************/
PyObject *M_Effect_Get( PyObject * self, PyObject * args )
{
/*arguments : string object name
int : position of effect in the obj's effect list */
char *name = NULL;
Object *object_iter;
Effect *eff;
int num = -1, i;
if( !PyArg_ParseTuple( args, "|si", &name, &num ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected string int argument" ) );
object_iter = G.main->object.first;
if( !object_iter )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"Scene contains no object" ) );
if( name ) { /* (name, num = -1) - try to find the given object */
while( object_iter ) {
if( !strcmp( name, object_iter->id.name + 2 ) ) {
eff = object_iter->effect.first; /*can be NULL: None will be returned*/
if (num >= 0) { /* return effect in given num position if available */
for( i = 0; i < num; i++ ) {
if (!eff) break;
eff = eff->next;
}
if (eff) {
return EffectCreatePyObject( eff, object_iter );
} else { /* didn't find any effect in the given position */
Py_RETURN_NONE;
}
}
else {/*return a list with all effects linked to the given object*/
/* this was pointed by Stephen Swaney */
PyObject *effectlist = PyList_New( 0 );
while (eff) {
PyObject *found_eff = EffectCreatePyObject( eff,
object_iter );
PyList_Append( effectlist, found_eff );
Py_DECREF( found_eff ); /* PyList_Append incref'ed it */
eff = eff->next;
}
return effectlist;
}
}
object_iter = object_iter->id.next;
}
if (!object_iter)
return EXPP_ReturnPyObjError (PyExc_AttributeError,
"no such object");
}
else { /* () - return a list with all effects currently in Blender */
PyObject *effectlist = PyList_New( 0 );
while( object_iter ) {
if( object_iter->effect.first != NULL ) {
eff = object_iter->effect.first;
while( eff ) {
PyObject *found_eff = EffectCreatePyObject( eff,
object_iter );
PyList_Append( effectlist, found_eff );
Py_DECREF( found_eff );
eff = eff->next;
}
}
object_iter = object_iter->id.next;
}
return effectlist;
}
printf("warning, static particles api removed\n");
Py_INCREF( Py_None );
return Py_None;
}
@@ -689,29 +585,7 @@ static PyObject *Effect_FlagsDict( void )
if( Flags ) {
BPy_constant *c = ( BPy_constant * ) Flags;
PyConstant_Insert( c, "SELECTED",
PyInt_FromLong( EFF_SELECT ) );
PyConstant_Insert( c, "BSPLINE",
PyInt_FromLong( PAF_BSPLINE ) );
PyConstant_Insert( c, "STATIC",
PyInt_FromLong( PAF_STATIC ) );
PyConstant_Insert( c, "FACES",
PyInt_FromLong( PAF_FACE ) );
PyConstant_Insert( c, "ANIMATED",
PyInt_FromLong( PAF_ANIMATED ) );
PyConstant_Insert( c, "UNBORN",
PyInt_FromLong( PAF_UNBORN ) );
PyConstant_Insert( c, "VERTS",
PyInt_FromLong( PAF_OFACE ) );
PyConstant_Insert( c, "EMESH",
PyInt_FromLong( PAF_SHOWE ) );
PyConstant_Insert( c, "TRUERAND",
PyInt_FromLong( PAF_TRAND ) );
PyConstant_Insert( c, "EVENDIST",
PyInt_FromLong( PAF_EDISTR ) );
PyConstant_Insert( c, "DIED",
PyInt_FromLong( PAF_DIED ) );
/* removed */
}
return Flags;
}
@@ -1290,134 +1164,7 @@ static int Effect_setStaticStep( BPy_Effect * self , PyObject * args )
/*****************************************************************************/
static PyObject *Effect_getParticlesLoc( BPy_Effect * self )
{
Object *ob;
Effect *eff;
PartEff *paf;
Particle *pa=0;
PyObject *list, *strand_list, *pyvec, *pyvec2;
float p_time, c_time, vec[3], vec1[3], cfra, m_time, s_time;
int a;
short disp=100 ;
cfra=frame_to_float( G.scene->r.cfra );
/* as we need to update the particles system we try to retrieve
the object to which the effect is connected */
eff =(Effect *) self->effect;
ob= self->object;
if(!ob)
return ( EXPP_ReturnPyObjError (PyExc_AttributeError,
"Effect has no object" ) );
/*get the particles data */
paf= (PartEff *)eff;
/* particles->disp reduce the display number of particles */
/* as we want the complete list ... we backup the disp value and restore later */
if (paf->disp<100)
disp= paf->disp; paf->disp=100;
build_particle_system(ob);
pa= paf->keys;
if(!pa)
return ( EXPP_ReturnPyObjError (PyExc_AttributeError,
"Particles Location : no Keys" ) );
/* if object is in motion */
if( ob->ipoflag & OB_OFFS_PARTICLE )
p_time= give_timeoffset(ob);
else
p_time= 0.0;
list = PyList_New( 0 );
if( !list )
return EXPP_ReturnPyObjError( PyExc_MemoryError, "PyList() failed" );
c_time= bsystem_time( ob, cfra, p_time );
for( a=0; a < paf->totpart; a++, pa += paf->totkey ) {
if(paf->flag & PAF_STATIC ) {
strand_list = PyList_New( 0 );
m_time= pa->time+pa->lifetime+paf->staticstep-1;
for(c_time= pa->time; c_time<m_time; c_time+=paf->staticstep) {
where_is_particle(paf, pa, c_time, vec);
MTC_Mat4MulVecfl(ob->obmat, vec); /* make worldspace like the others */
pyvec = newVectorObject(vec, 3, Py_NEW);
if( PyList_Append( strand_list, pyvec) < 0 ) {
Py_DECREF( list );
Py_DECREF( strand_list );
Py_XDECREF( pyvec );
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Couldn't append item to PyList" );
}
Py_DECREF( pyvec );
}
if( PyList_Append( list, strand_list) < 0 ) {
Py_DECREF( list );
Py_DECREF( strand_list );
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Couldn't append item to PyList" );
}
Py_DECREF( strand_list );
} else {
if(c_time > pa->time && c_time < pa->time+pa->lifetime ) {
/* vector particles are a tuple of 2 vectors */
if( paf->stype==PAF_VECT ) {
s_time= c_time;
p_time= c_time+1.0f;
if(c_time < pa->time) {
if(paf->flag & PAF_UNBORN)
p_time= pa->time+1.0f;
else
continue;
}
if(c_time > pa->time+pa->lifetime) {
if(paf->flag & PAF_DIED)
s_time= pa->time+pa->lifetime-1.0f;
else
continue;
}
where_is_particle(paf, pa, s_time, vec);
where_is_particle(paf, pa, p_time, vec1);
pyvec = newVectorObject(vec, 3, Py_NEW);
pyvec2 = newVectorObject(vec1, 3, Py_NEW);
if( PyList_Append( list, Py_BuildValue("[OO]", pyvec, pyvec2)) < 0 ) {
Py_DECREF( list );
Py_XDECREF( pyvec );
Py_XDECREF( pyvec2 );
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Couldn't append item to PyList" );
}
Py_DECREF( pyvec );
Py_DECREF( pyvec2 );
} else { /* not a vector */
where_is_particle(paf, pa, c_time, vec);
pyvec = newVectorObject(vec, 3, Py_NEW);
if( PyList_Append( list, pyvec) < 0 ) {
Py_DECREF( list );
Py_XDECREF( pyvec );
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"Couldn't append item to PyList" );
}
Py_DECREF( pyvec );
}
}
}
}
/* restore the real disp value */
if (disp<100){
paf->disp=disp;
build_particle_system(ob);
}
return list;
return PyList_New( 0 );
}
/*****************************************************************************/

View File

@@ -466,7 +466,7 @@ static PyObject *Object_upAxis(BPy_Object * self);
static PyMethodDef BPy_Object_methods[] = {
/* name, method, flags, doc */
{"buildParts", ( PyCFunction ) Object_buildParts, METH_NOARGS,
"Recalcs particle system (if any) "},
"Recalcs particle system (if any), (depricated, will always return an empty list in version 2.46)"},
{"getIpo", ( PyCFunction ) Object_getIpo, METH_NOARGS,
"Returns the ipo of this object (if any) "},
{"clrParent", ( PyCFunction ) Object_clrParent, METH_VARARGS,
@@ -1028,7 +1028,7 @@ static PyObject *M_Object_Duplicate( PyObject * self_unused,
static PyObject *Object_buildParts( BPy_Object * self )
{
build_particle_system( self->object );
/* This is now handles by modifiers */
Py_RETURN_NONE;
}
@@ -2986,12 +2986,7 @@ static PyObject *Object_getDupliObjects( BPy_Object * self )
if(ob->transflag & OB_DUPLI) {
/* before make duplis, update particle for current frame */
if(ob->transflag & OB_DUPLIVERTS) {
PartEff *paf= give_parteff(ob);
if(paf) {
if(paf->flag & PAF_ANIMATED) build_particle_system(ob);
}
}
/* TODO, build particles for particle dupli's */
if(ob->type!=OB_MBALL) {
PyObject *list;
DupliObject *dupob;
@@ -3035,23 +3030,7 @@ static int Object_setDupliGroup( BPy_Object * self, PyObject * value )
static PyObject *Object_getEffects( BPy_Object * self )
{
PyObject *effect_list, *pyval;
Effect *eff;
effect_list = PyList_New( 0 );
if( !effect_list )
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"PyList_New() failed" );
eff = self->object->effect.first;
while( eff ) {
pyval = EffectCreatePyObject( eff, self->object );
PyList_Append( effect_list, pyval );
Py_DECREF(pyval);
eff = eff->next;
}
return effect_list;
return PyList_New( 0 );
}
static PyObject *Object_getActionStrips( BPy_Object * self )
@@ -5028,7 +5007,7 @@ static PyGetSetDef BPy_Object_getseters[] = {
{"effects",
(getter)Object_getEffects, (setter)NULL,
"The list of particle effects associated with the object",
"The list of particle effects associated with the object, (depricated, will always return an empty list in version 2.46)",
NULL},
{"actionStrips",
(getter)Object_getActionStrips, (setter)NULL,

View File

@@ -262,43 +262,9 @@ struct PyMethodDef M_Particle_methods[] = {
/*****************************************************************************/
PyObject *M_Particle_New( PyObject * self, PyObject * args )
{
BPy_Effect *pyeffect;
Effect *bleffect = 0;
Object *ob;
char *name = NULL;
if( !PyArg_ParseTuple( args, "s", &name ) )
return EXPP_ReturnPyObjError( PyExc_TypeError,
"expected string argument" );
for( ob = G.main->object.first; ob; ob = ob->id.next )
if( !strcmp( name, ob->id.name + 2 ) )
break;
if( !ob )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"object does not exist" );
if( ob->type != OB_MESH )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"object is not a mesh" );
pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
if( !pyeffect )
return EXPP_ReturnPyObjError( PyExc_MemoryError,
"couldn't create Effect Data object" );
bleffect = add_effect( EFF_PARTICLE );
if( !bleffect ) {
Py_DECREF( pyeffect );
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
"couldn't create Effect Data in Blender" );
}
pyeffect->effect = (PartEff *)bleffect;
BLI_addtail( &ob->effect, bleffect );
return ( PyObject * ) pyeffect;
printf("warning, static particles api removed\n");
Py_INCREF( Py_None );
return Py_None;
}
/*****************************************************************************/
@@ -307,48 +273,7 @@ PyObject *M_Particle_New( PyObject * self, PyObject * args )
/*****************************************************************************/
PyObject *M_Particle_Get( PyObject * self, PyObject * args )
{
/*arguments : string object name
int : position of effect in the obj's effect list */
char *name = 0;
Object *object_iter;
Effect *eff;
BPy_Particle *wanted_eff;
int num, i;
if( !PyArg_ParseTuple( args, "si", &name, &num ) )
return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
"expected string int argument" ) );
object_iter = G.main->object.first;
if( !object_iter )
return EXPP_ReturnPyObjError( PyExc_AttributeError,
"Scene contains no object" );
while( object_iter ) {
if( strcmp( name, object_iter->id.name + 2 ) ) {
object_iter = object_iter->id.next;
continue;
}
if( object_iter->effect.first != NULL ) {
eff = object_iter->effect.first;
for( i = 0; i < num; i++ ) {
if( eff->type != EFF_PARTICLE )
continue;
eff = eff->next;
if( !eff )
return ( EXPP_ReturnPyObjError
( PyExc_AttributeError,
"Object" ) );
}
wanted_eff =
( BPy_Particle * ) PyObject_NEW( BPy_Particle,
&Particle_Type );
wanted_eff->particle = eff;
return ( PyObject * ) wanted_eff;
}
object_iter = object_iter->id.next;
}
printf("warning, static particles api removed\n");
Py_INCREF( Py_None );
return Py_None;
}

View File

@@ -3,7 +3,8 @@
"""
The Blender.Effect submodule
B{new}: now L{Get}('objname') (without specifying second parameter: 'position') returns a list of all effects linked to object "objname".
B{Deprecated}:
This module is now maintained but not actively developed.
Effect
======

View File

@@ -383,7 +383,7 @@ class Object:
@ivar sel: The selection state of the object in the current scene.
True is selected, False is unselected. Setting makes the object active.
@type sel: boolean
@ivar effects: The list of particle effects associated with the object.
@ivar effects: The list of particle effects associated with the object. (depricated, will always return an empty list)
Read-only.
@type effects: list of Effect objects
@ivar parentbonename: The string name of the parent bone (if defined).
@@ -645,7 +645,7 @@ class Object:
def buildParts():
"""
Recomputes the particle system. This method only applies to an Object of
the type Effect.
the type Effect. (depricated, does nothing now, use makeDisplayList instead to update the modifier stack)
"""
def insertShapeKey():
@@ -1195,12 +1195,9 @@ class Object:
def makeDisplayList():
"""
Updates this object's display list. Blender uses display lists to store
already transformed data (like a mesh with its vertices already modified
by coordinate transformations and armature deformation). If the object
isn't modified, there's no need to recalculate this data. This method is
here for the *few cases* where a script may need it, like when toggling
the "SubSurf" mode for a mesh:
Forces an update to the objects display data. If the object isn't modified,
there's no need to recalculate this data.
This method is here for the *few cases* where it is needed.
Example::
import Blender

View File

@@ -2477,21 +2477,6 @@ void do_object_panels(unsigned short event)
allqueue(REDRAWVIEW3D, 0);
}
break;
default:
if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
int a=B_SELEFFECT;
eff= ob->effect.first;
while(eff) {
if(event==a) eff->flag |= SELECT;
else eff->flag &= ~SELECT;
a++;
eff= eff->next;
}
allqueue(REDRAWBUTSOBJECT, 0);
}
}
}
@@ -2858,7 +2843,6 @@ void do_effects_panels(unsigned short event)
Object *ob;
Base *base;
Effect *eff, *effn;
PartEff *paf;
ModifierData *md;
ParticleSystemModifierData *psmd;
ParticleSystem *psys;
@@ -2887,114 +2871,6 @@ void do_effects_panels(unsigned short event)
G.scene->r.framelen/= G.scene->r.images;
allqueue(REDRAWALL, 0);
break;
case B_NEWEFFECT:
if(ob) {
if(ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) {
// NT particles and fluid meshes currently dont work together -> switch off beforehand
if(ob->fluidsimSettings->type == OB_FLUIDSIM_DOMAIN) {
pupmenu("Fluidsim Particle Error%t|Please disable the fluidsim domain before activating particles.%x0");
break;
//ob->fluidsimFlag = 0; ob->fluidsimSettings->type = 0; allqueue(REDRAWVIEW3D, 0);
}
}
if (BLI_countlist(&ob->effect)==MAX_EFFECT)
error("Unable to add: effect limit reached");
else
copy_act_effect(ob);
}
DAG_scene_sort(G.scene);
BIF_undo_push("New effect");
allqueue(REDRAWBUTSOBJECT, 0);
break;
case B_DELEFFECT:
if(ob==NULL || ob->type!=OB_MESH) break;
eff= ob->effect.first;
while(eff) {
effn= eff->next;
if(eff->flag & SELECT) {
BLI_remlink(&ob->effect, eff);
free_effect(eff);
break;
}
eff= effn;
}
BIF_undo_push("Delete effect");
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
break;
case B_NEXTEFFECT:
if(ob==0 || ob->type!=OB_MESH) break;
eff= ob->effect.first;
while(eff) {
if(eff->flag & SELECT) {
if(eff->next) {
eff->flag &= ~SELECT;
eff->next->flag |= SELECT;
}
break;
}
eff= eff->next;
}
allqueue(REDRAWBUTSOBJECT, 0);
break;
case B_PREVEFFECT:
if(ob==0 || ob->type!=OB_MESH) break;
eff= ob->effect.first;
while(eff) {
if(eff->flag & SELECT) {
if(eff->prev) {
eff->flag &= ~SELECT;
eff->prev->flag |= SELECT;
}
break;
}
eff= eff->next;
}
allqueue(REDRAWBUTSOBJECT, 0);
break;
case B_EFFECT_DEP:
DAG_scene_sort(G.scene);
/* no break, pass on */
case B_CALCEFFECT:
if(ob==NULL || ob->type!=OB_MESH) break;
eff= ob->effect.first;
while(eff) {
if(eff->flag & SELECT) {
if(eff->type==EFF_PARTICLE) build_particle_system(ob);
}
eff= eff->next;
}
allqueue(REDRAWVIEW3D, 0);
allqueue(REDRAWBUTSOBJECT, 0);
break;
case B_PAF_SET_VG:
paf= give_parteff(ob);
if(paf) {
bDeformGroup *dg= get_named_vertexgroup(ob, paf->vgroupname);
if(dg)
paf->vertgroup= get_defgroup_num(ob, dg)+1;
else
paf->vertgroup= 0;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
case B_PAF_SET_VG1:
paf= give_parteff(ob);
if(paf) {
bDeformGroup *dg= get_named_vertexgroup(ob, paf->vgroupname_v);
if(dg)
paf->vertgroup_v= get_defgroup_num(ob, dg)+1;
else
paf->vertgroup_v= 0;
DAG_object_flush_update(G.scene, ob, OB_RECALC_DATA);
allqueue(REDRAWVIEW3D, 0);
}
break;
case B_PARTBROWSE:
if(G.buts->menunr== -2) {
activate_databrowse((ID *)G.buts->lockpoin, ID_PA, 0, B_PARTBROWSE, &G.buts->menunr, do_effects_panels);
@@ -3288,43 +3164,6 @@ void do_effects_panels(unsigned short event)
DAG_object_flush_update(G.scene, ob, OB_RECALC_OB);
allqueue(REDRAWVIEW3D, 0);
break;
case B_RECALCAL:
if (G.vd==NULL)
break;
base= FIRSTBASE;
while(base) {
if(base->lay & G.vd->lay) {
ob= base->object;
eff= ob->effect.first;
while(eff) {
if(eff->flag & SELECT) {
if(eff->type==EFF_PARTICLE) build_particle_system(ob);
}
eff= eff->next;
}
}
base= base->next;
}
allqueue(REDRAWVIEW3D, 0);
break;
default:
if(event>=B_SELEFFECT && event<B_SELEFFECT+MAX_EFFECT) {
ob= OBACT;
if(ob) {
int a=B_SELEFFECT;
eff= ob->effect.first;
while(eff) {
if(event==a) eff->flag |= SELECT;
else eff->flag &= ~SELECT;
a++;
eff= eff->next;
}
allqueue(REDRAWBUTSOBJECT, 0);
}
}
}
}

View File

@@ -2866,143 +2866,6 @@ static int drawDispList(Base *base, int dt)
return retval;
}
/* ******************************** */
static void draw_particle_system(Base *base, PartEff *paf)
{
Object *ob= base->object;
Particle *pa;
float ptime, ctime, vec[3], vec1[3], mat[4][4];
int a, totpart;
pa= paf->keys;
// FSPARTICLE always rebuild fluid particle system upon change...
if( (pa==NULL)
|| ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
) {
build_particle_system(ob);
pa= paf->keys;
if(pa==NULL) return;
}
myloadmatrix(G.vd->viewmat);
/* flag abuse... but I need working code too now. This feature doesnt work for per frame animated objects */
if( (base->flag & OB_FROMDUPLI) && (ob->flag & OB_FROMGROUP) ) {
Mat4MulMat4(mat, paf->imat, ob->obmat);
mymultmatrix(mat);
}
if(ob->ipoflag & OB_OFFS_PARTICLE) ptime= give_timeoffset(ob);
else ptime= 0.0;
ctime= bsystem_time(ob, (float)(G.scene->r.cfra), ptime);
glPointSize(1.0);
if(paf->stype==PAF_VECT) glBegin(GL_LINES);
else glBegin(GL_POINTS);
totpart= (paf->disp*paf->totpart)/100;
for(a=0; a<totpart; a++, pa+=paf->totkey) {
if(ctime > pa->time) {
if(ctime < pa->time+pa->lifetime) {
if(paf->stype==PAF_VECT) {
where_is_particle(paf, pa, ctime, vec);
where_is_particle(paf, pa, ctime+1.0, vec1);
glVertex3fv(vec);
glVertex3fv(vec1);
}
else {
where_is_particle(paf, pa, ctime, vec);
glVertex3fv(vec);
}
}
}
}
glEnd();
myloadmatrix(G.vd->viewmat);
mymultmatrix(ob->obmat); // bring back local matrix for dtx
}
static void draw_static_particle_system(Object *ob, PartEff *paf, int dt)
{
Particle *pa;
float ctime, mtime, vec[3], veco[3];
int a, use_norm=0, totpart;
pa= paf->keys;
// FSPARTICLE always rebuild upon change...
if( (pa==NULL)
|| ( (ob->fluidsimFlag & OB_FLUIDSIM_ENABLE) && (ob->fluidsimSettings) && (ob->fluidsimSettings->type == OB_FLUIDSIM_PARTICLE))
) {
build_particle_system(ob);
pa= paf->keys;
if(pa==NULL) return;
}
if(paf->stype==PAF_VECT) {
if(dt>OB_WIRE) {
/* shaded/texture mode: we still draw solid, so have to set materials */
if(dt>OB_SOLID) init_gl_materials(ob, 0);
glEnable(GL_LIGHTING);
set_gl_material(paf->omat);
use_norm= 1;
}
}
else {
glPointSize(1.0);
glBegin(GL_POINTS);
}
totpart= (paf->disp*paf->totpart)/100;
for(a=0; a<totpart; a++, pa+=paf->totkey) {
if(paf->stype==PAF_VECT) {
glBegin(GL_LINE_STRIP);
where_is_particle(paf, pa, pa->time, veco);
mtime= pa->time+pa->lifetime+paf->staticstep;
for(ctime= pa->time+paf->staticstep; ctime<mtime; ctime+=paf->staticstep) {
where_is_particle(paf, pa, ctime, vec);
if(use_norm) {
float no[3];
VECSUB(no, vec, veco);
glNormal3fv(no);
}
glVertex3fv(veco);
VECCOPY(veco, vec);
}
glVertex3fv(veco);
glEnd();
}
else {
mtime= pa->time+pa->lifetime+paf->staticstep-1;
for(ctime= pa->time; ctime<mtime; ctime+=paf->staticstep) {
where_is_particle(paf, pa, ctime, vec);
glVertex3fv(vec);
}
}
}
if(paf->stype==PAF_VECT) {
glDisable(GL_LIGHTING);
}
else {
glEnd();
}
}
/* unified drawing of all new particle systems draw types except dupli ob & group */
/* mostly tries to use vertex arrays for speed */
@@ -4983,17 +4846,6 @@ void draw_object(Base *base, int flag)
if (!(base->flag&OB_RADIO)) {
empty_object= draw_mesh_object(base, dt, flag);
if(flag!=DRAW_CONSTCOLOR) dtx &= ~OB_DRAWWIRE; // mesh draws wire itself
if(G.obedit!=ob && warning_recursive==0) {
PartEff *paf = give_parteff(ob);
if(paf) {
if(col || (ob->flag & SELECT)) cpack(0xFFFFFF); /* for visibility, also while wpaint */
if(paf->flag & PAF_STATIC) draw_static_particle_system(ob, paf, dt);
else if((flag & DRAW_PICKING) == 0) draw_particle_system(base, paf); // selection errors happen to easy
if(col) cpack(col);
}
}
}
break;

View File

@@ -907,15 +907,15 @@ void apply_obmat(Object *ob)
Mat3CpyMat4(mat, ob->obmat);
VECCOPY(ob->loc, ob->obmat[3]);
if(ob->transflag & OB_QUAT) {
/* Quats arnt used yet */
/*if(ob->transflag & OB_QUAT) {
Mat3ToQuat(mat, ob->quat);
QuatToMat3(ob->quat, tmat);
}
else {
else {*/
Mat3ToEul(mat, ob->rot);
EulToMat3(ob->rot, tmat);
}
/*}*/
Mat3Inv(imat, tmat);
Mat3MulMat3(tmat, imat, mat);
@@ -1050,8 +1050,8 @@ void clear_object(char mode)
/* quats here are not really used anymore anywhere, so it probably doesn't
* matter to not clear them whether the euler-based rotation is used
*/
QuatOne(ob->quat);
QuatOne(ob->dquat);
/*QuatOne(ob->quat);
QuatOne(ob->dquat);*/
#ifdef WITH_VERSE
if(ob->vnode) {
@@ -3422,8 +3422,9 @@ void copy_attr(short event)
else if(event==2) { /* rot */
VECCOPY(base->object->rot, ob->rot);
VECCOPY(base->object->drot, ob->drot);
VECCOPY(base->object->quat, ob->quat);
VECCOPY(base->object->dquat, ob->dquat);
/* Quats arnt used yet */
/*VECCOPY(base->object->quat, ob->quat);
VECCOPY(base->object->dquat, ob->dquat);*/
}
else if(event==3) { /* size */
VECCOPY(base->object->size, ob->size);
@@ -3534,32 +3535,6 @@ void copy_attr(short event)
base->object->recalc |= OB_RECALC_DATA;
}
}
else if(event==20) { /* particle settings */
PartEff *pa1, *pa2;
char *p1, *p2;
pa1= give_parteff(ob);
pa2= give_parteff(base->object);
if(pa1==0 && pa2) {
BLI_remlink( &(base->object->effect), pa2);
free_effect( (Effect *) pa2);
}
else if(pa1 && pa2==0) {
free_effects(&(base->object->effect));
copy_effects(&(base->object->effect), &ob->effect);
build_particle_system(base->object);
}
else if(pa1 && pa2) {
if(pa2->keys) MEM_freeN(pa2->keys);
p1= (char *)pa1; p2= (char *)pa2;
memcpy( p2+8, p1+8, sizeof(PartEff) - 8);
pa2->keys= 0;
build_particle_system(base->object);
}
}
else if(event==21){
if (base->object->type==OB_MESH) {
ModifierData *md = modifiers_findByType(ob, eModifierType_Subsurf);
@@ -3690,8 +3665,6 @@ void copy_attr_menu()
strcat(str, "|Subsurf Settings%x21|AutoSmooth%x27");
}
if( give_parteff(ob) ) strcat(str, "|Particle Settings%x20");
if(ob->soft) strcat(str, "|Soft Body Settings%x23");
strcat(str, "|Pass Index%x30");
@@ -3966,7 +3939,7 @@ void apply_objects_locrot( void )
}
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
QuatOne(ob->quat);
/*QuatOne(ob->quat);*/ /* Quats arnt used yet */
where_is_object(ob);
@@ -3989,7 +3962,7 @@ void apply_objects_locrot( void )
/* Reset the object's transforms */
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
QuatOne(ob->quat);
/*QuatOne(ob->quat); (not used anymore)*/
where_is_object(ob);
@@ -4029,7 +4002,7 @@ void apply_objects_locrot( void )
ob->size[0]= ob->size[1]= ob->size[2]= 1.0;
ob->rot[0]= ob->rot[1]= ob->rot[2]= 0.0;
QuatOne(ob->quat);
/*QuatOne(ob->quat); (quats arnt used anymore)*/
where_is_object(ob);

View File

@@ -2213,11 +2213,6 @@ static uiBlock *view3d_edit_object_copyattrmenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Subsurf Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 21, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Modifiers ...|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 24, "");
}
if( give_parteff(ob) ) {
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Particle Settings|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 20, "");
}
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Object Pass Index|Ctrl C", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 30, "");
}

View File

@@ -1529,11 +1529,12 @@ void setcameratoview3d(void)
VECCOPY(ob->loc, dvec);
VecSubf(ob->loc, ob->loc, G.vd->ofs);
G.vd->viewquat[0]= -G.vd->viewquat[0];
if (ob->transflag & OB_QUAT) {
/* */
/*if (ob->transflag & OB_QUAT) {
QUATCOPY(ob->quat, G.vd->viewquat);
} else {
} else {*/
QuatToEul(G.vd->viewquat, ob->rot);
}
/*}*/
G.vd->viewquat[0]= -G.vd->viewquat[0];
}