~ubuntu-branches/ubuntu/gutsy/blender/gutsy-security

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/Effect.c

  • Committer: Bazaar Package Importer
  • Author(s): Florian Ernst
  • Date: 2005-11-06 12:40:03 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051106124003-3pgs7tcg5rox96xg
Tags: 2.37a-1.1
* Non-maintainer upload.
* Split out parts of 01_SConstruct_debian.dpatch again: root_build_dir
  really needs to get adjusted before the clean target runs - closes: #333958,
  see #288882 for reference

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
 
2
 * $Id: Effect.c,v 1.10 2004/10/31 04:09:19 ianwill Exp $
2
3
 *
3
4
 * ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
4
5
 *
37
38
/* Python BPy_Effect methods table:                                            */
38
39
/*****************************************************************************/
39
40
static PyMethodDef BPy_Effect_methods[] = {
40
 
  {0}
 
41
        {NULL, NULL, 0, NULL}
41
42
};
42
43
 
43
44
/*****************************************************************************/
44
45
/* Python Effect_Type structure definition:                                  */
45
46
/*****************************************************************************/
46
 
PyTypeObject Effect_Type =
47
 
{
48
 
  PyObject_HEAD_INIT(NULL)
49
 
  0,                                      /* ob_size */
50
 
  "Effect",                               /* tp_name */
51
 
  sizeof (BPy_Effect),                      /* tp_basicsize */
52
 
  0,                                      /* tp_itemsize */
53
 
  /* methods */
54
 
  (destructor)EffectDeAlloc,              /* tp_dealloc */
55
 
  0,                 /* tp_print */
56
 
  (getattrfunc)EffectGetAttr,             /* tp_getattr */
57
 
  (setattrfunc)EffectSetAttr,             /* tp_setattr */
58
 
  0,                                      /* tp_compare */
59
 
  (reprfunc)EffectRepr,                   /* tp_repr */
60
 
  0,                                      /* tp_as_number */
61
 
  0,                                      /* tp_as_sequence */
62
 
  0,                                      /* tp_as_mapping */
63
 
  0,                                      /* tp_as_hash */
64
 
  0,0,0,0,0,0,
65
 
  0,                                      /* tp_doc */ 
66
 
  0,0,0,0,0,0,
67
 
  BPy_Effect_methods,                       /* tp_methods */
68
 
  0,                                      /* tp_members */
 
47
PyTypeObject Effect_Type = {
 
48
        PyObject_HEAD_INIT( NULL )
 
49
                0,              /* ob_size */
 
50
        "Effect",               /* tp_name */
 
51
        sizeof( BPy_Effect ),   /* tp_basicsize */
 
52
        0,                      /* tp_itemsize */
 
53
        /* methods */
 
54
        ( destructor ) EffectDeAlloc,   /* tp_dealloc */
 
55
        0,                      /* tp_print */
 
56
        ( getattrfunc ) EffectGetAttr,  /* tp_getattr */
 
57
        ( setattrfunc ) EffectSetAttr,  /* tp_setattr */
 
58
        0,                      /* tp_compare */
 
59
        ( reprfunc ) EffectRepr,        /* tp_repr */
 
60
        0,                      /* tp_as_number */
 
61
        0,                      /* tp_as_sequence */
 
62
        0,                      /* tp_as_mapping */
 
63
        0,                      /* tp_as_hash */
 
64
        0, 0, 0, 0, 0, 0,
 
65
        0,                      /* tp_doc */
 
66
        0, 0, 0, 0, 0, 0,
 
67
        BPy_Effect_methods,     /* tp_methods */
 
68
        0,                      /* tp_members */
69
69
};
70
70
 
71
71
/*****************************************************************************/
76
76
 
77
77
 
78
78
struct PyMethodDef M_Effect_methods[] = {
79
 
  {"New",(PyCFunction)M_Effect_New, METH_VARARGS,NULL},
80
 
  {"Get",         M_Effect_Get,         METH_VARARGS,NULL},
81
 
  {"get",         M_Effect_Get,         METH_VARARGS, NULL},
82
 
  {NULL, NULL, 0, NULL}
 
79
        {"New", ( PyCFunction ) M_Effect_New, METH_VARARGS, NULL},
 
80
        {"Get", M_Effect_Get, METH_VARARGS, NULL},
 
81
        {"get", M_Effect_Get, METH_VARARGS, NULL},
 
82
        {NULL, NULL, 0, NULL}
83
83
};
84
84
 
85
85
/*****************************************************************************/
86
86
/* Function:              M_Effect_New                                       */
87
87
/* Python equivalent:     Blender.Effect.New                                 */
88
88
/*****************************************************************************/
89
 
PyObject *M_Effect_New(PyObject *self, PyObject *args)
 
89
PyObject *M_Effect_New( PyObject * self, PyObject * args )
90
90
{
91
 
  BPy_Effect    *pyeffect; 
92
 
  Effect      *bleffect = 0; 
93
 
  int type = -1;
94
 
  char * btype = NULL;
95
 
  Py_INCREF(Py_None);
96
 
  return Py_None;
97
 
  if (!PyArg_ParseTuple(args, "s",&btype))
98
 
    return (EXPP_ReturnPyObjError (PyExc_TypeError,
99
 
                        "expected type argument(wave,build or particle)"));
100
 
  if (!strcmp( btype,"wave"))type =   EFF_WAVE;                 
101
 
  if (!strcmp( btype,"build"))type =   EFF_BUILD;                         
102
 
  if (!strcmp( btype,"particle"))type =   EFF_PARTICLE;
103
 
  if (type == -1)
104
 
    return (EXPP_ReturnPyObjError (PyExc_TypeError,
105
 
                                   "unknown type "));
106
 
  
107
 
 
108
 
  bleffect = add_effect(type); 
109
 
  if (bleffect == NULL) 
110
 
    return (EXPP_ReturnPyObjError (PyExc_RuntimeError,
111
 
             "couldn't create Effect Data in Blender"));
112
 
 
113
 
  pyeffect = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
114
 
 
115
 
     
116
 
  if (pyeffect == NULL) return (EXPP_ReturnPyObjError (PyExc_MemoryError,
117
 
                     "couldn't create Effect Data object"));
118
 
 
119
 
  pyeffect->effect = bleffect; 
120
 
 
121
 
  return (PyObject *)pyeffect;
 
91
        BPy_Effect *pyeffect;
 
92
        Effect *bleffect = 0;
 
93
        int type = -1;
 
94
        char *btype = NULL;
 
95
        Py_INCREF( Py_None );
 
96
        return Py_None;
 
97
        if( !PyArg_ParseTuple( args, "s", &btype ) )
 
98
                return ( EXPP_ReturnPyObjError( PyExc_TypeError,
 
99
                                                "expected type argument(wave,build or particle)" ) );
 
100
        if( !strcmp( btype, "wave" ) )
 
101
                type = EFF_WAVE;
 
102
        if( !strcmp( btype, "build" ) )
 
103
                type = EFF_BUILD;
 
104
        if( !strcmp( btype, "particle" ) )
 
105
                type = EFF_PARTICLE;
 
106
        if( type == -1 )
 
107
                return ( EXPP_ReturnPyObjError( PyExc_TypeError,
 
108
                                                "unknown type " ) );
 
109
 
 
110
 
 
111
        bleffect = add_effect( type );
 
112
        if( bleffect == NULL )
 
113
                return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
114
                                                "couldn't create Effect Data in Blender" ) );
 
