Commit: 9cb2d321c10540a5fb560df3ed5ace4ab5ef880d
Author: Antonio Vazquez
Date:   Wed Aug 19 20:53:23 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB9cb2d321c10540a5fb560df3ed5ace4ab5ef880d

GPencil: Recalc scale size to fit with Potrace sizes

===================================================================

M       source/blender/editors/gpencil/gpencil_trace_ops.c
M       source/blender/editors/gpencil/gpencil_trace_utils.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_trace_ops.c 
b/source/blender/editors/gpencil/gpencil_trace_ops.c
index 30d9c3dbb35..4cac41bc4e1 100644
--- a/source/blender/editors/gpencil/gpencil_trace_ops.c
+++ b/source/blender/editors/gpencil/gpencil_trace_ops.c
@@ -123,8 +123,13 @@ static bool gpencil_trace_image(
   int offset[2];
   offset[0] = ibuf->x / 2;
   offset[1] = ibuf->y / 2;
+
+  /* Scale correction for Potrace. */
+  const float scale_potrace = scale * (640.0f / (float)ibuf->x) *
+                              ((float)ibuf->x / (float)ibuf->y);
+
   ED_gpencil_trace_data_to_strokes(
-      bmain, st, ob, gpf, offset, scale, sample, resolution, thickness);
+      bmain, st, ob, gpf, offset, scale_potrace, sample, resolution, 
thickness);
 
   /* Free memory. */
   potrace_state_free(st);
diff --git a/source/blender/editors/gpencil/gpencil_trace_utils.c 
b/source/blender/editors/gpencil/gpencil_trace_utils.c
index 28dc7bf51af..87e7d31b4d1 100644
--- a/source/blender/editors/gpencil/gpencil_trace_utils.c
+++ b/source/blender/editors/gpencil/gpencil_trace_utils.c
@@ -287,7 +287,7 @@ void ED_gpencil_trace_data_to_strokes(Main *bmain,
   int n, *tag;
   potrace_dpoint_t(*c)[3];
 
-  const float scalef = 0.005f * scale;
+  const float scalef = 0.008f * scale;
   /* Draw each curve. */
   path = st->plist;
   while (path != NULL) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to