diff options
author | Dalai Felinto <dfelinto@gmail.com> | 2018-05-02 10:58:31 +0300 |
---|---|---|
committer | Dalai Felinto <dfelinto@gmail.com> | 2018-05-02 11:13:22 +0300 |
commit | 3def6c7f8e9a6c81947d41f6d5d4d79530a688a2 (patch) | |
tree | bcfa716ce789744981e68e95a276fa6e812ee52c /source | |
parent | c052346fbf0e3bdfdd9dd48669985ea065e07185 (diff) |
Edit Mesh: look-cut copy-on-write support
Note: As already commented in the code, the ideal solution would
be to pass select mode as parameter to ED_view3D_backbuf_validate.
Without that we have to resort to the hack solution of writing to
evaluation data.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/mesh/editmesh_select.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c index 2e6c90cacb2..ac5999c97c4 100644 --- a/source/blender/editors/mesh/editmesh_select.c +++ b/source/blender/editors/mesh/editmesh_select.c @@ -70,6 +70,7 @@ #include "bmesh_tools.h" #include "DEG_depsgraph.h" +#include "DEG_depsgraph_query.h" #include "mesh_intern.h" /* own include */ @@ -657,15 +658,19 @@ BMEdge *EDBM_edge_find_nearest_ex( BMEdge *eed; /* Make sure that the edges also are considered to find nearest. - * TODO: cleanup: add `selectmode` as a parameter */ + * TODO: cleanup: add `selectmode` as a parameter + * XXX: Without selectmode as parameter we need to resort to this super ugly hack, + * because we should never write to evaluate data. */ const short ts_selectmode = vc->scene->toolsettings->selectmode; - vc->scene->toolsettings->selectmode |= SCE_SELECT_EDGE; + + Scene *scene_eval = (Scene *)DEG_get_evaluated_id(vc->depsgraph, &vc->scene->id); + scene_eval->toolsettings->selectmode |= SCE_SELECT_EDGE; /* No afterqueue (yet), so we check it now, otherwise the bm_xxxofs indices are bad. */ ED_view3d_backbuf_validate(vc); /* restore `selectmode` */ - vc->scene->toolsettings->selectmode = ts_selectmode; + scene_eval->toolsettings->selectmode = ts_selectmode; index = ED_view3d_backbuf_sample_rect(vc, vc->mval, dist_px, bm_solidoffs, bm_wireoffs, &dist_test); eed = index ? BM_edge_at_index_find_or_table(bm, index - 1) : NULL; |