115
 
 
116
        pyeffect = ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
 
117
 
 
118
 
 
119
        if( pyeffect == NULL )
 
120
                return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
 
121
                                                "couldn't create Effect Data object" ) );
 
122
 
 
123
        pyeffect->effect = bleffect;
 
124
 
 
125
        return ( PyObject * ) pyeffect;
122
126
}
123
127
 
124
128
/*****************************************************************************/
125
129
/* Function:              M_Effect_Get                                       */
126
130
/* Python equivalent:     Blender.Effect.Get                                 */
127
131
/*****************************************************************************/
128
 
PyObject *M_Effect_Get(PyObject *self, PyObject *args)
 
132
PyObject *M_Effect_Get( PyObject * self, PyObject * args )
129
133
{
130
 
  /*arguments : string object name
131
 
    int : position of effect in the obj's effect list  */
132
 
  char     *name = 0;
133
 
  Object   *object_iter;
134
 
  Effect *eff;
135
 
  BPy_Effect *wanted_eff;
136
 
  int num,i;
137
 
  if (!PyArg_ParseTuple(args, "|si", &name, &num ))
138
 
    return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
139
 
                                                                                                                                 "expected string int argument"));
140
 
  object_iter = G.main->object.first;
141
 
  if (!object_iter)return(EXPP_ReturnPyObjError(PyExc_AttributeError,\
142
 
                                                                                                                                                                                                "Scene contains no object"));
143
 
        if(name){
144
 
                while (object_iter)
145
 
                        {
146
 
                                if (strcmp(name,object_iter->id.name+2))
147
 
                                        {
148
 
                                                object_iter = object_iter->id.next;
149
 
                                                continue;
150
 
                                        }
151
 
 
152
 
      
153
 
                                if (object_iter->effect.first != NULL){
154
 
                                        eff = object_iter->effect.first;
155
 
                                        for(i = 0;i<num;i++)eff = eff->next;
156
 
                                        wanted_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
157
 
                                        wanted_eff->effect = eff;
158
 
                                        return (PyObject*)wanted_eff;  
 
134
        /*arguments : string object name
 
135
           int : position of effect in the obj's effect list  */
 
136
        char *name = NULL;
 
137
        Object *object_iter;
 
138
        Effect *eff;
 
139
        BPy_Effect *wanted_eff;
 
140
        int num = -1, i;
 
141
 
 
142
        if( !PyArg_ParseTuple( args, "|si", &name, &num ) )
 
143
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
 
144
                                                "expected string int argument" ) );
 
145
 
 
146
        object_iter = G.main->object.first;
 
147
 
 
148
        if( !object_iter )
 
149
                return ( EXPP_ReturnPyObjError( PyExc_AttributeError,
 
150
                                                "Scene contains no object" ) );
 
151
 
 
152
        if( name ) { /* (name, num = -1) - try to find the given object */
 
153
 
 
154
                while( object_iter ) {
 
155
 
 
156
                        if( !strcmp( name, object_iter->id.name + 2 ) ) {
 
157
 
 
158
                                eff = object_iter->effect.first; /*can be NULL: None will be returned*/
 
159
 
 
160
                                if (num >= 0) { /* return effect in given num position if available */
 
161
 
 
162
                                        for( i = 0; i < num; i++ ) {
 
163
                                                if (!eff) break;
 
164
                                                eff = eff->next;
 
165
                                        }
 
166
 
 
167
                                        if (eff) {
 
168
                                                wanted_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
 
169
                                                wanted_eff->effect = eff;
 
170
                                                return ( PyObject * ) wanted_eff;
 
171
                                        } else { /* didn't find any effect in the given position */
 
172
                                                Py_INCREF(Py_None);
 
173
                                                return Py_None;
 
174
                                        }
159
175
                                }
160
 
                                object_iter = object_iter->id.next;
161
 
                        }
162
 
        }
163
 
        else{  
164
 
PyObject *      effectlist = PyList_New (0);
165
 
                while (object_iter)
166
 
                        {
167
 
                                if (object_iter->effect.first != NULL){
168
 
                                        eff = object_iter->effect.first;
169
 
                                        while (eff){
170
 
                                                BPy_Effect *found_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect, &Effect_Type);
 
176
 
 
177
                                else {/*return a list with all effects linked to the given object*/
 
178
                                                        /* this was pointed by Stephen Swaney */
 
179
                                        PyObject *effectlist = PyList_New( 0 );
 
180
 
 
181
                                        while (eff) {
 
182
                                                BPy_Effect *found_eff = (BPy_Effect *)PyObject_NEW(BPy_Effect,
 
183
                                                        &Effect_Type);
171
184
                                                found_eff->effect = eff;
172
 
                                                PyList_Append (effectlist ,  (PyObject *)found_eff);  
 
185
                                                PyList_Append( effectlist, ( PyObject * ) found_eff );
 
186
                                                Py_DECREF((PyObject *)found_eff); /* PyList_Append incref'ed it */
173
187
                                                eff = eff->next;
174
188
                                        }
175
 
                                }
176
 
                                object_iter = object_iter->id.next;
177
 
                        }
 
189
                                        return effectlist;
 
190
                                }
 
191
                        }
 
192
                        
 
193
                        object_iter = object_iter->id.next;
 
194
                }
 
195
 
 
196
                if (!object_iter)
 
197
                        return EXPP_ReturnPyObjError (PyExc_AttributeError,
 
198
                                "no such object");
 
199
        }
 
