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-02-12 12:34:35 +0300
committerBastien Montagne <b.mont29@gmail.com>2020-02-12 12:34:35 +0300
commite32457952b45e5df7c3fc7d3e948e1403c7452da (patch)
treed6b8bbf09bab31a3d43ae8be4a67b0cf1bdc422e /source/blender/modifiers
parent1f28af6a79994154a66a341baea6b43441e3c395 (diff)
Modifiers: Hook Modifier add invert vgroup option
Adds the invert group optin to the hook modifier. Differential Revision: https://developer.blender.org/D6817
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index b1a662c8667..6b5d7233b60 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -143,6 +143,8 @@ struct HookData_cb {
float mat_uniform[3][3];
float mat[4][4];
+
+ bool invert_vgroup;
};
static float hook_falloff(const struct HookData_cb *hd, const float len_sq)
@@ -236,7 +238,8 @@ static void hook_co_apply(struct HookData_cb *hd, const int j)
if (fac) {
if (hd->dvert) {
- fac *= defvert_find_weight(&hd->dvert[j], hd->defgrp_index);
+ fac *= hd->invert_vgroup ? 1.0f - defvert_find_weight(&hd->dvert[j], hd->defgrp_index) :
+ defvert_find_weight(&hd->dvert[j], hd->defgrp_index);
}
if (fac) {
@@ -259,6 +262,7 @@ static void deformVerts_do(HookModifierData *hmd,
float dmat[4][4];
int i, *index_pt;
struct HookData_cb hd;
+ const bool invert_vgroup = (hmd->flag & MOD_HOOK_INVERT_VGROUP) != 0;
if (hmd->curfalloff == NULL) {
/* should never happen, but bad lib linking could cause it */
@@ -283,6 +287,8 @@ static void deformVerts_do(HookModifierData *hmd,
hd.use_falloff = (hd.falloff_sq != 0.0f);
hd.use_uniform = (hmd->flag & MOD_HOOK_UNIFORM_SPACE) != 0;
+ hd.invert_vgroup = invert_vgroup;
+
if (hd.use_uniform) {
copy_m3_m4(hd.mat_uniform, hmd->parentinv);
mul_v3_m3v3(hd.cent, hd.mat_uniform, hmd->cent);