[Bf-blender-cvs] [1d5cdde29f1] refactor-mesh-uv-map-generic: Rename BM_uv_map_ensure_selection_pin_attributes.

Martijn Versteegh noreply at git.blender.org
Tue Dec 6 21:34:23 CET 2022


Commit: 1d5cdde29f1a08807c19f35f8374745fe326e3d6
Author: Martijn Versteegh
Date:   Tue Dec 6 21:33:08 2022 +0100
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB1d5cdde29f1a08807c19f35f8374745fe326e3d6

Rename BM_uv_map_ensure_selection_pin_attributes.

Rename it to BM_uv_map_ensure_selection_and_pin_attributes.

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

M	source/blender/bmesh/intern/bmesh_interp.c
M	source/blender/bmesh/intern/bmesh_interp.h
M	source/blender/editors/mesh/mesh_data.cc
M	source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
M	source/blender/python/bmesh/bmesh_py_types_customdata.c

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

diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 6a8d7c99b8c..7c13b2e7663 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -873,7 +873,7 @@ void BM_data_layer_ensure_named(BMesh *bm, CustomData *data, int type, const cha
   }
 }
 
-void BM_uv_map_ensure_selection_pin_attributes(BMesh *bm, const char *uv_map_name)
+void BM_uv_map_ensure_selection_and_pin_attributes(BMesh *bm, const char *uv_map_name)
 {
   char name[MAX_CUSTOMDATA_LAYER_NAME];
   BM_data_layer_ensure_named(
diff --git a/source/blender/bmesh/intern/bmesh_interp.h b/source/blender/bmesh/intern/bmesh_interp.h
index f8bb45af1e7..0b7b5197074 100644
--- a/source/blender/bmesh/intern/bmesh_interp.h
+++ b/source/blender/bmesh/intern/bmesh_interp.h
@@ -65,7 +65,7 @@ void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *
 void BM_data_layer_ensure_named(BMesh *bm, CustomData *data, int type, const char *name);
 void BM_data_layer_free(BMesh *bm, CustomData *data, int type);
 
-void BM_uv_map_ensure_selection_pin_attributes(BMesh *bm, const char *uv_map_name);
+void BM_uv_map_ensure_selection_and_pin_attributes(BMesh *bm, const char *uv_map_name);
 void BM_uv_map_ensure_vert_selection_attribute(BMesh *bm, const char *uv_map_name);
 void BM_uv_map_ensure_edge_selection_attribute(BMesh *bm, const char *uv_map_name);
 void BM_uv_map_ensure_pin_attribute(BMesh *bm, const char *uv_map_name);
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index 270d1dd2350..098bf62677a 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -246,7 +246,7 @@ int ED_mesh_uv_add(
     }
 
     BM_data_layer_add_named(em->bm, &em->bm->ldata, CD_PROP_FLOAT2, name);
-    BM_uv_map_ensure_selection_pin_attributes(em->bm, name);
+    BM_uv_map_ensure_selection_and_pin_attributes(em->bm, name);
     /* copy data from active UV */
     if (layernum_dst && do_init) {
       const int layernum_src = CustomData_get_active_layer(&em->bm->ldata, CD_PROP_FLOAT2);
diff --git a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
index e7b6f9b5205..2543b21e7fb 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_mesh_primitive_ico_sphere.cc
@@ -36,8 +36,11 @@ static Mesh *create_ico_sphere_mesh(const int subdivisions, const float radius)
   const BMAllocTemplate allocsize = {0, 0, 0, 0};
   BMesh *bm = BM_mesh_create(&allocsize, &bmesh_create_params);
   BM_data_layer_add_named(bm, &bm->ldata, CD_PROP_FLOAT2, nullptr);
-
-  BM_uv_map_ensure_selection_pin_attributes(
+  /* Make sure the associated bool layers exists as well.
+   * Normally this would be done when adding a UV layer via python
+   * or when copying from Mesh, but when we 'manually' create the UV layer
+   * we need to make sure the bool layers exist as well. */
+  BM_uv_map_ensure_selection_and_pin_attributes(
       bm, CustomData_get_layer_name(&bm->ldata, CD_PROP_FLOAT2, 0));
 
   BMO_op_callf(bm,
diff --git a/source/blender/python/bmesh/bmesh_py_types_customdata.c b/source/blender/python/bmesh/bmesh_py_types_customdata.c
index 2bf288f22a3..659ec0bb104 100644
--- a/source/blender/python/bmesh/bmesh_py_types_customdata.c
+++ b/source/blender/python/bmesh/bmesh_py_types_customdata.c
@@ -468,7 +468,7 @@ static PyObject *bpy_bmlayercollection_verify(BPy_BMLayerCollection *self)
      * 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);
+    BM_uv_map_ensure_selection_and_pin_attributes(self->bm, active_uv_name);
   }
 
   BLI_assert(index >= 0);
@@ -517,7 +517,7 @@ static PyObject *bpy_bmlayercollection_new(BPy_BMLayerCollection *self, PyObject
      * 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);
+    BM_uv_map_ensure_selection_and_pin_attributes(self->bm, active_uv_name);
   }
 
   index = CustomData_number_of_layers(data, self->type) - 1;



More information about the Bf-blender-cvs mailing list