diff options
author | Germano Cavalcante <germano.costa@ig.com.br> | 2020-11-02 22:13:51 +0300 |
---|---|---|
committer | Germano Cavalcante <germano.costa@ig.com.br> | 2020-11-02 22:14:03 +0300 |
commit | 5ed4e1e23ab19282a8673bdeba3724026b80a880 (patch) | |
tree | 21df31ab26f881939a3f3f48f92ff16211911a0d /source/blender/editors/space_view3d/view3d_snap.c | |
parent | ef4aa42ea4ffa1bf7f5ad7f8e7f7b6acf9e3c3e6 (diff) |
Fix T77819: Snap Incremental does not match grid in all cases
The behavior of the incremental snap did not take into account the
relative dimensions of the window, which resulted in a different behavior
if the area height was greater than the width.
Diffstat (limited to 'source/blender/editors/space_view3d/view3d_snap.c')
-rw-r--r-- | source/blender/editors/space_view3d/view3d_snap.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c index 265cb04c7b2..148a0986c5c 100644 --- a/source/blender/editors/space_view3d/view3d_snap.c +++ b/source/blender/editors/space_view3d/view3d_snap.c @@ -73,14 +73,14 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph); Object *obact = CTX_data_active_object(C); Scene *scene = CTX_data_scene(C); - RegionView3D *rv3d = CTX_wm_region_data(C); + ARegion *region = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); TransVertStore tvs = {NULL}; TransVert *tv; float gridf, imat[3][3], bmat[3][3], vec[3]; int a; - gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL); + gridf = ED_view3d_grid_view_scale(scene, v3d, region, NULL); if (OBEDIT_FROM_OBACT(obact)) { ViewLayer *view_layer = CTX_data_view_layer(C); @@ -657,11 +657,11 @@ void VIEW3D_OT_snap_selected_to_active(wmOperatorType *ot) static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); - RegionView3D *rv3d = CTX_wm_region_data(C); + ARegion *region = CTX_wm_region(C); View3D *v3d = CTX_wm_view3d(C); float gridf, *curs; - gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL); + gridf = ED_view3d_grid_view_scale(scene, v3d, region, NULL); curs = scene->cursor.location; curs[0] = gridf * floorf(0.5f + curs[0] / gridf); |