Fix #133296: Grease Pencil influence VG affects stroke but not fill
This was true for Opacity or Tint modifiers where influence vertexgroups were having an effect on strokes, but were ignored for fills. This was also the case for GPv2 / 4.2, but there is no apparent reason for not doing this on fills (if we are doing it for strokes). NOTE: it was actually in use if "Use Weight as Factor" was used (but that only means weights should be used directly, otherwise [when used as influence], weights should be multiplied). Pull Request: https://projects.blender.org/blender/blender/pulls/133306
This commit is contained in:
committed by
Philipp Oeser
parent
ff9992d77f
commit
f6b820ccb7
@@ -141,11 +141,11 @@ static void modify_fill_color(const GreasePencilOpacityModifierData &omd,
|
||||
curves, omd.influence);
|
||||
|
||||
curves_mask.foreach_index(GrainSize(512), [&](int64_t curve_i) {
|
||||
/* Use the first stroke point as vertex weight. */
|
||||
const IndexRange points = points_by_curve[curve_i];
|
||||
const float vgroup_weight_first = vgroup_weights[points.first()];
|
||||
float stroke_weight = vgroup_weight_first;
|
||||
if (use_vgroup_opacity) {
|
||||
/* Use the first stroke point as vertex weight. */
|
||||
const IndexRange points = points_by_curve[curve_i];
|
||||
const float vgroup_weight_first = vgroup_weights[points.first()];
|
||||
float stroke_weight = vgroup_weight_first;
|
||||
if (points.is_empty() || (vgroup_weight_first <= 0.0f)) {
|
||||
stroke_weight = 1.0f;
|
||||
}
|
||||
@@ -154,7 +154,9 @@ static void modify_fill_color(const GreasePencilOpacityModifierData &omd,
|
||||
fill_opacities.span[curve_i] = std::clamp(stroke_influence, 0.0f, 1.0f);
|
||||
}
|
||||
else {
|
||||
fill_opacities.span[curve_i] = std::clamp(omd.color_factor, 0.0f, 1.0f);
|
||||
if (!points.is_empty() && (vgroup_weight_first > 0.0f)) {
|
||||
fill_opacities.span[curve_i] = std::clamp(omd.color_factor * stroke_weight, 0.0f, 1.0f);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -272,13 +272,17 @@ static void modify_fill_color(Object &ob,
|
||||
};
|
||||
|
||||
auto get_curve_factor = [&](const int64_t curve_i) {
|
||||
if (use_weight_as_factor) {
|
||||
/* Use the first stroke point as vertex weight. */
|
||||
const IndexRange points = points_by_curve[curve_i];
|
||||
const float weight = points.is_empty() ? 1.0f : vgroup_weights[points.first()];
|
||||
return invert_vertex_group ? 1.0f - weight : weight;
|
||||
/* Use the first stroke point as vertex weight. */
|
||||
const IndexRange points = points_by_curve[curve_i];
|
||||
const float vgroup_weight_first = vgroup_weights[points.first()];
|
||||
float stroke_weight = vgroup_weight_first;
|
||||
if (points.is_empty() || (vgroup_weight_first <= 0.0f)) {
|
||||
return 0.0f;
|
||||
}
|
||||
return tmd.factor;
|
||||
else if (use_weight_as_factor) {
|
||||
return invert_vertex_group ? 1.0f - stroke_weight : stroke_weight;
|
||||
}
|
||||
return tmd.factor * stroke_weight;
|
||||
};
|
||||
|
||||
switch (tint_mode) {
|
||||
|
||||
Reference in New Issue
Block a user