diff options
author | Ken Hughes <khughes@pacific.edu> | 2005-11-07 03:22:05 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2005-11-07 03:22:05 +0300 |
commit | 979c28bf06b53e1d87838e687d315e19df859940 (patch) | |
tree | 873a11a8e0db65207776255ef15096791d44d2f9 /source | |
parent | 0089c0bc53f9ed69c3970ba648bb9b8d7ba13ffb (diff) |
-- Clean-up of Effect and Particle modules; since particle was the only
remaining effect type, it didn't make much sense to leave things
implemented in two separate files. Changes include:
* two bug fixes (the getChild() and getMat() methods were using floats
instead of shorts)
* performing clamping on input values
* implementing attributes using tp_getset
* merging Effect and Particle functions: the Particle module exists in
name only, with the Particle.New() and Particle.Get() functions
remaining for backward compatibility (they are in fact identical to
Effect.New() and Effect.Get() functions)
* update of doc/Effect.py (including remove all old references to wave
and build effects)
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/python/SConscript | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Effect.c | 1133 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Effect.h | 28 | ||||
-rw-r--r-- | source/blender/python/api2_2x/Types.c | 1 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Effect.py | 513 |
5 files changed, 1194 insertions, 482 deletions
diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 206e266bbb3..51d1101e74a 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -34,7 +34,6 @@ source_files = ['BPY_interface.c', 'api2_2x/Noise.c', 'api2_2x/NMesh.c', 'api2_2x/Object.c', - 'api2_2x/Particle.c', 'api2_2x/point.c', 'api2_2x/Registry.c', 'api2_2x/Scene.c', diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c index a3dd5b7640b..f161cfc86fb 100644 --- a/source/blender/python/api2_2x/Effect.c +++ b/source/blender/python/api2_2x/Effect.c @@ -25,7 +25,7 @@ * * This is a new part of Blender. * - * Contributor(s): Jacques Guignot, Jean-Michel Soler + * Contributor(s): Jacques Guignot, Jean-Michel Soler, Ken Hughes * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -36,60 +36,431 @@ #include "BKE_main.h" #include "BKE_effect.h" #include "BKE_object.h" -#include "Particle.h" +#include "BLI_blenlib.h" #include "gen_utils.h" +#include "blendef.h" + +#define EXPP_EFFECT_STA_MIN -250.0f +#define EXPP_EFFECT_END_MIN 1.0f +#define EXPP_EFFECT_LIFETIME_MIN 1.0f +#define EXPP_EFFECT_NORMFAC_MIN -2.0f +#define EXPP_EFFECT_NORMFAC_MAX 2.0f +#define EXPP_EFFECT_OBFAC_MIN -1.0f +#define EXPP_EFFECT_OBFAC_MAX 1.0f +#define EXPP_EFFECT_RANDFAC_MIN 0.0f +#define EXPP_EFFECT_RANDFAC_MAX 2.0f +#define EXPP_EFFECT_TEXFAC_MIN 0.0f +#define EXPP_EFFECT_TEXFAC_MAX 2.0f +#define EXPP_EFFECT_RANDLIFE_MIN 0.0f +#define EXPP_EFFECT_RANDLIFE_MAX 2.0f +#define EXPP_EFFECT_NABLA_MIN 0.0001f +#define EXPP_EFFECT_NABLA_MAX 1.0f +#define EXPP_EFFECT_VECTSIZE_MIN 0.0f +#define EXPP_EFFECT_VECTSIZE_MAX 1.0f +#define EXPP_EFFECT_TOTPART_MIN 1.0f +#define EXPP_EFFECT_TOTPART_MAX 100000.0f +#define EXPP_EFFECT_FORCE_MIN -1.0f +#define EXPP_EFFECT_FORCE_MAX 1.0f +#define EXPP_EFFECT_MULT_MIN 0.0f +#define EXPP_EFFECT_MULT_MAX 1.0f +#define EXPP_EFFECT_LIFE_MIN 1.0f +#define EXPP_EFFECT_DEFVEC_MIN -1.0f +#define EXPP_EFFECT_DEFVEC_MAX 1.0f + +#define EXPP_EFFECT_TOTKEY_MIN 1 +#define EXPP_EFFECT_TOTKEY_MAX 100 +#define EXPP_EFFECT_SEED_MIN 0 +#define EXPP_EFFECT_SEED_MAX 255 +#define EXPP_EFFECT_CHILD_MIN 1 +#define EXPP_EFFECT_CHILD_MAX 600 +#define EXPP_EFFECT_MAT_MIN 1 +#define EXPP_EFFECT_MAT_MAX 8 -PyObject *M_Particle_New( PyObject * self, PyObject * args ); -int ParticleSetAttr( BPy_Particle * msh, char *name, PyObject * v ); -PyObject *ParticleGetAttr( BPy_Particle * msh, char *name ); -PyObject *M_Effect_GetParticlesLoc( PyObject * self, PyObject * args ); +/*****************************************************************************/ +/* Python API function prototypes for the Blender module. */ +/*****************************************************************************/ +static PyObject *M_Effect_New( PyObject * self, PyObject * args ); +static PyObject *M_Effect_Get( PyObject * self, PyObject * args ); +static PyObject *M_Effect_GetParticlesLoc( PyObject * self, PyObject * args ); + +/*****************************************************************************/ +/* Python BPy_Effect methods declarations: */ +/*****************************************************************************/ +static PyObject *Effect_getType( BPy_Effect * self ); +static int Effect_setType( void ); +static PyObject *Effect_getFlag( BPy_Effect * self ); +static int Effect_setFlag( BPy_Effect * self, PyObject * args ); +static PyObject *Effect_getSta( BPy_Effect * self ); +static int Effect_setSta( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getEnd( BPy_Effect * self ); +static int Effect_setEnd( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getLifetime( BPy_Effect * self ); +static int Effect_setLifetime( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getNormfac( BPy_Effect * self ); +static int Effect_setNormfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getObfac( BPy_Effect * self ); +static int Effect_setObfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getRandfac( BPy_Effect * self ); +static int Effect_setRandfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getTexfac( BPy_Effect * self ); +static int Effect_setTexfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getRandlife( BPy_Effect * self ); +static int Effect_setRandlife( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getNabla( BPy_Effect * self ); +static int Effect_setNabla( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getVectsize( BPy_Effect * self ); +static int Effect_setVectsize( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getTotpart( BPy_Effect * self ); +static int Effect_setTotpart( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getTotkey( BPy_Effect * self ); +static int Effect_setTotkey( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getSeed( BPy_Effect * self ); +static int Effect_setSeed( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getForce( BPy_Effect * self ); +static int Effect_setForce( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getMult( BPy_Effect * self ); +static int Effect_setMult( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getLife( BPy_Effect * self ); +static int Effect_setLife( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getMat( BPy_Effect * self ); +static int Effect_setMat( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getChild( BPy_Effect * self ); +static int Effect_setChild( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_getDefvec( BPy_Effect * self ); +static int Effect_setDefvec( BPy_Effect * self, PyObject * a ); + +static PyObject *Effect_oldsetType( void ); +static PyObject *Effect_oldsetFlag( BPy_Effect * self, PyObject * args ); +static PyObject *Effect_oldsetSta( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetEnd( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetLifetime( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetNormfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetObfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetRandfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetTexfac( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetRandlife( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetNabla( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetVectsize( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetTotpart( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetTotkey( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetSeed( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetForce( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetMult( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetLife( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetMat( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetChild( BPy_Effect * self, PyObject * a ); +static PyObject *Effect_oldsetDefvec( BPy_Effect * self, PyObject * a ); + +/*****************************************************************************/ +/* Python Effect_Type callback function prototypes: */ +/*****************************************************************************/ +static void Effect_dealloc( BPy_Effect * msh ); +static PyObject *Effect_repr( void ); + +/*****************************************************************************/ +/* The following string definitions are used for documentation strings. */ +/* In Python these will be written to the console when doing a */ +/* Blender.Particle.__doc__ */ +/*****************************************************************************/ +static char M_Particle_doc[] = "The Blender Effect module\n\n\ +This module provides access to **Object Data** in Blender.\n\ +Functions :\n\ + New(name) : creates a new part object and adds it to the given mesh object \n\ + Get(name) : retreives a particle with the given name (mandatory)\n\ + get(name) : same as Get. Kept for compatibility reasons.\n"; +static char M_Effect_New_doc[] = "New(name) : creates a new part object and adds it to the given mesh object\n"; +static char M_Effect_Get_doc[] = "xxx"; + +/*****************************************************************************/ +/* Python method structure definition for Blender.Particle module: */ +/*****************************************************************************/ +static struct PyMethodDef M_Particle_methods[] = { + {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, M_Effect_New_doc}, + {"Get", M_Effect_Get, METH_VARARGS, M_Effect_Get_doc}, + {"get", M_Effect_Get, METH_VARARGS, M_Effect_Get_doc}, + {NULL, NULL, 0, NULL} +}; /*****************************************************************************/ /* Python BPy_Effect methods table: */ /*****************************************************************************/ static PyMethodDef BPy_Effect_methods[] = { + {"getType", ( PyCFunction ) Effect_getType, + METH_NOARGS, "() - Return Effect type"}, + {"setType", ( PyCFunction ) Effect_oldsetType, + METH_VARARGS, "() - Set Effect type"}, + {"getFlag", ( PyCFunction ) Effect_getFlag, + METH_NOARGS, "() - Return Effect flag"}, + {"setFlag", ( PyCFunction ) Effect_oldsetFlag, + METH_VARARGS, "() - Set Effect flag"}, + {"getStartTime", ( PyCFunction ) Effect_getSta, + METH_NOARGS, "()-Return particle start time"}, + {"setStartTime", ( PyCFunction ) Effect_oldsetSta, METH_VARARGS, + "()- Sets particle start time"}, + {"getEndTime", ( PyCFunction ) Effect_getEnd, + METH_NOARGS, "()-Return particle end time"}, + {"setEndTime", ( PyCFunction ) Effect_oldsetEnd, METH_VARARGS, + "()- Sets particle end time"}, + {"getLifetime", ( PyCFunction ) Effect_getLifetime, + METH_NOARGS, "()-Return particle life time"}, + {"setLifetime", ( PyCFunction ) Effect_oldsetLifetime, METH_VARARGS, + "()- Sets particle life time "}, + {"getNormfac", ( PyCFunction ) Effect_getNormfac, + METH_NOARGS, "()-Return particle life time"}, + {"setNormfac", ( PyCFunction ) Effect_oldsetNormfac, METH_VARARGS, + "()- Sets particle life time "}, + {"getObfac", ( PyCFunction ) Effect_getObfac, + METH_NOARGS, "()-Return particle life time"}, + {"setObfac", ( PyCFunction ) Effect_oldsetObfac, METH_VARARGS, + "()- Sets particle life time "}, + {"getRandfac", ( PyCFunction ) Effect_getRandfac, + METH_NOARGS, "()-Return particle life time"}, + {"setRandfac", ( PyCFunction ) Effect_oldsetRandfac, METH_VARARGS, + "()- Sets particle life time "}, + {"getTexfac", ( PyCFunction ) Effect_getTexfac, + METH_NOARGS, "()-Return particle life time"}, + {"setTexfac", ( PyCFunction ) Effect_oldsetTexfac, METH_VARARGS, + "()- Sets particle life time "}, + {"getRandlife", ( PyCFunction ) Effect_getRandlife, + METH_NOARGS, "()-Return particle life time"}, + {"setRandlife", ( PyCFunction ) Effect_oldsetRandlife, METH_VARARGS, + "()- Sets particle life time "}, + {"getNabla", ( PyCFunction ) Effect_getNabla, + METH_NOARGS, "()-Return particle life time"}, + {"setNabla", ( PyCFunction ) Effect_oldsetNabla, METH_VARARGS, + "()- Sets particle life time "}, + {"getVectsize", ( PyCFunction ) Effect_getVectsize, + METH_NOARGS, "()-Return particle life time"}, + {"setVectsize", ( PyCFunction ) Effect_oldsetVectsize, METH_VARARGS, + "()- Sets particle life time "}, + {"getTotpart", ( PyCFunction ) Effect_getTotpart, + METH_NOARGS, "()-Return particle life time"}, + {"setTotpart", ( PyCFunction ) Effect_oldsetTotpart, METH_VARARGS, + "()- Sets particle life time "}, + {"getTotkey", ( PyCFunction ) Effect_getTotkey, + METH_NOARGS, "()-Return the number of key positions."}, + {"setTotkey", ( PyCFunction ) Effect_oldsetTotkey, METH_VARARGS, + "()-Set the number of key positions. "}, + {"getSeed", ( PyCFunction ) Effect_getSeed, + METH_NOARGS, "()-Return particle life time"}, + {"setSeed", ( PyCFunction ) Effect_oldsetSeed, METH_VARARGS, + "()- Sets particle life time "}, + {"getForce", ( PyCFunction ) Effect_getForce, + METH_NOARGS, "()-Return particle life time"}, + {"setForce", ( PyCFunction ) Effect_oldsetForce, METH_VARARGS, + "()- Sets particle life time "}, + {"getMult", ( PyCFunction ) Effect_getMult, + METH_NOARGS, "()-Return particle life time"}, + {"setMult", ( PyCFunction ) Effect_oldsetMult, METH_VARARGS, + "()- Sets particle life time "}, + {"getLife", ( PyCFunction ) Effect_getLife, + METH_NOARGS, "()-Return particle life time"}, + {"setLife", ( PyCFunction ) Effect_oldsetLife, METH_VARARGS, + "()- Sets particle life time "}, + {"getMat", ( PyCFunction ) Effect_getMat, + METH_NOARGS, "()-Return particle life time"}, + {"setMat", ( PyCFunction ) Effect_oldsetMat, METH_VARARGS, + "()- Sets particle life time "}, + {"getChild", ( PyCFunction ) Effect_getChild, + METH_NOARGS, "()-Return particle life time"}, + {"setChild", ( PyCFunction ) Effect_oldsetChild, METH_VARARGS, + "()- Sets particle life time "}, + {"getDefvec", ( PyCFunction ) Effect_getDefvec, + METH_NOARGS, "()-Return particle life time"}, + {"setDefvec", ( PyCFunction ) Effect_oldsetDefvec, METH_VARARGS, + "()- Sets particle life time "}, {NULL, NULL, 0, NULL} }; /*****************************************************************************/ +/* Python BPy_Effect attributes get/set structure: */ +/*****************************************************************************/ +static PyGetSetDef BPy_Effect_getseters[] = { + {"flag", + (getter)Effect_getFlag, (setter)Effect_setFlag, + "The particle flag bitfield", + NULL}, + {"type", + (getter)Effect_getType, (setter)Effect_setType, + "The effect's type (deprecated)", + NULL}, + {"child", + (getter)Effect_getChild, (setter)Effect_setChild, + "The number of children of a particle that multiply itself", + NULL}, + {"defvec", + (getter)Effect_getDefvec, (setter)Effect_setDefvec, + "The axes of a force, determined by the texture", + NULL}, + {"end", + (getter)Effect_getEnd, (setter)Effect_setEnd, + "The endframe for the effect", + NULL}, + {"force", + (getter)Effect_getForce, (setter)Effect_setForce, + "The axes of a continues force", + NULL}, + {"life", + (getter)Effect_getLife, (setter)Effect_setLife, + "The life span of the next generation of particles", + NULL}, + {"lifetime", + (getter)Effect_getLifetime, (setter)Effect_setLifetime, + "The life span of the particles", + NULL}, + {"mat", + (getter)Effect_getMat, (setter)Effect_setMat, + "Specify the material used for the particles", + NULL}, + {"mult", + (getter)Effect_getMult, (setter)Effect_setMult, + "The probabilities that a \"dying\" particle spawns a new one", + NULL}, + {"nabla", + (getter)Effect_getNabla, (setter)Effect_setNabla, + "The dimension of the area for gradient calculation", + NULL}, + {"normfac", + (getter)Effect_getNormfac, (setter)Effect_setNormfac, + "Particle's starting speed (from the mesh)", + NULL}, + {"obfac", + (getter)Effect_getObfac, (setter)Effect_setObfac, + "Particle's starting speed (from the object)", + NULL}, + {"randfac", + (getter)Effect_getRandfac, (setter)Effect_setRandfac, + "The random variation for the starting speed", + NULL}, + {"randlife", + (getter)Effect_getRandlife, (setter)Effect_setRandlife, + "The random variation for a particle's life", + NULL}, + {"seed", + (getter)Effect_getSeed, (setter)Effect_setSeed, + "The seed for random variations", + NULL}, + {"sta", + (getter)Effect_getSta, (setter)Effect_setSta, + "The startframe for the effect", + NULL}, + {"texfac", + (getter)Effect_getTexfac, (setter)Effect_setTexfac, + "Particle's starting speed (from the texture)", + NULL}, + {"totpart", + (getter)Effect_getTotpart, (setter)Effect_setTotpart, + "The total number of particles", + NULL}, + {"totkey", + (getter)Effect_getTotkey, (setter)Effect_setTotkey, + "The total number of key positions", + NULL}, + {"vectsize", + (getter)Effect_getVectsize, (setter)Effect_setVectsize, + "The speed for particle's rotation direction", + NULL}, + {NULL,NULL,NULL,NULL,NULL} /* Sentinel */ +}; + +/*****************************************************************************/ /* Python Effect_Type structure definition: */ /*****************************************************************************/ PyTypeObject Effect_Type = { - PyObject_HEAD_INIT( NULL ) - 0, /* ob_size */ - "Effect", /* tp_name */ - sizeof( BPy_Effect ), /* tp_basicsize */ - 0, /* tp_itemsize */ - /* methods */ - ( destructor ) EffectDeAlloc, /* tp_dealloc */ - 0, /* tp_print */ - ( getattrfunc ) EffectGetAttr, /* tp_getattr */ - ( setattrfunc ) EffectSetAttr, /* tp_setattr */ - 0, /* tp_compare */ - ( reprfunc ) EffectRepr, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_as_hash */ - 0, 0, 0, 0, 0, 0, - 0, /* tp_doc */ - 0, 0, 0, 0, 0, 0, - BPy_Effect_methods, /* tp_methods */ - 0, /* tp_members */ + PyObject_HEAD_INIT( NULL ) /* required py macro */ + 0, /* ob_size */ + /* For printing, in format "<module>.<name>" */ + "Blender Effect", /* char *tp_name; */ + sizeof( BPy_Effect ), /* int tp_basicsize; */ + 0, /* tp_itemsize; For allocation */ + + /* Methods to implement standard operations */ + + ( destructor ) Effect_dealloc,/* destructor tp_dealloc; */ + NULL, /* printfunc tp_print; */ + NULL, /* getattrfunc tp_getattr; */ + NULL, /* setattrfunc tp_setattr; */ + NULL, /* cmpfunc tp_compare; */ + ( reprfunc ) Effect_repr, /* reprfunc tp_repr; */ + + /* Method suites for standard classes */ + + NULL, /* PyNumberMethods *tp_as_number; */ + NULL, /* PySequenceMethods *tp_as_sequence; */ + NULL, /* PyMappingMethods *tp_as_mapping; */ + + /* More standard operations (here for binary compatibility) */ + + NULL, /* hashfunc tp_hash; */ + NULL, /* ternaryfunc tp_call; */ + NULL, /* reprfunc tp_str; */ + NULL, /* getattrofunc tp_getattro; */ + NULL, /* setattrofunc tp_setattro; */ + + /* Functions to access object as input/output buffer */ + NULL, /* PyBufferProcs *tp_as_buffer; */ + + /*** Flags to define presence of optional/expanded features ***/ + Py_TPFLAGS_DEFAULT, /* long tp_flags; */ + + NULL, /* char *tp_doc; Documentation string */ + /*** Assigned meaning in release 2.0 ***/ + /* call function for all accessible objects */ + NULL, /* traverseproc tp_traverse; */ + + /* delete references to contained objects */ + NULL, /* inquiry tp_clear; */ + + /*** Assigned meaning in release 2.1 ***/ + /*** rich comparisons ***/ + NULL, /* richcmpfunc tp_richcompare; */ + + /*** weak reference enabler ***/ + 0, /* long tp_weaklistoffset; */ + + /*** Added in release 2.2 ***/ + /* Iterators */ + NULL, /* getiterfunc tp_iter; */ + NULL, /* iternextfunc tp_iternext; */ + + /*** Attribute descriptor and subclassing stuff ***/ + BPy_Effect_methods, /* struct PyMethodDef *tp_methods; */ + NULL, /* struct PyMemberDef *tp_members; */ + BPy_Effect_getseters, /* struct PyGetSetDef *tp_getset; */ + NULL, /* struct _typeobject *tp_base; */ + NULL, /* PyObject *tp_dict; */ + NULL, /* descrgetfunc tp_descr_get; */ + NULL, /* descrsetfunc tp_descr_set; */ + 0, /* long tp_dictoffset; */ + NULL, /* initproc tp_init; */ + NULL, /* allocfunc tp_alloc; */ + NULL, /* newfunc tp_new; */ + /* Low-level free-memory routine */ + NULL, /* freefunc tp_free; */ + /* For PyObject_IS_GC */ + NULL, /* inquiry tp_is_gc; */ + NULL, /* PyObject *tp_bases; */ + /* method resolution order */ + NULL, /* PyObject *tp_mro; */ + NULL, /* PyObject *tp_cache; */ + NULL, /* PyObject *tp_subclasses; */ + NULL, /* PyObject *tp_weaklist; */ + NULL }; -static char M_Effect_GetParticlesLoc_doc[] = "GetParticlesLoc(name,effect num, curframe) : current particles locations"; +static char M_Effect_GetParticlesLoc_doc[] = + "GetParticlesLoc(name,effect num, curframe) : current particles locations"; /*****************************************************************************/ /* Python method structure definition for Blender.Effect module: */ /*****************************************************************************/ - struct PyMethodDef M_Effect_methods[] = { {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, NULL}, {"Get", M_Effect_Get, METH_VARARGS, NULL}, {"get", M_Effect_Get, METH_VARARGS, NULL}, - {"GetParticlesLoc", M_Effect_GetParticlesLoc, METH_VARARGS, M_Effect_GetParticlesLoc_doc}, + {"GetParticlesLoc", M_Effect_GetParticlesLoc, METH_VARARGS, + M_Effect_GetParticlesLoc_doc}, {NULL, NULL, 0, NULL} }; @@ -99,7 +470,43 @@ struct PyMethodDef M_Effect_methods[] = { /*****************************************************************************/ PyObject *M_Effect_New( PyObject * self, PyObject * args ) { - return M_Particle_New( self, 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; } /*****************************************************************************/ @@ -143,7 +550,7 @@ PyObject *M_Effect_Get( PyObject * self, PyObject * args ) if (eff) { wanted_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); - wanted_eff->effect = eff; + wanted_eff->effect = (PartEff *)eff; return ( PyObject * ) wanted_eff; } else { /* didn't find any effect in the given position */ Py_INCREF(Py_None); @@ -158,7 +565,7 @@ PyObject *M_Effect_Get( PyObject * self, PyObject * args ) while (eff) { BPy_Effect *found_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type); - found_eff->effect = eff; + found_eff->effect = (PartEff *)eff; PyList_Append( effectlist, ( PyObject * ) found_eff ); Py_DECREF((PyObject *)found_eff); /* PyList_Append incref'ed it */ eff = eff->next; @@ -186,7 +593,7 @@ PyObject *M_Effect_Get( PyObject * self, PyObject * args ) ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type ); - found_eff->effect = eff; + found_eff->effect = (PartEff *)eff; PyList_Append( effectlist, ( PyObject * ) found_eff ); @@ -224,7 +631,7 @@ PyObject *M_Effect_GetParticlesLoc( PyObject * self, PyObject * args ) if( !PyArg_ParseTuple( args, "sif", &name, &num , &cfra) ) return ( EXPP_ReturnPyObjError( PyExc_TypeError, - "expected string, int, float arguments" ) ); + "expected string, int, float arguments" ) ); for( ob = G.main->object.first; ob; ob = ob->id.next ) if( !strcmp( name, ob->id.name + 2 ) ) @@ -273,7 +680,7 @@ PyObject *M_Effect_GetParticlesLoc( PyObject * self, PyObject * args ) vec[0], vec[1], vec[2]) ) < 0 ) { Py_DECREF( list ); return EXPP_ReturnPyObjError( PyExc_RuntimeError, - "Couldn't add item to list" ); + "Couldn't append item to PyList" ); } } } @@ -281,22 +688,54 @@ PyObject *M_Effect_GetParticlesLoc( PyObject * self, PyObject * args ) return list; } +/* create the Blender.Effect.Flags constant dict */ + +static PyObject *Effect_FlagsDict( void ) +{ + PyObject *Flags = PyConstant_New( ); + + if( Flags ) { + BPy_constant *c = ( BPy_constant * ) Flags; + + PyConstant_Insert( c, "SELECTED", + PyInt_FromLong( EFF_SELECT ) ); + PyConstant_Insert( c, "FACE", + PyInt_FromLong( PAF_FACE ) ); + PyConstant_Insert( c, "STATIC", + PyInt_FromLong( PAF_STATIC ) ); + PyConstant_Insert( c, "ANIMATED", + PyInt_FromLong( PAF_ANIMATED ) ); + PyConstant_Insert( c, "BSPLINE", + PyInt_FromLong( PAF_BSPLINE ) ); + } + return Flags; +} + /*****************************************************************************/ /* Function: Effect_Init */ /*****************************************************************************/ - -PyObject *Particle_Init( void ); - PyObject *Effect_Init( void ) { PyObject *submodule, *dict; + PyObject *particle; + PyObject *Flags; - Effect_Type.ob_type = &PyType_Type; + if( PyType_Ready( &Effect_Type ) < 0) + return NULL; + + Flags = Effect_FlagsDict( ); submodule = Py_InitModule3( "Blender.Effect", M_Effect_methods, 0 ); + if( Flags ) + PyModule_AddObject( submodule, "Flags", Flags ); + + particle = Py_InitModule3( "Blender.Particle", M_Particle_methods, + M_Particle_doc ); + dict = PyModule_GetDict( submodule ); - PyDict_SetItemString( dict, "Particle", Particle_Init( ) ); + + PyDict_SetItemString( dict, "Particle", particle ); return ( submodule ); } @@ -304,7 +743,7 @@ PyObject *Effect_Init( void ) /* Python BPy_Effect methods: */ /*****************************************************************************/ -PyObject *Effect_getType( BPy_Effect * self ) +static PyObject *Effect_getType( BPy_Effect * self ) { PyObject *attr = PyInt_FromLong( ( long ) self->effect->type ); if( attr ) @@ -313,124 +752,489 @@ PyObject *Effect_getType( BPy_Effect * self ) "couldn't get mode attribute" ) ); } - /* does nothing since there is only one type of effect */ -PyObject *Effect_setType( BPy_Effect * self ) +static int Effect_setType( void ) { - Py_INCREF( Py_None ); - return Py_None; + return 0; } -PyObject *Effect_getFlag( BPy_Effect * self ) +static PyObject *Effect_getFlag( BPy_Effect * self ) { PyObject *attr = PyInt_FromLong( ( long ) self->effect->flag ); + if( attr ) return attr; - return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, - "couldn't get mode attribute" ) ); + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.flag attribute" ); } +static int Effect_setFlag( BPy_Effect * self, PyObject * args ) +{ + short param; + static short bitmask = PAF_FACE | PAF_STATIC | PAF_ANIMATED | PAF_BSPLINE; + + if( !PyArg_Parse( args, "h", ¶m ) ) + return EXPP_ReturnIntError( PyExc_TypeError, + "expected an int as argument" ); + + /* we don't allow users to change the select bit at this time */ + param &= ~EFF_SELECT; + + if ( ( param & bitmask ) != param ) + return EXPP_ReturnIntError( PyExc_ValueError, + "invalid bit(s) set in mask" ); + self->effect->flag &= EFF_SELECT; + self->effect->flag |= param; + return 0; +} -PyObject *Effect_setFlag( BPy_Effect * self, PyObject * args ) +static PyObject *Effect_getSta( BPy_Effect * self ) { - int value; - if( !PyArg_ParseTuple( args, "i", &value ) ) - return ( EXPP_ReturnPyObjError( PyExc_TypeError, - "expected an int as argument" ) ); - self->effect->flag = (short)value; - Py_INCREF( Py_None ); - return Py_None; + PyObject *attr = PyFloat_FromDouble( self->effect->sta ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.sta attribute" ); } +static int Effect_setSta( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->sta, + EXPP_EFFECT_STA_MIN, MAXFRAMEF ); +} +static PyObject *Effect_getEnd( BPy_Effect * self ) +{ + PyObject *attr; + PartEff *ptr = ( PartEff * ) self->effect; + attr = PyFloat_FromDouble( ptr->end ); + if( attr ) + return attr; + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.end attribute" ); +} -/*****************************************************************************/ -/* Function: EffectDeAlloc */ -/* Description: This is a callback function for the BPy_Effect type. It is */ -/* the destructor function. */ -/*****************************************************************************/ -void EffectDeAlloc( BPy_Effect * self ) +static int Effect_setEnd( BPy_Effect * self, PyObject * args ) { - PyObject_DEL( self ); + float val; + + if( !PyArg_Parse( args, "f", &val ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected float argument" ); + + self->effect->end = EXPP_ClampFloat( val, + EXPP_EFFECT_END_MIN, MAXFRAMEF ); + return 0; } -/*****************************************************************************/ -/* Function: EffectGetAttr */ -/* Description: This is a callback function for the BPy_Effect type. It is */ -/* the function that accesses BPy_Effect "member variables" and */ -/* methods. */ -/*****************************************************************************/ +static PyObject *Effect_getLifetime( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->lifetime ); + if( attr ) + return attr; -PyObject *EffectGetAttr( BPy_Effect * self, char *name ) + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.lifetime attribute" ); +} + +static int Effect_setLifetime( BPy_Effect * self, PyObject * args ) { - switch ( self->effect->type ) { - case EFF_PARTICLE: - return ParticleGetAttr( ( BPy_Particle * ) self, name ); - } + return EXPP_setFloatClamped( args, &self->effect->lifetime, + EXPP_EFFECT_LIFETIME_MIN, MAXFRAMEF ); +} + +static PyObject *Effect_getNormfac( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->normfac ); + + if( attr ) + return attr; - return Py_FindMethod( BPy_Effect_methods, ( PyObject * ) self, name ); + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.normfac attribute" ); } -/*****************************************************************************/ -/* Function: EffectSetAttr */ -/* Description: This is a callback function for the BPy_Effect type. It */ -/* sets Effect Data attributes (member variables). */ -/*****************************************************************************/ +static int Effect_setNormfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->normfac, + EXPP_EFFECT_NORMFAC_MIN, EXPP_EFFECT_NORMFAC_MAX ); +} +static PyObject *Effect_getObfac( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->obfac ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.obfac attribute" ); +} -int EffectSetAttr( BPy_Effect * self, char *name, PyObject * value ) +static int Effect_setObfac( BPy_Effect * self, PyObject * args ) { - switch ( self->effect->type ) { - case EFF_PARTICLE: - return ParticleSetAttr( ( BPy_Particle * ) self, name, value ); - } - return 0; /* normal exit */ + return EXPP_setFloatClamped( args, &self->effect->obfac, + EXPP_EFFECT_OBFAC_MIN, EXPP_EFFECT_OBFAC_MAX ); +} + +static PyObject *Effect_getRandfac( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->randfac ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.randfac attribute" ); +} + +static int Effect_setRandfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->randfac, + EXPP_EFFECT_RANDFAC_MIN, EXPP_EFFECT_RANDFAC_MAX ); +} + +static PyObject *Effect_getTexfac( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->texfac ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.texfac attribute" ); +} + +static int Effect_setTexfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->texfac, + EXPP_EFFECT_TEXFAC_MIN, EXPP_EFFECT_TEXFAC_MAX ); +} + +static PyObject *Effect_getRandlife( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->randlife ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.randlife attribute" ); +} + +static int Effect_setRandlife( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->randlife, + EXPP_EFFECT_RANDLIFE_MIN, EXPP_EFFECT_RANDLIFE_MAX ); +} + +static PyObject *Effect_getNabla( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->nabla ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.nabla attribute" ); +} + +static int Effect_setNabla( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->nabla, + EXPP_EFFECT_NABLA_MIN, EXPP_EFFECT_NABLA_MAX ); +} + +static PyObject *Effect_getVectsize( BPy_Effect * self ) +{ + PyObject *attr = PyFloat_FromDouble( self->effect->vectsize ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.vectsize attribute" ); +} + +static int Effect_setVectsize( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setFloatClamped( args, &self->effect->vectsize, + EXPP_EFFECT_VECTSIZE_MIN, EXPP_EFFECT_VECTSIZE_MAX ); +} + +static PyObject *Effect_getTotpart( BPy_Effect * self ) +{ + PyObject *attr = PyInt_FromLong( self->effect->totpart ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.totpart attribute" ); +} + +static int Effect_setTotpart( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setIValueClamped( args, &self->effect->totpart, + EXPP_EFFECT_TOTPART_MIN, EXPP_EFFECT_TOTPART_MAX, 'i' ); +} + +static PyObject *Effect_getTotkey( BPy_Effect * self ) +{ + PyObject *attr = PyInt_FromLong( self->effect->totkey ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.totkey attribute" ); +} + +static int Effect_setTotkey( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setIValueClamped( args, &self->effect->totkey, + EXPP_EFFECT_TOTKEY_MIN, EXPP_EFFECT_TOTKEY_MAX, 'i' ); +} + +static PyObject *Effect_getSeed( BPy_Effect * self ) +{ + PyObject *attr = PyInt_FromLong( self->effect->seed ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.seed attribute" ); +} + +static int Effect_setSeed( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setIValueClamped( args, &self->effect->seed, + EXPP_EFFECT_SEED_MIN, EXPP_EFFECT_SEED_MAX, 'i' ); +} + +static PyObject *Effect_getForce( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(f,f,f)", self->effect->force[0], + self->effect->force[1], self->effect->force[2] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.force attribute" ); +} + +static int Effect_setForce( BPy_Effect * self, PyObject * args ) +{ + float val[3]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "fff", &val[0], &val[1], &val[2] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of three float arguments" ); + for( i = 0; i < 3; ++i ) + self->effect->force[i] = EXPP_ClampFloat( val[i], + EXPP_EFFECT_FORCE_MIN, EXPP_EFFECT_FORCE_MAX ); + return 0; +} + +static PyObject *Effect_getMult( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(f,f,f,f)", self->effect->mult[0], + self->effect->mult[1], self->effect->mult[2], + self->effect->mult[3] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.mult attribute" ); +} + +static int Effect_setMult( BPy_Effect * self, PyObject * args ) +{ + float val[4]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2], &val[3] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of four float arguments" ); + for( i = 0; i < 4; ++i ) + self->effect->mult[i] = EXPP_ClampInt( val[i], + EXPP_EFFECT_MULT_MIN, EXPP_EFFECT_MULT_MAX ); + return 0; +} + +static PyObject *Effect_getLife( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(f,f,f,f)", self->effect->life[0], + self->effect->life[1], self->effect->life[2], + self->effect->life[3] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.life attribute" ); +} + +static int Effect_setLife( BPy_Effect * self, PyObject * args ) +{ + float val[4]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "ffff", &val[0], &val[1], &val[2], &val[3] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of four float arguments" ); + for( i = 0; i < 4; ++i ) + self->effect->life[i] = EXPP_ClampFloat( val[i], + EXPP_EFFECT_LIFE_MIN, MAXFRAMEF ); + return 0; +} + +static PyObject *Effect_getChild( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(h,h,h,h)", self->effect->child[0], + self->effect->child[1], self->effect->child[2], + self->effect->child[3] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.child attribute" ); +} + + +static int Effect_setChild( BPy_Effect * self, PyObject * args ) +{ + short val[4]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "hhhh", &val[0], &val[1], &val[2], &val[3] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of four int argument" ); + for( i = 0; i < 4; ++i ) + self->effect->child[i] = EXPP_ClampInt( val[i], + EXPP_EFFECT_CHILD_MIN, EXPP_EFFECT_CHILD_MAX ); + return 0; +} + +static PyObject *Effect_getMat( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(h,h,h,h)", self->effect->mat[0], + self->effect->mat[1], self->effect->mat[2], + self->effect->mat[3] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.mat attribute" ); +} + +static int Effect_setMat( BPy_Effect * self, PyObject * args ) +{ + short val[4]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "hhhh", &val[0], &val[1], &val[2], &val[3] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of four int argument" ); + for( i = 0; i < 4; ++i ) + self->effect->mat[i] = EXPP_ClampInt( val[i], + EXPP_EFFECT_MAT_MIN, EXPP_EFFECT_MAT_MAX ); + return 0; +} + +static PyObject *Effect_getDefvec( BPy_Effect * self ) +{ + PyObject *attr = Py_BuildValue( "(f,f,f)", self->effect->defvec[0], + self->effect->defvec[1], self->effect->defvec[2] ); + + if( attr ) + return attr; + + return EXPP_ReturnPyObjError( PyExc_RuntimeError, + "couldn't get Effect.defvec attribute" ); +} + +static int Effect_setDefvec( BPy_Effect * self, PyObject * args ) +{ + float val[3]; + int i; + + if( PyTuple_Check( args ) && PyTuple_Size( args ) == 1 ) + args = PyTuple_GetItem( args, 0 ); + + if( !PyArg_ParseTuple( args, "fff", &val[0], &val[1], &val[2] ) ) + return EXPP_ReturnIntError( PyExc_AttributeError, + "expected a tuple of three float arguments" ); + + for( i = 0; i < 3; ++i ) + self->effect->defvec[i] = EXPP_ClampFloat( val[i], + EXPP_EFFECT_DEFVEC_MIN, EXPP_EFFECT_DEFVEC_MAX ); + return 0; } /*****************************************************************************/ -/* Function: EffectPrint */ -/* Description: This is a callback function for the BPy_Effect type. It */ -/* builds a meaninful string to 'print' effcte objects. */ +/* Function: Effect_dealloc */ +/* Description: This is a callback function for the BPy_Effect type. It is */ +/* the destructor function. */ /*****************************************************************************/ -/* -int EffectPrint(BPy_Effect *self, FILE *fp, int flags) -{ -if (self->effect->type == EFF_PARTICLE)puts("Effect Particle"); - - return 0; +static void Effect_dealloc( BPy_Effect * self ) +{ + PyObject_DEL( self ); } -*/ + /*****************************************************************************/ -/* Function: EffectRepr */ +/* Function: Effect_repr */ /* Description: This is a callback function for the BPy_Effect type. It */ /* builds a meaninful string to represent effcte objects. */ /*****************************************************************************/ -PyObject *EffectRepr( BPy_Effect * self ) +static PyObject *Effect_repr( void ) { - char *str = ""; - if( self->effect->type == EFF_PARTICLE ) - str = "Effect Particle"; - return PyString_FromString( str ); + return PyString_FromString( "Particle" ); } -PyObject *EffectCreatePyObject( struct Effect * effect ) +/*****************************************************************************/ +/* These are needed by Object.c */ +/*****************************************************************************/ +PyObject *EffectCreatePyObject( Effect * effect ) { BPy_Effect *blen_object; blen_object = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type ); - if( blen_object == NULL ) { - return ( NULL ); - } - blen_object->effect = effect; - return ( ( PyObject * ) blen_object ); + if( blen_object ) + blen_object->effect = (PartEff *)effect; + return ( PyObject * ) blen_object; } int EffectCheckPyObject( PyObject * py_obj ) @@ -438,12 +1242,115 @@ int EffectCheckPyObject( PyObject * py_obj ) return ( py_obj->ob_type == &Effect_Type ); } +/* #####DEPRECATED###### */ + +static PyObject *Effect_oldsetChild( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setChild ); +} + +static PyObject *Effect_oldsetDefvec( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setDefvec ); +} + +static PyObject *Effect_oldsetForce( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setForce ); +} + +static PyObject *Effect_oldsetMat( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setMat ); +} + +static PyObject *Effect_oldsetEnd( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setEnd ); +} -struct Effect *EffectFromPyObject( PyObject * py_obj ) +static PyObject *Effect_oldsetLife( BPy_Effect * self, PyObject * args ) { - BPy_Effect *blen_obj; + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setLife ); +} - blen_obj = ( BPy_Effect * ) py_obj; - return ( ( Effect * ) blen_obj->effect ); +static PyObject *Effect_oldsetLifetime( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setLifetime ); +} +static PyObject *Effect_oldsetMult( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapperTuple( (void *)self, args, + (setter)Effect_setMult ); +} + +static PyObject *Effect_oldsetNabla( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setNabla ); +} + +static PyObject *Effect_oldsetNormfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setNormfac ); +} + +static PyObject *Effect_oldsetObfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setObfac ); +} + +static PyObject *Effect_oldsetRandfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setRandfac ); +} + +static PyObject *Effect_oldsetRandlife( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setRandlife ); +} + +static PyObject *Effect_oldsetSeed( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setSeed ); +} + +static PyObject *Effect_oldsetSta( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setSta ); +} + +static PyObject *Effect_oldsetTexfac( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTexfac ); +} + +static PyObject *Effect_oldsetTotkey( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTotkey ); +} + +static PyObject *Effect_oldsetTotpart( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setTotpart ); +} + +static PyObject *Effect_oldsetVectsize( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setVectsize ); +} + +static PyObject *Effect_oldsetFlag( BPy_Effect * self, PyObject * args ) +{ + return EXPP_setterWrapper( (void *)self, args, (setter)Effect_setFlag ); +} + +static PyObject *Effect_oldsetType( void ) +{ + return EXPP_incr_ret( Py_None ); } diff --git a/source/blender/python/api2_2x/Effect.h b/source/blender/python/api2_2x/Effect.h index 11260c9576e..594ebda1813 100644 --- a/source/blender/python/api2_2x/Effect.h +++ b/source/blender/python/api2_2x/Effect.h @@ -43,36 +43,14 @@ extern PyTypeObject Effect_Type; /* Python BPy_Effect structure definition */ typedef struct { PyObject_HEAD /* required py macro */ - Effect * effect; + PartEff * effect; } BPy_Effect; - -/*****************************************************************************/ -/* Python API function prototypes for the Effect module. */ -/*****************************************************************************/ -PyObject *M_Effect_New( PyObject * self, PyObject * args ); -PyObject *M_Effect_Get( PyObject * self, PyObject * args ); - - - /*****************************************************************************/ -/* Python BPy_Effect methods declarations: */ +/* Python Effect_Type helpder function prototypes: */ /*****************************************************************************/ -/*PyObject *Effect_getType(BPy_Effect *self);*/ - - -/*****************************************************************************/ -/* Python Effect_Type callback function prototypes: */ -/*****************************************************************************/ - PyObject *Effect_Init( void ); -void EffectDeAlloc( BPy_Effect * msh ); -//int EffectPrint (BPy_Effect *msh, FILE *fp, int flags); -int EffectSetAttr( BPy_Effect * msh, char *name, PyObject * v ); -PyObject *EffectGetAttr( BPy_Effect * msh, char *name ); -PyObject *EffectRepr( BPy_Effect * msh ); -PyObject *EffectCreatePyObject( struct Effect *effect ); int EffectCheckPyObject( PyObject * py_obj ); -struct Effect *EffectFromPyObject( PyObject * py_obj ); +PyObject *EffectCreatePyObject( Effect * eff ); #endif /* EXPP_EFFECT_H */ diff --git a/source/blender/python/api2_2x/Types.c b/source/blender/python/api2_2x/Types.c index d41dd9b2c44..2fdaf063862 100644 --- a/source/blender/python/api2_2x/Types.c +++ b/source/blender/python/api2_2x/Types.c @@ -76,7 +76,6 @@ void types_InitAll( void ) MCol_Type.ob_type = &PyType_Type; Mesh_Type.ob_type = &PyType_Type; Object_Type.ob_type = &PyType_Type; - Particle_Type.ob_type = &PyType_Type; RenderData_Type.ob_type = &PyType_Type; Scene_Type.ob_type = &PyType_Type; Text_Type.ob_type = &PyType_Type; diff --git a/source/blender/python/api2_2x/doc/Effect.py b/source/blender/python/api2_2x/doc/Effect.py index 8b4a65cd2f5..1f4732d8b2b 100644 --- a/source/blender/python/api2_2x/doc/Effect.py +++ b/source/blender/python/api2_2x/doc/Effect.py @@ -5,22 +5,21 @@ The Blender.Effect submodule B{new}: now L{Get}('objname') (without specifying second paramenter: 'position') returns a list of all effects linked to object "objname". -INTRODUCTION - -The module effect allows you to access all the data of an effect. -An effect can modify an object (typically a mesh) in three different ways. +Effect +====== -a) the build effect : makes the mesh appear progressively. +INTRODUCTION -b) the wave effect : waves appear on the mesh (which should be fine-grained) +The Effect module allows you to access all the data of particle effects. +An effect can modify a mesh object using particles, where vertex of +the mesh emits particles, which can themselves emit new particles. -c) the particle effect : every vertex of the mesh emits particles, which can themselves emit new particles. This effect is the most parameterizable. +In the Blender internals, the effect object is just a placeholder for +the particle effect. Prior to v2.39 build and wave effects were also +supported by Blender, and the Python API supported all three types of +effects. They were removed in v2.39 when the build and wave modifiers +were implemented. -In the blender internals, the effect object is just a placeholder for the "real" -effect, which can be a wave, particle or build effect. The python API follows -this structure : the Effect module grants access to (the few) data which -are shared between all effects. It has three submodules : Wave, Build, Particle -, which grant r/w access to the real parameters of these effects. Example:: import Blender @@ -30,29 +29,52 @@ Example:: #we suppose the first effect is a build effect print eff.getLen() eff.setLen(500) + +@type Flags: read-only dictionary +@var Flags: The particle effect flags. Values can be ORed. + - SELECTED: The particle effect is selected in the UI. (Read-only) + - FACE: Also emit particles from faces + - STATIC: Make static particles + - ANIMATED: Recalculate static particles for each rendered frame + - BSPLINE: Use a B-spline formula for particle interpolation """ -def New (type): +def New (name): """ - Creates a new Effect. - @type type: string - @param type: Effect type. Can be "wave", "particle" or "build" + Creates a new particle effect and attaches to an object. + @type name: string + @param name: The name of object to associate with the effect. Only mesh + objects are supported. @rtype: Blender Effect - @return: The created Effect. + @return: the new effect """ -def Get (objname, position = None): +def Get (name = None, position = None): """ Get an Effect from Blender. - @type objname: string - @param objname: The name of object to which is linked the effect. + @type name: string + @param name: The name of object linked to the effect. @type position: int @param position: The position of the effect in the list of effects linked to the object. @rtype: Blender Effect or a list of Blender Effects @return: It depends on the 'objname, position' parameters: - - (objname): A list with all Effects linked to the given object (new); - - (objname, position): The Effect linked to the given object at the given position; - - (): A list with all Effects in the current scene. + - (): A list with all Effects in the current scene; + - (name): A list with all Effects linked to the given object; + - (name, position): The Effect linked to the given object at the given position + """ + +def GetParticlesLoc (name, position, time ): + """ + Get the location of each particle at a given time. + @type name: string + @param name: The name of object linked to the effect. + @type position: int + @param position: The position of the effect in the list of effects + linked to the object. + @type time: int + @param time: The desired time during the particle effect. + @rtype: List of x,y,z coordinates + @return: The coordinates of each particle at the requested time. """ @@ -60,50 +82,83 @@ class Effect: """ The Effect object ================= - This object gives access to generic data from all effects in Blender. - Its attributes depend upon its type. - - @ivar seed: (Particle effects) seed of the RNG. - @ivar nabla: (Particle effects) The nabla value . - @ivar sta: (Particle effects) start time of the effect. - @ivar end: (Particle effects) end time of the effect - @ivar lifetime: (Particle and Wave effects)lifetime of the effect - @ivar normfac: (Particle effects) normal strength of the particles (relatively to mesh). - @ivar obfac: (Particle effects)initial strength of the particles relatively to objects. - @ivar randfac: (Particle effects) initial random speed of the particles. - @ivar texfac: (Particle effects) initial speed of the particles caused by the texture. - @ivar randlife: (Particle effects) variability of the life of the particles. - @ivar vectsize: (Particle effects) size of vectors associated to the particles (if any). - @ivar totpart: (Particle effects) total number of particles. - @ivar force: (Particle effects) constant force applied to the parts. - @ivar mult: (Particle effects) probabilities of a particle having a child. - @ivar child: (Particle effects) number of children a particle may have. - @ivar mat: (Particle effects) materials used by the 4 generation particles. - @ivar defvec: (Particle effects)x, y and z axis of the force defined by the texture. - @ivar sfra: (Build effects) starting frame of the build effect. - @ivar len: (Build effects) length of the build effect. - @ivar timeoffs: (Wave effects) time offset of the wave effect. - @ivar damp: (Wave effects) damp factor of the wave effect. - @ivar minfac: (Wave effects) - @ivar speed: (Wave effects) speed of the wave effect. - @ivar narrow: (Wave effects)narrowness of the wave effect. - @ivar width: (Wave effects) width of the wave effect. - @ivar height: (Wave effects) height of the wave effect. - @ivar startx: (Wave effects) x-position of the origin of the wave effect. - @ivar starty: (Wave effects) y-position of the origin of the wave effect. + This object gives access to particle effect data in Blender. + + @ivar child: The number of children a particle may have. + Values are clamped to the range [1,600]. + @type child: tuple of 4 ints + @ivar defvec: The x, y and z axis of the force defined by the texture. + Values are clamped to the range [-1.0,1.0]. + @type defvec: tuple of 3 floats + @ivar end: The end time of the effect + Value is clamped to the range [1.0,30000.0]. + @type end: float + @ivar flag: The flag bitfield. See L{Flags} for values. + @type flag: int + @ivar force: The constant force applied to the parts. + Values are clamped to the range [-1.0,1.0]. + @type force: tuple of 3 floats + @ivar life: The lifetime of of the next generation of particles. + Values are clamped to the range [1.0,30000.0]. + @type life: tuple of 4 floats + @ivar lifetime: The lifetime of the effect. + Value is clamped to the range [1.0,30000.0]. + @type lifetime: float + @ivar mat: The materials used by the 4 generation particles. + Values are clamped to the range [1,8]. + @type mat: tuple of 4 ints + @ivar mult: The probabilities of a particle having a child. + Values are clamped to the range [0.0,1.0]. + @type mult: tuple of 4 floats + @ivar nabla: The nabla value. + Value is clamped to the range [0.0001,1.0]. + @type nabla: float + @ivar normfac: The normal strength of the particles relative to mesh. + Value is clamped to the range [-2.0,2.0]. + @type normfac: float + @ivar obfac: The strength of the particles relative to objects. + Value is clamped to the range [-1.0,1.0]. + @type obfac: float + @ivar randfac: The initial random speed of the particles. + Value is clamped to the range [0.0,2.0]. + @type randfac: float + @ivar randlife: The variability of the life of the particles. + Value is clamped to the range [0.0,2.0]. + @type randlife: float + @ivar seed: The seed of the random number generator. + Value is clamped to the range [0,255]. + @type seed: int + @ivar sta: The start time of the effect. + Value is clamped to the range [-250.0,30000.0]. + @type sta: float + @ivar texfac: The initial speed of the particles caused by the texture. + Value is clamped to the range [0.0,2.0]. + @type texfac: float + @ivar totpart: The total number of particles. + Value is clamped to the range [1,100000]. + @type totpart: int + @ivar totkey: The total number of key positions. + Value is clamped to the range [1,100]. + @type totkey: int + @ivar type: The type of the effect. Deprecated. + @type type: int + @ivar vectsize: The size of vectors associated to the particles (if any). + Value is clamped to the range [0.0,1.0]. + @type vectsize: float """ def getType(): """ - Retrieves the type of an effect object + Retrieves the type of an effect object. + Deprecated, since only particle effects are supported. @rtype: int - @return: the type of an effect object : 0 = build effect; 1 = wave effect;2 = particle effect; + @return: the type of an effect object : should always return 1 + (particle effect) """ - def setType(name): """ - Sets the type of an effect object + Deprecated, since only particle effects are supported. @type name: int @param name : the new type. @rtype: PyNone @@ -114,264 +169,39 @@ class Effect: """ Retrieves the flag of an effect object. The flag is a bit-mask. @rtype: int - @return: The flag of the effect is a combination of parameters, whose semantics depend upon the effect type. - - All types : - Bit 0 : set to 1 if the effect is selected in the effects window. - - Wave effect : - Bits 1,2,3 : set to 1 if the button "X", "Y" or "Cycl" is clicked. - - Particle effect : - Bits 1,2,3 : set to 1 if the button "Bspline", "Static" or "Face" is clicked. + @return: The flag of the effect is a combination of parameters. See + L{Flags} for values. """ - def setFlag(newflag): """ - Sets the flag of an effect object. See L{getFlag()} for bit values. + Sets the flag of an effect object. See L{Flags} for values. @type newflag: int @param newflag: the new flag. @rtype: PyNone @return: PyNone """ - - - def getLen(): - """ - (Build Effect) Retrieves the length of an build effect object - @rtype: int - @return: the length of the effect. - """ - - - def setLen(newlength): - """ - (Build Effect) Sets the length of an build effect object - @type newlength: int - @param newlength: the new length. - @rtype: PyNone - @return: PyNone - """ - - - - def getSfra(): - """ - (Build Effect) Retrieves the starting frame of an build effect object - @rtype: int - @return: the starting frame of the effect. - """ - - - def setSfra(sfra): - """ - (Build Effect) Sets the starting frame of an build effect object - @type sfra: int - @param sfra: the new starting frame. - @rtype: PyNone - @return: PyNone - """ - - def getStartx(): - """ - (Wave Effect) Retrieves the x-coordinate of the starting point of the wave. - @rtype: float - @return: the x-coordinate of the starting point of the wave. - """ - - - def setStartx(startx): - """ - (Wave Effect) Sets the x-coordinate of the starting point of the wave. - @type startx: float - @param startx: the new x-coordinate of the starting point of the wave. - @rtype: PyNone - @return: PyNone - """ - - - - def getStarty(): - """ - (Wave Effect) Retrieves the y-coordinate of the starting point of the wave. - @rtype: float - @return: the y-coordinate of the starting point of the wave. - """ - - - def setStarty(starty): - """ - (Wave Effect) Sets the y-coordinate of the starting point of the wave. - @type starty: float - @param starty: the new y-coordinate of the starting point of the wave. - @rtype: PyNone - @return: PyNone - """ - - - - def getHeight(): - """ - (Wave Effect) Retrieves the height of the wave. - @rtype: float - @return: the height of the wave. - """ - - - def setHeight(height): - """ - (Wave Effect) Sets the height of the wave. - @type height: float - @param height: the height of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getWidth(): - """ - (Wave Effect) Retrieves the width of the wave. - @rtype: float - @return: the width of the wave. - """ - - - def setWidth(width): - """ - (Wave Effect) Sets the width of the wave. - @type width: float - @param width: the width of the wave. - @rtype: PyNone - @return: PyNone - """ - - def getNarrow(): - """ - (Wave Effect) Retrieves the narrowness of the wave. - @rtype: float - @return: the narrowness of the wave. - """ - - - def setNarrow(narrow): - """ - (Wave Effect) Sets the narrowness of the wave. - @type narrow: float - @param narrow: the narrowness of the wave. - @rtype: PyNone - @return: PyNone - """ - - def getSpeed(): - """ - (Wave Effect) Retrieves the speed of the wave. - @rtype: float - @return: the speed of the wave. - """ - - - def setSpeed(speed): - """ - (Wave Effect) Sets the speed of the wave. - @type speed: float - @param speed: the speed of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getMinfac(): + def getStartTime(): """ - (Wave Effect) Retrieves the minfac of the wave. - @rtype: float - @return: the minfac of the wave. - """ - - - def setMinfac(minfac): - """ - (Wave Effect) Sets the minfac of the wave. - @type minfac: float - @param minfac: the minfac of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getDamp(): - """ - (Wave Effect) Retrieves the damp of the wave. - @rtype: float - @return: the damp of the wave. - """ - - - def setDamp(damp): - """ - (Wave Effect) Sets the damp of the wave. - @type damp: float - @param damp: the damp of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getTimeoffs(): - """ - (Wave Effect) Retrieves the time offset of the wave. - @rtype: float - @return: the time offset of the wave. - """ - - - def setTimeoffs(timeoffs): - """ - (Wave Effect) Sets the time offset of the wave. - @type timeoffs: float - @param timeoffs: the time offset of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getLifetime(): - """ - (Wave Effect) Retrieves the life time of the wave. - @rtype: float - @return: the life time of the wave. - """ - - - def setLifetime(lifetime): - """ - (Wave Effect) Sets the life time of the wave. - @type lifetime: float - @param lifetime: the life time of the wave. - @rtype: PyNone - @return: PyNone - """ - - - def getSta(): - """ - (Particle Effect) Retrieves the starting time of a particle effect object + Retrieves the starting time of a particle effect object @rtype: float @return: the starting time of the effect. """ - def setSta(newstart): """ - (Particle Effect) Sets the starting time of an particle effect object + Sets the starting time of an particle effect object @type newstart: float @param newstart: the new starting time. @rtype: PyNone @return: PyNone """ - def getEnd(): + def getEndTime(): """ - (Particle Effect) Retrieves the end time of a particle effect object + Retrieves the end time of a particle effect object @rtype: float @return: the end time of the effect. """ @@ -379,7 +209,7 @@ class Effect: def setEnd(newendrt): """ - (Particle Effect) Sets the end time of an particle effect object + Sets the end time of an particle effect object @type newendrt: float @param newendrt: the new end time. @rtype: PyNone @@ -388,7 +218,7 @@ class Effect: def getLifetime(): """ - (Particle Effect) Retrieves the lifetime of a particle effect object + Retrieves the lifetime of a particle effect object @rtype: float @return: the lifetime of the effect. """ @@ -396,7 +226,7 @@ class Effect: def setLifetime(newlifetime): """ - (Particle Effect) Sets the lifetime of a particle effect object + Sets the lifetime of a particle effect object @type newlifetime: float @param newlifetime: the new lifetime. @rtype: PyNone @@ -405,7 +235,7 @@ class Effect: def getNormfac(): """ - (Particle Effect) Retrieves the normal strength of the particles (relatively to mesh). + Retrieves the normal strength of the particles (relatively to mesh). @rtype: float @return: normal strength of the particles (relatively to mesh). """ @@ -413,7 +243,7 @@ class Effect: def setNormfac(newnormfac): """ - (Particle Effect) Sets the normal strength of the particles (relatively to mesh). + Sets the normal strength of the particles (relatively to mesh). @type newnormfac: float @param newnormfac: the normal strength of the particles (relatively to mesh). @rtype: PyNone @@ -422,7 +252,7 @@ class Effect: def getObfac(): """ - (Particle Effect) Retrieves the initial strength of the particles relatively to objects. + Retrieves the initial strength of the particles relatively to objects. @rtype: float @return: initial strength of the particles (relatively to mesh). """ @@ -430,7 +260,7 @@ class Effect: def setObfac(newobfac): """ - (Particle Effect) Sets the initial strength of the particles relatively to objects. + Sets the initial strength of the particles relatively to objects. @type newobfac: float @param newobfac: the initial strength of the particles relatively to objects. @rtype: PyNone @@ -439,7 +269,7 @@ class Effect: def getRandfac(): """ - (Particle Effect) Retrieves the random strength applied to the particles. + Retrieves the random strength applied to the particles. @rtype: float @return: random strength applied to the particles. """ @@ -447,7 +277,7 @@ class Effect: def setRandfac(newrandfac): """ - (Particle Effect) Sets the random strength applied to the particles. + Sets the random strength applied to the particles. @type newrandfac: float @param newrandfac: the random strength applied to the particles. @rtype: PyNone @@ -456,7 +286,7 @@ class Effect: def getTexfac(): """ - (Particle Effect) Retrieves the strength applied to the particles from the texture of the object. + Retrieves the strength applied to the particles from the texture of the object. @rtype: float @return: strength applied to the particles from the texture of the object. """ @@ -464,7 +294,7 @@ class Effect: def setTexfac(newtexfac): """ - (Particle Effect) Sets the strength applied to the particles from the texture of the object. + Sets the strength applied to the particles from the texture of the object. @type newtexfac: float @param newtexfac: the strength applied to the particles from the texture of the object. @rtype: PyNone @@ -473,7 +303,7 @@ class Effect: def getRandlife(): """ - (Particle Effect) Retrieves the variability of the life of the particles. + Retrieves the variability of the life of the particles. @rtype: float @return: variability of the life of the particles. """ @@ -481,7 +311,7 @@ class Effect: def setRandlife(newrandlife): """ - (Particle Effect) Sets the variability of the life of the particles. + Sets the variability of the life of the particles. @type newrandlife: float @param newrandlife: the variability of the life of the particles. @rtype: PyNone @@ -490,7 +320,7 @@ class Effect: def getNabla(): """ - (Particle Effect) Retrieves the sensibility of the particles to the variations of the texture. + Retrieves the sensibility of the particles to the variations of the texture. @rtype: float @return: sensibility of the particles to the variations of the texture. """ @@ -498,7 +328,7 @@ class Effect: def setNabla(newnabla): """ - (Particle Effect) Sets the sensibility of the particles to the variations of the texture. + Sets the sensibility of the particles to the variations of the texture. @type newnabla: float @param newnabla: the sensibility of the particles to the variations of the texture. @rtype: PyNone @@ -507,7 +337,7 @@ class Effect: def getVectsize(): """ - (Particle Effect) Retrieves the size of the vector which is associated to the particles. + Retrieves the size of the vector which is associated to the particles. @rtype: float @return: size of the vector which is associated to the particles. """ @@ -515,7 +345,7 @@ class Effect: def setVectsize(newvectsize): """ - (Particle Effect) Sets the size of the vector which is associated to the particles. + Sets the size of the vector which is associated to the particles. @type newvectsize: float @param newvectsize: the size of the vector which is associated to the particles. @rtype: PyNone @@ -524,7 +354,7 @@ class Effect: def getTotpart(): """ - (Particle Effect) Retrieves the total number of particles. + Retrieves the total number of particles. @rtype: int @return: the total number of particles. """ @@ -532,7 +362,7 @@ class Effect: def setTotpart(newtotpart): """ - (Particle Effect) Sets the the total number of particles. + Sets the the total number of particles. @type newtotpart: int @param newtotpart: the the total number of particles. @rtype: PyNone @@ -541,7 +371,7 @@ class Effect: def getTotkey(): """ - (Particle Effect) Retrieves the number of keys associated to the particles (kind of degree of freedom) + Retrieves the number of keys associated to the particles (kind of degree of freedom) @rtype: int @return: number of keys associated to the particles. """ @@ -549,7 +379,7 @@ class Effect: def setTotkey(newtotkey): """ - (Particle Effect) Sets the number of keys associated to the particles. + Sets the number of keys associated to the particles. @type newtotkey: int @param newtotkey: number of keys associated to the particles. @rtype: PyNone @@ -558,33 +388,32 @@ class Effect: def getSeed(): """ - (Particle Effect) Retrieves the RNG seed. + Retrieves the random number generator seed. @rtype: int - @return: RNG seed. + @return: current seed value. """ - def setSeed(newseed): """ - (Particle Effect) Sets the RNG seed. + Sets the random number generator seed. @type newseed: int - @param newseed: RNG seed. + @param newseed: new seed value. @rtype: PyNone @return: PyNone """ def getForce(): """ - (Particle Effect) Retrieves the force applied to the particles. - @rtype: list of three floats + Retrieves the force applied to the particles. + @rtype: tuple of three floats @return: force applied to the particles. """ def setForce(newforce): """ - (Particle Effect) Sets the force applied to the particles. - @type newforce: list of 3 floats + Sets the force applied to the particles. + @type newforce: tuple of 3 floats @param newforce: force applied to the particles. @rtype: PyNone @return: PyNone @@ -592,16 +421,16 @@ class Effect: def getMult(): """ - (Particle Effect) Retrieves the probabilities of a particle having a child. - @rtype: list of 4 floats + Retrieves the probabilities of a particle having a child. + @rtype: tuple of 4 floats @return: probabilities of a particle having a child. """ def setMult(newmult): """ - (Particle Effect) Sets the probabilities of a particle having a child. - @type newmult: list of 4 floats + Sets the probabilities of a particle having a child. + @type newmult: tuple of 4 floats @param newmult: probabilities of a particle having a child. @rtype: PyNone @return: PyNone @@ -609,16 +438,16 @@ class Effect: def getLife(): """ - (Particle Effect) Retrieves the average life of the particles (4 generations) - @rtype: list of 4 floats + Retrieves the average life of the particles (4 generations) + @rtype: tuple of 4 floats @return: average life of the particles (4 generations) """ def setLife(newlife): """ - (Particle Effect) Sets the average life of the particles (4 generations). - @type newlife: list of 4 floats + Sets the average life of the particles (4 generations). + @type newlife: tuple of 4 floats @param newlife: average life of the particles (4 generations). @rtype: PyNone @return: PyNone @@ -626,16 +455,15 @@ class Effect: def getChild(): """ - (Particle Effect) Retrieves the average number of children of the particles (4 generations). - @rtype: list of 4 floats + Retrieves the average number of children of the particles (4 generations). + @rtype: tuple of 4 ints @return: average number of children of the particles (4 generations). """ - def setChild(newchild): """ - (Particle Effect) Sets the average number of children of the particles (4 generations). - @type newchild: list of 4 floats + Sets the average number of children of the particles (4 generations). + @type newchild: tuple of 4 ints @param newchild: average number of children of the particles (4 generations). @rtype: PyNone @return: PyNone @@ -643,16 +471,16 @@ class Effect: def getMat(): """ - (Particle Effect) Retrieves the indexes of the materials associated to the particles (4 generations). - @rtype: list of 4 floats + Retrieves the indexes of the materials associated to the particles (4 generations). + @rtype: tuple of 4 ints @return: indexes of the materials associated to the particles (4 generations). """ def setMat(newmat): """ - (Particle Effect) Sets the indexes of the materials associated to the particles (4 generations). - @type newmat: list of 4 floats + Sets the indexes of the materials associated to the particles (4 generations). + @type newmat: tuple of 4 ints @param newmat: the indexes of the materials associated to the particles (4 generations). @rtype: PyNone @return: PyNone @@ -661,17 +489,18 @@ class Effect: def getDefvec(): """ - (Particle Effect) Retrieves the x, y and z components of the force defined by the texture. - @rtype: list of 3 floats + Retrieves the x, y and z components of the force defined by the texture. + @rtype: tuple of 3 floats @return: x, y and z components of the force defined by the texture. """ def setDefvec(newdefvec): """ - (Particle Effect) Sets the x, y and z components of the force defined by the texture. - @type newdefvec: list of 3 floats + Sets the x, y and z components of the force defined by the texture. + @type newdefvec: tuple of 3 floats @param newdefvec: the x, y and z components of the force defined by the texture. @rtype: PyNone @return: PyNone """ + |