diff options
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 12 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_boolean.c | 23 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_shrinkwrap.c | 7 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_smoke.c | 3 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.c | 14 | ||||
-rw-r--r-- | source/blender/modifiers/intern/MOD_util.h | 1 |
6 files changed, 31 insertions, 29 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index 971b3f0cd14..80caa384086 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -55,6 +55,8 @@ #include "BKE_modifier.h" #include "BKE_object.h" +#include "MOD_util.h" + #include "bmesh.h" #include "depsgraph_private.h" @@ -320,7 +322,7 @@ static void merge_first_last(BMesh *bm, static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, Scene *scene, Object *ob, DerivedMesh *dm, - int UNUSED(initFlags)) + ModifierApplyFlag flag) { DerivedMesh *result; BMesh *bm = DM_to_bmesh(dm, false); @@ -340,9 +342,9 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, /* need to avoid infinite recursion here */ if (amd->start_cap && amd->start_cap != ob && amd->start_cap->type == OB_MESH) - start_cap = mesh_get_derived_final(scene, amd->start_cap, CD_MASK_MESH); + start_cap = get_dm_for_modifier(amd->start_cap, flag); if (amd->end_cap && amd->end_cap != ob && amd->end_cap->type == OB_MESH) - end_cap = mesh_get_derived_final(scene, amd->end_cap, CD_MASK_MESH); + end_cap = get_dm_for_modifier(amd->end_cap, flag); unit_m4(offset); @@ -571,12 +573,12 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm, - ModifierApplyFlag UNUSED(flag)) + ModifierApplyFlag flag) { DerivedMesh *result; ArrayModifierData *amd = (ArrayModifierData *) md; - result = arrayModifier_doArray(amd, md->scene, ob, dm, 0); + result = arrayModifier_doArray(amd, md->scene, ob, dm, flag); return result; } diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c index bee7a32f6aa..71a8074c698 100644 --- a/source/blender/modifiers/intern/MOD_boolean.c +++ b/source/blender/modifiers/intern/MOD_boolean.c @@ -1,3 +1,4 @@ + /* * ***** BEGIN GPL LICENSE BLOCK ***** * @@ -119,7 +120,7 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *derivedData, - ModifierApplyFlag UNUSED(flag)) + ModifierApplyFlag flag) { BooleanModifierData *bmd = (BooleanModifierData *) md; DerivedMesh *dm; @@ -127,25 +128,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, if (!bmd->object) return derivedData; - - /* 2.63 used this... */ - /* dm = bmd->object->derivedFinal; */ - - /* but we want to make sure we can get the object - * in some cases the depsgraph fails us - especially for objects - * in other scenes when compositing */ - if (bmd->object != ob) { - /* weak! - but we can too easy end up with circular dep crash otherwise */ - if (bmd->object->type == OB_MESH && modifiers_findByType(bmd->object, eModifierType_Boolean) == NULL) { - dm = mesh_get_derived_final(md->scene, bmd->object, CD_MASK_MESH); - } - else { - dm = bmd->object->derivedFinal; - } - } - else { - dm = NULL; - } + dm = get_dm_for_modifier(bmd->object, flag); if (dm) { DerivedMesh *result; diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c index 6e96a160cd4..eebb687aa8d 100644 --- a/source/blender/modifiers/intern/MOD_shrinkwrap.c +++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c @@ -108,17 +108,18 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData, float (*vertexCos)[3], int numVerts, - ModifierApplyFlag UNUSED(flag)) + ModifierApplyFlag flag) { DerivedMesh *dm = derivedData; CustomDataMask dataMask = requiredDataMask(ob, md); + bool forRender = (flag & MOD_APPLY_RENDER) != 0; /* ensure we get a CDDM with applied vertex coords */ if (dataMask) { dm = get_cddm(ob, NULL, dm, vertexCos, dependsOnNormals(md)); } - shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts); + shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, forRender); if (dm != derivedData) dm->release(dm); @@ -135,7 +136,7 @@ static void deformVertsEM(ModifierData *md, Object *ob, struct BMEditMesh *editD dm = get_cddm(ob, editData, dm, vertexCos, dependsOnNormals(md)); } - shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts); + shrinkwrapModifier_deform((ShrinkwrapModifierData *)md, ob, dm, vertexCos, numVerts, false); if (dm != derivedData) dm->release(dm); diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c index 22a4c8753d8..fcd4cc96410 100644 --- a/source/blender/modifiers/intern/MOD_smoke.c +++ b/source/blender/modifiers/intern/MOD_smoke.c @@ -104,11 +104,12 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, ModifierApplyFlag flag) { SmokeModifierData *smd = (SmokeModifierData *) md; + bool for_render = (flag & MOD_APPLY_RENDER) != 0; if (flag & MOD_APPLY_ORCO) return dm; - return smokeModifier_do(smd, md->scene, ob, dm); + return smokeModifier_do(smd, md->scene, ob, dm, for_render); } static bool dependsOnTime(ModifierData *UNUSED(md)) diff --git a/source/blender/modifiers/intern/MOD_util.c b/source/blender/modifiers/intern/MOD_util.c index 62a02928920..bde30fb23ae 100644 --- a/source/blender/modifiers/intern/MOD_util.c +++ b/source/blender/modifiers/intern/MOD_util.c @@ -207,6 +207,20 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, return dm; } +/* Get derived mesh for other object, which is used as an operand for the modifier, + * i.e. second operand for boolean modifier. + */ +DerivedMesh *get_dm_for_modifier(Object *ob, ModifierApplyFlag flag) +{ + if (flag & MOD_APPLY_RENDER) { + /* TODO(sergey): Use proper derived render in the future. */ + return ob->derivedFinal; + } + else { + return ob->derivedFinal; + } +} + void modifier_get_vgroup(Object *ob, DerivedMesh *dm, const char *name, MDeformVert **dvert, int *defgrp_index) { *defgrp_index = defgroup_name_index(ob, name); diff --git a/source/blender/modifiers/intern/MOD_util.h b/source/blender/modifiers/intern/MOD_util.h index b4dcdc1721a..72077b5c000 100644 --- a/source/blender/modifiers/intern/MOD_util.h +++ b/source/blender/modifiers/intern/MOD_util.h @@ -48,6 +48,7 @@ struct DerivedMesh *get_cddm(struct Object *ob, struct BMEditMesh *em, struct De float (*vertexCos)[3], bool use_normals); struct DerivedMesh *get_dm(struct Object *ob, struct BMEditMesh *em, struct DerivedMesh *dm, float (*vertexCos)[3], bool use_normals, bool use_orco); +struct DerivedMesh *get_dm_for_modifier(struct Object *ob, ModifierApplyFlag flag); void modifier_get_vgroup(struct Object *ob, struct DerivedMesh *dm, const char *name, struct MDeformVert **dvert, int *defgrp_index); |