Fixed a bug where face flags could not be set because of the faces existing flags.

A problem with the current flag seting in Mesh is that Mesh needs to know of all possible flags or setting a flag can raise an error from the faces own unrecognezed flag.
also stopped the active face flag raising an error so pythoners can do face1.flag |= face2.flag without checking for active face flags. if the flag is a part of the arg its removed quietly.
Checked Mesh flags, face modes and edge flags, should all be ok now.
This commit is contained in:
2006-06-27 02:49:55 +00:00
parent 2670797e8a
commit be2c208077
2 changed files with 12 additions and 8 deletions

View File

@@ -3844,7 +3844,14 @@ static PyObject *MFace_getFlag( BPy_MFace *self )
static int MFace_setFlag( BPy_MFace *self, PyObject *value )
{
int param;
static short bitmask = TF_SELECT | TF_HIDE;
static short bitmask =
TF_SELECT |
TF_ACTIVE |
TF_SEL1 |
TF_SEL2 |
TF_SEL3 |
TF_SEL4 |
TF_HIDE;
if( !self->mesh->tface )
return EXPP_ReturnIntError( PyExc_ValueError,
@@ -3861,10 +3868,8 @@ static int MFace_setFlag( BPy_MFace *self, PyObject *value )
param = PyInt_AS_LONG ( value );
/* only one face can be active, so don't allow that here */
if( ( param & bitmask ) == TF_ACTIVE )
return EXPP_ReturnIntError( PyExc_ValueError,
"cannot make a face active; use 'activeFace' attribute" );
if( param & TF_ACTIVE )
param &= ~TF_ACTIVE;
if( ( param & bitmask ) != param )
return EXPP_ReturnIntError( PyExc_ValueError,