From stable
Revision: 11237 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11237 Author: campbellbarton Date: 2007-07-12 13:05:31 +0200 (Thu, 12 Jul 2007) Log Message: ----------- PyObject_IsTrue was missing a check for an error return value in many cases.
This commit is contained in:
parent
e7c15b97e2
commit
bfb9603cb4
@ -350,7 +350,12 @@ static PyObject *BezTriple_getHide( BPy_BezTriple * self )
|
||||
|
||||
static int BezTriple_setHide( BPy_BezTriple * self, PyObject *value )
|
||||
{
|
||||
if( PyObject_IsTrue( value ) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->beztriple->hide = IPO_BEZ;
|
||||
else
|
||||
self->beztriple->hide = 0;
|
||||
@ -368,6 +373,7 @@ static int BezTriple_setSelects( BPy_BezTriple * self, PyObject *args )
|
||||
{
|
||||
struct BezTriple *bezt = self->beztriple;
|
||||
PyObject *ob1, *ob2, *ob3;
|
||||
int param1, param2, param3;
|
||||
|
||||
/* only accept a sequence of three booleans */
|
||||
|
||||
@ -379,15 +385,22 @@ static int BezTriple_setSelects( BPy_BezTriple * self, PyObject *args )
|
||||
ob2 = PySequence_ITEM( args, 1 );
|
||||
ob3 = PySequence_ITEM( args, 2 );
|
||||
|
||||
param1 = PyObject_IsTrue( ob1 );
|
||||
param2 = PyObject_IsTrue( ob2 );
|
||||
param3 = PyObject_IsTrue( ob3 );
|
||||
|
||||
if (param1==-1 || param2==-1 || param3==-1)
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected a sequence of 3 items: True/False or 0/1" );
|
||||
|
||||
/* assign the selects */
|
||||
bezt->f1 = ( char )PyObject_IsTrue( ob1 );
|
||||
bezt->f2 = ( char )PyObject_IsTrue( ob2 );
|
||||
bezt->f3 = ( char )PyObject_IsTrue( ob3 );
|
||||
bezt->f1 = (char)param1;
|
||||
bezt->f2 = (char)param2;
|
||||
bezt->f3 = (char)param3;
|
||||
|
||||
Py_DECREF( ob1 );
|
||||
Py_DECREF( ob2 );
|
||||
Py_DECREF( ob3 );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -824,7 +824,12 @@ static PyObject *getFlagAttr( BPy_Camera *self, void *type )
|
||||
|
||||
static int setFlagAttr( BPy_Camera *self, PyObject *value, void *type )
|
||||
{
|
||||
if (PyObject_IsTrue(value))
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param)
|
||||
self->camera->flag |= (int)type;
|
||||
else
|
||||
self->camera->flag &= ~(int)type;
|
||||
|
@ -1095,7 +1095,12 @@ static int Image_setSource( BPy_Image *self, PyObject *args)
|
||||
|
||||
static int Image_setFlag(BPy_Image *self, PyObject *value, void *flag)
|
||||
{
|
||||
if ( PyObject_IsTrue(value) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->image->flag |= (int)flag;
|
||||
else
|
||||
self->image->flag &= ~(int)flag;
|
||||
@ -1104,7 +1109,12 @@ static int Image_setFlag(BPy_Image *self, PyObject *value, void *flag)
|
||||
|
||||
static int Image_setFlagTpage(BPy_Image *self, PyObject *value, void *flag)
|
||||
{
|
||||
if ( PyObject_IsTrue(value) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->image->tpageflag |= (int)flag;
|
||||
else
|
||||
self->image->tpageflag &= ~(int)flag;
|
||||
|
@ -1029,6 +1029,9 @@ static PyObject *IpoCurve_getFlag( C_IpoCurve * self, void *type )
|
||||
static int IpoCurve_setFlag( C_IpoCurve * self, PyObject *value, void *type )
|
||||
{
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param)
|
||||
self->ipocurve->flag |= (int)type;
|
||||
|
@ -334,7 +334,12 @@ static PyObject *Key_getRelative( BPy_Key * self )
|
||||
|
||||
static int Key_setRelative( BPy_Key * self, PyObject * value )
|
||||
{
|
||||
if( PyObject_IsTrue( value ) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->key->type = KEY_RELATIVE;
|
||||
else
|
||||
self->key->type = KEY_NORMAL;
|
||||
|
@ -2576,7 +2576,7 @@ static int MEdge_setSel( BPy_MEdge * self,PyObject * value,
|
||||
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected true/false argument" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
me = self->mesh;
|
||||
|
||||
@ -3994,7 +3994,7 @@ static int MFace_setSelect( BPy_MFace * self, PyObject * value,
|
||||
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected true/false argument" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
me = self->mesh;
|
||||
if( param ) {
|
||||
@ -5011,12 +5011,25 @@ static PyObject *MFaceSeq_extend( BPy_MEdgeSeq * self, PyObject *args,
|
||||
/* process any keyword arguments */
|
||||
if( keywds ) {
|
||||
PyObject *res = PyDict_GetItemString( keywds, "ignoreDups" );
|
||||
if( res )
|
||||
if( res ) {
|
||||
ignore_dups = PyObject_IsTrue( res );
|
||||
|
||||
if (ignore_dups==-1) {
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"keyword argument \"ignoreDups\" expected True/False or 0/1" );
|
||||
}
|
||||
}
|
||||
res = PyDict_GetItemString( keywds, "indexList" );
|
||||
if( res && PyObject_IsTrue( res ) )
|
||||
return_list = PyList_New( 0 );
|
||||
if (res) {
|
||||
switch( PyObject_IsTrue( res ) ) {
|
||||
case 0:
|
||||
break;
|
||||
case -1:
|
||||
return EXPP_ReturnPyObjError( PyExc_TypeError,
|
||||
"keyword argument \"indexList\" expected True/False or 0/1" );
|
||||
default:
|
||||
return_list = PyList_New( 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* make sure we get a tuple of sequences of something */
|
||||
@ -7677,7 +7690,7 @@ static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type )
|
||||
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected int argument in range [0,1]" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
/* sticky is independent of faceUV and vertUV */
|
||||
|
||||
@ -7904,15 +7917,19 @@ static int Mesh_setTexMesh( BPy_Mesh * self, PyObject * value )
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int Mesh_setSel( BPy_Mesh * self, PyObject * arg )
|
||||
static int Mesh_setSel( BPy_Mesh * self, PyObject * value )
|
||||
{
|
||||
int i;
|
||||
int i, param = PyObject_IsTrue( value );
|
||||
Mesh *me = self->mesh;
|
||||
MVert *mvert = me->mvert;
|
||||
MEdge *medge = me->medge;
|
||||
MFace *mface = me->mface;
|
||||
|
||||
if( PyObject_IsTrue( arg ) ) {
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param ) {
|
||||
for( i = 0; i < me->totvert; ++mvert, ++i )
|
||||
mvert->flag |= SELECT;
|
||||
for( i = 0; i < me->totedge; ++medge, ++i )
|
||||
@ -7931,15 +7948,19 @@ static int Mesh_setSel( BPy_Mesh * self, PyObject * arg )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int Mesh_setHide( BPy_Mesh * self, PyObject * arg )
|
||||
static int Mesh_setHide( BPy_Mesh * self, PyObject * value )
|
||||
{
|
||||
int i;
|
||||
int i, param = PyObject_IsTrue( value );
|
||||
Mesh *me = self->mesh;
|
||||
MVert *mvert = me->mvert;
|
||||
MEdge *medge = me->medge;
|
||||
MFace *mface = me->mface;
|
||||
|
||||
if( PyObject_IsTrue( arg ) ) {
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param ) {
|
||||
for( i = 0; i < me->totvert; ++mvert, ++i )
|
||||
mvert->flag |= ME_HIDE;
|
||||
for( i = 0; i < me->totedge; ++medge, ++i )
|
||||
|
@ -1209,16 +1209,16 @@ static PyObject *Object_getSelected( BPy_Object * self )
|
||||
static int Object_setSelect( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
Base *base;
|
||||
int setting = PyObject_IsTrue( value );
|
||||
int param = PyObject_IsTrue( value );
|
||||
|
||||
if( setting == -1 )
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected true/false argument" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
base = FIRSTBASE;
|
||||
while( base ) {
|
||||
if( base->object == self->object ) {
|
||||
if( setting == 1 ) {
|
||||
if( param ) {
|
||||
base->flag |= SELECT;
|
||||
self->object->flag = (short)base->flag;
|
||||
set_active_base( base );
|
||||
@ -2939,20 +2939,20 @@ static PyObject *Object_getNLAflagBits ( BPy_Object * self )
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static int Object_setNLAflagBits ( BPy_Object * self, PyObject * args )
|
||||
static int Object_setNLAflagBits ( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int value;
|
||||
int param;
|
||||
|
||||
value = PyObject_IsTrue( args );
|
||||
if( value == -1 )
|
||||
param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected 1/0 for true/false" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (value==1)
|
||||
if (param)
|
||||
self->object->nlaflag |= OB_NLA_OVERRIDE;
|
||||
else
|
||||
self->object->nlaflag &= ~OB_NLA_OVERRIDE;
|
||||
|
||||
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
|
||||
return 0;
|
||||
@ -2961,7 +2961,6 @@ static int Object_setNLAflagBits ( BPy_Object * self, PyObject * args )
|
||||
static PyObject *Object_getDupliObjects( BPy_Object * self )
|
||||
{
|
||||
Object *ob= self->object;
|
||||
PyObject *pair;
|
||||
|
||||
if(ob->transflag & OB_DUPLI) {
|
||||
/* before make duplis, update particle for current frame */
|
||||
@ -2983,6 +2982,7 @@ static PyObject *Object_getDupliObjects( BPy_Object * self )
|
||||
"PyList_New() failed" );
|
||||
|
||||
for(dupob= duplilist->first, index=0; dupob; dupob= dupob->next, index++) {
|
||||
PyObject *pair;
|
||||
pair = PyTuple_New( 2 );
|
||||
|
||||
PyTuple_SET_ITEM( pair, 0, Object_CreatePyObject(dupob->ob) );
|
||||
@ -3184,20 +3184,20 @@ static PyObject *Object_getPIDeflection( BPy_Object * self )
|
||||
return PyBool_FromLong( ( long ) self->object->pd->deflect );
|
||||
}
|
||||
|
||||
static int Object_setPIDeflection( BPy_Object * self, PyObject * args )
|
||||
static int Object_setPIDeflection( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int value;
|
||||
int param;
|
||||
|
||||
if( !self->object->pd && !setupPI(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
"particle deflection could not be accessed" );
|
||||
|
||||
value = PyObject_IsTrue( args );
|
||||
if( value == -1 )
|
||||
param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected true/false argument" );
|
||||
|
||||
self->object->pd->deflect = (short)value;
|
||||
self->object->pd->deflect = (short)param;
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
|
||||
return 0;
|
||||
@ -3249,20 +3249,20 @@ static PyObject *Object_getPIUseMaxDist( BPy_Object * self )
|
||||
return PyBool_FromLong( ( long )self->object->pd->flag );
|
||||
}
|
||||
|
||||
static int Object_setPIUseMaxDist( BPy_Object * self, PyObject * args )
|
||||
static int Object_setPIUseMaxDist( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int value;
|
||||
int param;
|
||||
|
||||
if( !self->object->pd && !setupPI(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
"particle deflection could not be accessed" );
|
||||
|
||||
value = PyObject_IsTrue( args );
|
||||
if( value == -1 )
|
||||
param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected true/false argument" );
|
||||
|
||||
self->object->pd->flag = (short)value;
|
||||
self->object->pd->flag = (short)param;
|
||||
self->object->recalc |= OB_RECALC_OB;
|
||||
|
||||
return 0;
|
||||
@ -3363,9 +3363,9 @@ static PyObject *Object_getSBUseGoal( BPy_Object * self )
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static int Object_setSBUseGoal( BPy_Object * self, PyObject * args )
|
||||
static int Object_setSBUseGoal( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int setting = PyObject_IsTrue( args );
|
||||
int setting = PyObject_IsTrue( value );
|
||||
|
||||
if( !self->object->soft && !setupSB(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
@ -3396,9 +3396,9 @@ static PyObject *Object_getSBUseEdges( BPy_Object * self )
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static int Object_setSBUseEdges( BPy_Object * self, PyObject * args )
|
||||
static int Object_setSBUseEdges( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int setting = PyObject_IsTrue( args );
|
||||
int setting = PyObject_IsTrue( value );
|
||||
|
||||
if( !self->object->soft && !setupSB(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
@ -3429,9 +3429,9 @@ static PyObject *Object_getSBStiffQuads( BPy_Object * self )
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static int Object_setSBStiffQuads( BPy_Object * self, PyObject * args )
|
||||
static int Object_setSBStiffQuads( BPy_Object * self, PyObject * value )
|
||||
{
|
||||
int setting = PyObject_IsTrue( args );
|
||||
int setting = PyObject_IsTrue( value );
|
||||
|
||||
if( !self->object->soft && !setupSB(self->object) )
|
||||
return EXPP_ReturnIntError( PyExc_RuntimeError,
|
||||
@ -4174,7 +4174,12 @@ static PyObject *Object_getRestricted( BPy_Object *self, void *type )
|
||||
static int Object_setRestricted( BPy_Object *self, PyObject *value,
|
||||
void *type )
|
||||
{
|
||||
if (PyObject_IsTrue(value) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->object->restrictflag |= (int)type;
|
||||
else
|
||||
self->object->restrictflag &= ~(int)type;
|
||||
|
@ -931,7 +931,12 @@ static PyObject *PoseBone_getSelect(BPy_PoseBone *self, void *closure)
|
||||
//Sets the pose bones selection
|
||||
static int PoseBone_setSelect(BPy_PoseBone *self, PyObject *value, void *closure)
|
||||
{
|
||||
if (PyObject_IsTrue( value ))
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->posechannel->bone->flag |= BONE_SELECTED;
|
||||
else
|
||||
self->posechannel->bone->flag &= ~(BONE_SELECTED | BONE_ACTIVE);
|
||||
@ -1071,7 +1076,12 @@ static PyObject *PoseBone_getIKFlag(BPy_PoseBone *self, void *flag)
|
||||
//Sets the pose bones ikflag
|
||||
static int PoseBone_setIKFlag(BPy_PoseBone *self, PyObject *value, void *flag)
|
||||
{
|
||||
if ( PyObject_IsTrue(value) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if ( param )
|
||||
self->posechannel->ikflag |= (int)flag;
|
||||
else
|
||||
self->posechannel->ikflag &= ~(int)flag;
|
||||
|
@ -457,9 +457,14 @@ static PyObject *SurfNurb_getCyclicV( BPy_SurfNurb * self )
|
||||
Py_RETURN_FALSE;
|
||||
}
|
||||
|
||||
static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * args )
|
||||
static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * value )
|
||||
{
|
||||
if( PyObject_IsTrue( args ) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->nurb->flagu |= CU_CYCLIC;
|
||||
else
|
||||
self->nurb->flagu &= ~CU_CYCLIC;
|
||||
@ -467,9 +472,14 @@ static int SurfNurb_setCyclicU( BPy_SurfNurb * self, PyObject * args )
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int SurfNurb_setCyclicV( BPy_SurfNurb * self, PyObject * args )
|
||||
static int SurfNurb_setCyclicV( BPy_SurfNurb * self, PyObject * value )
|
||||
{
|
||||
if( PyObject_IsTrue( args ) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->nurb->flagv |= CU_CYCLIC;
|
||||
else
|
||||
self->nurb->flagv &= ~CU_CYCLIC;
|
||||
|
@ -1406,7 +1406,12 @@ static int Texture_setAnimFrames( BPy_Texture * self, PyObject * value )
|
||||
|
||||
static int Texture_setIUserCyclic( BPy_Texture * self, PyObject * value )
|
||||
{
|
||||
if( PyObject_IsTrue( value ) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->texture->iuser.cycl = 1;
|
||||
else
|
||||
self->texture->iuser.cycl = 0;
|
||||
@ -1623,7 +1628,12 @@ static int Texture_setImageFlags( BPy_Texture * self, PyObject * value,
|
||||
static int Texture_setIUserFlags( BPy_Texture * self, PyObject * value,
|
||||
void *flag )
|
||||
{
|
||||
if( PyObject_IsTrue(value) )
|
||||
int param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if( param )
|
||||
self->texture->iuser.flag |= (int)flag;
|
||||
else
|
||||
self->texture->iuser.flag &= ~(int)flag;
|
||||
|
@ -352,12 +352,12 @@ static int LibBlockSeq_setActive(BPy_LibBlockSeq *self, PyObject *value)
|
||||
|
||||
static int LibBlockSeq_setTag(BPy_LibBlockSeq *self, PyObject *value)
|
||||
{
|
||||
int param = PyObject_IsTrue( value );
|
||||
ID *id;
|
||||
int param = PyObject_IsTrue( value );
|
||||
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected int argument in range [0,1]" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
id = (ID *)wich_libbase(G.main, self->type)->first;
|
||||
|
||||
|
@ -76,7 +76,7 @@ int GenericLib_setFakeUser( void *self, PyObject *value )
|
||||
param = PyObject_IsTrue( value );
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected int argument in range [0,1]" );
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param) {
|
||||
if (!(id->flag & LIB_FAKEUSER)) {
|
||||
|
@ -828,23 +828,27 @@ PyObject *EXPP_getBitfield( void *param, int setting, char type )
|
||||
|
||||
int EXPP_setBitfield( PyObject * value, void *param, int setting, char type )
|
||||
{
|
||||
int flag = PyObject_IsTrue( value );
|
||||
int param_bool = PyObject_IsTrue( value );
|
||||
|
||||
if( param_bool == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
switch ( type ) {
|
||||
case 'b':
|
||||
if ( flag )
|
||||
if ( param_bool )
|
||||
*(char *)param |= setting;
|
||||
else
|
||||
*(char *)param &= ~setting;
|
||||
return 0;
|
||||
case 'h':
|
||||
if ( flag )
|
||||
if ( param_bool )
|
||||
*(short *)param |= setting;
|
||||
else
|
||||
*(short *)param &= ~setting;
|
||||
return 0;
|
||||
case 'i':
|
||||
if ( flag )
|
||||
if ( param_bool )
|
||||
*(int *)param |= setting;
|
||||
else
|
||||
*(int *)param &= ~setting;
|
||||
|
@ -708,11 +708,15 @@ static PyObject *getFlagAttr( BPy_Sequence *self, void *type )
|
||||
static int setFlagAttr( BPy_Sequence *self, PyObject *value, void *type )
|
||||
{
|
||||
int t = (int)type;
|
||||
int param = PyObject_IsTrue( value );
|
||||
|
||||
if (PyObject_IsTrue(value))
|
||||
if( param == -1 )
|
||||
return EXPP_ReturnIntError( PyExc_TypeError,
|
||||
"expected True/False or 0/1" );
|
||||
|
||||
if (param)
|
||||
self->seq->flag |= t;
|
||||
else {
|
||||
|
||||
/* dont allow leftsel and rightsel when its not selected */
|
||||
if (t == SELECT)
|
||||
t = t + SEQ_LEFTSEL + SEQ_RIGHTSEL;
|
||||
|
Loading…
Reference in New Issue
Block a user