Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in>2022-03-03 15:02:07 +0300
committerSiddhartha Jejurkar <f20180617@goa.bits-pilani.ac.in>2022-03-03 15:29:09 +0300
commitffaaa0bcbf477c30cf3665b9330bbbb767397169 (patch)
tree4ae6a873568f4267691d991abff10928bb299f36 /source/blender/editors/uvedit/uvedit_path.c
parent76879e37024504d6f14609730be9ac17b5a02293 (diff)
UV: Edge selection support
This patch adds edge selection support for UV editing (refer T76545). Developed as a part of GSoC 2021 project - UV Editor Improvements. Previously, selections in the UV editor always flushed down to vertices and this caused multiple issues such as T76343, T78757 and T26676. This patch fixes that by adding edge selection support for all UV operators and adding support for flushing selections between vertices and edges. Updating UV select modes is now done using a separate operator, which also handles select mode flushing and undo for UV select modes. Drawing edges (in UV edge mode) is also updated to match the edit-mesh display in the 3D viewport. Notes on technical changes made with this patch: * MLOOPUV_EDGESEL flag is restored (was removed in rB9fa29fe7652a). * Support for flushing selection between vertices and edges. * Restored the BMLoopUV.select_edge boolean in the Python API. * New operator to update UV select modes and flushing. * UV select mode is now part of editmesh undo. TODOs added with this patch: * Edge support for shortest path operator (currently uses vertex path logic). * Change default theme color instead of reducing contrast with edge-select. * Proper UV element selections for Reveal Hidden operator. Reviewed By: campbellbarton Differential Revision: https://developer.blender.org/D12028
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_path.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_path.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c
index 33621c1f0b6..7c6960a634a 100644
--- a/source/blender/editors/uvedit/uvedit_path.c
+++ b/source/blender/editors/uvedit/uvedit_path.c
@@ -234,6 +234,9 @@ static int mouse_mesh_uv_shortest_path_vert(Scene *scene,
const int cd_loop_uv_offset)
{
const char uv_selectmode = ED_uvedit_select_mode_get(scene);
+ /* TODO(@sidd017): Implement logic to calculate shortest path for UV edges, since we now support
+ * proper edge selection for UVs (D12028).
+ * Till then continue using vertex path to fake shortest path calculation for edges. */
const bool use_fake_edge_select = (uv_selectmode & UV_SELECT_EDGE);
BMEditMesh *em = BKE_editmesh_from_object(obedit);
BMesh *bm = em->bm;
@@ -377,7 +380,7 @@ static bool facetag_test_cb(BMFace *f, void *user_data_v)
BMIter iter;
BMLoop *l_iter;
BM_ITER_ELEM (l_iter, &iter, f, BM_LOOPS_OF_FACE) {
- if (!uvedit_uv_select_test(scene, l_iter, cd_loop_uv_offset)) {
+ if (!uvedit_edge_select_test(scene, l_iter, cd_loop_uv_offset)) {
return false;
}
}
@@ -531,8 +534,21 @@ static bool uv_shortest_path_pick_ex(Scene *scene,
* flush the selection from the vertices. */
BM_mesh_select_mode_flush_ex(em->bm, SCE_SELECT_VERTEX, BM_SELECT_LEN_FLUSH_RECALC_ALL);
}
+ ED_uvedit_select_sync_flush(scene->toolsettings, em, select);
+ }
+ else {
+ if (uv_selectmode & UV_SELECT_EDGE) {
+ /* TODO(@sidd017): Remove this case when adding proper uv edge support for this operator.
+ * In the meantime, this case helps ensures proper UV selection states for edge mode. */
+ if (select) {
+ uvedit_select_flush(scene, em);
+ }
+ else {
+ uvedit_deselect_flush(scene, em);
+ }
+ }
+ ED_uvedit_selectmode_flush(scene, em);
}
- ED_uvedit_select_sync_flush(scene->toolsettings, em, select);
}
if (ts->uv_flag & UV_SYNC_SELECTION) {
@@ -603,7 +619,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
else if (uv_selectmode & UV_SELECT_EDGE) {
UvNearestHit hit = UV_NEAREST_HIT_INIT_MAX(&region->v2d);
- if (!uv_find_nearest_edge(scene, obedit, co, &hit)) {
+ if (!uv_find_nearest_edge(scene, obedit, co, 0.0f, &hit)) {
return OPERATOR_CANCELLED;
}