200
        
 
201
        else { /* () - return a list with all effects currently in Blender */
 
202
                PyObject *effectlist = PyList_New( 0 );
 
203
 
 
204
                while( object_iter ) {
 
205
                        if( object_iter->effect.first != NULL ) {
 
206
                                eff = object_iter->effect.first;
 
207
                                while( eff ) {
 
208
                                        BPy_Effect *found_eff =
 
209
                                                ( BPy_Effect * )
 
210
                                                PyObject_NEW( BPy_Effect,
 
211
                                                              &Effect_Type );
 
212
                                        found_eff->effect = eff;
 
213
                                        PyList_Append( effectlist,
 
214
                                                       ( PyObject * )
 
215
                                                       found_eff );
 
216
                                        Py_DECREF((PyObject *)found_eff);
 
217
                                        eff = eff->next;
 
218
                                }
 
219
                        }
 
220
                        object_iter = object_iter->id.next;
 
221
                }
178
222
                return effectlist;
179
223
        }
180
 
  Py_INCREF(Py_None);
181
 
  return Py_None;
 
224
        Py_INCREF( Py_None );
 
225
        return Py_None;
182
226
}
183
227
 
184
228
/*****************************************************************************/
186
230
/*****************************************************************************/
187
231
 
188
232
 
189
 
PyObject *Build_Init (void);
190
 
PyObject *Wave_Init (void);
191
 
PyObject *Particle_Init (void);
192
 
 
193
 
PyObject *Effect_Init (void)
194
 
{
195
 
  PyObject  *submodule, *dict;
196
 
 
197
 
  Effect_Type.ob_type = &PyType_Type;
198
 
 
199
 
        submodule = Py_InitModule3("Blender.Effect",M_Effect_methods, 0 );
200
 
  dict = PyModule_GetDict (submodule);
201
 
  PyDict_SetItemString (dict, "Wave", Wave_Init());
202
 
  PyDict_SetItemString (dict, "Build", Build_Init());
203
 
  PyDict_SetItemString (dict, "Particle", Particle_Init());
204
 
  return (submodule);
205
 
}
206
 
 
207
 
/*****************************************************************************/
208
 
/* Python BPy_Effect methods:                                                  */
209
 
/*****************************************************************************/
210
 
 
211
 
PyObject *Effect_getType(BPy_Effect *self)
212
 
{
213
 
  PyObject *attr = PyInt_FromLong((long)self->effect->type);
214
 
  if (attr) return attr;
215
 
        return (EXPP_ReturnPyObjError (PyExc_RuntimeError,\
216
 
                        "couldn't get mode attribute"));
217
 
}
218
 
 
219
 
 
220
 
