[Bf-blender-cvs] [50178acb07e] temp-angavrilov: Vertex Weight Mix: support Minimim and Maximum mix modes.
Alexander Gavrilov
noreply at git.blender.org
Sun Feb 20 08:54:05 CET 2022
Commit: 50178acb07e01a7c747dcf70826e2cef41d6aa08
Author: Alexander Gavrilov
Date: Sun Feb 20 01:52:43 2022 +0300
Branches: temp-angavrilov
https://developer.blender.org/rB50178acb07e01a7c747dcf70826e2cef41d6aa08
Vertex Weight Mix: support Minimim and Maximum mix modes.
They seem to be obvious and useful simple math functions to add.
===================================================================
M source/blender/makesdna/DNA_modifier_types.h
M source/blender/makesrna/intern/rna_modifier.c
M source/blender/modifiers/intern/MOD_weightvgmix.c
===================================================================
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index db5a3d69e4d..36f14e7d357 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -1604,6 +1604,10 @@ enum {
MOD_WVG_MIX_DIF = 6,
/** Average of both weights. */
MOD_WVG_MIX_AVG = 7,
+ /** Minimum of both weights. */
+ MOD_WVG_MIX_MIN = 8,
+ /** Maximum of both weights. */
+ MOD_WVG_MIX_MAX = 9,
};
/** #WeightVGMixModifierData.mix_set (what vertices to affect). */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 45d22981205..4b8a3f8415f 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -5166,6 +5166,8 @@ static void rna_def_modifier_weightvgmix(BlenderRNA *brna)
"Difference",
"Difference between VGroup A's and VGroup B's weights"},
{MOD_WVG_MIX_AVG, "AVG", 0, "Average", "Average value of VGroup A's and VGroup B's weights"},
+ {MOD_WVG_MIX_MIN, "MIN", 0, "Minimum", "Minimum of VGroup A's and VGroup B's weights"},
+ {MOD_WVG_MIX_MAX, "MAX", 0, "Maximum", "Maximum of VGroup A's and VGroup B's weights"},
{0, NULL, 0, NULL, NULL},
};
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index 1078ebfaeb2..1b6472e2d42 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -105,6 +105,12 @@ static float mix_weight(float weight, float weight2, char mix_mode)
if (mix_mode == MOD_WVG_MIX_AVG) {
return (weight + weight2) * 0.5f;
}
+ if (mix_mode == MOD_WVG_MIX_MIN) {
+ return (weight < weight2 ? weight : weight2);
+ }
+ if (mix_mode == MOD_WVG_MIX_MAX) {
+ return (weight > weight2 ? weight : weight2);
+ }
return weight2;
}
More information about the Bf-blender-cvs
mailing list