diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2022-04-28 17:28:22 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2022-04-28 17:28:37 +0300 |
commit | 22f5c05cb39a0296db55e3bb5e45d26e5670f7c1 (patch) | |
tree | 5794fccba38ad9a4d3c0bea884de46afa630004a /source/blender/editors/space_view3d/view3d_cursor_snap.c | |
parent | 17769489d920f86310464297e8906f34d5ec61b9 (diff) |
Snap Cursor: split 'ED_view3d_cursor_snap_data_get'
Split 'ED_view3d_cursor_snap_data_get' into 'update' and 'get' functions
Sometimes we just want to update and sometimes we just get the result.
Make it clear.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_cursor_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_cursor_snap.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/source/blender/editors/space_view3d/view3d_cursor_snap.c b/source/blender/editors/space_view3d/view3d_cursor_snap.c index f3e45a14565..210ec767924 100644 --- a/source/blender/editors/space_view3d/view3d_cursor_snap.c +++ b/source/blender/editors/space_view3d/view3d_cursor_snap.c @@ -956,28 +956,30 @@ void ED_view3d_cursor_snap_prevpoint_set(V3DSnapCursorState *state, const float } } -V3DSnapCursorData *ED_view3d_cursor_snap_data_get(V3DSnapCursorState *state, - const bContext *C, - const int x, - const int y) +void ED_view3d_cursor_snap_data_update(V3DSnapCursorState *state, + const bContext *C, + const int x, + const int y) { SnapCursorDataIntern *data_intern = &g_data_intern; - if (C) { - wmWindowManager *wm = CTX_wm_manager(C); - if (v3d_cursor_eventstate_has_changed(data_intern, state, wm, x, y)) { - Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); - Scene *scene = DEG_get_input_scene(depsgraph); - ScrArea *area = CTX_wm_area(C); - ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); - View3D *v3d = CTX_wm_view3d(C); - - if (!state) { - state = ED_view3d_cursor_snap_state_get(); - } - v3d_cursor_snap_update(state, C, wm, depsgraph, scene, region, v3d, x, y); + wmWindowManager *wm = CTX_wm_manager(C); + if (v3d_cursor_eventstate_has_changed(data_intern, state, wm, x, y)) { + Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C); + Scene *scene = DEG_get_input_scene(depsgraph); + ScrArea *area = CTX_wm_area(C); + ARegion *region = BKE_area_find_region_type(area, RGN_TYPE_WINDOW); + View3D *v3d = CTX_wm_view3d(C); + + if (!state) { + state = ED_view3d_cursor_snap_state_get(); } + v3d_cursor_snap_update(state, C, wm, depsgraph, scene, region, v3d, x, y); } +} +V3DSnapCursorData *ED_view3d_cursor_snap_data_get() +{ + SnapCursorDataIntern *data_intern = &g_data_intern; return &data_intern->snap_data; } |