PyObject *Effect_setType(BPy_Effect *self, PyObject *args)
221
 
{
222
 
  int value;
223
 
  if (!PyArg_ParseTuple(args, "i", &value))
224
 
    return (EXPP_ReturnPyObjError (PyExc_TypeError,\
225
 
                                   "expected an int as argument"));
226
 
  self->effect->type = value;
227
 
  Py_INCREF(Py_None);
228
 
  return Py_None;
229
 
}
230
 
 
231
 
PyObject *Effect_getFlag(BPy_Effect *self)
232
 
{
233
 
  PyObject *attr = PyInt_FromLong((long)self->effect->flag);
234
 
  if (attr) return attr;
235
 
  return (EXPP_ReturnPyObjError (PyExc_RuntimeError,\
236
 
                                 "couldn't get mode attribute"));
237
 
}
238
 
 
239
 
 
240
 
PyObject *Effect_setFlag(BPy_Effect *self, PyObject *args)
241
 
{
242
 
  int value;
243
 
  if (!PyArg_ParseTuple(args, "i", &value))
244
 
    return (EXPP_ReturnPyObjError (PyExc_TypeError,\
245
 
                                   "expected an int as argument"));
246
 
  self->effect->flag = value;
247
 
  Py_INCREF(Py_None);
248
 
  return Py_None;
 
233
PyObject *Build_Init( void );
 
234
PyObject *Wave_Init( void );
 
235
PyObject *Particle_Init( void );
 
236
 
 
237
PyObject *Effect_Init( void )
 
238
{
 
239
        PyObject *submodule, *dict;
 
240
 
 
241
        Effect_Type.ob_type = &PyType_Type;
 
242
 
 
243
        submodule = Py_InitModule3( "Blender.Effect", M_Effect_methods, 0 );
 
244
        dict = PyModule_GetDict( submodule );
 
245
        PyDict_SetItemString( dict, "Wave", Wave_Init(  ) );
 
246
        PyDict_SetItemString( dict, "Build", Build_Init(  ) );
 
247
        PyDict_SetItemString( dict, "Particle", Particle_Init(  ) );
 
248
        return ( submodule );
 
249
}
 
250
 
 
251
/*****************************************************************************/
 
252
/* Python BPy_Effect methods:                                       */
 
253
/*****************************************************************************/
 
254
 
 
255
PyObject *Effect_getType( BPy_Effect * self )
 
256
{
 
257
        PyObject *attr = PyInt_FromLong( ( long ) self->effect->type );
 
258
        if( attr )
 
259
                return attr;
 
260
        return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
261
                                        "couldn't get mode attribute" ) );
 
262
}
 
263
 
 
264
 
 
265
PyObject *Effect_setType( BPy_Effect * self, PyObject * args )
 
266
{
 
267
        int value;
 
268
        if( !PyArg_ParseTuple( args, "i", &value ) )
 
269
                return ( EXPP_ReturnPyObjError( PyExc_TypeError,
 
270
                                                "expected an int as argument" ) );
 
271
        self->effect->type = value;
 
272
        Py_INCREF( Py_None );
 
273
        return Py_None;
 
274
}
 
275
 
 
276
PyObject *Effect_getFlag( BPy_Effect * self )
 
277
{
 
278
        PyObject *attr = PyInt_FromLong( ( long ) self->effect->flag );
 
279
        if( attr )
 
280
                return attr;
 
281
        return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
 
282
                                        "couldn't get mode attribute" ) );
 
283
}
 
284
 
 
285
 
 
286
PyObject *Effect_setFlag( BPy_Effect * self, PyObject * args )
 
287
{
 
288
        int value;
 
289
        if( !PyArg_ParseTuple( args, "i", &value ) )
 
290
                return ( EXPP_ReturnPyObjError( PyExc_TypeError,
 
291
                                                "expected an int as argument" ) );
 
292
        self->effect->flag = value;
 
293
        Py_INCREF( Py_None );
 
294
        return Py_None;
249
295
}
250
296
 
