[Bf-blender-cvs] [beab06b242d] master: GPencil: Change UI scale for z-depth offset

Antonio Vazquez noreply at git.blender.org
Mon Aug 19 20:34:42 CEST 2019


Commit: beab06b242df87fb01a9defc9134322bb030054a
Author: Antonio Vazquez
Date:   Mon Aug 19 16:30:41 2019 +0200
Branches: master
https://developer.blender.org/rBbeab06b242df87fb01a9defc9134322bb030054a

GPencil: Change UI scale for z-depth offset

Actually, the value for this parameter must be in the order of 0.00001 and this makes the UI uncomfortable.

Now, the value is divided by 1000 internally and the UI values are more logic.

Reviewers: mendio, pepeland

Differential Revision: https://developer.blender.org/D5528

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c
M	source/blender/makesrna/intern/rna_gpencil.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ee78a947b55..900883bd0af 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -423,7 +423,7 @@ static void gp_stroke_convertcoords(tGPsdata *p, const float mval[2], float out[
 
     /* add small offset to keep stroke over the surface */
     if ((depth) && (gpd->zdepth_offset > 0.0f) && (*p->align_flag & GP_PROJECT_DEPTH_VIEW)) {
-      *depth *= (1.0f - gpd->zdepth_offset);
+      *depth *= (1.0f - (gpd->zdepth_offset / 1000.0f));
     }
 
     int mval_i[2];
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 25913fe821a..e4b2e5540ea 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -959,7 +959,7 @@ static void gp_primitive_update_strokes(bContext *C, tGPDprimitive *tgpi)
 
     /* add small offset to keep stroke over the surface */
     if ((depth_arr) && (gpd->zdepth_offset > 0.0f)) {
-      depth_arr[i] *= (1.0f - gpd->zdepth_offset);
+      depth_arr[i] *= (1.0f - (gpd->zdepth_offset / 1000.0f));
     }
 
     /* convert screen-coordinates to 3D coordinates */
diff --git a/source/blender/makesrna/intern/rna_gpencil.c b/source/blender/makesrna/intern/rna_gpencil.c
index 17e9e24004c..c88ceb070ab 100644
--- a/source/blender/makesrna/intern/rna_gpencil.c
+++ b/source/blender/makesrna/intern/rna_gpencil.c
@@ -1914,7 +1914,7 @@ static void rna_def_gpencil_data(BlenderRNA *brna)
   prop = RNA_def_property(srna, "zdepth_offset", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "zdepth_offset");
   RNA_def_property_range(prop, 0.0f, 1.0f);
-  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.001, 5);
+  RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 3);
   RNA_def_property_ui_text(prop, "Surface Offset", "Offset amount when drawing in surface mode");
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, "rna_GPencil_update");



More information about the Bf-blender-cvs mailing list