diff options
author | YimingWu <xp8110@outlook.com> | 2021-09-19 08:01:24 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2021-09-19 08:01:24 +0300 |
commit | 25e548c96b3d8c1698fd4385b4dc395665b5a7f6 (patch) | |
tree | bbd3cb431e55eda8145e0aa198b6651928c01686 /source/blender/makesrna/intern | |
parent | bdbc7e12a02e15ad7265dfc1ac21fb6d0016308f (diff) |
GPencil: Curvature support for length modifier.
Diffstat (limited to 'source/blender/makesrna/intern')
-rw-r--r-- | source/blender/makesrna/intern/rna_gpencil_modifier.c | 66 |
1 files changed, 58 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c index 4fa33424994..9b8726d4491 100644 --- a/source/blender/makesrna/intern/rna_gpencil_modifier.c +++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c @@ -74,6 +74,11 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = { ICON_MOD_DASH, "Dot Dash", "Generate dot-dash styled strokes"}, + {eGpencilModifierType_Length, + "GP_LENGTH", + ICON_MOD_LENGTH, + "Length", + "Extend or shrink strokes"}, {eGpencilModifierType_Lineart, "GP_LINEART", ICON_MOD_LINEART, @@ -120,11 +125,6 @@ const EnumPropertyItem rna_enum_object_greasepencil_modifier_type_items[] = { ICON_MOD_LATTICE, "Lattice", "Deform strokes using lattice"}, - {eGpencilModifierType_Length, - "GP_LENGTH", - ICON_MOD_LENGTH, - "Length", - "Extend or shrink strokes"}, {eGpencilModifierType_Noise, "GP_NOISE", ICON_MOD_NOISE, "Noise", "Add noise to strokes"}, {eGpencilModifierType_Offset, "GP_OFFSET", @@ -3278,13 +3278,25 @@ static void rna_def_modifier_gpencillength(BlenderRNA *brna) prop = RNA_def_property(srna, "start_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "start_fac"); - RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 1); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 2); RNA_def_property_ui_text(prop, "Start Factor", "Length difference for each segment"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "end_factor", PROP_FLOAT, PROP_NONE); RNA_def_property_float_sdna(prop, NULL, "end_fac"); - RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 1); + RNA_def_property_ui_range(prop, -10.0f, 10.0f, 0.1, 2); + RNA_def_property_ui_text(prop, "End Factor", "Length difference for each segment"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "start_length", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "start_fac"); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 0.1f, 3); + RNA_def_property_ui_text(prop, "Start Factor", "Length difference for each segment"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "end_length", PROP_FLOAT, PROP_DISTANCE); + RNA_def_property_float_sdna(prop, NULL, "end_fac"); + RNA_def_property_ui_range(prop, -100.0f, 100.0f, 0.1f, 3); RNA_def_property_ui_text(prop, "End Factor", "Length difference for each segment"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); @@ -3294,7 +3306,7 @@ static void rna_def_modifier_gpencillength(BlenderRNA *brna) RNA_def_property_ui_text( prop, "Overshoot Factor", - "Defines how precise must follow the stroke trajectory for the overshoot extremes"); + "Defines what portion of the stroke is used for curvature approximation."); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); prop = RNA_def_property(srna, "mode", PROP_ENUM, PROP_NONE); @@ -3303,6 +3315,44 @@ static void rna_def_modifier_gpencillength(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Mode", "Mode to define length"); RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "use_curvature", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_USE_CURVATURE); + RNA_def_property_ui_text(prop, "Use Curvature", "Follow the curvature of the stroke"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "invert_curvature", PROP_BOOLEAN, PROP_NONE); + RNA_def_property_boolean_sdna(prop, NULL, "flag", GP_LENGTH_INVERT_CURVATURE); + RNA_def_property_ui_text( + prop, "Invert Curvature", "Invert the curvature of the stroke's extension"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "point_density", PROP_FLOAT, PROP_NONE); + RNA_def_property_range(prop, 0.1f, 1000.0f); + RNA_def_property_ui_range(prop, 0.1f, 1000.0f, 1.0f, 1); + RNA_def_property_ui_scale_type(prop, PROP_SCALE_CUBIC); + RNA_def_property_ui_text( + prop, "Point Density", "Multiplied by Start/End for the total added point count"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "edge_point_tradeoff", PROP_FLOAT, PROP_FACTOR); + RNA_def_property_range(prop, -2.0f, 3.0f); + RNA_def_property_ui_range(prop, 0.0f, 1.0f, 0.1f, 2); + RNA_def_property_ui_text( + prop, + "Smoothness", + "Factor to determine how much to use a theoretical smooth arc between points instead of " + "straight lines when determining the extrapolation shape"); + RNA_def_property_update(prop, 0, "rna_GpencilModifier_update"); + + prop = RNA_def_property(srna, "max_angle", PROP_FLOAT, PROP_ANGLE); + RNA_def_property_ui_text(prop, + "Filter Angle", + "Ignore points on the stroke that deviate from their neighbors by more " + "than this angle when determining the extrapolation shape"); + RNA_def_property_range(prop, 0.0f, DEG2RAD(180.0f)); + RNA_def_property_ui_range(prop, 0.0f, DEG2RAD(179.5f), 10.0f, 1); + RNA_def_property_update(prop, NC_SCENE, "rna_GpencilModifier_update"); + prop = RNA_def_property(srna, "layer", PROP_STRING, PROP_NONE); RNA_def_property_string_sdna(prop, NULL, "layername"); RNA_def_property_ui_text(prop, "Layer", "Layer name"); |