251
297
 
254
300
 
255
301
/*****************************************************************************/
256
302
/* Function:    EffectDeAlloc                                                */
257
 
/* Description: This is a callback function for the BPy_Effect type. It is     */
 
303
/* Description: This is a callback function for the BPy_Effect type. It is   */
258
304
/*              the destructor function.                                     */
259
305
/*****************************************************************************/
260
 
void EffectDeAlloc (BPy_Effect *self)
 
306
void EffectDeAlloc( BPy_Effect * self )
261
307
{
262
 
  PyObject_DEL (self);
 
308
        PyObject_DEL( self );
263
309
}
264
310
 
265
311
/*****************************************************************************/
266
312
/* Function:    EffectGetAttr                                                */
267
 
/* Description: This is a callback function for the BPy_Effect type. It is     */
268
 
/*              the function that accesses BPy_Effect "member variables" and   */
 
313
/* Description: This is a callback function for the BPy_Effect type. It is   */
 
314
/*              the function that accesses BPy_Effect "member variables" and */
269
315
/*              methods.                                                     */
270
316
/*****************************************************************************/
271
317
 
272
318
 
273
 
PyObject *EffectGetAttr (BPy_Effect *self, char *name)
 
319
PyObject *EffectGetAttr( BPy_Effect * self, char *name )
274
320
{
275
 
        switch(self->effect->type)
276
 
                {
277
 
                case EFF_BUILD : return BuildGetAttr( (BPy_Build*)self, name);
278
 
                case EFF_WAVE : return WaveGetAttr ((BPy_Wave*)self, name);
279
 
                case EFF_PARTICLE : return ParticleGetAttr ((BPy_Particle*)self, name);
280
 
                }
 
321
        switch ( self->effect->type ) {
 
322
        case EFF_BUILD:
 
323
                return BuildGetAttr( ( BPy_Build * ) self, name );
 
324
        case EFF_WAVE:
 
325
                return WaveGetAttr( ( BPy_Wave * ) self, name );
 
326
        case EFF_PARTICLE:
 
327
                return ParticleGetAttr( ( BPy_Particle * ) self, name );
 
328
        }
281
329
 
282
 
  return Py_FindMethod(BPy_Effect_methods, (PyObject *)self, name);
 
330
        return Py_FindMethod( BPy_Effect_methods, ( PyObject * ) self, name );
283
331
}
284
332
 
285
333
/*****************************************************************************/
286
334
/* Function:    EffectSetAttr                                                */
287
 
/* Description: This is a callback function for the BPy_Effect type. It is the */
288
 
/*              function that sets Effect Data attributes (member variables).*/
 
335
/* Description: This is a callback function for the BPy_Effect type. It   */
 
336
/*              sets Effect Data attributes (member variables). */
289
337
/*****************************************************************************/
290
338
 
291
339
 
292
 
int EffectSetAttr (BPy_Effect *self, char *name, PyObject *value)
 
340
int EffectSetAttr( BPy_Effect * self, char *name, PyObject * value )
293
341
{
294
 
        switch(self->effect->type)
295
 
                {
296
 
                case EFF_BUILD : return BuildSetAttr( (BPy_Build*)self, name,value);
297
 
                case EFF_WAVE : return WaveSetAttr ((BPy_Wave*)self, name,value);
298
 
                case EFF_PARTICLE : return ParticleSetAttr ((BPy_Particle*)self, name,value);
299
 
                }
300
 
  return 0; /* normal exit */
 
342
        switch ( self->effect->type ) {
 
343
        case EFF_BUILD:
 
344
                return BuildSetAttr( ( BPy_Build * ) self, name, value );
 
345
        case EFF_WAVE:
 
346
                return WaveSetAttr( ( BPy_Wave * ) self, name, value );
 
347
        case EFF_PARTICLE:
 
348
                return ParticleSetAttr( ( BPy_Particle * ) self, name, value );
 
349
        }
 
350
        return 0;               /* normal exit */
301
351
}
302
352
 
