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/include/ED_uvedit.h
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/include/ED_uvedit.h')
-rw-r--r--source/blender/editors/include/ED_uvedit.h149
1 files changed, 114 insertions, 35 deletions
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 26af378b1b7..cf4d023ccdf 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -25,6 +25,7 @@ struct Scene;
struct SpaceImage;
struct ToolSettings;
struct ViewLayer;
+struct bContext;
struct bNode;
struct bNodeTree;
struct wmKeyConfig;
@@ -80,7 +81,8 @@ void ED_object_assign_active_image(struct Main *bmain,
bool ED_uvedit_test(struct Object *obedit);
-/* visibility and selection */
+/* Visibility and selection tests. */
+
bool uvedit_face_visible_test_ex(const struct ToolSettings *ts, struct BMFace *efa);
bool uvedit_face_select_test_ex(const struct ToolSettings *ts,
struct BMFace *efa,
@@ -91,24 +93,50 @@ bool uvedit_edge_select_test_ex(const struct ToolSettings *ts,
bool uvedit_uv_select_test_ex(const struct ToolSettings *ts,
struct BMLoop *l,
int cd_loop_uv_offset);
-
bool uvedit_face_visible_test(const struct Scene *scene, struct BMFace *efa);
bool uvedit_face_select_test(const struct Scene *scene, struct BMFace *efa, int cd_loop_uv_offset);
bool uvedit_edge_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset);
bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_loop_uv_offset);
-/* uv face */
-void uvedit_face_select_set_with_sticky(const struct Scene *scene,
- struct BMEditMesh *em,
- struct BMFace *efa,
- bool select,
- bool do_history,
- int cd_loop_uv_offset);
+
+/* Individual UV element selection functions. */
+
+/**
+ * \brief Select UV Face
+ *
+ * Changes selection state of a single UV Face.
+ */
void uvedit_face_select_set(const struct Scene *scene,
struct BMEditMesh *em,
struct BMFace *efa,
bool select,
bool do_history,
int cd_loop_uv_offset);
+/**
+ * \brief Select UV Edge
+ *
+ * Changes selection state of a single UV Edge.
+ */
+void uvedit_edge_select_set(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ bool select,
+ bool do_history,
+ int cd_loop_uv_offset);
+/**
+ * \brief Select UV Vertex
+ *
+ * Changes selection state of a single UV vertex.
+ */
+void uvedit_uv_select_set(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ bool select,
+ bool do_history,
+ int cd_loop_uv_offset);
+
+/* Low level functions for (de)selecting individual UV elements. Ensure UV face visibility before
+ * use. */
+
void uvedit_face_select_enable(const struct Scene *scene,
struct BMEditMesh *em,
struct BMFace *efa,
@@ -118,19 +146,6 @@ void uvedit_face_select_disable(const struct Scene *scene,
struct BMEditMesh *em,
struct BMFace *efa,
int cd_loop_uv_offset);
-/* uv edge */
-void uvedit_edge_select_set_with_sticky(const struct Scene *scene,
- struct BMEditMesh *em,
- struct BMLoop *l,
- bool select,
- bool do_history,
- uint cd_loop_uv_offset);
-void uvedit_edge_select_set(const struct Scene *scene,
- struct BMEditMesh *em,
- struct BMLoop *l,
- bool select,
- bool do_history,
- int cd_loop_uv_offset);
void uvedit_edge_select_enable(const struct Scene *scene,
struct BMEditMesh *em,
struct BMLoop *l,
@@ -140,19 +155,6 @@ void uvedit_edge_select_disable(const struct Scene *scene,
struct BMEditMesh *em,
struct BMLoop *l,
int cd_loop_uv_offset);
-/* uv vert */
-void uvedit_uv_select_set_with_sticky(const struct Scene *scene,
- struct BMEditMesh *em,
- struct BMLoop *l,
- bool select,
- bool do_history,
- uint cd_loop_uv_offset);
-void uvedit_uv_select_set(const struct Scene *scene,
- struct BMEditMesh *em,
- struct BMLoop *l,
- bool select,
- bool do_history,
- int cd_loop_uv_offset);
void uvedit_uv_select_enable(const struct Scene *scene,
struct BMEditMesh *em,
struct BMLoop *l,
@@ -163,6 +165,83 @@ void uvedit_uv_select_disable(const struct Scene *scene,
struct BMLoop *l,
int cd_loop_uv_offset);
+/* Sticky mode UV element selection functions. */
+
+void uvedit_face_select_set_with_sticky(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMFace *efa,
+ bool select,
+ bool do_history,
+ int cd_loop_uv_offset);
+void uvedit_edge_select_set_with_sticky(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ bool select,
+ bool do_history,
+ uint cd_loop_uv_offset);
+void uvedit_uv_select_set_with_sticky(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ bool select,
+ bool do_history,
+ uint cd_loop_uv_offset);
+
+/* Low level functions for sticky element selection (sticky mode independent). Type of sticky
+ * selection is specified explicitly (using sticky_flag, except for face selection). */
+
+void uvedit_face_select_shared_vert(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMFace *efa,
+ const bool select,
+ const bool do_history,
+ const int cd_loop_uv_offset);
+void uvedit_edge_select_shared_vert(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ const bool select,
+ const int sticky_flag,
+ const bool do_history,
+ const int cd_loop_uv_offset);
+void uvedit_uv_select_shared_vert(const struct Scene *scene,
+ struct BMEditMesh *em,
+ struct BMLoop *l,
+ const bool select,
+ const int sticky_flag,
+ const bool do_history,
+ const int cd_loop_uv_offset);
+
+/* Sets required UV edge flags as specified by the sticky_flag. */
+void uvedit_edge_select_set_noflush(const struct Scene *scene,
+ struct BMLoop *l,
+ const bool select,
+ const int sticky_flag,
+ const int cd_loop_uv_offset);
+
+/**
+ * \brief UV Select Mode set
+ *
+ * Updates selection state for UVs based on the select mode and sticky mode. Similar to
+ * #EDBM_selectmode_set.
+ */
+void ED_uvedit_selectmode_clean(struct Scene *scene, struct Object *obedit);
+void ED_uvedit_selectmode_clean_multi(struct bContext *C);
+
+/**
+ * \brief UV Select Mode Flush
+ *
+ * Flushes selections upwards as dictated by the UV select mode.
+ */
+void ED_uvedit_selectmode_flush(struct Scene *scene, struct BMEditMesh *em);
+
+/**
+ * Mode independent UV de-selection flush.
+ */
+void uvedit_deselect_flush(struct Scene *scene, struct BMEditMesh *em);
+/**
+ * Mode independent UV selection flush.
+ */
+void uvedit_select_flush(struct Scene *scene, struct BMEditMesh *em);
+
bool ED_uvedit_nearest_uv(const struct Scene *scene,
struct Object *obedit,
const float co[2],