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_rip.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_rip.c')
-rw-r--r--source/blender/editors/uvedit/uvedit_rip.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/source/blender/editors/uvedit/uvedit_rip.c b/source/blender/editors/uvedit/uvedit_rip.c
index 272540d61c7..545cc57e3c4 100644
--- a/source/blender/editors/uvedit/uvedit_rip.c
+++ b/source/blender/editors/uvedit/uvedit_rip.c
@@ -52,7 +52,7 @@
/** Unordered loop data, stored in #BMLoop.head.index. */
typedef struct ULData {
- /** When this UV is selected as well as the next UV. */
+ /** When the specified UV edge is selected. */
uint is_select_edge : 1;
/**
* When only this UV is selected and none of the other UV's
@@ -762,15 +762,17 @@ static bool uv_rip_object(Scene *scene, Object *obedit, const float co[2], const
const MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (luv->flag & MLOOPUV_VERTSEL) {
const MLoopUV *luv_prev = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_uv_offset);
- const MLoopUV *luv_next = BM_ELEM_CD_GET_VOID_P(l->next, cd_loop_uv_offset);
- if (luv_next->flag & MLOOPUV_VERTSEL) {
+ if (luv->flag & MLOOPUV_EDGESEL) {
UL(l)->is_select_edge = true;
}
+ else if ((luv_prev->flag & MLOOPUV_EDGESEL) == 0) {
+ /* #bm_loop_uv_select_single_vert_validate validates below. */
+ UL(l)->is_select_vert_single = true;
+ is_all = false;
+ }
else {
- if ((luv_prev->flag & MLOOPUV_VERTSEL) == 0) {
- /* #bm_loop_uv_select_single_vert_validate validates below. */
- UL(l)->is_select_vert_single = true;
- }
+ /* Cases where all vertices of a face are selected but not all edges are selected. */
+ is_all = false;
}
}
else {
@@ -797,7 +799,7 @@ static bool uv_rip_object(Scene *scene, Object *obedit, const float co[2], const
}
}
- /* Special case: if we have selected faces, isolated them.
+ /* Special case: if we have selected faces, isolate them.
* This isn't a rip, however it's useful for users as a quick way
* to detach the selection.
*
@@ -812,6 +814,10 @@ static bool uv_rip_object(Scene *scene, Object *obedit, const float co[2], const
luv->flag &= ~MLOOPUV_VERTSEL;
changed = true;
}
+ if (luv->flag & MLOOPUV_EDGESEL) {
+ luv->flag &= ~MLOOPUV_EDGESEL;
+ changed = true;
+ }
}
}
}
@@ -871,6 +877,9 @@ static bool uv_rip_object(Scene *scene, Object *obedit, const float co[2], const
}
}
}
+ if (changed) {
+ uvedit_deselect_flush(scene, em);
+ }
return changed;
}