~ubuntu-branches/ubuntu/maverick/blender/maverick

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Khashayar Naderehvandi, Khashayar Naderehvandi, Alessio Treglia
  • Date: 2009-01-22 16:53:59 UTC
  • mfrom: (14.1.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20090122165359-v0996tn7fbit64ni
Tags: 2.48a+dfsg-1ubuntu1
[ Khashayar Naderehvandi ]
* Merge from debian experimental (LP: #320045), Ubuntu remaining changes:
  - Add patch correcting header file locations.
  - Add libvorbis-dev and libgsm1-dev to Build-Depends.
  - Use avcodec_decode_audio2() in source/blender/src/hddaudio.c

[ Alessio Treglia ]
* Add missing previous changelog entries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* 
2
 
 * $Id: bpy_data.c 14444 2008-04-16 22:40:48Z hos $
 
2
 * $Id: bpy_data.c 16827 2008-09-29 17:08:11Z campbellbarton $
3
3
 *
4
4
 * ***** BEGIN GPL LICENSE BLOCK *****
5
5
 *
243
243
        return object;
244
244
}
245
245
 
246
 
PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
 
246
static PyObject *LibBlockSeq_getActive(BPy_LibBlockSeq *self)
247
247
{
248
248
        switch (self->type) {
249
249
        case ID_SCE:
263
263
                }
264
264
                break;
265
265
        case ID_TXT: {
266
 
                        SpaceText *st= curarea->spacedata.first;
267
 
                        
268
 
                        if (st->spacetype!=SPACE_TEXT || st->text==NULL) {
 
266
                        SpaceText *st = NULL;
 
267
                        
 
268
                        if (curarea)
 
269
                                st = curarea->spacedata.first;
 
270
                        
 
271
                        if (st==NULL || st->spacetype!=SPACE_TEXT || st->text==NULL) {
269
272
                                Py_RETURN_NONE;
270
273
                        } else {
271
274
                                return Text_CreatePyObject( st->text );
330
333
                        return EXPP_ReturnIntError(PyExc_TypeError,
331
334
                                        "Must be a text" );
332
335
                } else {
333
 
                        SpaceText *st= curarea->spacedata.first;        
 
336
                        SpaceText *st= NULL;
334
337
                        Text *data = ((BPy_Text *)value)->text;
335
338
                        
 
339
                        if (curarea==NULL) {
 
340
                                return 0;
 
341
                        } else {
 
342
                                st= curarea->spacedata.first;
 
343
                        }
 
344
                        
336
345
                        if( !data )
337
346
                                return EXPP_ReturnIntError( PyExc_RuntimeError,
338
347
                                                      "This object isn't linked to a Blender Text Object" );
373
382
 
374
383
 
375
384
/* New Data, internal functions */
376
 
Mesh *add_mesh__internal(char *name)
 
385
static Mesh *add_mesh__internal(char *name)
377
386
{
378
387
        Mesh *mesh = add_mesh(name); /* doesn't return NULL now, but might someday */
379
388
        
444
453
                                        return EXPP_ReturnPyObjError( PyExc_IOError,
445
454
                                                      "couldn't create pyobject on load, unknown error" );
446
455
                        if (name) {
447
 
                                ID *id = ((BPy_GenericLib *)ret)->id;
448
 
                                rename_id( id, name );
 
456
                                rename_id( ((BPy_GenericLib *)ret)->id, name );
449
457
                        }
450
458
                        return ret;
451
459
                }
590
598
}
591
599
 
592
600
 
593
 
PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
 
601
static PyObject *LibBlockSeq_unlink(BPy_LibBlockSeq *self, PyObject * value)
594
602
{
595
603
        switch (self->type) {
596
604
        case ID_SCE:
781
789
PyObject * Data_Init( void )
782
790
{
783
791
        PyObject *module;
784
 
        PyObject *dict;
785
 
        
786
792
        
787
793
        PyType_Ready( &LibBlockSeq_Type );
788
794
        PyType_Ready( &Config_Type );
789
795
        
790
796
        /*submodule = Py_InitModule3( "Blender.Main", NULL, M_Main_doc );*/
791
797
        module = Py_InitModule3( "bpy.data", NULL, "The bpy.data submodule" );
792
 
        dict = PyModule_GetDict( module );
793
798
        
794
799
        /* Python Data Types */
795
800
        PyModule_AddObject( module, "scenes",   LibBlockSeq_CreatePyObject(NULL, ID_SCE) );