From c51b017a1a12ed1bc9001c2e4e47b14e07f53b53 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Tue, 8 May 2018 12:58:01 +0200 Subject: WeightVG modifiers: Cleanup, add asserts to validate expected data status... --- source/blender/modifiers/intern/MOD_weightvgedit.c | 6 ++++-- source/blender/modifiers/intern/MOD_weightvgmix.c | 2 ++ source/blender/modifiers/intern/MOD_weightvgproximity.c | 5 ++++- 3 files changed, 10 insertions(+), 3 deletions(-) (limited to 'source/blender/modifiers/intern') diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c index cc000cbee09..e2b1a491ced 100644 --- a/source/blender/modifiers/intern/MOD_weightvgedit.c +++ b/source/blender/modifiers/intern/MOD_weightvgedit.c @@ -155,9 +155,11 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) } static Mesh *applyModifier(ModifierData *md, - const ModifierEvalContext *ctx, - Mesh *mesh) + const ModifierEvalContext *ctx, + Mesh *mesh) { + BLI_assert(mesh != NULL); + WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md; MDeformVert *dvert = NULL; diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c index 2ea721c1982..0841bc9bfc0 100644 --- a/source/blender/modifiers/intern/MOD_weightvgmix.c +++ b/source/blender/modifiers/intern/MOD_weightvgmix.c @@ -204,6 +204,8 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { + BLI_assert(mesh != NULL); + WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md; MDeformVert *dvert = NULL; diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c index 85d647c3f41..1b5ef23884d 100644 --- a/source/blender/modifiers/intern/MOD_weightvgproximity.c +++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c @@ -41,6 +41,7 @@ #include "DNA_object_types.h" #include "BKE_cdderivedmesh.h" +#include "BKE_curve.h" #include "BKE_customdata.h" #include "BKE_deform.h" #include "BKE_library.h" @@ -380,6 +381,8 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams)) static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { + BLI_assert(mesh != NULL); + WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md; MDeformVert *dvert = NULL; MDeformWeight **dw, **tdw; @@ -519,7 +522,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes Mesh *target_mesh = get_mesh_eval_for_modifier(obr, ctx->flag); /* We must check that we do have a valid target_mesh! */ - if (target_mesh) { + if (target_mesh != NULL) { SpaceTransform loc2trgt; float *dists_v = use_trgt_verts ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_v") : NULL; float *dists_e = use_trgt_edges ? MEM_malloc_arrayN(numIdx, sizeof(float), "dists_e") : NULL; -- cgit v1.2.3