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

« back to all changes in this revision

Viewing changes to source/blender/python/api2_2x/Group.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:
46
46
#include "gen_utils.h"
47
47
#include "gen_library.h"
48
48
 
 
49
#include "vector.h"
 
50
 
49
51
/* checks for the group being removed */
50
52
#define GROUP_DEL_CHECK_PY(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnPyObjError( PyExc_RuntimeError, "Group has been removed" ) )
51
53
#define GROUP_DEL_CHECK_INT(bpy_group) if (!(bpy_group->group)) return ( EXPP_ReturnIntError( PyExc_RuntimeError, "Group has been removed" ) )
54
56
/* Python API function prototypes for the Blender module.                */
55
57
/*****************************************************************************/
56
58
static PyObject *M_Group_New( PyObject * self, PyObject * args );
57
 
PyObject *M_Group_Get( PyObject * self, PyObject * args );
58
 
PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
 
59
static PyObject *M_Group_Get( PyObject * self, PyObject * args );
 
60
static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp );
59
61
 
60
62
/* internal */
61
63
static PyObject *GroupObSeq_CreatePyObject( BPy_Group *self, GroupObject *iter );
200
202
        return 0;
201
203
}
202
204
 
 
205
static PyObject *Group_getDupliOfs( BPy_Group * self )
 
206
{
 
207
        GROUP_DEL_CHECK_PY(self);
 
208
        return newVectorObject( self->group->dupli_ofs, 3, Py_WRAP );
 
209
}
 
210
 
 
211
static int Group_setDupliOfs( BPy_Group * self, PyObject * value )
 
212
{       
 
213
        VectorObject *bpy_vec;
 
214
        GROUP_DEL_CHECK_INT(self);
 
215
        if (!VectorObject_Check(value))
 
216
                return ( EXPP_ReturnIntError( PyExc_TypeError,
 
217
                        "expected a vector" ) );
 
218
        
 
219
        bpy_vec = (VectorObject *)value;
 
220
        
 
221
        if (bpy_vec->size != 3)
 
222
                return ( EXPP_ReturnIntError( PyExc_ValueError,
 
223
                        "can only assign a 3D vector" ) );
 
224
        
 
225
        self->group->dupli_ofs[0] = bpy_vec->vec[0];
 
226
        self->group->dupli_ofs[1] = bpy_vec->vec[1];
 
227
        self->group->dupli_ofs[2] = bpy_vec->vec[2];
 
228
        return 0;
 
229
}
203
230
 
204
231
 
205
232
/*****************************************************************************/
251
278
         (getter)Group_getObjects, (setter)Group_setObjects,
252
279
         "objects in this group",
253
280
         NULL},
 
281
        {"dupliOffset",
 
282
         (getter)Group_getDupliOfs, (setter)Group_setDupliOfs,
 
283
         "offset to use when instancing this group as a DupliGroup",
 
284
        NULL},
254
285
        {NULL,NULL,NULL,NULL,NULL}  /* Sentinel */
255
286
};
256
287
 
374
405
/* Function:      M_Group_Get                                           */
375
406
/* Python equivalent:     Blender.Group.Get                             */
376
407
/*****************************************************************************/
377
 
PyObject *M_Group_Get( PyObject * self, PyObject * args )
 
408
static PyObject *M_Group_Get( PyObject * self, PyObject * args )
378
409
{
379
410
        char *name = NULL;
380
411
        Group *group_iter;
444
475
/* Function:      M_Group_Unlink                                                */
445
476
/* Python equivalent:     Blender.Group.Unlink                          */
446
477
/*****************************************************************************/
447
 
PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
 
478
static PyObject *M_Group_Unlink( PyObject * self, BPy_Group * pygrp )
448
479
{
449
480
        Group *group;
450
481
        if( !BPy_Group_Check(pygrp) )