From be2c208077e67d04dfce89fd7dc42c022623643f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 27 Jun 2006 02:49:55 +0000 Subject: [PATCH] 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. --- source/blender/python/api2_2x/Mesh.c | 15 ++++++++++----- source/blender/python/api2_2x/doc/Mesh.py | 5 ++--- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index c9e49dea774..956de7e2504 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -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, diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 05f6efe2857..47c295e71b1 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -58,14 +58,13 @@ done once. - NOVNORMALSFLIP - no flipping of vertex normals during render. - TWOSIDED - double sided mesh. - AUTOSMOOTH - turn auto smoothing of faces "on". - - SUBSURF - turn Catmull-Clark subdivision of surfaces "on". - - OPTIMAL - optimal drawing of edges when "SubSurf" is "on". + - note: SUBSURF and OPTIMAL have been removed, use Modifiers to apply subsurf. @var FaceFlags: The available *texture face* (uv face select mode) selection flags. Note: these refer to TexFace faces, available if mesh.faceUV() returns true. - SELECT - selected. - HIDE - hidden. - - ACTIVE - the active face. + - ACTIVE - the active face, read only - Use L{mesh.activeFace} to set. @var FaceModes: The available *texture face* modes. Note: these are only meaningful if mesh.faceUV() returns true, since in Blender this info is stored at the TexFace (TexFace button in Edit Mesh buttons) structure.