diff options
author | Campbell Barton <campbell@blender.org> | 2022-02-16 05:46:00 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-02-16 05:46:00 +0300 |
commit | 18d18b5a986724d43f45bac63a98400741e8e12a (patch) | |
tree | ca8f8a5cd12adac5c8a2dcbc975dbb6a67971471 /source/blender/editors/uvedit/uvedit_path.c | |
parent | a0ad8c57ef7da7ee21b3c2352057cf78b60000ae (diff) |
UV: move sticky selection from image space into tool settings
Having this setting stored in the image space caused low level selection
logic to have to pass around the image space (which could be NULL
in some cases). Use the tool-settings instead since there doesn't seem
to be much/any advantage in having this setting per-space.
Diffstat (limited to 'source/blender/editors/uvedit/uvedit_path.c')
-rw-r--r-- | source/blender/editors/uvedit/uvedit_path.c | 48 |
1 files changed, 11 insertions, 37 deletions
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; } |