Commit: 78fb2d3d2af735b164c42dfbc459db8fb51de210 Author: Hans Goudey Date: Thu Aug 25 17:50:16 2022 -0400 Branches: refactor-mesh-uv-map-generic https://developer.blender.org/rB78fb2d3d2af735b164c42dfbc459db8fb51de210
Merge branch 'master' into refactor-mesh-uv-map-generic =================================================================== =================================================================== diff --cc source/blender/blenkernel/intern/mesh.cc index 1e587d84f3d,7f2c09f049b..11899d3938f --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@@ -247,18 -246,17 +247,21 @@@ static void mesh_blend_write(BlendWrite memset(&mesh->pdata, 0, sizeof(mesh->pdata)); } else { + Set<std::string> names_to_skip; if (!BLO_write_is_undo(writer)) { BKE_mesh_legacy_convert_hide_layers_to_flags(mesh); + /* When converting to the old mesh format, don't save redunant attributes. */ + names_to_skip.add_multiple_new({".hide_vert", ".hide_edge", ".hide_poly"}); } - CustomData_blend_write_prepare(mesh->vdata, vert_layers, {".hide_vert"}); - CustomData_blend_write_prepare(mesh->edata, edge_layers, {".hide_edge"}); - CustomData_blend_write_prepare(mesh->ldata, loop_layers); - CustomData_blend_write_prepare(mesh->pdata, poly_layers, {".hide_poly"}); + CustomData_blend_write_prepare(mesh->vdata, vert_layers, names_to_skip); + CustomData_blend_write_prepare(mesh->edata, edge_layers, names_to_skip); + CustomData_blend_write_prepare(mesh->ldata, loop_layers, names_to_skip); + CustomData_blend_write_prepare(mesh->pdata, poly_layers, names_to_skip); + + if (!BLO_write_is_undo(writer)) { + BKE_mesh_legacy_convert_uvs_to_struct(mesh, temp_arrays_for_legacy_format, loop_layers); + } } BLO_write_id_struct(writer, Mesh, id_address, &mesh->id); diff --cc source/blender/bmesh/tools/bmesh_path_uv.c index 172fe8c5d0f,6531677fce6..5ba613fd130 --- a/source/blender/bmesh/tools/bmesh_path_uv.c +++ b/source/blender/bmesh/tools/bmesh_path_uv.c @@@ -65,10 -65,10 +65,10 @@@ static void verttag_add_adjacent_uv(Hea const struct BMCalcPathUVParams *params) { BLI_assert(params->aspect_y != 0.0f); - const uint cd_loop_uv_offset = params->cd_loop_uv_offset; + const int cd_loop_uv_offset = params->cd_loop_uv_offset; const int l_a_index = BM_elem_index_get(l_a); - const MLoopUV *luv_a = BM_ELEM_CD_GET_VOID_P(l_a, cd_loop_uv_offset); - const float uv_a[2] = {luv_a->uv[0], luv_a->uv[1] / params->aspect_y}; + const float *luv_a = BM_ELEM_CD_GET_FLOAT_P(l_a, cd_loop_uv_offset); + const float uv_a[2] = {luv_a[0], luv_a[1] / params->aspect_y}; { BMIter liter; diff --cc source/blender/editors/include/ED_uvedit.h index 656783d7f57,38e542fc0ca..e7a90daf96e --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@@ -143,34 -139,32 +143,34 @@@ void uvedit_uv_select_set(const struct * use. */ void uvedit_face_select_enable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMFace *efa, bool do_history, - int cd_loop_uv_offset); + UVMap_Offsets offsets); void uvedit_face_select_disable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMFace *efa, - int cd_loop_uv_offset); + UVMap_Offsets offsets); + void uvedit_edge_select_enable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMLoop *l, bool do_history, - int cd_loop_uv_offset); + UVMap_Offsets offsets); void uvedit_edge_select_disable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMLoop *l, - int cd_loop_uv_offset); + UVMap_Offsets offsets); + void uvedit_uv_select_enable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMLoop *l, bool do_history, - int cd_loop_uv_offset); + UVMap_Offsets offsets); void uvedit_uv_select_disable(const struct Scene *scene, - struct BMEditMesh *em, + struct BMesh *bm, struct BMLoop *l, - int cd_loop_uv_offset); + UVMap_Offsets offsets); /* Sticky mode UV element selection functions. */ diff --cc source/blender/editors/mesh/editmesh_utils.c index 30de89c7cee,a6a6b095c31..28d336542b8 --- a/source/blender/editors/mesh/editmesh_utils.c +++ b/source/blender/editors/mesh/editmesh_utils.c @@@ -642,7 -644,7 +642,7 @@@ static int bm_uv_edge_select_build_isla UvElement *islandbuf, uint *map, bool uv_selected, - UVMap_Offsets offsets) - const int cd_loop_uv_offset) ++ const UVMap_Offsets offsets) { BM_uv_element_map_ensure_head_table(element_map); diff --cc source/blender/editors/uvedit/uvedit_islands.c index ab838d111d5,68c00b18b09..62a211b1aa8 --- a/source/blender/editors/uvedit/uvedit_islands.c +++ b/source/blender/editors/uvedit/uvedit_islands.c @@@ -338,8 -340,9 +340,9 @@@ int bm_mesh_calc_uv_islands(const Scen const bool only_selected_uvs, const bool use_seams, const float aspect_y, - const int cd_loop_uv_offset) + const UVMap_Offsets uv_offsets) { - BLI_assert(cd_loop_uv_offset >= 0); ++ BLI_assert(uv_offsets.uv >= 0); int island_added = 0; BM_mesh_elem_table_ensure(bm, BM_FACE); diff --cc source/blender/editors/uvedit/uvedit_path.c index cc63b5eeb50,19218259b95..98233d2fd99 --- a/source/blender/editors/uvedit/uvedit_path.c +++ b/source/blender/editors/uvedit/uvedit_path.c @@@ -148,9 -148,9 +148,9 @@@ static void verttag_set_cb(BMLoop *l, b BMLoop *l_iter; BM_ITER_ELEM (l_iter, &iter, l->v, BM_LOOPS_OF_VERT) { if (verttag_filter_cb(l_iter, user_data)) { - float const *luv_iter = BM_ELEM_CD_GET_FLOAT_P(l_iter, cd_loop_uv_offset); - MLoopUV *luv_iter = BM_ELEM_CD_GET_VOID_P(l_iter, cd_loop_uv_offset); - if (equals_v2v2(luv->uv, luv_iter->uv)) { - uvedit_uv_select_set(scene, em->bm, l_iter, val, false, cd_loop_uv_offset); ++ const float *luv_iter = BM_ELEM_CD_GET_FLOAT_P(l_iter, cd_loop_uv_offset); + if (equals_v2v2(luv, luv_iter)) { + uvedit_uv_select_set(scene, em, l_iter, val, false, user_data->offsets); } } } diff --cc source/blender/editors/uvedit/uvedit_select.c index 0f3fa8fedcf,8fc97dbe0ce..2266b8e964a --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@@ -207,7 -207,7 +207,7 @@@ static void uvedit_vertex_select_tagged BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) { BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { if (BM_elem_flag_test(l->v, BM_ELEM_TAG)) { - uvedit_uv_select_set(scene, em, l, select, false, offsets); - uvedit_uv_select_set(scene, em->bm, l, select, false, cd_loop_uv_offset); ++ uvedit_uv_select_set(scene, em->bm, l, select, false, offsets); } } } @@@ -312,22 -317,20 +312,20 @@@ void uvedit_face_select_set(const Scen BMFace *efa, const bool select, const bool do_history, - const int cd_loop_uv_offset) + const UVMap_Offsets offsets) { if (select) { - uvedit_face_select_enable(scene, em, efa, do_history, offsets); - uvedit_face_select_enable(scene, bm, efa, do_history, cd_loop_uv_offset); ++ uvedit_face_select_enable(scene, bm, efa, do_history, offsets); } else { - uvedit_face_select_disable(scene, em, efa, offsets); - uvedit_face_select_disable(scene, bm, efa, cd_loop_uv_offset); ++ uvedit_face_select_disable(scene, bm, efa, offsets); } } - void uvedit_face_select_enable(const Scene *scene, - BMEditMesh *em, - BMFace *efa, - const bool do_history, - const UVMap_Offsets offsets) + void uvedit_face_select_enable( - const Scene *scene, BMesh *bm, BMFace *efa, const bool do_history, const int cd_loop_uv_offset) ++ const Scene *scene, BMesh *bm, BMFace *efa, const bool do_history, const UVMap_Offsets offsets) { - BLI_assert(cd_loop_uv_offset >= 0); ++ BLI_assert(offsets.uv >= 0); const ToolSettings *ts = scene->toolsettings; if (ts->uv_flag & UV_SYNC_SELECTION) { @@@ -348,10 -352,11 +346,11 @@@ } void uvedit_face_select_disable(const Scene *scene, - BMEditMesh *em, + BMesh *bm, BMFace *efa, - const int cd_loop_uv_offset) + const UVMap_Offsets offsets) { - BLI_assert(cd_loop_uv_offset >= 0); ++ BLI_assert(offsets.uv >= 0); const ToolSettings *ts = scene->toolsettings; if (ts->uv_flag & UV_SYNC_SELECTION) { @@@ -402,7 -410,7 +401,7 @@@ void uvedit_edge_select_set_with_sticky { const ToolSettings *ts = scene->toolsettings; if (ts->uv_flag & UV_SYNC_SELECTION) { - uvedit_edge_select_set(scene, em, l, select, do_history, offsets); - uvedit_edge_select_set(scene, em->bm, l, select, do_history, cd_loop_uv_offset); ++ @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs