Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Swaney <sswaney@centurytel.net>2004-09-26 00:30:40 +0400
committerStephen Swaney <sswaney@centurytel.net>2004-09-26 00:30:40 +0400
commita509b8adc9b8952cdb395c69406e821f57a9a6c7 (patch)
tree7c0e3c7b81007acc6b3e268e59a6af5fcb4bd93f /source/blender/python/api2_2x/Effect.c
parentbd371ddb9ff947d4e598ad04af9402d89fa80d5e (diff)
Another round in the Great BPy Cleanup:
Run everything thru indent to cleanup spaces vs tabs. Clean up some of the comments by hand. BGL.c was not touched due to all that macro wackyness. There are no functional changes to the code. Pre-indent versions of source are tagged with tag bpy-cleanup-20040925 , just in case.
Diffstat (limited to 'source/blender/python/api2_2x/Effect.c')
-rw-r--r--source/blender/python/api2_2x/Effect.c402
1 files changed, 210 insertions, 192 deletions
diff --git a/source/blender/python/api2_2x/Effect.c b/source/blender/python/api2_2x/Effect.c
index 30340de1165..388f93db0b9 100644
--- a/source/blender/python/api2_2x/Effect.c
+++ b/source/blender/python/api2_2x/Effect.c
@@ -38,35 +38,34 @@
/* Python BPy_Effect methods table: */
/*****************************************************************************/
static PyMethodDef BPy_Effect_methods[] = {
- {NULL, NULL, 0, NULL}
+ {NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* 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 */
+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 */
};
/*****************************************************************************/
@@ -77,109 +76,119 @@ PyTypeObject Effect_Type =
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},
- {NULL, NULL, 0, NULL}
+ {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, NULL},
+ {"Get", M_Effect_Get, METH_VARARGS, NULL},
+ {"get", M_Effect_Get, METH_VARARGS, NULL},
+ {NULL, NULL, 0, NULL}
};
/*****************************************************************************/
/* Function: M_Effect_New */
/* Python equivalent: Blender.Effect.New */
/*****************************************************************************/
-PyObject *M_Effect_New(PyObject *self, PyObject *args)
+PyObject *M_Effect_New( PyObject * self, PyObject * args )
{
- BPy_Effect *pyeffect;
- Effect *bleffect = 0;
- int type = -1;
- char * btype = NULL;
- Py_INCREF(Py_None);
- return Py_None;
- if (!PyArg_ParseTuple(args, "s",&btype))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "expected type argument(wave,build or particle)"));
- if (!strcmp( btype,"wave"))type = EFF_WAVE;
- if (!strcmp( btype,"build"))type = EFF_BUILD;
- if (!strcmp( btype,"particle"))type = EFF_PARTICLE;
- if (type == -1)
- return (EXPP_ReturnPyObjError (PyExc_TypeError,
- "unknown type "));
-
-
- bleffect = add_effect(type);
- if (bleffect == NULL)
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
- "couldn't create Effect Data in Blender"));
-
- pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
-
-
- if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError,
- "couldn't create Effect Data object"));
-
- pyeffect->effect = bleffect;
-
- return (PyObject *)pyeffect;
+ BPy_Effect *pyeffect;
+ Effect *bleffect = 0;
+ int type = -1;
+ char *btype = NULL;
+ Py_INCREF( Py_None );
+ return Py_None;
+ if( !PyArg_ParseTuple( args, "s", &btype ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected type argument(wave,build or particle)" ) );
+ if( !strcmp( btype, "wave" ) )
+ type = EFF_WAVE;
+ if( !strcmp( btype, "build" ) )
+ type = EFF_BUILD;
+ if( !strcmp( btype, "particle" ) )
+ type = EFF_PARTICLE;
+ if( type == -1 )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "unknown type " ) );
+
+
+ bleffect = add_effect( type );
+ if( bleffect == NULL )
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't create Effect Data in Blender" ) );
+
+ pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
+
+
+ if( pyeffect == NULL )
+ return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
+ "couldn't create Effect Data object" ) );
+
+ pyeffect->effect = bleffect;
+
+ return ( PyObject * ) pyeffect;
}
/*****************************************************************************/
/* Function: M_Effect_Get */
/* Python equivalent: Blender.Effect.Get */
/*****************************************************************************/
-PyObject *M_Effect_Get(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 = 0;
- Object *object_iter;
- Effect *eff;
- BPy_Effect *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"));
- if(name){
- 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++)eff = eff->next;
- wanted_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
- wanted_eff->effect = eff;
- return (PyObject*)wanted_eff;
- }
+ /*arguments : string object name
+ int : position of effect in the obj's effect list */
+ char *name = 0;
+ Object *object_iter;
+ Effect *eff;
+ BPy_Effect *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" ) );
+ if( name ) {
+ while( object_iter ) {
+ if( strcmp( name, object_iter->id.name + 2 ) ) {
object_iter = object_iter->id.next;
+ continue;
}
- }
- else{
-PyObject * effectlist = PyList_New (0);
- while (object_iter)
- {
- if (object_iter->effect.first != NULL){
- eff = object_iter->effect.first;
- while (eff){
- BPy_Effect *found_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
- found_eff->effect = eff;
- PyList_Append (effectlist , (PyObject *)found_eff);
- eff = eff->next;
- }
+
+
+ if( object_iter->effect.first != NULL ) {
+ eff = object_iter->effect.first;
+ for( i = 0; i < num; i++ )
+ eff = eff->next;
+ wanted_eff =
+ ( BPy_Effect * )
+ PyObject_NEW( BPy_Effect,
+ &Effect_Type );
+ wanted_eff->effect = eff;
+ return ( PyObject * ) wanted_eff;
+ }
+ object_iter = object_iter->id.next;
+ }
+ } else {
+ PyObject *effectlist = PyList_New( 0 );
+ while( object_iter ) {
+ if( object_iter->effect.first != NULL ) {
+ eff = object_iter->effect.first;
+ while( eff ) {
+ BPy_Effect *found_eff =
+ ( BPy_Effect * )
+ PyObject_NEW( BPy_Effect,
+ &Effect_Type );
+ found_eff->effect = eff;
+ PyList_Append( effectlist,
+ ( PyObject * )
+ found_eff );
+ eff = eff->next;
}
- object_iter = object_iter->id.next;
}
+ object_iter = object_iter->id.next;
+ }
return effectlist;
}
- Py_INCREF(Py_None);
- return Py_None;
+ Py_INCREF( Py_None );
+ return Py_None;
}
/*****************************************************************************/
@@ -187,66 +196,68 @@ PyObject * effectlist = PyList_New (0);
/*****************************************************************************/
-PyObject *Build_Init (void);
-PyObject *Wave_Init (void);
-PyObject *Particle_Init (void);
+PyObject *Build_Init( void );
+PyObject *Wave_Init( void );
+PyObject *Particle_Init( void );
-PyObject *Effect_Init (void)
+PyObject *Effect_Init( void )
{
- PyObject *submodule, *dict;
+ PyObject *submodule, *dict;
- Effect_Type.ob_type = &PyType_Type;
+ Effect_Type.ob_type = &PyType_Type;
- submodule = Py_InitModule3("Blender.Effect",M_Effect_methods, 0 );
- dict = PyModule_GetDict (submodule);
- PyDict_SetItemString (dict, "Wave", Wave_Init());
- PyDict_SetItemString (dict, "Build", Build_Init());
- PyDict_SetItemString (dict, "Particle", Particle_Init());
- return (submodule);
+ submodule = Py_InitModule3( "Blender.Effect", M_Effect_methods, 0 );
+ dict = PyModule_GetDict( submodule );
+ PyDict_SetItemString( dict, "Wave", Wave_Init( ) );
+ PyDict_SetItemString( dict, "Build", Build_Init( ) );
+ PyDict_SetItemString( dict, "Particle", Particle_Init( ) );
+ return ( submodule );
}
/*****************************************************************************/
-/* Python BPy_Effect methods: */
+/* Python BPy_Effect methods: */
/*****************************************************************************/
-PyObject *Effect_getType(BPy_Effect *self)
+PyObject *Effect_getType( BPy_Effect * self )
{
- PyObject *attr = PyInt_FromLong((long)self->effect->type);
- if (attr) return attr;
- return (EXPP_ReturnPyObjError (PyExc_RuntimeError,\
- "couldn't get mode attribute"));
+ PyObject *attr = PyInt_FromLong( ( long ) self->effect->type );
+ if( attr )
+ return attr;
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get mode attribute" ) );
}
-PyObject *Effect_setType(BPy_Effect *self, PyObject *args)
+PyObject *Effect_setType( BPy_Effect * self, PyObject * args )
{
- int value;
- if (!PyArg_ParseTuple(args, "i", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,\
- "expected an int as argument"));
- self->effect->type = value;
- Py_INCREF(Py_None);
- return Py_None;
+ int value;
+ if( !PyArg_ParseTuple( args, "i", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected an int as argument" ) );
+ self->effect->type = value;
+ Py_INCREF( Py_None );
+ return Py_None;
}
-PyObject *Effect_getFlag(BPy_Effect *self)
+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"));
+ PyObject *attr = PyInt_FromLong( ( long ) self->effect->flag );
+ if( attr )
+ return attr;
+ return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
+ "couldn't get mode attribute" ) );
}
-PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args)
+PyObject *Effect_setFlag( BPy_Effect * self, PyObject * args )
{
- int value;
- if (!PyArg_ParseTuple(args, "i", &value))
- return (EXPP_ReturnPyObjError (PyExc_TypeError,\
- "expected an int as argument"));
- self->effect->flag = value;
- Py_INCREF(Py_None);
- return Py_None;
+ int value;
+ if( !PyArg_ParseTuple( args, "i", &value ) )
+ return ( EXPP_ReturnPyObjError( PyExc_TypeError,
+ "expected an int as argument" ) );
+ self->effect->flag = value;
+ Py_INCREF( Py_None );
+ return Py_None;
}
@@ -255,55 +266,59 @@ PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args)
/*****************************************************************************/
/* Function: EffectDeAlloc */
-/* Description: This is a callback function for the BPy_Effect type. It is */
+/* Description: This is a callback function for the BPy_Effect type. It is */
/* the destructor function. */
/*****************************************************************************/
-void EffectDeAlloc (BPy_Effect *self)
+void EffectDeAlloc( BPy_Effect * self )
{
- PyObject_DEL (self);
+ PyObject_DEL( self );
}
/*****************************************************************************/
/* Function: EffectGetAttr */
-/* Description: This is a callback function for the BPy_Effect type. It is */
-/* the function that accesses BPy_Effect "member variables" and */
+/* Description: This is a callback function for the BPy_Effect type. It is */
+/* the function that accesses BPy_Effect "member variables" and */
/* methods. */
/*****************************************************************************/
-PyObject *EffectGetAttr (BPy_Effect *self, char *name)
+PyObject *EffectGetAttr( BPy_Effect * self, char *name )
{
- switch(self->effect->type)
- {
- case EFF_BUILD : return BuildGetAttr( (BPy_Build*)self, name);
- case EFF_WAVE : return WaveGetAttr ((BPy_Wave*)self, name);
- case EFF_PARTICLE : return ParticleGetAttr ((BPy_Particle*)self, name);
- }
+ switch ( self->effect->type ) {
+ case EFF_BUILD:
+ return BuildGetAttr( ( BPy_Build * ) self, name );
+ case EFF_WAVE:
+ return WaveGetAttr( ( BPy_Wave * ) self, name );
+ case EFF_PARTICLE:
+ return ParticleGetAttr( ( BPy_Particle * ) self, name );
+ }
- return Py_FindMethod(BPy_Effect_methods, (PyObject *)self, name);
+ return Py_FindMethod( BPy_Effect_methods, ( PyObject * ) self, name );
}
/*****************************************************************************/
/* Function: EffectSetAttr */
-/* Description: This is a callback function for the BPy_Effect type. It is the */
-/* function that sets Effect Data attributes (member variables).*/
+/* Description: This is a callback function for the BPy_Effect type. It */
+/* sets Effect Data attributes (member variables). */
/*****************************************************************************/
-int EffectSetAttr (BPy_Effect *self, char *name, PyObject *value)
+int EffectSetAttr( BPy_Effect * self, char *name, PyObject * value )
{
- switch(self->effect->type)
- {
- case EFF_BUILD : return BuildSetAttr( (BPy_Build*)self, name,value);
- case EFF_WAVE : return WaveSetAttr ((BPy_Wave*)self, name,value);
- case EFF_PARTICLE : return ParticleSetAttr ((BPy_Particle*)self, name,value);
- }
- return 0; /* normal exit */
+ switch ( self->effect->type ) {
+ case EFF_BUILD:
+ return BuildSetAttr( ( BPy_Build * ) self, name, value );
+ case EFF_WAVE:
+ return WaveSetAttr( ( BPy_Wave * ) self, name, value );
+ case EFF_PARTICLE:
+ return ParticleSetAttr( ( BPy_Particle * ) self, name, value );
+ }
+ return 0; /* normal exit */
}
/*****************************************************************************/
/* Function: EffectPrint */
-/* Description: This is a callback function for the BPy_Effect type. It */
+/* Description: This is a callback function for the BPy_Effect type. It */
/* builds a meaninful string to 'print' effcte objects. */
/*****************************************************************************/
/*
@@ -318,45 +333,48 @@ if (self->effect->type == EFF_WAVE)puts("Effect Wave");
*/
/*****************************************************************************/
/* Function: EffectRepr */
-/* Description: This is a callback function for the BPy_Effect type. It */
+/* 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)
+PyObject *EffectRepr( BPy_Effect * self )
{
-char*str="";
-if (self->effect->type == EFF_BUILD)str = "Effect Build";
-if (self->effect->type == EFF_PARTICLE)str = "Effect Particle";
-if (self->effect->type == EFF_WAVE)str = "Effect Wave";
-return PyString_FromString(str);
+ char *str = "";
+ if( self->effect->type == EFF_BUILD )
+ str = "Effect Build";
+ if( self->effect->type == EFF_PARTICLE )
+ str = "Effect Particle";
+ if( self->effect->type == EFF_WAVE )
+ str = "Effect Wave";
+ return PyString_FromString( str );
}
-PyObject* EffectCreatePyObject (struct Effect *effect)
+PyObject *EffectCreatePyObject( struct Effect * effect )
{
- BPy_Effect * blen_object;
+ BPy_Effect *blen_object;
- blen_object = (BPy_Effect*)PyObject_NEW (BPy_Effect, &Effect_Type);
+ 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 == NULL ) {
+ return ( NULL );
+ }
+ blen_object->effect = effect;
+ return ( ( PyObject * ) blen_object );
}
-int EffectCheckPyObject (PyObject *py_obj)
+int EffectCheckPyObject( PyObject * py_obj )
{
-return (py_obj->ob_type == &Effect_Type);
+ return ( py_obj->ob_type == &Effect_Type );
}
-struct Effect* EffectFromPyObject (PyObject *py_obj)
+struct Effect *EffectFromPyObject( PyObject * py_obj )
{
- BPy_Effect * blen_obj;
+ BPy_Effect *blen_obj;
- blen_obj = (BPy_Effect*)py_obj;
- return ((Effect*)blen_obj->effect);
+ blen_obj = ( BPy_Effect * ) py_obj;
+ return ( ( Effect * ) blen_obj->effect );
}