GPencil: Invert weight in Weight Proximity modifier

In meshes modifer the Lowest is 0 and Highest is 1.0 and this was working inverted for grease pencil. Now, it works equals to meshes modifier.

Also changed the tooltip to keep consistency with meshes modifier.
This commit is contained in:
Antonio Vazquez 2021-09-24 16:08:46 +02:00
parent 95ec6e4dd3
commit ede14b3856
2 changed files with 5 additions and 5 deletions

View File

@ -83,13 +83,13 @@ static float calc_point_weight_by_distance(Object *ob,
float dist = len_v3v3(mmd->object->obmat[3], gvert);
if (dist > dist_max) {
weight = 0.0f;
weight = 1.0f;
}
else if (dist <= dist_max && dist > dist_min) {
weight = (dist_max - dist) / max_ff((dist_max - dist_min), 0.0001f);
weight = 1.0f - ((dist_max - dist) / max_ff((dist_max - dist_min), 0.0001f));
}
else {
weight = 1.0f;
weight = 0.0f;
}
return weight;

View File

@ -2867,7 +2867,7 @@ static void rna_def_modifier_gpencilweight_proximity(BlenderRNA *brna)
prop = RNA_def_property(srna, "distance_start", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dist_start");
RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2);
RNA_def_property_ui_text(prop, "Lowest", "Start value for distance calculation");
RNA_def_property_ui_text(prop, "Lowest", "Distance mapping to 0.0 weight");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "minimum_weight", PROP_FLOAT, PROP_FACTOR);
@ -2878,7 +2878,7 @@ static void rna_def_modifier_gpencilweight_proximity(BlenderRNA *brna)
prop = RNA_def_property(srna, "distance_end", PROP_FLOAT, PROP_NONE);
RNA_def_property_float_sdna(prop, NULL, "dist_end");
RNA_def_property_ui_range(prop, 0, 1000.0, 1.0, 2);
RNA_def_property_ui_text(prop, "Highest", "Max value for distance calculation");
RNA_def_property_ui_text(prop, "Highest", "Distance mapping to 1.0 weight");
RNA_def_property_update(prop, 0, "rna_GpencilModifier_update");
prop = RNA_def_property(srna, "pass_index", PROP_INT, PROP_NONE);