GPencil: Add new Distance property to Simplify modifier

Before, the length variable was reused for Sample and Merge Simplify. Now, the Merge has its own distance property and variable in the modifier struct.
This commit is contained in:
Antonio Vazquez 2019-08-10 17:16:12 +02:00
parent 745f773d92
commit 7029810b04
4 changed files with 15 additions and 4 deletions

View File

@ -1793,7 +1793,7 @@ class DATA_PT_gpencil_modifiers(ModifierButtonsPanel, Panel):
elif md.mode == 'SAMPLE':
col.prop(md, "length")
elif md.mode == 'MERGE':
col.prop(md, "length", text="Threshold")
col.prop(md, "distance")
col = layout.column()
col.separator()

View File

@ -46,6 +46,7 @@ static void initData(GpencilModifierData *md)
gpmd->step = 1;
gpmd->factor = 0.0f;
gpmd->length = 0.1f;
gpmd->distance = 0.1f;
gpmd->layername[0] = '\0';
}
@ -94,7 +95,7 @@ static void deformStroke(GpencilModifierData *md,
break;
}
case GP_SIMPLIFY_MERGE: {
BKE_gpencil_merge_distance_stroke(gpf, gps, mmd->length, true);
BKE_gpencil_merge_distance_stroke(gpf, gps, mmd->distance, true);
break;
}
default:

View File

@ -502,8 +502,11 @@ typedef struct SimplifyGpencilModifierData {
short step;
/** Custom index for passes. */
int layer_pass;
/* Sample length */
/** Sample length */
float length;
/** Merge distance */
float distance;
char _pad[4];
} SimplifyGpencilModifierData;
typedef enum eSimplifyGpencil_Flag {

View File

@ -689,9 +689,16 @@ static void rna_def_modifier_gpencilsimplify(BlenderRNA *brna)
/* Sample */
prop = RNA_def_property(srna, "length", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "length");
RNA_def_property_range(prop, 0, 10);
RNA_def_property_range(prop, 0, 10.0f);
RNA_def_property_ui_text(prop, "Length", "Length of each segment");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
/* Distance */
prop = RNA_def_property(srna, "distance", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "distance");
RNA_def_property_range(prop, 0, 100.0f);
RNA_def_property_ui_text(prop, "Distance", "Distance between vertex");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
}
static void rna_def_modifier_gpencilthick(BlenderRNA *brna)