[Bf-blender-cvs] [ede14b3856c] master: GPencil: Invert weight in Weight Proximity modifier
Antonio Vazquez
noreply at git.blender.org
Fri Sep 24 16:16:45 CEST 2021
Commit: ede14b3856c5b8938e57d3db217d68a9399385f2
Author: Antonio Vazquez
Date: Fri Sep 24 16:08:46 2021 +0200
Branches: master
https://developer.blender.org/rBede14b3856c5b8938e57d3db217d68a9399385f2
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.
===================================================================
M source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
M source/blender/makesrna/intern/rna_gpencil_modifier.c
===================================================================
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
index 0885828a3a0..4079485de8d 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilweight_proximity.c
@@ -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;
diff --git a/source/blender/makesrna/intern/rna_gpencil_modifier.c b/source/blender/makesrna/intern/rna_gpencil_modifier.c
index 6480d16ccd2..ae6c7dcd76f 100644
--- a/source/blender/makesrna/intern/rna_gpencil_modifier.c
+++ b/source/blender/makesrna/intern/rna_gpencil_modifier.c
@@ -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);
More information about the Bf-blender-cvs
mailing list