[Bf-blender-cvs] [c4e595aaf32] greasepencil-object: New Normalize thickness parameter
Antonio Vazquez
noreply at git.blender.org
Sat Dec 9 20:09:56 CET 2017
Commit: c4e595aaf32e1731b40d4ee1b25887659b1631eb
Author: Antonio Vazquez
Date: Sat Dec 9 20:09:43 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rBc4e595aaf32e1731b40d4ee1b25887659b1631eb
New Normalize thickness parameter
Now the thickness modifier has a parameter to assign the same thickness to all strokes.
===================================================================
M release/scripts/startup/bl_ui/properties_data_modifier.py
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/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 f104990e2ee..af3507d8170 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -1661,6 +1661,8 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.prop(md, "pass_index", text="Pass")
row.prop(md, "inverse_pass", text="", icon="ARROW_LEFTRIGHT")
+ col.prop(md, "normalize_thickness")
+
col = split.column()
col.label("Layer:")
row = col.row(align=True)
@@ -1672,12 +1674,13 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
row.prop(md, "inverse_vertex", text="", icon="ARROW_LEFTRIGHT")
- split = layout.split()
- col = split.column()
- col.prop(md, "use_custom_curve")
+ if not md.normalize_thickness:
+ 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")
def GP_TINT(self, layout, ob, md):
gpd = ob.data
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 6431913eb63..3574bc720ab 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1699,6 +1699,7 @@ typedef enum eGpencilThick_Flag {
GP_THICK_INVERSE_PASS = (1 << 1),
GP_THICK_INVERSE_VGROUP = (1 << 2),
GP_THICK_CUSTOM_CURVE = (1 << 3),
+ GP_THICK_NORMALIZE = (1 << 4),
} eGpencilThick_Flag;
typedef struct GpencilTintModifierData {
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 1008b268e27..20476476605 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5204,6 +5204,11 @@ static void rna_def_modifier_gpencilthick(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Custom Curve", "Use a custom curve to define thickness changes");
RNA_def_property_update(prop, 0, "rna_Modifier_update");
+ prop = RNA_def_property(srna, "normalize_thickness", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_THICK_NORMALIZE);
+ RNA_def_property_ui_text(prop, "Normalize", "Normalize the full stroke to modifier thickness");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
+
prop = RNA_def_property(srna, "curve", PROP_POINTER, PROP_NONE);
RNA_def_property_pointer_sdna(prop, NULL, "cur_thickness");
RNA_def_property_ui_text(prop, "Curve", "Custom Thickness Curve");
diff --git a/source/blender/modifiers/intern/MOD_gpencilthick.c b/source/blender/modifiers/intern/MOD_gpencilthick.c
index f43ed4f3199..100696557d5 100644
--- a/source/blender/modifiers/intern/MOD_gpencilthick.c
+++ b/source/blender/modifiers/intern/MOD_gpencilthick.c
@@ -96,24 +96,33 @@ static void deformStroke(ModifierData *md, const EvaluationContext *UNUSED(eval_
return;
}
+ /* if normalize, set stroke thickness */
+ if (mmd->flag & GP_THICK_NORMALIZE) {
+ gps->thickness = mmd->thickness;
+ }
+
for (int i = 0; i < gps->totpoints; i++) {
bGPDspoint *pt = &gps->points[i];
float curvef = 1.0f;
-
/* verify vertex group */
float weight = is_point_affected_by_modifier(pt, (int)(!(mmd->flag & GP_THICK_INVERSE_VGROUP) == 0), vindex);
if (weight < 0) {
continue;
}
- if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->cur_thickness)) {
- /* nomalize value */
- float value = (float)i / (gps->totpoints - 1);
- curvef = curvemapping_evaluateF(mmd->cur_thickness, 0, value);
+ if (mmd->flag & GP_THICK_NORMALIZE) {
+ pt->pressure = 1.0f;
}
+ else {
+ if ((mmd->flag & GP_THICK_CUSTOM_CURVE) && (mmd->cur_thickness)) {
+ /* normalize value to evaluate curve */
+ float value = (float)i / (gps->totpoints - 1);
+ curvef = curvemapping_evaluateF(mmd->cur_thickness, 0, value);
+ }
- pt->pressure += mmd->thickness * weight * curvef;
- CLAMP(pt->strength, 0.0f, 1.0f);
+ pt->pressure += mmd->thickness * weight * curvef;
+ CLAMP(pt->strength, 0.0f, 1.0f);
+ }
}
}
More information about the Bf-blender-cvs
mailing list