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:
authormano-wii <germano.costa@ig.com.br>2018-12-31 18:45:20 +0300
committermano-wii <germano.costa@ig.com.br>2018-12-31 18:45:20 +0300
commit4d795cee4938f080f83aa367272d1ad25bba1fbd (patch)
treea3c2fb0460c8d1c5c1715bb2f87eb71d5a332039 /source/blender/editors/space_view3d
parent82e0739f648134213161df500634c52d324c12cc (diff)
Fix T60015: snap to grid - snaps only to largest increment
Caused by rBc7a96651dfa4 when trying to remove all uses of the deprecated `rv3d->gridview`.
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c8
-rw-r--r--source/blender/editors/space_view3d/view3d_snap.c6
2 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index b6ded48d53f..a64ba5b2197 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -780,9 +780,9 @@ float ED_view3d_grid_scale(Scene *scene, View3D *v3d, const char **grid_unit)
return v3d->grid * ED_scene_grid_scale(scene, grid_unit);
}
-/* Simulates the grid scale that is visualized by the shaders drawing functions.
- * The actual code is seen in `object_grid_frag.glsl` when you get the `grid_res` value.
- * Currently the simulation is done only when RV3D_VIEW_IS_AXIS. */
+/* Simulates the grid scale that is actually viewed.
+ * The actual code is seen in `object_grid_frag.glsl` (see `grid_res`).
+ * Currently the simulation is only done when RV3D_VIEW_IS_AXIS. */
float ED_view3d_grid_view_scale(
Scene *scene, View3D *v3d, RegionView3D *rv3d, const char **grid_unit)
{
@@ -798,7 +798,7 @@ float ED_view3d_grid_view_scale(
float lvl = (logf(grid_distance / grid_scale) / logf(grid_subdiv));
/* 1.3f is a visually chosen offset for the
- * subdivision to match the displayed grid. */
+ * subdivision to match the visible grid. */
lvl -= 1.3f;
CLAMP_MIN(lvl, 0.0f);
diff --git a/source/blender/editors/space_view3d/view3d_snap.c b/source/blender/editors/space_view3d/view3d_snap.c
index dbf2271e114..9729598b022 100644
--- a/source/blender/editors/space_view3d/view3d_snap.c
+++ b/source/blender/editors/space_view3d/view3d_snap.c
@@ -79,13 +79,14 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
ViewLayer *view_layer_eval = DEG_get_evaluated_view_layer(depsgraph);
Object *obedit = CTX_data_edit_object(C);
Scene *scene = CTX_data_scene(C);
+ RegionView3D *rv3d = CTX_wm_region_data(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_scale(scene, v3d, NULL);
+ gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL);
if (obedit) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@@ -516,10 +517,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);
View3D *v3d = CTX_wm_view3d(C);
float gridf, *curs;
- gridf = ED_view3d_grid_scale(scene, v3d, NULL);
+ gridf = ED_view3d_grid_view_scale(scene, v3d, rv3d, NULL);
curs = scene->cursor.location;
curs[0] = gridf * floorf(0.5f + curs[0] / gridf);