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:
authorGermano Cavalcante <germano.costa@ig.com.br>2022-04-28 17:28:22 +0300
committerGermano Cavalcante <germano.costa@ig.com.br>2022-04-28 17:28:37 +0300
commit22f5c05cb39a0296db55e3bb5e45d26e5670f7c1 (patch)
tree5794fccba38ad9a4d3c0bea884de46afa630004a /source/blender/editors/space_view3d
parent17769489d920f86310464297e8906f34d5ec61b9 (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')
-rw-r--r--source/blender/editors/space_view3d/space_view3d.c3
-rw-r--r--source/blender/editors/space_view3d/view3d_cursor_snap.c36
-rw-r--r--source/blender/editors/space_view3d/view3d_placement.c4
3 files changed, 22 insertions, 21 deletions
diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c
index 50d288af0e0..b39557929f8 100644
--- a/source/blender/editors/space_view3d/space_view3d.c
+++ b/source/blender/editors/space_view3d/space_view3d.c
@@ -692,8 +692,7 @@ static void view3d_ob_drop_matrix_from_snap(V3DSnapCursorState *snap_state,
Object *ob,
float obmat_final[4][4])
{
- V3DSnapCursorData *snap_data;
- snap_data = ED_view3d_cursor_snap_data_get(snap_state, NULL, 0, 0);
+ V3DSnapCursorData *snap_data = ED_view3d_cursor_snap_data_get();
BLI_assert(snap_state->draw_box || snap_state->draw_plane);
copy_m4_m3(obmat_final, snap_data->plane_omat);
copy_v3_v3(obmat_final[3], snap_data->loc);
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;
}
diff --git a/source/blender/editors/space_view3d/view3d_placement.c b/source/blender/editors/space_view3d/view3d_placement.c
index 298de9b8730..eefc085bdf8 100644
--- a/source/blender/editors/space_view3d/view3d_placement.c
+++ b/source/blender/editors/space_view3d/view3d_placement.c
@@ -684,7 +684,7 @@ static bool view3d_interactive_add_calc_snap(bContext *UNUSED(C),
bool *r_is_enabled,
bool *r_is_snap_invert)
{
- V3DSnapCursorData *snap_data = ED_view3d_cursor_snap_data_get(NULL, NULL, 0, 0);
+ V3DSnapCursorData *snap_data = ED_view3d_cursor_snap_data_get();
copy_v3_v3(r_co_src, snap_data->loc);
if (r_matrix_orient) {
copy_m3_m3(r_matrix_orient, snap_data->plane_omat);
@@ -741,7 +741,7 @@ static void view3d_interactive_add_begin(bContext *C, wmOperator *op, const wmEv
/* Be sure to also compute the #V3DSnapCursorData.plane_omat. */
snap_state->draw_plane = true;
- ED_view3d_cursor_snap_data_get(snap_state_new, C, mval[0], mval[1]);
+ ED_view3d_cursor_snap_data_update(snap_state_new, C, mval[0], mval[1]);
snap_state_new->flag = flag_orig;
}
}