[Bf-blender-cvs] [02a1342641a] refactor-mesh-uv-map-generic: Create dependent layers for all uv layers created via python API.

Martijn Versteegh noreply at git.blender.org
Tue Dec 6 12:56:38 CET 2022


Commit: 02a1342641aae9f2c527759518272ec9df855feb
Author: Martijn Versteegh
Date:   Tue Dec 6 11:33:46 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB02a1342641aae9f2c527759518272ec9df855feb

Create dependent layers for all uv layers created via python API.

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

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 9aea303aca5..2bf288f22a3 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -511,6 +511,15 @@ static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject
     BM_data_layer_add(self->bm, data, self->type);
   }
 
+  if (self->type == CD_PROP_FLOAT2 && self->htype == BM_LOOP) {
+    /* Because adding CustomData layers to a bmesh will invalidate any existing pointers
+     * in Py objects we can't lazily add the associated bool layers. So add them all right
+     * now. */
+    const char *active_uv_name = CustomData_get_active_layer_name(&self->bm->ldata,
+                                                                  CD_PROP_FLOAT2);
+    BM_uv_map_ensure_selection_pin_attributes(self->bm, active_uv_name);
+  }
+
   index = CustomData_number_of_layers(data, self->type) - 1;
   BLI_assert(index >= 0);



More information about the Bf-blender-cvs mailing list