[Bf-blender-cvs] [4a00ad551bf] refactor-mesh-uv-map-generic: Also deprecate MLoopUV flags
Hans Goudey
noreply at git.blender.org
Sat Aug 27 01:45:10 CEST 2022
Commit: 4a00ad551bfba8fad2661c7a90d87e886fc30982
Author: Hans Goudey
Date: Fri Aug 26 18:35:06 2022 -0500
Branches: refactor-mesh-uv-map-generic
https://developer.blender.org/rB4a00ad551bfba8fad2661c7a90d87e886fc30982
Also deprecate MLoopUV flags
===================================================================
M source/blender/blenkernel/intern/mesh_legacy_convert.cc
M source/blender/editors/uvedit/uvedit_select.c
M source/blender/makesdna/DNA_meshdata_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 5e0468075dc..1830e00479d 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -1045,9 +1045,8 @@ void BKE_mesh_legacy_convert_uvs_to_generic(Mesh *mesh)
}
for (const StringRefNull name : uv_layers_to_convert) {
- const MLoopUV *mloopuv = static_cast<const MLoopUV *>(
- CustomData_get_layer_named(&mesh->ldata, CD_MLOOPUV, name.c_str()));
- uint32_t needed_boolean_attributes = threading::parallel_reduce(
+ const MLoopUV *mloopuv = static_cast<const MLoopUV *>(CustomData_get_layer_named(&mesh->ldata, CD_MLOOPUV, name.c_str()));
+ const uint32_t needed_boolean_attributes = threading::parallel_reduce(
IndexRange(mesh->totloop),
4096,
0,
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 337b5a7fa74..09d9b97a977 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -1207,14 +1207,11 @@ bool uvedit_vert_is_all_other_faces_selected(const Scene *scene,
return true;
}
-/**
- * Clear specified UV flag (vert/edge/pinned).
- */
-static void bm_uv_flag_clear(const Scene *scene,
- BMesh *bm,
- const int flag,
- const BMUVOffsets offsets)
+static void bm_clear_uv_vert_selection(const Scene *scene, BMesh *bm, const BMUVOffsets offsets)
{
+ if (offsets.select_vert == -1) {
+ return;
+ }
BMFace *efa;
BMLoop *l;
BMIter iter, liter;
@@ -1223,15 +1220,7 @@ static void bm_uv_flag_clear(const Scene *scene,
continue;
}
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
- if (flag & MLOOPUV_EDGESEL) {
- BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, false);
- }
- if (flag & MLOOPUV_VERTSEL) {
- BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false);
- }
- if (flag & MLOOPUV_PINNED) {
- BM_ELEM_CD_SET_BOOL(l, offsets.pin, false);
- }
+ BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false);
}
}
}
@@ -2266,12 +2255,12 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em)
}
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) {
- /* Use #MLOOPUV_EDGESEL to flag edges that must be selected. */
+ /* Use UV edge selection to find vertices and edges that must be selected. */
bool es = BM_ELEM_CD_GET_OPT_BOOL(l, offsets.select_edge);
BM_ELEM_CD_SET_BOOL(l, offsets.select_edge, !es);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, false);
}
- /* Use #MLOOPUV_VERTSEL to flag verts that must be selected. */
+ /* Use UV vertex selection to find vertices and edges that must be selected. */
else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) {
bool vs = BM_ELEM_CD_GET_OPT_BOOL(l, offsets.select_vert);
BM_ELEM_CD_SET_BOOL(l, offsets.select_vert, !vs);
@@ -3403,10 +3392,10 @@ static void uv_select_flush_from_tag_loop(const Scene *scene, Object *obedit, co
}
/**
- * Flush the selection from UV edge flags based on sticky modes.
+ * Flush the selection from UV edges based on sticky modes.
*
* Useful when performing edge selections in different sticky modes, since setting the required
- * edge flags (#MLOOPUV_EDGESEL) is done manually or using #uvedit_edge_select_set_noflush,
+ * edge selection is done manually or using #uvedit_edge_select_set_noflush,
* but dealing with sticky modes for vertex selections is best done in a separate function.
*
* \note Current behavior is selecting only; deselecting can be added but the behavior isn't
@@ -3426,11 +3415,11 @@ static void uv_select_flush_from_loop_edge_flag(const Scene *scene, BMEditMesh *
if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 &&
ELEM(ts->uv_sticky, SI_STICKY_LOC, SI_STICKY_VERTEX)) {
- /* Use the #MLOOPUV_EDGESEL flag to identify which verts must to be selected */
+ /* Use UV edge selection to identify which verts must to be selected */
struct UvVertMap *vmap;
uint efa_index;
/* Clear UV vert flags */
- bm_uv_flag_clear(scene, em->bm, MLOOPUV_VERTSEL, offsets);
+ bm_clear_uv_vert_selection(scene, em->bm, offsets);
BM_mesh_elem_table_ensure(em->bm, BM_FACE);
vmap = BM_uv_vert_map_create(em->bm, false, false);
diff --git a/source/blender/makesdna/DNA_meshdata_types.h b/source/blender/makesdna/DNA_meshdata_types.h
index 151113a30c9..166c13c2d2e 100644
--- a/source/blender/makesdna/DNA_meshdata_types.h
+++ b/source/blender/makesdna/DNA_meshdata_types.h
@@ -321,16 +321,16 @@ typedef enum eMVertSkinFlag {
/** \name Custom Data (Loop)
* \{ */
+#ifdef DNA_DEPRECATED_ALLOW
+
/**
* UV coordinate for a polygon face & flag for selection & other options.
* Deprecated, but kept to read old files. UV coordinates are now stored as #CD_PROP_FLOAT2 layers.
*/
-#ifdef DNA_DEPRECATED_ALLOW
typedef struct MLoopUV {
float uv[2];
int flag;
} MLoopUV;
-#endif
/** #MLoopUV.flag */
enum {
@@ -339,6 +339,8 @@ enum {
MLOOPUV_PINNED = (1 << 2),
};
+#endif
+
/**
* \note While alpha is not currently in the 3D Viewport,
* this may eventually be added back, keep this value set to 255.
More information about the Bf-blender-cvs
mailing list