70
70
static PyObject *World_getRange( BPy_World * self );
71
71
static PyObject *World_setRange( BPy_World * self, PyObject * args );
72
72
static PyObject *World_getIpo( BPy_World * self );
73
static PyObject *World_setIpo( BPy_World * self, PyObject * args );
73
static PyObject *World_oldsetIpo( BPy_World * self, PyObject * args );
74
static int World_setIpo( BPy_World * self, PyObject * args );
74
75
static PyObject *World_clearIpo( BPy_World * self );
75
76
static PyObject *World_insertIpoKey( BPy_World * self, PyObject * args );
76
static PyObject *World_getName( BPy_World * self );
77
static PyObject *World_setName( BPy_World * self, PyObject * args );
78
77
static PyObject *World_getMode( BPy_World * self );
79
static PyObject *World_setMode( BPy_World * self, PyObject * args );
78
static PyObject *World_oldsetMode( BPy_World * self, PyObject * args );
79
static int World_setMode( BPy_World * self, PyObject * args );
80
80
static PyObject *World_getSkytype( BPy_World * self );
81
static PyObject *World_setSkytype( BPy_World * self, PyObject * args );
81
static PyObject *World_oldsetSkytype( BPy_World * self, PyObject * args );
82
static int World_setSkytype( BPy_World * self, PyObject * args );
82
83
static PyObject *World_getMistype( BPy_World * self );
83
static PyObject *World_setMistype( BPy_World * self, PyObject * args );
84
static PyObject *World_oldsetMistype( BPy_World * self, PyObject * args );
85
static int World_setMistype( BPy_World * self, PyObject * args );
84
86
static PyObject *World_getHor( BPy_World * self );
85
static PyObject *World_setHor( BPy_World * self, PyObject * args );
87
static PyObject *World_oldsetHor( BPy_World * self, PyObject * args );
88
static int World_setHor( BPy_World * self, PyObject * args );
86
89
static PyObject *World_getZen( BPy_World * self );
87
static PyObject *World_setZen( BPy_World * self, PyObject * args );
90
static PyObject *World_oldsetZen( BPy_World * self, PyObject * args );
91
static int World_setZen( BPy_World * self, PyObject * args );
88
92
static PyObject *World_getAmb( BPy_World * self );
89
static PyObject *World_setAmb( BPy_World * self, PyObject * args );
93
static PyObject *World_oldsetAmb( BPy_World * self, PyObject * args );
94
static int World_setAmb( BPy_World * self, PyObject * args );
90
95
static PyObject *World_getStar( BPy_World * self );
91
static PyObject *World_setStar( BPy_World * self, PyObject * args );
96
static PyObject *World_oldsetStar( BPy_World * self, PyObject * args );
97
static int World_setStar( BPy_World * self, PyObject * args );
92
98
static PyObject *World_getMist( BPy_World * self );
93
static PyObject *World_setMist( BPy_World * self, PyObject * args );
99
static PyObject *World_oldsetMist( BPy_World * self, PyObject * args );
100
static int World_setMist( BPy_World * self, PyObject * args );
94
101
static PyObject *World_getScriptLinks( BPy_World * self, PyObject * args );
95
102
static PyObject *World_addScriptLink( BPy_World * self, PyObject * args );
96
103
static PyObject *World_clearScriptLinks( BPy_World * self, PyObject * args );
165
169
"() - Change this World's range"},
166
170
{"getIpo", ( PyCFunction ) World_getIpo, METH_NOARGS,
167
171
"() - Return World Ipo"},
168
{"setIpo", ( PyCFunction ) World_setIpo, METH_VARARGS,
172
{"setIpo", ( PyCFunction ) World_oldsetIpo, METH_VARARGS,
169
173
"() - Change this World's ipo"},
170
174
{"clearIpo", ( PyCFunction ) World_clearIpo, METH_VARARGS,
171
175
"() - Unlink Ipo from this World"},
172
{"getName", ( PyCFunction ) World_getName, METH_NOARGS,
176
{"getName", ( PyCFunction ) GenericLib_getName, METH_NOARGS,
173
177
"() - Return World Data name"},
174
{"setName", ( PyCFunction ) World_setName, METH_VARARGS,
178
{"setName", ( PyCFunction ) GenericLib_setName_with_method, METH_VARARGS,
175
179
"() - Set World Data name"},
176
180
{"getMode", ( PyCFunction ) World_getMode, METH_NOARGS,
177
181
"() - Return World Data mode"},
178
{"setMode", ( PyCFunction ) World_setMode, METH_VARARGS,
182
{"setMode", ( PyCFunction ) World_oldsetMode, METH_VARARGS,
179
183
"(i) - Set World Data mode"},
180
184
{"getSkytype", ( PyCFunction ) World_getSkytype, METH_NOARGS,
181
185
"() - Return World Data skytype"},
182
{"setSkytype", ( PyCFunction ) World_setSkytype, METH_VARARGS,
186
{"setSkytype", ( PyCFunction ) World_oldsetSkytype, METH_VARARGS,
183
187
"() - Return World Data skytype"},
184
188
{"getMistype", ( PyCFunction ) World_getMistype, METH_NOARGS,
185
189
"() - Return World Data mistype"},
186
{"setMistype", ( PyCFunction ) World_setMistype, METH_VARARGS,
190
{"setMistype", ( PyCFunction ) World_oldsetMistype, METH_VARARGS,
187
191
"() - Return World Data mistype"},
188
192
{"getHor", ( PyCFunction ) World_getHor, METH_NOARGS,
189
193
"() - Return World Data hor"},
190
{"setHor", ( PyCFunction ) World_setHor, METH_VARARGS,
194
{"setHor", ( PyCFunction ) World_oldsetHor, METH_VARARGS,
191
195
"() - Return World Data hor"},
192
196
{"getZen", ( PyCFunction ) World_getZen, METH_NOARGS,
193
197
"() - Return World Data zen"},
194
{"setZen", ( PyCFunction ) World_setZen, METH_VARARGS,
198
{"setZen", ( PyCFunction ) World_oldsetZen, METH_VARARGS,
195
199
"() - Return World Data zen"},
196
200
{"getAmb", ( PyCFunction ) World_getAmb, METH_NOARGS,
197
201
"() - Return World Data amb"},
198
{"setAmb", ( PyCFunction ) World_setAmb, METH_VARARGS,
202
{"setAmb", ( PyCFunction ) World_oldsetAmb, METH_VARARGS,
199
203
"() - Return World Data amb"},
200
204
{"getStar", ( PyCFunction ) World_getStar, METH_NOARGS,
201
205
"() - Return World Data star"},
202
{"setStar", ( PyCFunction ) World_setStar, METH_VARARGS,
206
{"setStar", ( PyCFunction ) World_oldsetStar, METH_VARARGS,
203
207
"() - Return World Data star"},
204
208
{"getMist", ( PyCFunction ) World_getMist, METH_NOARGS,
205
209
"() - Return World Data mist"},
206
{"setMist", ( PyCFunction ) World_setMist, METH_VARARGS,
210
{"setMist", ( PyCFunction ) World_oldsetMist, METH_VARARGS,
207
211
"() - Return World Data mist"},
208
212
{"getScriptLinks", ( PyCFunction ) World_getScriptLinks, METH_VARARGS,
209
213
"(eventname) - Get a list of this world's scriptlinks (Text names) "
225
229
"( World IPO type ) - Inserts a key into the IPO"},
226
230
{"__copy__", ( PyCFunction ) World_copy, METH_NOARGS,
227
231
"() - Makes a copy of this world."},
232
{"copy", ( PyCFunction ) World_copy, METH_NOARGS,
233
"() - Makes a copy of this world."},
228
234
{NULL, NULL, 0, NULL}
237
/*****************************************************************************/
238
/* Python attributes get/set structure: */
239
/*****************************************************************************/
240
static PyGetSetDef BPy_World_getseters[] = {
241
GENERIC_LIB_GETSETATTR,
242
{"skytype", (getter)World_getSkytype, (setter)World_setSkytype,
243
"sky settings as a list", NULL},
244
{"mode", (getter)World_getMode, (setter)World_setMode,
246
{"mistype", (getter)World_getMistype, (setter)World_setMistype,
247
"world mist type", NULL},
248
{"hor", (getter)World_getHor, (setter)World_setHor,
249
"world horizon color", NULL},
250
{"amb", (getter)World_getAmb, (setter)World_setAmb,
251
"world ambient color", NULL},
252
{"mist", (getter)World_getMist, (setter)World_setMist,
253
"world mist settings", NULL},
254
{"ipo", (getter)World_getIpo, (setter)World_setIpo,
256
{NULL,NULL,NULL,NULL,NULL} /* Sentinel */
232
259
/*****************************************************************************/
233
260
/* Python World_Type structure definition: */
239
266
sizeof( BPy_World ), /* tp_basicsize */
240
267
0, /* tp_itemsize */
242
( destructor ) World_DeAlloc, /* tp_dealloc */
244
( getattrfunc ) World_GetAttr, /* tp_getattr */
245
( setattrfunc ) World_SetAttr, /* tp_setattr */
269
NULL, /* tp_dealloc */
271
NULL, /* tp_getattr */
272
NULL, /* tp_setattr */
246
273
( cmpfunc ) World_Compare, /* tp_compare */
247
274
( reprfunc ) World_Repr, /* tp_repr */
248
0, /* tp_as_number */
249
0, /* tp_as_sequence */
250
0, /* tp_as_mapping */
255
BPy_World_methods, /* tp_methods */
257
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
276
/* Method suites for standard classes */
278
NULL, /* PyNumberMethods *tp_as_number; */
279
NULL, /* PySequenceMethods *tp_as_sequence; */
280
NULL, /* PyMappingMethods *tp_as_mapping; */
282
/* More standard operations (here for binary compatibility) */
284
( hashfunc ) GenericLib_hash, /* hashfunc tp_hash; */
285
NULL, /* ternaryfunc tp_call; */
286
NULL, /* reprfunc tp_str; */
287
NULL, /* getattrofunc tp_getattro; */
288
NULL, /* setattrofunc tp_setattro; */
290
/* Functions to access object as input/output buffer */
291
NULL, /* PyBufferProcs *tp_as_buffer; */
293
/*** Flags to define presence of optional/expanded features ***/
294
Py_TPFLAGS_DEFAULT, /* long tp_flags; */
296
NULL, /* char *tp_doc; Documentation string */
297
/*** Assigned meaning in release 2.0 ***/
298
/* call function for all accessible objects */
299
NULL, /* traverseproc tp_traverse; */
301
/* delete references to contained objects */
302
NULL, /* inquiry tp_clear; */
304
/*** Assigned meaning in release 2.1 ***/
305
/*** rich comparisons ***/
306
NULL, /* richcmpfunc tp_richcompare; */
308
/*** weak reference enabler ***/
309
0, /* long tp_weaklistoffset; */
311
/*** Added in release 2.2 ***/
313
NULL, /* getiterfunc tp_iter; */
314
NULL, /* iternextfunc tp_iternext; */
316
/*** Attribute descriptor and subclassing stuff ***/
317
BPy_World_methods, /* struct PyMethodDef *tp_methods; */
318
NULL, /* struct PyMemberDef *tp_members; */
319
BPy_World_getseters, /* struct PyGetSetDef *tp_getset; */
320
NULL, /* struct _typeobject *tp_base; */
321
NULL, /* PyObject *tp_dict; */
322
NULL, /* descrgetfunc tp_descr_get; */
323
NULL, /* descrsetfunc tp_descr_set; */
324
0, /* long tp_dictoffset; */
325
NULL, /* initproc tp_init; */
326
NULL, /* allocfunc tp_alloc; */
327
NULL, /* newfunc tp_new; */
328
/* Low-level free-memory routine */
329
NULL, /* freefunc tp_free; */
330
/* For PyObject_IS_GC */
331
NULL, /* inquiry tp_is_gc; */
332
NULL, /* PyObject *tp_bases; */
333
/* method resolution order */
334
NULL, /* PyObject *tp_mro; */
335
NULL, /* PyObject *tp_cache; */
336
NULL, /* PyObject *tp_subclasses; */
337
NULL, /* PyObject *tp_weaklist; */
326
407
char *name = NULL;
327
408
World *world_iter;
328
409
PyObject *worldlist;
329
BPy_World *wanted_world = NULL;
330
410
char error_msg[64];
332
412
if( !PyArg_ParseTuple( args, "|s", &name ) )
333
413
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
334
414
"expected string argument (or nothing)" ) );
336
world_iter = G.main->world.first;
338
416
if( name ) { /* (name) - Search world by name */
339
while( ( world_iter ) && ( wanted_world == NULL ) ) {
340
if( strcmp( name, world_iter->id.name + 2 ) == 0 ) {
343
PyObject_NEW( BPy_World, &World_Type );
345
wanted_world->world = world_iter;
347
world_iter = world_iter->id.next;
350
if( wanted_world == NULL ) { /* Requested world doesn't exist */
417
world_iter = ( World * ) GetIdFromList( &( G.main->world ), name );
419
if( world_iter == NULL ) { /* Requested world doesn't exist */
351
420
PyOS_snprintf( error_msg, sizeof( error_msg ),
352
421
"World \"%s\" not found", name );
353
422
return ( EXPP_ReturnPyObjError
354
423
( PyExc_NameError, error_msg ) );
357
return ( PyObject * ) wanted_world;
426
return ( PyObject * ) World_CreatePyObject(world_iter);
360
429
else { /* return a list of all worlds in the scene */
430
world_iter = G.main->world.first;
361
431
worldlist = PyList_New( 0 );
362
432
if( worldlist == NULL )
363
433
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
449
525
return Ipo_CreatePyObject( ipo );
452
static PyObject *World_setIpo( BPy_World * self, PyObject * args )
458
if( !PyArg_ParseTuple( args, "O!", &Ipo_Type, &pyipo ) )
459
return EXPP_ReturnPyObjError( PyExc_TypeError,
460
"expected Ipo as argument" );
462
ipo = Ipo_FromPyObject( pyipo );
465
return EXPP_ReturnPyObjError( PyExc_RuntimeError,
468
if( ipo->blocktype != ID_WO )
469
return EXPP_ReturnPyObjError( PyExc_TypeError,
470
"this ipo is not a World type ipo" );
472
oldipo = self->world->ipo;
474
ID *id = &oldipo->id;
479
id_us_plus(&ipo->id);
481
self->world->ipo = ipo;
528
static int World_setIpo( BPy_World * self, PyObject * value )
530
return GenericLib_assignData(value, (void **) &self->world->ipo, 0, 1, ID_IP, ID_WO);
533
static PyObject *World_oldsetIpo( BPy_World * self, PyObject * args )
535
return EXPP_setterWrapper( (void *)self, args, (setter)World_setIpo );
486
538
static PyObject *World_clearIpo( BPy_World * self )
676
static PyObject *World_setHor( BPy_World * self, PyObject * args )
687
static int World_setHor( BPy_World * self, PyObject * value )
678
PyObject *listargs = 0;
679
if( !PyArg_ParseTuple( args, "O", &listargs ) )
680
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
689
if( !PyList_Check( value ) )
690
return ( EXPP_ReturnIntError( PyExc_TypeError,
681
691
"expected list argument" ) );
682
self->world->horr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
683
self->world->horg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
684
self->world->horb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
692
if( PyList_Size( value ) != 3 )
693
return ( EXPP_ReturnIntError
694
( PyExc_TypeError, "list size must be 3" ) );
695
self->world->horr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
696
self->world->horg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
697
self->world->horb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
701
static PyObject *World_oldsetHor( BPy_World * self, PyObject * args )
703
return EXPP_setterWrapper( (void *)self, args, (setter)World_setHor );
689
706
static PyObject *World_getZen( BPy_World * self )
702
static PyObject *World_setZen( BPy_World * self, PyObject * args )
719
static int World_setZen( BPy_World * self, PyObject * value )
704
PyObject *listargs = 0;
705
if( !PyArg_ParseTuple( args, "O", &listargs ) )
706
return ( EXPP_ReturnPyObjError( PyExc_TypeError,
721
if( !PyList_Check( value ) )
722
return ( EXPP_ReturnIntError( PyExc_TypeError,
707
723
"expected list argument" ) );
708
self->world->zenr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
709
self->world->zeng = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
710
self->world->zenb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
724
if( PyList_Size( value ) != 3 )
725
return ( EXPP_ReturnIntError
726
( PyExc_TypeError, "list size must be 3" ) );
727
self->world->zenr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
728
self->world->zeng = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
729
self->world->zenb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
733
static PyObject *World_oldsetZen( BPy_World * self, PyObject * args )
735
return EXPP_setterWrapper( (void *)self, args, (setter)World_setZen );
717
739
static PyObject *World_getAmb( BPy_World * self )
730
static PyObject *World_setAmb( BPy_World * self, PyObject * args )
752
static int World_setAmb( BPy_World * self, PyObject * value )
732
PyObject *listargs = 0;
733
if( !PyArg_ParseTuple( args, "O", &listargs ) )
734
return ( EXPP_ReturnPyObjError
735
( PyExc_TypeError, "expected list argument" ) );
736
if( !PyList_Check( listargs ) )
737
return ( EXPP_ReturnPyObjError
738
( PyExc_TypeError, "expected list argument" ) );
739
if( PyList_Size( listargs ) != 3 )
740
return ( EXPP_ReturnPyObjError
754
if( !PyList_Check( value ) )
755
return ( EXPP_ReturnIntError( PyExc_TypeError,
756
"expected list argument" ) );
757
if( PyList_Size( value ) != 3 )
758
return ( EXPP_ReturnIntError
741
759
( PyExc_TypeError, "wrong list size" ) );
742
self->world->ambr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
743
self->world->ambg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
744
self->world->ambb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
760
self->world->ambr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
761
self->world->ambg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
762
self->world->ambb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
766
static PyObject *World_oldsetAmb( BPy_World * self, PyObject * args )
768
return EXPP_setterWrapper( (void *)self, args, (setter)World_setAmb );
749
771
static PyObject *World_getStar( BPy_World * self )
766
static PyObject *World_setStar( BPy_World * self, PyObject * args )
788
static int World_setStar( BPy_World * self, PyObject * value )
768
PyObject *listargs = 0;
769
if( !PyArg_ParseTuple( args, "O", &listargs ) )
770
return ( EXPP_ReturnPyObjError
771
( PyExc_TypeError, "expected list argument" ) );
772
if( !PyList_Check( listargs ) )
773
return ( EXPP_ReturnPyObjError
774
( PyExc_TypeError, "expected list argument" ) );
775
if( PyList_Size( listargs ) != 7 )
776
return ( EXPP_ReturnPyObjError
790
if( !PyList_Check( value ) )
791
return ( EXPP_ReturnIntError
792
( PyExc_TypeError, "expected list argument" ) );
793
if( PyList_Size( value ) != 7 )
794
return ( EXPP_ReturnIntError
777
795
( PyExc_TypeError, "wrong list size" ) );
778
self->world->starr = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
779
self->world->starg = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
780
self->world->starb = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
796
self->world->starr = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
797
self->world->starg = (float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
798
self->world->starb = (float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
781
799
self->world->starsize =
782
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
800
(float)PyFloat_AsDouble( PyList_GetItem( value, 3 ) );
783
801
self->world->starmindist =
784
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 4 ) );
802
(float)PyFloat_AsDouble( PyList_GetItem( value, 4 ) );
785
803
self->world->stardist =
786
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 5 ) );
804
(float)PyFloat_AsDouble( PyList_GetItem( value, 5 ) );
787
805
self->world->starcolnoise =
788
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 6 ) );
806
(float)PyFloat_AsDouble( PyList_GetItem( value, 6 ) );
810
static PyObject *World_oldsetStar( BPy_World * self, PyObject * args )
812
return EXPP_setterWrapper( (void *)self, args, (setter)World_setStar );
797
816
static PyObject *World_getMist( BPy_World * self )
811
static PyObject *World_setMist( BPy_World * self, PyObject * args )
830
static int World_setMist( BPy_World * self, PyObject * value )
813
PyObject *listargs = 0;
814
if( !PyArg_ParseTuple( args, "O", &listargs ) )
815
return ( EXPP_ReturnPyObjError
816
( PyExc_TypeError, "expected list argument" ) );
817
if( !PyList_Check( listargs ) )
818
return ( EXPP_ReturnPyObjError
819
( PyExc_TypeError, "expected list argument" ) );
820
if( PyList_Size( listargs ) != 4 )
821
return ( EXPP_ReturnPyObjError
832
if( !PyList_Check( value ) )
833
return ( EXPP_ReturnIntError
834
( PyExc_TypeError, "expected list argument" ) );
835
if( PyList_Size( value ) != 4 )
836
return ( EXPP_ReturnIntError
822
837
( PyExc_TypeError, "wrong list size" ) );
823
self->world->misi = (float)PyFloat_AsDouble( PyList_GetItem( listargs, 0 ) );
838
self->world->misi = (float)PyFloat_AsDouble( PyList_GetItem( value, 0 ) );
824
839
self->world->miststa =
825
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 1 ) );
840
(float)PyFloat_AsDouble( PyList_GetItem( value, 1 ) );
826
841
self->world->mistdist =
827
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 2 ) );
842
(float)PyFloat_AsDouble( PyList_GetItem( value, 2 ) );
828
843
self->world->misthi =
829
(float)PyFloat_AsDouble( PyList_GetItem( listargs, 3 ) );
844
(float)PyFloat_AsDouble( PyList_GetItem( value, 3 ) );
848
static PyObject *World_oldsetMist( BPy_World * self, PyObject * args )
850
return EXPP_setterWrapper( (void *)self, args, (setter)World_setMist );
833
854
/* world.addScriptLink */
834
855
static PyObject *World_addScriptLink( BPy_World * self, PyObject * args )
886
914
/* world.__copy__ */
887
915
static PyObject *World_copy( BPy_World * self )
892
blworld = copy_world( self->world );
895
/* return user count to zero because add_world() inc'd it */
897
/* create python wrapper obj */
899
( BPy_World * ) PyObject_NEW( BPy_World, &World_Type );
901
return ( EXPP_ReturnPyObjError( PyExc_RuntimeError,
902
"couldn't create World Data in Blender" ) );
904
if( pyworld == NULL )
905
return ( EXPP_ReturnPyObjError( PyExc_MemoryError,
906
"couldn't create World Data object" ) );
908
pyworld->world = blworld;
910
return ( PyObject * ) pyworld;
917
* \brief The World PyType destructor
920
static void World_DeAlloc( BPy_World * self )
922
PyObject_DEL( self );
926
* \brief The World PyType attribute getter
928
* This is the callback called when a user tries to retrieve the contents of
929
* World PyObject data members. Ex. in Python: "print myworld.lens".
932
static PyObject *World_GetAttr( BPy_World * self, char *name )
935
if( strcmp( name, "name" ) == 0 )
936
return World_getName( self );
937
if( strcmp( name, "skytype" ) == 0 )
938
return World_getSkytype( self );
939
if( strcmp( name, "mode" ) == 0 )
940
return World_getMode( self );
941
if( strcmp( name, "mistype" ) == 0 )
942
return World_getMistype( self );
943
if( strcmp( name, "hor" ) == 0 )
944
return World_getHor( self );
945
if( strcmp( name, "zen" ) == 0 )
946
return World_getZen( self );
947
if( strcmp( name, "amb" ) == 0 )
948
return World_getAmb( self );
949
if( strcmp( name, "star" ) == 0 )
950
return World_getStar( self );
951
if( strcmp( name, "mist" ) == 0 )
952
return World_getMist( self );
953
if( strcmp( name, "users" ) == 0 )
954
return PyInt_FromLong( self->world->id.us );
955
return Py_FindMethod( BPy_World_methods, ( PyObject * ) self, name );
959
* \brief The World PyType attribute setter
961
* This is the callback called when the user tries to change the value of some
962
* World data member. Ex. in Python: "myworld.lens = 45.0".
965
static int World_SetAttr( BPy_World * self, char *name, PyObject * value )
967
PyObject *error=NULL;
968
PyObject *valtuple = Py_BuildValue( "(O)", value );
971
return EXPP_ReturnIntError( PyExc_MemoryError,
972
"WorldSetAttr: couldn't parse args" );
973
else if( strcmp( name, "name" ) == 0 )
974
error = World_setName( self, valtuple );
975
else if( strcmp( name, "skytype" ) == 0 )
976
error = World_setSkytype( self, valtuple );
977
else if( strcmp( name, "mode" ) == 0 )
978
error = World_setMode( self, valtuple );
979
else if( strcmp( name, "mistype" ) == 0 )
980
error = World_setMistype( self, valtuple );
981
else if( strcmp( name, "hor" ) == 0 )
982
error = World_setHor( self, valtuple );
983
else if( strcmp( name, "zen" ) == 0 )
984
error = World_setZen( self, valtuple );
985
else if( strcmp( name, "amb" ) == 0 )
986
error = World_setAmb( self, valtuple );
987
else if( strcmp( name, "star" ) == 0 )
988
error = World_setStar( self, valtuple );
989
else if( strcmp( name, "mist" ) == 0 )
990
error = World_setMist( self, valtuple );
992
Py_DECREF( valtuple );
993
return ( EXPP_ReturnIntError( PyExc_KeyError,
994
"attribute not found" ) );
999
if( error != Py_None )
1002
Py_DECREF( Py_None );
917
World *world = copy_world(self->world );
919
return World_CreatePyObject(world);