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:
-rw-r--r--release/scripts/startup/bl_ui/properties_data_modifier.py4
-rw-r--r--source/blender/makesdna/DNA_modifier_types.h1
-rw-r--r--source/blender/makesrna/intern/rna_modifier.c5
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c8
4 files changed, 16 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/properties_data_modifier.py b/release/scripts/startup/bl_ui/properties_data_modifier.py
index b91c7f71843..7dadbd427fd 100644
--- a/release/scripts/startup/bl_ui/properties_data_modifier.py
+++ b/release/scripts/startup/bl_ui/properties_data_modifier.py
@@ -454,7 +454,9 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
col.prop_search(md, "subtarget", md.object.data, "bones", text="")
col = split.column()
col.label(text="Vertex Group:")
- col.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ row = col.row(align=True)
+ row.prop_search(md, "vertex_group", ob, "vertex_groups", text="")
+ row.prop(md, "invert_vertex_group", text="", icon='ARROW_LEFTRIGHT')
layout.separator()
diff --git a/source/blender/makesdna/DNA_modifier_types.h b/source/blender/makesdna/DNA_modifier_types.h
index 2c0d34fdccf..474e9107bc4 100644
--- a/source/blender/makesdna/DNA_modifier_types.h
+++ b/source/blender/makesdna/DNA_modifier_types.h
@@ -703,6 +703,7 @@ typedef struct ArmatureModifierData {
enum {
MOD_HOOK_UNIFORM_SPACE = (1 << 0),
+ MOD_HOOK_INVERT_VGROUP = (1 << 1)
};
/* same as WarpModifierFalloff */
diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index 0d953728c5e..c6898120bfa 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -2550,6 +2550,11 @@ static void rna_def_modifier_hook(BlenderRNA *brna)
func, "indices", 1, NULL, INT_MIN, INT_MAX, "", "Vertex Indices", 0, INT_MAX);
RNA_def_property_array(parm, RNA_MAX_ARRAY_LENGTH);
RNA_def_parameter_flags(parm, PROP_DYNAMIC, PARM_REQUIRED);
+
+ prop = RNA_def_property(srna, "invert_vertex_group", PROP_BOOLEAN, PROP_NONE);
+ RNA_def_property_boolean_sdna(prop, NULL, "flag", MOD_HOOK_INVERT_VGROUP);
+ RNA_def_property_ui_text(prop, "Invert", "Invert vertex group influence");
+ RNA_def_property_update(prop, 0, "rna_Modifier_update");
}
static void rna_def_modifier_softbody(BlenderRNA *brna)
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);