diff options
author | Bastien Montagne <bastien@blender.org> | 2020-04-11 18:12:56 +0300 |
---|---|---|
committer | Bastien Montagne <bastien@blender.org> | 2020-04-11 18:16:58 +0300 |
commit | 85de07e64c967e7d80e57d3df2db08fdec16794a (patch) | |
tree | 37497e1e0ee9924e947c1c93332eaf0b7dae3c8d /source/blender/modifiers/intern/MOD_weightvgproximity.c | |
parent | 5cc7036aa39506f3af3608ad450f1fdf6b2f3347 (diff) |
Sanitize and cleanup a bit depsgraph relations building in some modifiers.
This commit mainly:
* Removes some uneeded dependencies to geometry of other objects (since
we only use positions of those objects...).
* Ensures `DEG_add_modifier_to_transform_relation` is only called once
per modifier (in one case at least it could be called twice).
* For modifiers using texture mask, only add dependencies to object used
to generate texture coordinates when there is actually a texture set.
No behavior change expected from this commit...
Diffstat (limited to 'source/blender/modifiers/intern/MOD_weightvgproximity.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_weightvgproximity.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 7ef0d284ddf..7b7aaaeb654 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -366,6 +366,8 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx) { WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md; + bool need_transform_relation = false; + if (wmd->proximity_ob_target != NULL) { DEG_add_object_relation( ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier"); @@ -374,17 +376,25 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte DEG_add_object_relation( ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier"); } + need_transform_relation = true; } - 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, "WeightVGProximity Modifier"); - DEG_add_object_relation( - ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier"); - } + if (wmd->mask_texture != NULL) { DEG_add_generic_id_relation(ctx->node, &wmd->mask_texture->id, "WeightVGProximity 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, "WeightVGProximity 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, "WeightVGProximity Modifier"); } - DEG_add_modifier_to_transform_relation(ctx->node, "WeightVGProximity Modifier"); } static bool isDisabled(const struct Scene *UNUSED(scene), |