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:
-rw-r--r--release/scripts/startup/bl_ui/space_image.py2
-rw-r--r--source/blender/editors/include/ED_uvedit.h9
-rw-r--r--source/blender/editors/uvedit/uvedit_ops.c2
-rw-r--r--source/blender/editors/uvedit/uvedit_path.c48
-rw-r--r--source/blender/editors/uvedit/uvedit_select.c109
-rw-r--r--source/blender/makesdna/DNA_scene_types.h10
-rw-r--r--source/blender/makesdna/DNA_space_types.h12
-rw-r--r--source/blender/makesrna/intern/rna_scene.c26
-rw-r--r--source/blender/makesrna/intern/rna_space.c27
9 files changed, 92 insertions, 153 deletions
diff --git a/release/scripts/startup/bl_ui/space_image.py b/release/scripts/startup/bl_ui/space_image.py
index 16e3f32e88a..5b840fae341 100644
--- a/release/scripts/startup/bl_ui/space_image.py
+++ b/release/scripts/startup/bl_ui/space_image.py
@@ -780,7 +780,7 @@ class IMAGE_HT_header(Header):
layout.template_edit_mode_selection()
else:
layout.prop(tool_settings, "uv_select_mode", text="", expand=True)
- layout.prop(uvedit, "sticky_select_mode", icon_only=True)
+ layout.prop(tool_settings, "uv_sticky_select_mode", icon_only=True)
IMAGE_MT_editor_menus.draw_collapsible(context, layout)
diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h
index 0c9ddc97508..26af378b1b7 100644
--- a/source/blender/editors/include/ED_uvedit.h
+++ b/source/blender/editors/include/ED_uvedit.h
@@ -97,8 +97,7 @@ bool uvedit_face_select_test(const struct Scene *scene, struct BMFace *efa, int
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 SpaceImage *sima,
- const struct Scene *scene,
+void uvedit_face_select_set_with_sticky(const struct Scene *scene,
struct BMEditMesh *em,
struct BMFace *efa,
bool select,
@@ -120,8 +119,7 @@ void uvedit_face_select_disable(const struct Scene *scene,
struct BMFace *efa,
int cd_loop_uv_offset);
/* uv edge */
-void uvedit_edge_select_set_with_sticky(const struct SpaceImage *sima,
- const struct Scene *scene,
+void uvedit_edge_select_set_with_sticky(const struct Scene *scene,
struct BMEditMesh *em,
struct BMLoop *l,
bool select,
@@ -143,8 +141,7 @@ void uvedit_edge_select_disable(const struct Scene *scene,
struct BMLoop *l,
int cd_loop_uv_offset);
/* uv vert */
-void uvedit_uv_select_set_with_sticky(const struct SpaceImage *sima,
- const struct Scene *scene,
+void uvedit_uv_select_set_with_sticky(const struct Scene *scene,
struct BMEditMesh *em,
struct BMLoop *l,
bool select,
diff --git a/source/blender/editors/uvedit/uvedit_ops.c b/source/blender/editors/uvedit/uvedit_ops.c
index 3d5b9207ad1..ccaabe18620 100644
--- a/source/blender/editors/uvedit/uvedit_ops.c
+++ b/source/blender/editors/uvedit/uvedit_ops.c
@@ -1572,7 +1572,7 @@ static int uv_reveal_exec(bContext *C, wmOperator *op)
const ToolSettings *ts = scene->toolsettings;
const bool use_face_center = (ts->uv_selectmode == UV_SELECT_FACE);
- const bool stickymode = sima ? (sima->sticky != SI_STICKY_DISABLE) : 1;
+ const bool stickymode = sima ? (ts->uv_sticky != SI_STICKY_DISABLE) : 1;
const bool select = RNA_boolean_get(op->ptr, "select");
uint objects_len = 0;
diff --git a/source/blender/editors/uvedit/uvedit_path.c b/source/blender/editors/uvedit/uvedit_path.c
index 225b595852f..33621c1f0b6 100644
--- a/source/blender/editors/uvedit/uvedit_path.c
+++ b/source/blender/editors/uvedit/uvedit_path.c
@@ -138,7 +138,6 @@ struct PathSelectParams {
};
struct UserData_UV {
- const SpaceImage *sima;
Scene *scene;
BMEditMesh *em;
uint cd_loop_uv_offset;
@@ -226,8 +225,7 @@ static void looptag_set_cb(BMLoop *l, bool val, void *user_data_v)
}
}
-static int mouse_mesh_uv_shortest_path_vert(const SpaceImage *sima,
- Scene *scene,
+static int mouse_mesh_uv_shortest_path_vert(Scene *scene,
Object *obedit,
const struct PathSelectParams *op_params,
BMLoop *l_src,
@@ -269,7 +267,6 @@ static int mouse_mesh_uv_shortest_path_vert(const SpaceImage *sima,
}
struct UserData_UV user_data = {
- .sima = sima,
.scene = scene,
.em = em,
.cd_loop_uv_offset = cd_loop_uv_offset,
@@ -389,15 +386,13 @@ static bool facetag_test_cb(BMFace *f, void *user_data_v)
static void facetag_set_cb(BMFace *f, bool val, void *user_data_v)
{
struct UserData_UV *user_data = user_data_v;
- const SpaceImage *sima = user_data->sima;
const Scene *scene = user_data->scene;
BMEditMesh *em = user_data->em;
const uint cd_loop_uv_offset = user_data->cd_loop_uv_offset;
- uvedit_face_select_set_with_sticky(sima, scene, em, f, val, false, cd_loop_uv_offset);
+ uvedit_face_select_set_with_sticky(scene, em, f, val, false, cd_loop_uv_offset);
}
-static int mouse_mesh_uv_shortest_path_face(const SpaceImage *sima,
- Scene *scene,
+static int mouse_mesh_uv_shortest_path_face(Scene *scene,
Object *obedit,
const struct PathSelectParams *op_params,
BMFace *f_src,
@@ -410,7 +405,6 @@ static int mouse_mesh_uv_shortest_path_face(const SpaceImage *sima,
int flush = 0;
struct UserData_UV user_data = {
- .sima = sima,
.scene = scene,
.em = em,
.cd_loop_uv_offset = cd_loop_uv_offset,
@@ -489,8 +483,7 @@ static int mouse_mesh_uv_shortest_path_face(const SpaceImage *sima,
static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op);
-static bool uv_shortest_path_pick_ex(const SpaceImage *sima,
- Scene *scene,
+static bool uv_shortest_path_pick_ex(Scene *scene,
Depsgraph *depsgraph,
Object *obedit,
const struct PathSelectParams *op_params,
@@ -508,8 +501,7 @@ static bool uv_shortest_path_pick_ex(const SpaceImage *sima,
/* pass */
}
else if (ele_src->head.htype == BM_FACE) {
- flush = mouse_mesh_uv_shortest_path_face(sima,
- scene,
+ flush = mouse_mesh_uv_shortest_path_face(scene,
obedit,
op_params,
(BMFace *)ele_src,
@@ -519,8 +511,7 @@ static bool uv_shortest_path_pick_ex(const SpaceImage *sima,
ok = true;
}
else if (ele_src->head.htype == BM_LOOP) {
- flush = mouse_mesh_uv_shortest_path_vert(sima,
- scene,
+ flush = mouse_mesh_uv_shortest_path_vert(scene,
obedit,
op_params,
(BMLoop *)ele_src,
@@ -560,7 +551,6 @@ static bool uv_shortest_path_pick_ex(const SpaceImage *sima,
static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEvent *event)
{
- SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
const ToolSettings *ts = scene->toolsettings;
const char uv_selectmode = ED_uvedit_select_mode_get(scene);
@@ -667,7 +657,7 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
}
uv_shortest_path_pick_ex(
- sima, scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, cd_loop_uv_offset);
+ scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, cd_loop_uv_offset);
/* To support redo. */
int index;
@@ -691,7 +681,6 @@ static int uv_shortest_path_pick_invoke(bContext *C, wmOperator *op, const wmEve
static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- const SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
const char uv_selectmode = ED_uvedit_select_mode_get(scene);
Object *obedit = CTX_data_edit_object(C);
@@ -742,15 +731,8 @@ static int uv_shortest_path_pick_exec(bContext *C, wmOperator *op)
path_select_params_from_op(op, &op_params);
op_params.track_active = true;
- if (!uv_shortest_path_pick_ex(sima,
- scene,
- depsgraph,
- obedit,
- &op_params,
- ele_src,
- ele_dst,
- aspect_y,
- cd_loop_uv_offset)) {
+ if (!uv_shortest_path_pick_ex(
+ scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, cd_loop_uv_offset)) {
return OPERATOR_CANCELLED;
}
@@ -791,7 +773,6 @@ void UV_OT_shortest_path_pick(wmOperatorType *ot)
static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- const SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
const char uv_selectmode = ED_uvedit_select_mode_get(scene);
bool found_valid_elements = false;
@@ -840,15 +821,8 @@ static int uv_shortest_path_select_exec(bContext *C, wmOperator *op)
struct PathSelectParams op_params;
path_select_params_from_op(op, &op_params);
- uv_shortest_path_pick_ex(sima,
- scene,
- depsgraph,
- obedit,
- &op_params,
- ele_src,
- ele_dst,
- aspect_y,
- cd_loop_uv_offset);
+ uv_shortest_path_pick_ex(
+ scene, depsgraph, obedit, &op_params, ele_src, ele_dst, aspect_y, cd_loop_uv_offset);
found_valid_elements = true;
}
diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c
index 75bcf7c546e..4454a8414b5 100644
--- a/source/blender/editors/uvedit/uvedit_select.c
+++ b/source/blender/editors/uvedit/uvedit_select.c
@@ -63,14 +63,8 @@ static void uv_select_all_perform_multi(Scene *scene,
const uint objects_len,
int action);
-static void uv_select_flush_from_tag_face(SpaceImage *sima,
- Scene *scene,
- Object *obedit,
- const bool select);
-static void uv_select_flush_from_tag_loop(SpaceImage *sima,
- Scene *scene,
- Object *obedit,
- const bool select);
+static void uv_select_flush_from_tag_face(Scene *scene, Object *obedit, const bool select);
+static void uv_select_flush_from_tag_loop(Scene *scene, Object *obedit, const bool select);
static void uv_select_tag_update_for_object(Depsgraph *depsgraph,
const ToolSettings *ts,
Object *obedit);
@@ -234,8 +228,7 @@ bool uvedit_face_select_test(const Scene *scene, BMFace *efa, const int cd_loop_
return uvedit_face_select_test_ex(scene->toolsettings, efa, cd_loop_uv_offset);
}
-void uvedit_face_select_set_with_sticky(const SpaceImage *sima,
- const Scene *scene,
+void uvedit_face_select_set_with_sticky(const Scene *scene,
BMEditMesh *em,
BMFace *efa,
const bool select,
@@ -251,8 +244,7 @@ void uvedit_face_select_set_with_sticky(const SpaceImage *sima,
BMLoop *l_iter, *l_first;
l_iter = l_first = BM_FACE_FIRST_LOOP(efa);
do {
- uvedit_uv_select_set_with_sticky(
- sima, scene, em, l_iter, select, do_history, cd_loop_uv_offset);
+ uvedit_uv_select_set_with_sticky(scene, em, l_iter, select, do_history, cd_loop_uv_offset);
} while ((l_iter = l_iter->next) != l_first);
}
@@ -344,8 +336,7 @@ bool uvedit_edge_select_test(const Scene *scene, BMLoop *l, const int cd_loop_uv
return uvedit_edge_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
}
-void uvedit_edge_select_set_with_sticky(const struct SpaceImage *sima,
- const Scene *scene,
+void uvedit_edge_select_set_with_sticky(const Scene *scene,
BMEditMesh *em,
BMLoop *l,
const bool select,
@@ -358,9 +349,8 @@ void uvedit_edge_select_set_with_sticky(const struct SpaceImage *sima,
return;
}
- uvedit_uv_select_set_with_sticky(sima, scene, em, l, select, do_history, cd_loop_uv_offset);
- uvedit_uv_select_set_with_sticky(
- sima, scene, em, l->next, select, do_history, cd_loop_uv_offset);
+ uvedit_uv_select_set_with_sticky(scene, em, l, select, do_history, cd_loop_uv_offset);
+ uvedit_uv_select_set_with_sticky(scene, em, l->next, select, do_history, cd_loop_uv_offset);
}
void uvedit_edge_select_set(const Scene *scene,
@@ -463,8 +453,7 @@ bool uvedit_uv_select_test(const Scene *scene, BMLoop *l, const int cd_loop_uv_o
return uvedit_uv_select_test_ex(scene->toolsettings, l, cd_loop_uv_offset);
}
-void uvedit_uv_select_set_with_sticky(const struct SpaceImage *sima,
- const Scene *scene,
+void uvedit_uv_select_set_with_sticky(const Scene *scene,
BMEditMesh *em,
BMLoop *l,
const bool select,
@@ -477,7 +466,7 @@ void uvedit_uv_select_set_with_sticky(const struct SpaceImage *sima,
return;
}
- const int sticky = sima->sticky;
+ const int sticky = ts->uv_sticky;
switch (sticky) {
case SI_STICKY_DISABLE: {
uvedit_uv_select_set(scene, em, l, select, do_history, cd_loop_uv_offset);
@@ -1133,8 +1122,7 @@ static void uv_select_edgeloop_single_side_tag(const Scene *scene,
}
}
-static int uv_select_edgeloop(
- SpaceImage *sima, Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
+static int uv_select_edgeloop(Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
{
BMEditMesh *em = BKE_editmesh_from_object(obedit);
bool select;
@@ -1197,8 +1185,7 @@ static int uv_select_edgeloop(
BMLoop *l_iter;
BM_ITER_ELEM (l_iter, &liter, f, BM_LOOPS_OF_FACE) {
if (BM_elem_flag_test(l_iter, BM_ELEM_TAG)) {
- uvedit_edge_select_set_with_sticky(
- sima, scene, em, l_iter, select, false, cd_loop_uv_offset);
+ uvedit_edge_select_set_with_sticky(scene, em, l_iter, select, false, cd_loop_uv_offset);
}
}
}
@@ -1213,8 +1200,7 @@ static int uv_select_edgeloop(
/** \name Edge Ring Select
* \{ */
-static int uv_select_edgering(
- const SpaceImage *sima, Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
+static int uv_select_edgering(Scene *scene, Object *obedit, UvNearestHit *hit, const bool extend)
{
const ToolSettings *ts = scene->toolsettings;
BMEditMesh *em = BKE_editmesh_from_object(obedit);
@@ -1253,12 +1239,10 @@ static int uv_select_edgering(
}
if (use_face_select) {
- uvedit_face_select_set_with_sticky(
- sima, scene, em, l_step->f, select, false, cd_loop_uv_offset);
+ uvedit_face_select_set_with_sticky(scene, em, l_step->f, select, false, cd_loop_uv_offset);
}
else {
- uvedit_edge_select_set_with_sticky(
- sima, scene, em, l_step, select, false, cd_loop_uv_offset);
+ uvedit_edge_select_set_with_sticky(scene, em, l_step, select, false, cd_loop_uv_offset);
}
BM_elem_flag_enable(l_step->e, BM_ELEM_TAG);
@@ -1544,7 +1528,6 @@ static int uv_select_more_less(bContext *C, const bool select)
{
Scene *scene = CTX_data_scene(C);
ViewLayer *view_layer = CTX_data_view_layer(C);
- SpaceImage *sima = CTX_wm_space_image(C);
BMFace *efa;
BMLoop *l;
@@ -1643,11 +1626,11 @@ static int uv_select_more_less(bContext *C, const bool select)
if (changed) {
if (is_uv_face_selectmode) {
/* Select tagged faces. */
- uv_select_flush_from_tag_face(sima, scene, obedit, select);
+ uv_select_flush_from_tag_face(scene, obedit, select);
}
else {
/* Select tagged loops. */
- uv_select_flush_from_tag_loop(sima, scene, obedit, select);
+ uv_select_flush_from_tag_loop(scene, obedit, select);
}
DEG_id_tag_update(obedit->data, ID_RECALC_SELECT);
WM_event_add_notifier(C, NC_GEOM | ND_SELECT, obedit->data);
@@ -1877,7 +1860,6 @@ static int uv_mouse_select_multi(bContext *C,
const bool deselect_all)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- SpaceImage *sima = CTX_wm_space_image(C);
const ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
const ToolSettings *ts = scene->toolsettings;
@@ -1907,7 +1889,7 @@ static int uv_mouse_select_multi(bContext *C,
}
else {
selectmode = ts->uv_selectmode;
- sticky = (sima) ? sima->sticky : SI_STICKY_DISABLE;
+ sticky = ts->uv_sticky;
}
/* find nearest element */
@@ -1991,20 +1973,19 @@ static int uv_mouse_select_multi(bContext *C,
if (selectmode == UV_SELECT_VERTEX) {
/* (de)select uv vertex */
select = !uvedit_uv_select_test(scene, hit.l, cd_loop_uv_offset);
- uvedit_uv_select_set_with_sticky(sima, scene, em, hit.l, select, true, cd_loop_uv_offset);
+ uvedit_uv_select_set_with_sticky(scene, em, hit.l, select, true, cd_loop_uv_offset);
flush = 1;
}
else if (selectmode == UV_SELECT_EDGE) {
/* (de)select edge */
select = !(uvedit_edge_select_test(scene, hit.l, cd_loop_uv_offset));
- uvedit_edge_select_set_with_sticky(sima, scene, em, hit.l, select, true, cd_loop_uv_offset);
+ uvedit_edge_select_set_with_sticky(scene, em, hit.l, select, true, cd_loop_uv_offset);
flush = 1;
}
else if (selectmode == UV_SELECT_FACE) {
/* (de)select face */
select = !(uvedit_face_select_test(scene, hit.efa, cd_loop_uv_offset));
- uvedit_face_select_set_with_sticky(
- sima, scene, em, hit.efa, select, true, cd_loop_uv_offset);
+ uvedit_face_select_set_with_sticky(scene, em, hit.efa, select, true, cd_loop_uv_offset);
flush = -1;
}
@@ -2027,18 +2008,17 @@ static int uv_mouse_select_multi(bContext *C,
if (selectmode == UV_SELECT_VERTEX) {
/* select vertex */
- uvedit_uv_select_set_with_sticky(sima, scene, em, hit.l, select, true, cd_loop_uv_offset);
+ uvedit_uv_select_set_with_sticky(scene, em, hit.l, select, true, cd_loop_uv_offset);
flush = 1;
}
else if (selectmode == UV_SELECT_EDGE) {
/* select edge */
- uvedit_edge_select_set_with_sticky(sima, scene, em, hit.l, select, true, cd_loop_uv_offset);
+ uvedit_edge_select_set_with_sticky(scene, em, hit.l, select, true, cd_loop_uv_offset);
flush = 1;
}
else if (selectmode == UV_SELECT_FACE) {
/* select face */
- uvedit_face_select_set_with_sticky(
- sima, scene, em, hit.efa, select, true, cd_loop_uv_offset);
+ uvedit_face_select_set_with_sticky(scene, em, hit.efa, select, true, cd_loop_uv_offset);
flush = 1;
}
}
@@ -2154,7 +2134,6 @@ static int uv_mouse_select_loop_generic_multi(bContext *C,
const bool extend,
enum eUVLoopGenericType loop_type)
{
- SpaceImage *sima = CTX_wm_space_image(C);
const ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
Scene *scene = CTX_data_scene(C);
@@ -2179,10 +2158,10 @@ static int uv_mouse_select_loop_generic_multi(bContext *C,
}
if (loop_type == UV_LOOP_SELECT) {
- flush = uv_select_edgeloop(sima, scene, obedit, &hit, extend);
+ flush = uv_select_edgeloop(scene, obedit, &hit, extend);
}
else if (loop_type == UV_RING_SELECT) {
- flush = uv_select_edgering(sima, scene, obedit, &hit, extend);
+ flush = uv_select_edgering(scene, obedit, &hit, extend);
}
else {
BLI_assert_unreachable();
@@ -2686,10 +2665,7 @@ static void uv_select_flush_from_tag_sticky_loc_internal(Scene *scene,
* \note This function is very similar to #uv_select_flush_from_tag_loop,
* be sure to update both upon changing.
*/
-static void uv_select_flush_from_tag_face(SpaceImage *sima,
- Scene *scene,
- Object *obedit,
- const bool select)
+static void uv_select_flush_from_tag_face(Scene *scene, Object *obedit, const bool select)
{
/* Selecting UV Faces with some modes requires us to change
* the selection in other faces (depending on the sticky mode).
@@ -2704,7 +2680,7 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima,
BMIter iter, liter;
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
- if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) {
+ if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && ts->uv_sticky == SI_STICKY_VERTEX) {
/* Tag all verts as untouched, then touch the ones that have a face center
* in the loop and select all MLoopUV's that use a touched vert. */
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
@@ -2728,7 +2704,7 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima,
}
}
}
- else if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_LOC) {
+ else if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && ts->uv_sticky == SI_STICKY_LOC) {
struct UvVertMap *vmap;
uint efa_index;
@@ -2769,10 +2745,7 @@ static void uv_select_flush_from_tag_face(SpaceImage *sima,
* \note This function is very similar to #uv_select_flush_from_tag_loop,
* be sure to update both upon changing.
*/
-static void uv_select_flush_from_tag_loop(SpaceImage *sima,
- Scene *scene,
- Object *obedit,
- const bool select)
+static void uv_select_flush_from_tag_loop(Scene *scene, Object *obedit, const bool select)
{
/* Selecting UV Loops with some modes requires us to change
* the selection in other faces (depending on the sticky mode).
@@ -2788,7 +2761,7 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima,
const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV);
- if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_VERTEX) {
+ if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && ts->uv_sticky == SI_STICKY_VERTEX) {
/* Tag all verts as untouched, then touch the ones that have a face center
* in the loop and select all MLoopUV's that use a touched vert. */
BM_mesh_elem_hflag_disable_all(em->bm, BM_VERT, BM_ELEM_TAG, false);
@@ -2812,7 +2785,7 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima,
}
}
}
- else if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && sima->sticky == SI_STICKY_LOC) {
+ else if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && ts->uv_sticky == SI_STICKY_LOC) {
struct UvVertMap *vmap;
uint efa_index;
@@ -2854,7 +2827,6 @@ static void uv_select_flush_from_tag_loop(SpaceImage *sima,
static int uv_box_select_exec(bContext *C, wmOperator *op)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- SpaceImage *sima = CTX_wm_space_image(C);
Scene *scene = CTX_data_scene(C);
const ToolSettings *ts = scene->toolsettings;
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -2923,7 +2895,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
/* (de)selects all tagged faces and deals with sticky modes */
if (changed) {
- uv_select_flush_from_tag_face(sima, scene, obedit, select);
+ uv_select_flush_from_tag_face(scene, obedit, select);
}
}
else if (use_edge && !pinned) {
@@ -2939,7 +2911,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (BLI_rctf_isect_pt_v(&rectf, luv->uv) && BLI_rctf_isect_pt_v(&rectf, luv_prev->uv)) {
uvedit_edge_select_set_with_sticky(
- sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
+ scene, em, l_prev, select, false, cd_loop_uv_offset);
changed = true;
}
l_prev = l;
@@ -2985,7 +2957,7 @@ static int uv_box_select_exec(bContext *C, wmOperator *op)
}
}
- if (sima->sticky == SI_STICKY_VERTEX) {
+ if (ts->uv_sticky == SI_STICKY_VERTEX) {
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
}
}
@@ -3142,7 +3114,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
/* (de)selects all tagged faces and deals with sticky modes */
if (changed) {
- uv_select_flush_from_tag_face(sima, scene, obedit, select);
+ uv_select_flush_from_tag_face(scene, obedit, select);
}
}
else if (use_edge) {
@@ -3158,7 +3130,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset);
if (uv_circle_select_is_edge_inside(luv->uv, luv_prev->uv, offset, ellipse)) {
uvedit_edge_select_set_with_sticky(
- sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
+ scene, em, l_prev, select, false, cd_loop_uv_offset);
changed = true;
}
l_prev = l;
@@ -3194,7 +3166,7 @@ static int uv_circle_select_exec(bContext *C, wmOperator *op)
}
}
- if (sima->sticky == SI_STICKY_VERTEX) {
+ if (ts->uv_sticky == SI_STICKY_VERTEX) {
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
}
}
@@ -3262,7 +3234,6 @@ static bool do_lasso_select_mesh_uv(bContext *C,
const eSelectOp sel_op)
{
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
- SpaceImage *sima = CTX_wm_space_image(C);
const ARegion *region = CTX_wm_region(C);
Scene *scene = CTX_data_scene(C);
const ToolSettings *ts = scene->toolsettings;
@@ -3321,7 +3292,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
/* (de)selects all tagged faces and deals with sticky modes */
if (changed) {
- uv_select_flush_from_tag_face(sima, scene, obedit, select);
+ uv_select_flush_from_tag_face(scene, obedit, select);
}
}
else if (use_edge) {
@@ -3340,7 +3311,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
do_lasso_select_mesh_uv_is_point_inside(
region, &rect, mcoords, mcoords_len, luv_prev->uv)) {
uvedit_edge_select_set_with_sticky(
- sima, scene, em, l_prev, select, false, cd_loop_uv_offset);
+ scene, em, l_prev, select, false, cd_loop_uv_offset);
changed = true;
}
l_prev = l;
@@ -3377,7 +3348,7 @@ static bool do_lasso_select_mesh_uv(bContext *C,
}
}
- if (sima->sticky == SI_STICKY_VERTEX) {
+ if (ts->uv_sticky == SI_STICKY_VERTEX) {
uvedit_vertex_select_tagged(em, scene, select, cd_loop_uv_offset);
}
}
diff --git a/source/blender/makesdna/DNA_scene_types.h b/source/blender/makesdna/DNA_scene_types.h
index a3e4551a865..0d42abdb363 100644
--- a/source/blender/makesdna/DNA_scene_types.h
+++ b/source/blender/makesdna/DNA_scene_types.h
@@ -1391,13 +1391,14 @@ typedef struct ToolSettings {
char object_flag;
/* Selection Mode for Mesh */
- short selectmode;
+ char selectmode;
/* UV Calculation */
char unwrapper;
char uvcalc_flag;
char uv_flag;
char uv_selectmode;
+ char uv_sticky;
float uvcalc_margin;
@@ -2300,6 +2301,13 @@ enum {
#define UV_SELECT_FACE 4
#define UV_SELECT_ISLAND 8
+/** #ToolSettings.uv_sticky */
+enum {
+ SI_STICKY_LOC = 0,
+ SI_STICKY_DISABLE = 1,
+ SI_STICKY_VERTEX = 2,
+};
+
/** #ToolSettings.gpencil_flags */
typedef enum eGPencil_Flags {
/* When creating new frames, the last frame gets used as the basis for the new one */
diff --git a/source/blender/makesdna/DNA_space_types.h b/source/blender/makesdna/DNA_space_types.h
index ad7f8cc1e40..b1212965992 100644
--- a/source/blender/makesdna/DNA_space_types.h
+++ b/source/blender/makesdna/DNA_space_types.h
@@ -1214,11 +1214,10 @@ typedef struct SpaceImage {
/** UV draw type. */
char dt_uv;
/** Sticky selection type. */
- char sticky;
char dt_uvstretch;
char around;
- char _pad1[3];
+ char _pad1[4];
int flag;
@@ -1265,15 +1264,6 @@ typedef enum eSpaceImage_Mode {
SI_MODE_UV = 3,
} eSpaceImage_Mode;
-/* SpaceImage.sticky
- * Note DISABLE should be 0, however would also need to re-arrange icon order,
- * also, sticky loc is the default mode so this means we don't need to 'do_versions' */
-typedef enum eSpaceImage_Sticky {
- SI_STICKY_LOC = 0,
- SI_STICKY_DISABLE = 1,
- SI_STICKY_VERTEX = 2,
-} eSpaceImage_Sticky;
-
/** #SpaceImage.flag */
typedef enum eSpaceImage_Flag {
SI_FLAG_UNUSED_0 = (1 << 0), /* cleared */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index c8f65e5e153..178029ef340 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2883,6 +2883,25 @@ static void rna_def_tool_settings(BlenderRNA *brna)
{0, NULL, 0, NULL, NULL},
};
+ static const EnumPropertyItem uv_sticky_mode_items[] = {
+ {SI_STICKY_DISABLE,
+ "DISABLED",
+ ICON_STICKY_UVS_DISABLE,
+ "Disabled",
+ "Sticky vertex selection disabled"},
+ {SI_STICKY_LOC,
+ "SHARED_LOCATION",
+ ICON_STICKY_UVS_LOC,
+ "Shared Location",
+ "Select UVs that are at the same location and share a mesh vertex"},
+ {SI_STICKY_VERTEX,
+ "SHARED_VERTEX",
+ ICON_STICKY_UVS_VERT,
+ "Shared Vertex",
+ "Select UVs that share a mesh vertex, whether or not they are at the same location"},
+ {0, NULL, 0, NULL, NULL},
+ };
+
srna = RNA_def_struct(brna, "ToolSettings", NULL);
RNA_def_struct_path_func(srna, "rna_ToolSettings_path");
RNA_def_struct_ui_text(srna, "Tool Settings", "");
@@ -3454,6 +3473,13 @@ static void rna_def_tool_settings(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "UV Selection Mode", "UV selection and display mode");
RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+ prop = RNA_def_property(srna, "uv_sticky_select_mode", PROP_ENUM, PROP_NONE);
+ RNA_def_property_enum_sdna(prop, NULL, "uv_sticky");
+ RNA_def_property_enum_items(prop, uv_sticky_mode_items);
+ RNA_def_property_ui_text(
+ prop, "Sticky Selection Mode", "Method for extending UV vertex selection");
+ RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
+
prop = RNA_def_property(srna, "use_uv_select_sync", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "uv_flag", UV_SYNC_SELECTION);
RNA_def_property_ui_text(
diff --git a/source/blender/makesrna/intern/rna_space.c b/source/blender/makesrna/intern/rna_space.c
index 20fa8b87cd2..c51f0c00498 100644
--- a/source/blender/makesrna/intern/rna_space.c
+++ b/source/blender/makesrna/intern/rna_space.c
@@ -3428,25 +3428,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
StructRNA *srna;
PropertyRNA *prop;
- static const EnumPropertyItem sticky_mode_items[] = {
- {SI_STICKY_DISABLE,
- "DISABLED",
- ICON_STICKY_UVS_DISABLE,
- "Disabled",
- "Sticky vertex selection disabled"},
- {SI_STICKY_LOC,
- "SHARED_LOCATION",
- ICON_STICKY_UVS_LOC,
- "Shared Location",
- "Select UVs that are at the same location and share a mesh vertex"},
- {SI_STICKY_VERTEX,
- "SHARED_VERTEX",
- ICON_STICKY_UVS_VERT,
- "Shared Vertex",
- "Select UVs that share a mesh vertex, whether or not they are at the same location"},
- {0, NULL, 0, NULL, NULL},
- };
-
static const EnumPropertyItem dt_uvstretch_items[] = {
{SI_UVDT_STRETCH_ANGLE, "ANGLE", 0, "Angle", "Angular distortion between UV and 3D angles"},
{SI_UVDT_STRETCH_AREA, "AREA", 0, "Area", "Area distortion between UV and 3D faces"},
@@ -3466,14 +3447,6 @@ static void rna_def_space_image_uv(BlenderRNA *brna)
RNA_def_struct_path_func(srna, "rna_SpaceUVEditor_path");
RNA_def_struct_ui_text(srna, "Space UV Editor", "UV editor data for the image editor space");
- /* selection */
- prop = RNA_def_property(srna, "sticky_select_mode", PROP_ENUM, PROP_NONE);
- RNA_def_property_enum_sdna(prop, NULL, "sticky");
- RNA_def_property_enum_items(prop, sticky_mode_items);
- RNA_def_property_ui_text(
- prop, "Sticky Selection Mode", "Method for extending UV vertex selection");
- RNA_def_property_update(prop, NC_SPACE | ND_SPACE_IMAGE, NULL);
-
/* drawing */
prop = RNA_def_property(srna, "edge_display_type", PROP_ENUM, PROP_NONE);
RNA_def_property_enum_sdna(prop, NULL, "dt_uv");