[Bf-blender-cvs] [a99886d55c9] greasepencil-object: GP: Guides: Fix snapping distance
Charlie Jolly
noreply at git.blender.org
Fri Jan 11 00:48:27 CET 2019
Commit: a99886d55c971b0f59bc748b837ce06e1314afb0
Author: Charlie Jolly
Date: Thu Jan 10 23:46:27 2019 +0000
Branches: greasepencil-object
https://developer.blender.org/rBa99886d55c971b0f59bc748b837ce06e1314afb0
GP: Guides: Fix snapping distance
Use pre-existing code to determine the pixel scale.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 1b75f3be117..0dd337f0b7b 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2752,7 +2752,17 @@ static void gpencil_draw_apply_event(bContext *C, wmOperator *op, const wmEvent
/* calculate once and store snapping distance and origin */
RegionView3D * rv3d = p->ar->regiondata;
- p->guide_spacing = guide->spacing / rv3d->pixsize;
+ float scale = 1.0f;
+ if (rv3d->is_persp) {
+ float vec[3];
+ gp_get_3d_reference(p, vec);
+ mul_m4_v3(rv3d->persmat, vec);
+ scale = vec[2] * rv3d->pixsize;
+ }
+ else {
+ scale = rv3d->pixsize;
+ }
+ p->guide_spacing = guide->spacing / scale;
p->half_spacing = p->guide_spacing * 0.5f;
gp_origin_get(p, p->origin);
More information about the Bf-blender-cvs
mailing list