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:
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgedit.c')
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index ba1745f7b5e..8ce1aaee942 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -10,7 +10,7 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
+ * along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* The Original Code is Copyright (C) 2011 by Bastien Montagne.
@@ -45,6 +45,7 @@
#include "MEM_guardedalloc.h"
#include "MOD_modifiertypes.h"
+#include "MOD_util.h"
#include "MOD_weightvg_util.h"
/**************************************
@@ -79,7 +80,7 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla
const WeightVGEditModifierData *wmd = (const WeightVGEditModifierData *)md;
WeightVGEditModifierData *twmd = (WeightVGEditModifierData *)target;
- modifier_copyData_generic(md, target, flag);
+ BKE_modifier_copydata_generic(md, target, flag);
twmd->cmap_curve = BKE_curvemapping_copy(wmd->cmap_curve);
}
@@ -134,16 +135,23 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
- if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(
- ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
- DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
- }
- else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
- }
+ bool need_transform_relation = false;
+
if (wmd->mask_texture != NULL) {
DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGEdit Modifier");
+
+ if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
+ MOD_depsgraph_update_object_bone_relation(
+ ctx->node, wmd->mask_tex_map_obj, wmd->mask_tex_map_bone, "WeightVGEdit Modifier");
+ need_transform_relation = true;
+ }
+ else if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
+ need_transform_relation = true;
+ }
+ }
+
+ if (need_transform_relation) {
+ DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGEdit Modifier");
}
}
@@ -156,7 +164,7 @@ static bool isDisabled(const struct Scene *UNUSED(scene),
return (wmd->defgrp_name[0] == '\0');
}
-static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
+static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh)
{
BLI_assert(mesh != NULL);
@@ -231,6 +239,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
/* Do mapping. */
const bool do_invert_mapping = (wmd->edit_flags & MOD_WVG_INVERT_FALLOFF) != 0;
+ const bool do_normalize = (wmd->edit_flags & MOD_WVG_EDIT_WEIGHTS_NORMALIZE) != 0;
if (do_invert_mapping || wmd->falloff_type != MOD_WVG_MAPPING_NONE) {
RNG *rng = NULL;
@@ -261,6 +270,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
wmd->mask_tex_use_channel,
wmd->mask_tex_mapping,
wmd->mask_tex_map_obj,
+ wmd->mask_tex_map_bone,
wmd->mask_tex_uvlayer_name,
invert_vgroup_mask);
@@ -274,7 +284,8 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes
do_add,
wmd->add_threshold,
do_rem,
- wmd->rem_threshold);
+ wmd->rem_threshold,
+ do_normalize);
/* If weight preview enabled... */
#if 0 /* XXX Currently done in mod stack :/ */
@@ -306,7 +317,10 @@ ModifierTypeInfo modifierType_WeightVGEdit = {
/* deformMatrices */ NULL,
/* deformVertsEM */ NULL,
/* deformMatricesEM */ NULL,
- /* applyModifier */ applyModifier,
+ /* modifyMesh */ modifyMesh,
+ /* modifyHair */ NULL,
+ /* modifyPointCloud */ NULL,
+ /* modifyVolume */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,