[Bf-blender-cvs] [9965e83b506] refactor-mesh-uv-map-generic: Add python exceptions to soem asserts, to make sure there's a warning in release mode.
Martijn Versteegh
noreply at git.blender.org
Fri Jan 6 15:20:16 CET 2023
Commit: 9965e83b506dbf737c401201642a1beb0fe9af3b
Author: Martijn Versteegh
Date: Fri Jan 6 15:13:24 2023 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB9965e83b506dbf737c401201642a1beb0fe9af3b
Add python exceptions to soem asserts, to make sure there's a warning in release mode.
===================================================================
M source/blender/python/bmesh/bmesh_py_types_meshdata.c
===================================================================
diff --git a/source/blender/python/bmesh/bmesh_py_types_meshdata.c b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
index d1134dacc85..71d2b996c7d 100644
--- a/source/blender/python/bmesh/bmesh_py_types_meshdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_meshdata.c
@@ -83,6 +83,7 @@ static PyObject *bpy_bmloopuv_pin_uv_get(BPy_BMLoopUV *self, void *UNUSED(closur
/* A non existing pin layer means nothing is currently pinned */
return self->pin ? PyBool_FromLong(*self->pin) : false;
}
+
static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UNUSED(closure))
{
/* TODO: if we add lazy allocation of the associated uv map bool layers to BMesh we need
@@ -94,6 +95,10 @@ static int bpy_bmloopuv_pin_uv_set(BPy_BMLoopUV *self, PyObject *value, void *UN
if (self->pin) {
*self->pin = PyC_Long_AsBool(value);
}
+ else {
+ PyErr_Format(PyExc_RuntimeError,
+ "active uv layer has no associated pin layer. This is a bug!");
+ }
return 0;
}
@@ -109,6 +114,10 @@ static int bpy_bmloopuv_select_set(BPy_BMLoopUV *self, PyObject *value, void *UN
if (self->vert_select) {
*self->vert_select = PyC_Long_AsBool(value);
}
+ else {
+ PyErr_Format(PyExc_RuntimeError,
+ "active uv layer has no associated vertex selection layer. This is a bug!");
+ }
return 0;
}
@@ -124,6 +133,10 @@ static int bpy_bmloopuv_select_edge_set(BPy_BMLoopUV *self, PyObject *value, voi
if (self->edge_select) {
*self->edge_select = PyC_Long_AsBool(value);
}
+ else {
+ PyErr_Format(PyExc_RuntimeError,
+ "active uv layer has no associated edge selection layer. This is a bug!");
+ }
return 0;
}
More information about the Bf-blender-cvs
mailing list