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:
Campbell Barton 2006-06-27 02:49:55 +00:00
parent 2670797e8a
commit be2c208077
2 changed files with 12 additions and 8 deletions

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

@ -58,14 +58,13 @@ done once.
- NOVNORMALSFLIP - no flipping of vertex normals during render. - NOVNORMALSFLIP - no flipping of vertex normals during render.
- TWOSIDED - double sided mesh. - TWOSIDED - double sided mesh.
- AUTOSMOOTH - turn auto smoothing of faces "on". - AUTOSMOOTH - turn auto smoothing of faces "on".
- SUBSURF - turn Catmull-Clark subdivision of surfaces "on". - note: SUBSURF and OPTIMAL have been removed, use Modifiers to apply subsurf.
- OPTIMAL - optimal drawing of edges when "SubSurf" is "on".
@var FaceFlags: The available *texture face* (uv face select mode) selection @var FaceFlags: The available *texture face* (uv face select mode) selection
flags. Note: these refer to TexFace faces, available if mesh.faceUV() flags. Note: these refer to TexFace faces, available if mesh.faceUV()
returns true. returns true.
- SELECT - selected. - SELECT - selected.
- HIDE - hidden. - HIDE - hidden.
- ACTIVE - the active face. - ACTIVE - the active face, read only - Use L{mesh.activeFace<Mesh.Mesh.activeFace>} to set.
@var FaceModes: The available *texture face* modes. Note: these are only @var FaceModes: The available *texture face* modes. Note: these are only
meaningful if mesh.faceUV() returns true, since in Blender this info is meaningful if mesh.faceUV() returns true, since in Blender this info is
stored at the TexFace (TexFace button in Edit Mesh buttons) structure. stored at the TexFace (TexFace button in Edit Mesh buttons) structure.