[Bf-blender-cvs] [1e0f4ba1388] soc-2019-npr: GPencil: Allow widng curve when normalize on in thickness modifier.

YimingWu noreply at git.blender.org
Wed Jul 17 05:21:08 CEST 2019


Commit: 1e0f4ba138885f4be7a469422b55aed34e5c3150
Author: YimingWu
Date:   Wed Jul 17 11:20:15 2019 +0800
Branches: soc-2019-npr
https://developer.blender.org/rB1e0f4ba138885f4be7a469422b55aed34e5c3150

GPencil: Allow widng curve when normalize on in thickness modifier.

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

M	release/scripts/startup/bl_ui/properties_data_modifier.py
M	source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c

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

diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index a998858abc9..69aab6cf169 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1890,13 +1890,12 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
 
         col.prop(md, "normalize_thickness")
 
-        if not md.normalize_thickness:
-            split = layout.split()
-            col = split.column()
-            col.prop(md, "use_custom_curve")
+        split = layout.split()
+        col = split.column()
+        col.prop(md, "use_custom_curve")
 
-            if md.use_custom_curve:
-                col.template_curve_mapping(md, "curve")
+        if md.use_custom_curve:
+            col.template_curve_mapping(md, "curve")
 
         col = layout.column()
         col.separator()
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
index 4a2a1783127..0d5cc055e57 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilthick.c
@@ -117,19 +117,22 @@ static void deformStroke(GpencilModifierData *md,
       continue;
     }
 
-    if (mmd->flag & GP_THICK_NORMALIZE) {
-      pt->pressure = 1.0f;
+    
+    if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->curve_thickness)) {
+      /* normalize value to evaluate curve */
+      float value = (float)i / (gps->totpoints - 1);
+      curvef = curvemapping_evaluateF(mmd->curve_thickness, 0, value);
     }
-    else {
-      if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->curve_thickness)) {
-        /* normalize value to evaluate curve */
-        float value = (float)i / (gps->totpoints - 1);
-        curvef = curvemapping_evaluateF(mmd->curve_thickness, 0, value);
-      }
 
-      pt->pressure += mmd->thickness * weight * curvef;
-      CLAMP_MIN(pt->pressure, 0.1f);
+    float new_pressure = weight * curvef;
+
+    if (mmd->flag & GP_THICK_NORMALIZE) {
+      pt->pressure = 1.0f * new_pressure;
+    }else{
+      pt->pressure += mmd->thickness * new_pressure;
     }
+
+    CLAMP_MIN(pt->pressure, 0.1f);
   }
 }



More information about the Bf-blender-cvs mailing list