Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Winchester <CodyWinch>2020-01-27 16:03:24 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2020-01-27 16:46:01 +0300
commit1094e560413d38e9834ae563ef248f898cb8b201 (patch)
tree4ca12baecce5ef734cb6f5dee69b29ff65104938 /source/blender/modifiers/intern/MOD_cast.c
parent2ab5ca81a5379cb99dfc134efffe070d4851d311 (diff)
Cast modifier: Add invert vgroup option.
Adds the Invert Vertex Group weight option to the Cast modifier. Uses the same setup as similar modifiers invert weight. Adds a boolean invert property next to the vertex group string in the modifier and subtracts the current vertex weight from 1.0f if it is turned on. Differential Revision: https://developer.blender.org/D6671 Minor modifications by @mont29.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_cast.c')
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 0bf1dd8e2b3..b070a3c7127 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -105,6 +105,7 @@ static void sphere_do(CastModifierData *cmd,
int numVerts)
{
MDeformVert *dvert = NULL;
+ const bool invert_vgroup = (cmd->flag & MOD_CAST_INVERT_VGROUP) != 0;
Object *ctrl_ob = NULL;
@@ -198,7 +199,9 @@ static void sphere_do(CastModifierData *cmd,
}
if (dvert) {
- const float weight = defvert_find_weight(&dvert[i], defgrp_index);
+ const float weight = invert_vgroup ? 1.0f - defvert_find_weight(&dvert[i], defgrp_index) :
+ defvert_find_weight(&dvert[i], defgrp_index);
+
if (weight == 0.0f) {
continue;
}
@@ -240,6 +243,8 @@ static void cuboid_do(CastModifierData *cmd,
int numVerts)
{
MDeformVert *dvert = NULL;
+ const bool invert_vgroup = (cmd->flag & MOD_CAST_INVERT_VGROUP) != 0;
+
Object *ctrl_ob = NULL;
int i, defgrp_index;
@@ -365,7 +370,9 @@ static void cuboid_do(CastModifierData *cmd,
}
if (dvert) {
- const float weight = defvert_find_weight(&dvert[i], defgrp_index);
+ const float weight = invert_vgroup ? 1.0f - defvert_find_weight(&dvert[i], defgrp_index) :
+ defvert_find_weight(&dvert[i], defgrp_index);
+
if (weight == 0.0f) {
continue;
}