Fix unreported: the gridview is no longer computed, so the snapping functions have to use the actual grid scale.

This commit is contained in:
Germano Cavalcante 2018-08-27 11:40:48 -03:00
parent 9de320d882
commit c7a96651df
Notes: blender-bot 2023-02-14 03:31:57 +01:00
Referenced by commit 4d795cee49, Fix T60015: snap to grid - snaps only to largest increment
2 changed files with 7 additions and 4 deletions

View File

@ -2025,9 +2025,11 @@ static int gp_snap_to_grid(bContext *C, wmOperator *UNUSED(op))
{
bGPdata *gpd = ED_gpencil_data_get_active(C);
RegionView3D *rv3d = CTX_wm_region_data(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C); \
View3D *v3d = CTX_wm_view3d(C);
Scene *scene = CTX_data_scene(C);
Depsgraph *depsgraph = CTX_data_depsgraph(C);
Object *obact = CTX_data_active_object(C);
const float gridf = rv3d->gridview;
const float gridf = ED_view3d_grid_scale(scene, v3d, NULL);
for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
/* only editable and visible layers are considered */

View File

@ -80,12 +80,13 @@ static int snap_sel_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
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 = rv3d->gridview;
gridf = ED_view3d_grid_scale(scene, v3d, NULL);
if (obedit) {
ViewLayer *view_layer = CTX_data_view_layer(C);
@ -497,7 +498,7 @@ static int snap_curs_to_grid_exec(bContext *C, wmOperator *UNUSED(op))
View3D *v3d = CTX_wm_view3d(C);
float gridf, *curs;
gridf = rv3d->gridview;
gridf = ED_view3d_grid_scale(scene, v3d, NULL);
curs = ED_view3d_cursor3d_get(scene, v3d)->location;
curs[0] = gridf * floorf(0.5f + curs[0] / gridf);