From de491abf996281785391b18b3547d1bff305355f Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 7 Dec 2018 15:45:53 +0100 Subject: Fix modifiers evaluation outside of depsgraph/CoW context. Fix T58237: Exporters: Curve Modifier not applied when "apply modifiers" are selected. Fix T58856: Python: "to_mesh" broken in 2.8. ...And many other cases... ;) Thing is, we need target IDs to always be evaluated ones (at least I cannot see any case where having orig ones is desired effect here). Depsgraph/Cow system ensures us that when modifiers are evaluated by it, but they can also be called outside of this context, e.g. when doing binding, or object conversion... So we need to ensure in modifiers code that we actually are always working with eval data for those targets. Note that I did not touch to physics modifiers, those are a bit touchy and rather not 'fix' something there until proven broken! --- source/blender/modifiers/intern/MOD_boolean.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source/blender/modifiers/intern/MOD_boolean.c') diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index 7c09f86b4ca..840cee6f630 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -176,15 +176,14 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes Mesh *mesh_other; bool mesh_other_free; - if (!bmd->object) { + if (bmd->object == NULL) { return result; } - Object *ob_eval = DEG_get_evaluated_object(ctx->depsgraph, bmd->object); - mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(ob_eval, &mesh_other_free); + Object *other = DEG_get_evaluated_object(ctx->depsgraph, bmd->object); + mesh_other = BKE_modifier_get_evaluated_mesh_from_evaluated_object(other, &mesh_other_free); if (mesh_other) { Object *object = ctx->object; - Object *other = bmd->object; /* when one of objects is empty (has got no faces) we could speed up * calculation a bit returning one of objects' derived meshes (or empty one) @@ -266,6 +265,7 @@ static Mesh *applyModifier(ModifierData *md, const ModifierEvalContext *ctx, Mes short *material_remap = BLI_array_alloca(material_remap, ob_src_totcol ? ob_src_totcol : 1); /* Using original (not evaluated) object here since we are writing to it. */ + /* XXX Pretty sure comment above is fully wrong now with CoW & co ? */ BKE_material_remap_object_calc(ctx->object, other, material_remap); BMFace *efa; -- cgit v1.2.3