diff options
author | Ken Hughes <khughes@pacific.edu> | 2006-01-18 09:15:17 +0300 |
---|---|---|
committer | Ken Hughes <khughes@pacific.edu> | 2006-01-18 09:15:17 +0300 |
commit | a8cb639f0baaab807622cbb6c04d11cd37f596c3 (patch) | |
tree | 1ae167bf0483ebf65bf78cb1d943c9887bee6b45 | |
parent | 85c58bfa8a486d801420e9a2021018f3070d90ec (diff) |
==Python API==
Bugfix #3761: Attempting to set mesh.faceUV=1 when a mesh has no faces
now throws a RuntimeError exception. Previous behavior was to do nothing.
-rw-r--r-- | source/blender/python/api2_2x/Mesh.c | 6 | ||||
-rw-r--r-- | source/blender/python/api2_2x/doc/Mesh.py | 3 |
2 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/python/api2_2x/Mesh.c b/source/blender/python/api2_2x/Mesh.c index ce131e3851a..9440e15bbd8 100644 --- a/source/blender/python/api2_2x/Mesh.c +++ b/source/blender/python/api2_2x/Mesh.c @@ -6042,8 +6042,12 @@ static int Mesh_setFlag( BPy_Mesh * self, PyObject *value, void *type ) MEM_freeN( mesh->tface ); mesh->tface = NULL; } - } else if( !mesh->tface ) + } else if( !mesh->tface ) { + if( !mesh->totface ) + return EXPP_ReturnIntError( PyExc_RuntimeError, + "mesh has no faces" ); make_tfaces( mesh ); + } return 0; case MESH_HASMCOL: if( !param ) { diff --git a/source/blender/python/api2_2x/doc/Mesh.py b/source/blender/python/api2_2x/doc/Mesh.py index 82b414c89e7..7711345959e 100644 --- a/source/blender/python/api2_2x/doc/Mesh.py +++ b/source/blender/python/api2_2x/doc/Mesh.py @@ -626,6 +626,9 @@ class Mesh: be set. Furthermore, if vertexColors is already set when faceUV is set, vertexColors is cleared. This is because the vertex color information is stored with UV faces, so enabling faceUV implies enabling vertexColors. + In addition, faceUV cannot be set when the mesh has no faces defined + (this is the same behavior as the UI). Attempting to do so will throw + a RuntimeError exception. @type faceUV: bool @ivar vertexColors: The mesh contains vertex colors. See L{faceUV} for the use of vertex colors when UV-mapped texture faces are enabled. |