303
353
/*****************************************************************************/
304
354
/* Function:    EffectPrint                                                  */
305
 
/* Description: This is a callback function for the BPy_Effect type. It        */
 
355
/* Description: This is a callback function for the BPy_Effect type. It      */
306
356
/*              builds a meaninful string to 'print' effcte objects.         */
307
357
/*****************************************************************************/
308
358
/*
317
367
*/
318
368
/*****************************************************************************/
319
369
/* Function:    EffectRepr                                                   */
320
 
/* Description: This is a callback function for the BPy_Effect type. It        */
 
370
/* Description: This is a callback function for the BPy_Effect type. It      */
321
371
/*              builds a meaninful string to represent effcte objects.       */
322
372
/*****************************************************************************/
323
373
 
324
 
PyObject *EffectRepr (BPy_Effect *self) 
325
 
{
326
 
char*str="";
327
 
if (self->effect->type == EFF_BUILD)str =  "Effect Build";
328
 
if (self->effect->type == EFF_PARTICLE)str = "Effect Particle";
329
 
if (self->effect->type == EFF_WAVE)str = "Effect Wave";
330
 
return PyString_FromString(str);
331
 
}
332
 
 
333
 
PyObject* EffectCreatePyObject (struct Effect *effect)
334
 
{
335
 
 BPy_Effect    * blen_object;
336
 
 
337
 
    blen_object = (BPy_Effect*)PyObject_NEW (BPy_Effect, &Effect_Type);
338
 
 
339
 
    if (blen_object == NULL)
340
 
    {
341
 
        return (NULL);
342
 
    }
343
 
    blen_object->effect = effect;
344
 
    return ((PyObject*)blen_object);
345
 
 
346
 
}
347
 
 
348
 
int EffectCheckPyObject (PyObject *py_obj)
349
 
{
350
 
return (py_obj->ob_type == &Effect_Type);
351
 
}
352
 
 
353
 
 
354
 
struct Effect* EffectFromPyObject (PyObject *py_obj)
355
 
{
356
 
 BPy_Effect    * blen_obj;
357
 
 
358
 
    blen_obj = (BPy_Effect*)py_obj;
359
 
    return ((Effect*)blen_obj->effect);
 
374
PyObject *EffectRepr( BPy_Effect * self )
 
375
{
 
376
        char *str = "";
 
377
        if( self->effect->type == EFF_BUILD )
 
378
                str = "Effect Build";
 
379
        if( self->effect->type == EFF_PARTICLE )
 
380
                str = "Effect Particle";
 
381
        if( self->effect->type == EFF_WAVE )
 
382
                str = "Effect Wave";
 
383
        return PyString_FromString( str );
 
384
}
 
385
 
 
386
PyObject *EffectCreatePyObject( struct Effect * effect )
 
387
{
 
388
        BPy_Effect *blen_object;
 
389
 
 
390
        blen_object =
 
391
                ( BPy_Effect * ) PyObject_NEW( BPy_Effect, &Effect_Type );
 
392
 
 
393
        if( blen_object == NULL ) {
 
394
                return ( NULL );
 
395
        }
 
396
        blen_object->effect = effect;
 
397
        return ( ( PyObject * ) blen_object );
 
398
 
 
399
}
 
400
 
 
401
int EffectCheckPyObject( PyObject * py_obj )
 
402
{
 
403
        return ( py_obj->ob_type == &Effect_Type );
 
404
}
 
405
 
 
406
 
 
407
struct Effect *EffectFromPyObject( PyObject * py_obj )
 
408
{
 
409
        BPy_Effect *blen_obj;
 
410
 
 
411
        blen_obj = ( BPy_Effect * ) py_obj;
 
412
        return ( ( Effect * ) blen_obj->effect );
360
413
 
361
414
}