[Bf-blender-cvs] [673c7065857] refactor-mesh-uv-map-generic: Always ensure bool layers for pyhton api.

Martijn Versteegh noreply at git.blender.org
Sun Nov 13 21:25:49 CET 2022


Commit: 673c70658573a40899dac7a23454f9aa76d054aa
Author: Martijn Versteegh
Date:   Sun Nov 13 21:23:06 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB673c70658573a40899dac7a23454f9aa76d054aa

Always ensure bool layers for pyhton api.

When verifying a uv layer from the pytho api, always ensure
the associated bool layers. We can't lazily allocate them because
allocating CustomData layers on a BMesh reallocates layers thereby
invalidating existing python objects.

===================================================================

M	source/blender/python/bmesh/bmesh_py_types_customdata.c

===================================================================

diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 10ae6a33435..f6e9a6864d8 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -465,13 +465,13 @@ static PyObject *bpy_bmlayercollection_verify(BPy_BMLayerCollection *self)
      * in Py objects we can't lazily add the associated bool layers. So add them all right
      * now.
      */
-    if (self->type == CD_PROP_FLOAT2 && self->htype == BM_LOOP) {
-      const char *active_uv_name = CustomData_get_active_layer_name(&self->bm->ldata,
+  }
+  if (self->type == CD_PROP_FLOAT2 && self->htype == BM_LOOP) {
+    const char *active_uv_name = CustomData_get_active_layer_name(&self->bm->ldata,
                                                                     CD_PROP_FLOAT2);
-      BM_uv_map_ensure_vert_selection_attribute(self->bm, active_uv_name);
-      BM_uv_map_ensure_edge_selection_attribute(self->bm, active_uv_name);
-      BM_uv_map_ensure_pin_attribute(self->bm, active_uv_name);
-    }
+    BM_uv_map_ensure_vert_selection_attribute(self->bm, active_uv_name);
+    BM_uv_map_ensure_edge_selection_attribute(self->bm, active_uv_name);
+    BM_uv_map_ensure_pin_attribute(self->bm, active_uv_name);
   }
 
   BLI_assert(index >= 0);



More information about the Bf-blender-cvs mailing list