diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-30 12:34:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2018-05-30 13:04:06 +0300 |
commit | 72f4ac99c70b02e095cc9a71d501d6b1dc85ac3e (patch) | |
tree | 940c598d4efb2246eb7b523840e2b7337a59bc1b /source/blender/modifiers/intern/MOD_boolean.c | |
parent | e55c1a9b5a089f3c688a0b47cba363cb0d6f92d0 (diff) |
Cleanup/fix wrong modifiers targets handling in COW context.
Modifiers stack only get COW/evaluated IDs, so no need to go auery again
DEG for those. Further more, now unified handling of EditBMesh case (was
done on case-by-case basis in a few modifiers, not all for some reason).
We are still missing the ability to get final and cage deformed meshes
when in Edit mode though, this is to be defined/implemented in depsgraph.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_boolean.c')
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 73d1388d88f..2b6f6cf8920 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -170,14 +170,16 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data)) static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { BooleanModifierData *bmd = (BooleanModifierData *) md; + Mesh *result; + Mesh *mesh_other; + bool mesh_other_free; if (!bmd->object) return mesh; - mesh_other = BKE_modifier_get_evaluated_mesh_from_object(ctx, bmd->object); + mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(bmd->object, &mesh_other_free); if (mesh_other) { - Mesh *result; Object *object_eval = DEG_get_evaluated_object(ctx->depsgraph, ctx->object); Object *other_eval = DEG_get_evaluated_object(ctx->depsgraph, bmd->object); @@ -321,19 +323,19 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes #ifdef DEBUG_TIME TIMEIT_END(boolean_bmesh); #endif - - return result; } /* if new mesh returned, return it; otherwise there was * an error, so delete the modifier object */ - if (result) - return result; - else + if (result == NULL) modifier_setError(md, "Cannot execute boolean operation"); } - return mesh; + if (mesh_other != NULL && mesh_other_free) { + BKE_id_free(NULL, mesh_other); + } + + return result; } static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md)) |