Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2018-04-15 13:16:55 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2018-04-15 13:16:55 +0300
commit7e1832c8d546ec13e752b7bd42ce13e3fc10ae86 (patch)
tree0fff9d878db69b288f909ff9a0f8aefe31ab8d80 /source/blender/modifiers
parentc0c8df3f2cf3ab03cec1f660619b0fe2290caf2a (diff)
parent94959dba1b53640e2a36cf9b5ca46aaf49c5c74a (diff)
Merge branch 'blender2.8' into hair_guides
Diffstat (limited to 'source/blender/modifiers')
-rw-r--r--source/blender/modifiers/CMakeLists.txt11
-rw-r--r--source/blender/modifiers/intern/MOD_armature.c10
-rw-r--r--source/blender/modifiers/intern/MOD_array.c48
-rw-r--r--source/blender/modifiers/intern/MOD_boolean.c118
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.c790
-rw-r--r--source/blender/modifiers/intern/MOD_boolean_util.h46
-rw-r--r--source/blender/modifiers/intern/MOD_build.c14
-rw-r--r--source/blender/modifiers/intern/MOD_cast.c10
-rw-r--r--source/blender/modifiers/intern/MOD_cloth.c10
-rw-r--r--source/blender/modifiers/intern/MOD_curve.c12
-rw-r--r--source/blender/modifiers/intern/MOD_datatransfer.c8
-rw-r--r--source/blender/modifiers/intern/MOD_displace.c20
-rw-r--r--source/blender/modifiers/intern/MOD_dynamicpaint.c12
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim.c16
-rw-r--r--source/blender/modifiers/intern/MOD_fluidsim_util.c6
-rw-r--r--source/blender/modifiers/intern/MOD_hook.c12
-rw-r--r--source/blender/modifiers/intern/MOD_lattice.c12
-rw-r--r--source/blender/modifiers/intern/MOD_mask.c8
-rw-r--r--source/blender/modifiers/intern/MOD_meshdeform.c12
-rw-r--r--source/blender/modifiers/intern/MOD_meshsequencecache.c16
-rw-r--r--source/blender/modifiers/intern/MOD_mirror.c10
-rw-r--r--source/blender/modifiers/intern/MOD_normal_edit.c8
-rw-r--r--source/blender/modifiers/intern/MOD_particleinstance.c9
-rw-r--r--source/blender/modifiers/intern/MOD_screw.c8
-rw-r--r--source/blender/modifiers/intern/MOD_shrinkwrap.c14
-rw-r--r--source/blender/modifiers/intern/MOD_simpledeform.c8
-rw-r--r--source/blender/modifiers/intern/MOD_skin.c6
-rw-r--r--source/blender/modifiers/intern/MOD_smoke.c14
-rw-r--r--source/blender/modifiers/intern/MOD_softbody.c14
-rw-r--r--source/blender/modifiers/intern/MOD_surfacedeform.c34
-rw-r--r--source/blender/modifiers/intern/MOD_uvproject.c8
-rw-r--r--source/blender/modifiers/intern/MOD_uvwarp.c16
-rw-r--r--source/blender/modifiers/intern/MOD_warp.c12
-rw-r--r--source/blender/modifiers/intern/MOD_wave.c20
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgedit.c14
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgmix.c24
-rw-r--r--source/blender/modifiers/intern/MOD_weightvgproximity.c28
37 files changed, 181 insertions, 1257 deletions
diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt
index 8066d0605fc..cf1021ec945 100644
--- a/source/blender/modifiers/CMakeLists.txt
+++ b/source/blender/modifiers/CMakeLists.txt
@@ -108,7 +108,6 @@ set(SRC
intern/MOD_wireframe.c
MOD_modifiertypes.h
- intern/MOD_boolean_util.h
intern/MOD_fluidsim_util.h
intern/MOD_meshcache_util.h
intern/MOD_util.h
@@ -122,16 +121,6 @@ if(WITH_ALEMBIC)
)
endif()
-if(WITH_MOD_BOOLEAN)
- add_definitions(-DWITH_MOD_BOOLEAN)
- list(APPEND SRC
- intern/MOD_boolean_util.c
- )
- list(APPEND INC
- ../../../extern/carve
- )
-endif()
-
if(WITH_MOD_REMESH)
add_definitions(-DWITH_MOD_REMESH)
list(APPEND INC
diff --git a/source/blender/modifiers/intern/MOD_armature.c b/source/blender/modifiers/intern/MOD_armature.c
index 60c7998853e..f6640704a83 100644
--- a/source/blender/modifiers/intern/MOD_armature.c
+++ b/source/blender/modifiers/intern/MOD_armature.c
@@ -97,16 +97,12 @@ static void foreachObjectLink(
walk(userData, ob, &amd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ArmatureModifierData *amd = (ArmatureModifierData *)md;
if (amd->object != NULL) {
- DEG_add_object_relation(node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
- DEG_add_object_relation(node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
+ DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_EVAL_POSE, "Armature Modifier");
+ DEG_add_object_relation(ctx->node, amd->object, DEG_OB_COMP_TRANSFORM, "Armature Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index 91501e539c0..f598667f96d 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -51,6 +51,7 @@
#include "BKE_library_query.h"
#include "BKE_modifier.h"
#include "BKE_mesh.h"
+#include "BKE_object_deform.h"
#include "MOD_util.h"
@@ -96,26 +97,22 @@ static void foreachObjectLink(
walk(userData, ob, &amd->offset_ob, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ArrayModifierData *amd = (ArrayModifierData *)md;
if (amd->start_cap != NULL) {
- DEG_add_object_relation(node, amd->start_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier Start Cap");
+ DEG_add_object_relation(ctx->node, amd->start_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier Start Cap");
}
if (amd->end_cap != NULL) {
- DEG_add_object_relation(node, amd->end_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier End Cap");
+ DEG_add_object_relation(ctx->node, amd->end_cap, DEG_OB_COMP_TRANSFORM, "Array Modifier End Cap");
}
if (amd->curve_ob) {
- struct Depsgraph *depsgraph = DEG_get_graph_from_handle(node);
- DEG_add_object_relation(node, amd->curve_ob, DEG_OB_COMP_GEOMETRY, "Array Modifier Curve");
+ struct Depsgraph *depsgraph = DEG_get_graph_from_handle(ctx->node);
+ DEG_add_object_relation(ctx->node, amd->curve_ob, DEG_OB_COMP_GEOMETRY, "Array Modifier Curve");
DEG_add_special_eval_flag(depsgraph, &amd->curve_ob->id, DAG_EVAL_NEED_CURVE_PATH);
}
if (amd->offset_ob != NULL) {
- DEG_add_object_relation(node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
+ DEG_add_object_relation(ctx->node, amd->offset_ob, DEG_OB_COMP_TRANSFORM, "Array Modifier Offset");
}
}
@@ -279,7 +276,7 @@ static void dm_mvert_map_doubles(
static void dm_merge_transform(
DerivedMesh *result, DerivedMesh *cap_dm, float cap_offset[4][4],
unsigned int cap_verts_index, unsigned int cap_edges_index, int cap_loops_index, int cap_polys_index,
- int cap_nverts, int cap_nedges, int cap_nloops, int cap_npolys)
+ int cap_nverts, int cap_nedges, int cap_nloops, int cap_npolys, int *remap, int remap_len)
{
int *index_orig;
int i;
@@ -287,6 +284,7 @@ static void dm_merge_transform(
MEdge *me;
MLoop *ml;
MPoly *mp;
+ MDeformVert *dvert;
/* needed for subsurf so arrays are allocated */
cap_dm->getVertArray(cap_dm);
@@ -307,6 +305,12 @@ static void dm_merge_transform(
mv->flag = mv->bweight = 0;
}
+ /* remap the vertex groups if necessary */
+ dvert = DM_get_vert_data(result, cap_verts_index, CD_MDEFORMVERT);
+ if (dvert != NULL) {
+ BKE_object_defgroup_index_map_apply(dvert, cap_nverts, remap, remap_len);
+ }
+
/* adjust cap edge vertex indices */
me = CDDM_get_edges(result) + cap_edges_index;
for (i = 0; i < cap_nedges; i++, me++) {
@@ -383,6 +387,11 @@ static DerivedMesh *arrayModifier_doArray(
DerivedMesh *result, *start_cap_dm = NULL, *end_cap_dm = NULL;
+ int *vgroup_start_cap_remap = NULL;
+ int vgroup_start_cap_remap_len = 0;
+ int *vgroup_end_cap_remap = NULL;
+ int vgroup_end_cap_remap_len = 0;
+
chunk_nverts = dm->getNumVerts(dm);
chunk_nedges = dm->getNumEdges(dm);
chunk_nloops = dm->getNumLoops(dm);
@@ -391,6 +400,8 @@ static DerivedMesh *arrayModifier_doArray(
count = amd->count;
if (amd->start_cap && amd->start_cap != ob && amd->start_cap->type == OB_MESH) {
+ vgroup_start_cap_remap = BKE_object_defgroup_index_map_create(amd->start_cap, ob, &vgroup_start_cap_remap_len);
+
start_cap_dm = get_dm_for_modifier(amd->start_cap, flag);
if (start_cap_dm) {
start_cap_nverts = start_cap_dm->getNumVerts(start_cap_dm);
@@ -400,6 +411,8 @@ static DerivedMesh *arrayModifier_doArray(
}
}
if (amd->end_cap && amd->end_cap != ob && amd->end_cap->type == OB_MESH) {
+ vgroup_end_cap_remap = BKE_object_defgroup_index_map_create(amd->end_cap, ob, &vgroup_end_cap_remap_len);
+
end_cap_dm = get_dm_for_modifier(amd->end_cap, flag);
if (end_cap_dm) {
end_cap_nverts = end_cap_dm->getNumVerts(end_cap_dm);
@@ -656,7 +669,8 @@ static DerivedMesh *arrayModifier_doArray(
result_nedges - start_cap_nedges - end_cap_nedges,
result_nloops - start_cap_nloops - end_cap_nloops,
result_npolys - start_cap_npolys - end_cap_npolys,
- start_cap_nverts, start_cap_nedges, start_cap_nloops, start_cap_npolys);
+ start_cap_nverts, start_cap_nedges, start_cap_nloops, start_cap_npolys,
+ vgroup_start_cap_remap, vgroup_start_cap_remap_len);
/* Identify doubles with first chunk */
if (use_merge) {
dm_mvert_map_doubles(
@@ -680,7 +694,8 @@ static DerivedMesh *arrayModifier_doArray(
result_nedges - end_cap_nedges,
result_nloops - end_cap_nloops,
result_npolys - end_cap_npolys,
- end_cap_nverts, end_cap_nedges, end_cap_nloops, end_cap_npolys);
+ end_cap_nverts, end_cap_nedges, end_cap_nloops, end_cap_npolys,
+ vgroup_end_cap_remap, vgroup_end_cap_remap_len);
/* Identify doubles with last chunk */
if (use_merge) {
dm_mvert_map_doubles(
@@ -728,6 +743,13 @@ static DerivedMesh *arrayModifier_doArray(
result->dirty |= DM_DIRTY_NORMALS;
}
+ if (vgroup_start_cap_remap) {
+ MEM_freeN(vgroup_start_cap_remap);
+ }
+ if (vgroup_end_cap_remap) {
+ MEM_freeN(vgroup_end_cap_remap);
+ }
+
return result;
}
diff --git a/source/blender/modifiers/intern/MOD_boolean.c b/source/blender/modifiers/intern/MOD_boolean.c
index 0554fbb0317..c9d762a7fbe 100644
--- a/source/blender/modifiers/intern/MOD_boolean.c
+++ b/source/blender/modifiers/intern/MOD_boolean.c
@@ -33,10 +33,6 @@
*/
// #ifdef DEBUG_TIME
-#define USE_BMESH
-#ifdef WITH_MOD_BOOLEAN
-# define USE_CARVE WITH_MOD_BOOLEAN
-#endif
#include <stdio.h>
@@ -49,11 +45,9 @@
#include "BKE_library_query.h"
#include "BKE_modifier.h"
-#include "MOD_boolean_util.h"
#include "MOD_util.h"
-#ifdef USE_BMESH
#include "BLI_alloca.h"
#include "BLI_math_geom.h"
#include "BKE_material.h"
@@ -63,18 +57,16 @@
#include "bmesh.h"
#include "bmesh_tools.h"
#include "tools/bmesh_intersect.h"
-#endif
#ifdef DEBUG_TIME
-#include "PIL_time.h"
-#include "PIL_time_utildefines.h"
+# include "PIL_time.h"
+# include "PIL_time_utildefines.h"
#endif
static void initData(ModifierData *md)
{
BooleanModifierData *bmd = (BooleanModifierData *)md;
- bmd->solver = eBooleanModifierSolver_BMesh;
bmd->double_threshold = 1e-6f;
}
@@ -103,23 +95,17 @@ static void foreachObjectLink(
walk(userData, ob, &bmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
BooleanModifierData *bmd = (BooleanModifierData *)md;
if (bmd->object != NULL) {
- DEG_add_object_relation(node, bmd->object, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
- DEG_add_object_relation(node, bmd->object, DEG_OB_COMP_GEOMETRY, "Boolean Modifier");
+ DEG_add_object_relation(ctx->node, bmd->object, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
+ DEG_add_object_relation(ctx->node, bmd->object, DEG_OB_COMP_GEOMETRY, "Boolean Modifier");
}
/* We need own transformation as well. */
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Boolean Modifier");
}
-#if defined(USE_CARVE) || defined(USE_BMESH)
-
static DerivedMesh *get_quick_derivedMesh(
Object *ob_self, DerivedMesh *dm_self,
Object *ob_other, DerivedMesh *dm_other,
@@ -166,13 +152,7 @@ static DerivedMesh *get_quick_derivedMesh(
return result;
}
-#endif /* defined(USE_CARVE) || defined(USE_BMESH) */
-
-/* -------------------------------------------------------------------- */
-/* BMESH */
-
-#ifdef USE_BMESH
/* has no meaning for faces, do this so we can tell which face is which */
#define BM_FACE_TAG BM_ELEM_DRAW
@@ -185,8 +165,8 @@ static int bm_face_isect_pair(BMFace *f, void *UNUSED(user_data))
return BM_elem_flag_test(f, BM_FACE_TAG) ? 1 : 0;
}
-static DerivedMesh *applyModifier_bmesh(
- ModifierData *md, Object *ob,
+static DerivedMesh *applyModifier(
+ ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx), Object *ob,
DerivedMesh *dm,
ModifierApplyFlag flag)
{
@@ -354,66 +334,6 @@ static DerivedMesh *applyModifier_bmesh(
return dm;
}
-#endif /* USE_BMESH */
-
-
-/* -------------------------------------------------------------------- */
-/* CARVE */
-
-#ifdef USE_CARVE
-static DerivedMesh *applyModifier_carve(
- ModifierData *md, Object *ob,
- DerivedMesh *derivedData,
- ModifierApplyFlag flag)
-{
- BooleanModifierData *bmd = (BooleanModifierData *) md;
- DerivedMesh *dm;
-
- if (!bmd->object)
- return derivedData;
-
- dm = get_dm_for_modifier(bmd->object, flag);
-
- if (dm) {
- DerivedMesh *result;
-
- /* 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)
- * Returning mesh is depended on modifiers operation (sergey) */
- result = get_quick_derivedMesh(ob, derivedData, bmd->object, dm, bmd->operation);
-
- if (result == NULL) {
-#ifdef DEBUG_TIME
- TIMEIT_START(boolean_carve);
-#endif
-
- result = NewBooleanDerivedMesh(dm, bmd->object, derivedData, ob,
- 1 + bmd->operation);
-#ifdef DEBUG_TIME
- TIMEIT_END(boolean_carve);
-#endif
- }
-
- /* if new mesh returned, return it; otherwise there was
- * an error, so delete the modifier object */
- if (result)
- return result;
- else
- modifier_setError(md, "Cannot execute boolean operation");
- }
-
- return derivedData;
-}
-#endif /* USE_CARVE */
-
-
-static DerivedMesh *applyModifier_nop(
- ModifierData *UNUSED(md), Object *UNUSED(ob),
- DerivedMesh *derivedData,
- ModifierApplyFlag UNUSED(flag))
-{
- return derivedData;
-}
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(md))
{
@@ -424,28 +344,6 @@ static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *UNUSED(
return dataMask;
}
-static DerivedMesh *applyModifier(
- ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
- Object *ob, DerivedMesh *derivedData,
- ModifierApplyFlag flag)
-{
- BooleanModifierData *bmd = (BooleanModifierData *)md;
-
- switch (bmd->solver) {
-#ifdef USE_CARVE
- case eBooleanModifierSolver_Carve:
- return applyModifier_carve(md, ob, derivedData, flag);
-#endif
-#ifdef USE_BMESH
- case eBooleanModifierSolver_BMesh:
- return applyModifier_bmesh(md, ob, derivedData, flag);
-#endif
- default:
- return applyModifier_nop(md, ob, derivedData, flag);
- }
-}
-
-
ModifierTypeInfo modifierType_Boolean = {
/* name */ "Boolean",
/* structName */ "BooleanModifierData",
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.c b/source/blender/modifiers/intern/MOD_boolean_util.c
deleted file mode 100644
index 49010664aa8..00000000000
--- a/source/blender/modifiers/intern/MOD_boolean_util.c
+++ /dev/null
@@ -1,790 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) Blender Foundation
- * All rights reserved.
- *
- * Contributor(s): Sergey Sharybin.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/modifiers/intern/MOD_boolean_util.c
- * \ingroup modifiers
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "DNA_material_types.h"
-#include "DNA_meshdata_types.h"
-#include "DNA_object_types.h"
-
-#include "BLI_utildefines.h"
-#include "BLI_alloca.h"
-#include "BLI_ghash.h"
-#include "BLI_math.h"
-
-#include "BKE_cdderivedmesh.h"
-#include "BKE_material.h"
-
-#include "MOD_boolean_util.h"
-
-#include "carve-capi.h"
-
-/* Adopted from BM_loop_interp_from_face(),
- *
- * Transform matrix is used in cases when target coordinate needs
- * to be converted to source space (namely when interpolating
- * boolean result loops from second operand).
- *
- * TODO(sergey): Consider making it a generic function in DerivedMesh.c.
- */
-static void DM_loop_interp_from_poly(DerivedMesh *source_dm,
- MVert *source_mverts,
- MLoop *source_mloops,
- MPoly *source_poly,
- DerivedMesh *target_dm,
- MVert *target_mverts,
- MLoop *target_mloop,
- float transform[4][4],
- int target_loop_index)
-{
- float (*cos_3d)[3] = BLI_array_alloca(cos_3d, source_poly->totloop);
- int *source_indices = BLI_array_alloca(source_indices, source_poly->totloop);
- float *weights = BLI_array_alloca(weights, source_poly->totloop);
- int i;
- int target_vert_index = target_mloop[target_loop_index].v;
- float coord[3];
-
- for (i = 0; i < source_poly->totloop; ++i) {
- MLoop *mloop = &source_mloops[source_poly->loopstart + i];
- source_indices[i] = source_poly->loopstart + i;
- copy_v3_v3(cos_3d[i], source_mverts[mloop->v].co);
- }
-
- if (transform) {
- mul_v3_m4v3(coord, transform, target_mverts[target_vert_index].co);
- }
- else {
- copy_v3_v3(coord, target_mverts[target_vert_index].co);
- }
-
- interp_weights_poly_v3(weights, cos_3d, source_poly->totloop, coord);
-
- DM_interp_loop_data(source_dm, target_dm, source_indices, weights,
- source_poly->totloop, target_loop_index);
-}
-
-typedef struct DMArrays {
- MVert *mvert;
- MEdge *medge;
- MLoop *mloop;
- MPoly *mpoly;
- bool mvert_allocated;
- bool medge_allocated;
- bool mloop_allocated;
- bool mpoly_allocated;
-} DMArrays;
-
-static void dm_arrays_get(DerivedMesh *dm, DMArrays *arrays)
-{
- arrays->mvert = DM_get_vert_array(dm, &arrays->mvert_allocated);
- arrays->medge = DM_get_edge_array(dm, &arrays->medge_allocated);
- arrays->mloop = DM_get_loop_array(dm, &arrays->mloop_allocated);
- arrays->mpoly = DM_get_poly_array(dm, &arrays->mpoly_allocated);
-}
-
-static void dm_arrays_free(DMArrays *arrays)
-{
- if (arrays->mvert_allocated) {
- MEM_freeN(arrays->mvert);
- }
- if (arrays->medge_allocated) {
- MEM_freeN(arrays->medge);
- }
- if (arrays->mloop_allocated) {
- MEM_freeN(arrays->mloop);
- }
- if (arrays->mpoly_allocated) {
- MEM_freeN(arrays->mpoly);
- }
-}
-
-/* **** Importer from derived mesh to Carve **** */
-
-typedef struct ImportMeshData {
- DerivedMesh *dm;
- float obmat[4][4];
- MVert *mvert;
- MEdge *medge;
- MLoop *mloop;
- MPoly *mpoly;
-} ImportMeshData;
-
-/* Get number of vertices. */
-static int importer_GetNumVerts(ImportMeshData *import_data)
-{
- DerivedMesh *dm = import_data->dm;
- return dm->getNumVerts(dm);
-}
-
-/* Get number of edges. */
-static int importer_GetNumEdges(ImportMeshData *import_data)
-{
- DerivedMesh *dm = import_data->dm;
- return dm->getNumEdges(dm);
-}
-
-/* Get number of loops. */
-static int importer_GetNumLoops(ImportMeshData *import_data)
-{
- DerivedMesh *dm = import_data->dm;
- return dm->getNumLoops(dm);
-}
-
-/* Get number of polys. */
-static int importer_GetNumPolys(ImportMeshData *import_data)
-{
- DerivedMesh *dm = import_data->dm;
- return dm->getNumPolys(dm);
-}
-
-/* Get 3D coordinate of vertex with given index. */
-static void importer_GetVertCoord(ImportMeshData *import_data, int vert_index, float coord[3])
-{
- MVert *mvert = import_data->mvert;
-
- BLI_assert(vert_index >= 0 && vert_index < import_data->dm->getNumVerts(import_data->dm));
-
- mul_v3_m4v3(coord, import_data->obmat, mvert[vert_index].co);
-}
-
-/* Get index of vertices which are adjucent to edge specified by it's index. */
-static void importer_GetEdgeVerts(ImportMeshData *import_data, int edge_index, int *v1, int *v2)
-{
- MEdge *medge = &import_data->medge[edge_index];
-
- BLI_assert(edge_index >= 0 && edge_index < import_data->dm->getNumEdges(import_data->dm));
-
- *v1 = medge->v1;
- *v2 = medge->v2;
-}
-
-/* Get number of adjucent vertices to the poly specified by it's index. */
-static int importer_GetPolyNumVerts(ImportMeshData *import_data, int poly_index)
-{
- MPoly *mpoly = import_data->mpoly;
-
- BLI_assert(poly_index >= 0 && poly_index < import_data->dm->getNumPolys(import_data->dm));
-
- return mpoly[poly_index].totloop;
-}
-
-/* Get list of adjucent vertices to the poly specified by it's index. */
-static void importer_GetPolyVerts(ImportMeshData *import_data, int poly_index, int *verts)
-{
- MPoly *mpoly = &import_data->mpoly[poly_index];
- MLoop *mloop = import_data->mloop + mpoly->loopstart;
- int i;
- BLI_assert(poly_index >= 0 && poly_index < import_data->dm->getNumPolys(import_data->dm));
- for (i = 0; i < mpoly->totloop; i++, mloop++) {
- verts[i] = mloop->v;
- }
-}
-
-// Triangulate 2D polygon.
-#if 0
-static int importer_triangulate2DPoly(ImportMeshData *UNUSED(import_data),
- const float (*vertices)[2], int num_vertices,
- unsigned int (*triangles)[3])
-{
- // TODO(sergey): Currently import_data is unused but in the future we could
- // put memory arena there which will reduce amount of allocations happening
- // over the triangulation period.
- //
- // However that's not so much straighforward to do it right now because we
- // also are tu consider threaded import/export.
-
- BLI_assert(num_vertices > 3);
-
- BLI_polyfill_calc(vertices, num_vertices, triangles);
-
- return num_vertices - 2;
-}
-#endif
-
-static CarveMeshImporter MeshImporter = {
- importer_GetNumVerts,
- importer_GetNumEdges,
- importer_GetNumLoops,
- importer_GetNumPolys,
- importer_GetVertCoord,
- importer_GetEdgeVerts,
- importer_GetPolyNumVerts,
- importer_GetPolyVerts,
-
- /* TODO(sergey): We don't use BLI_polyfill_calc() because it tends
- * to generate degenerated geometry which is fatal for booleans.
- *
- * For now we stick to Carve's triangulation.
- */
- NULL, /* importer_triangulate2DPoly */
-};
-
-/* **** Exporter from Carve to derived mesh **** */
-
-typedef struct ExportMeshData {
- DerivedMesh *dm;
- float obimat[4][4];
- MVert *mvert;
- MEdge *medge;
- MLoop *mloop;
- MPoly *mpoly;
- int *vert_origindex;
- int *edge_origindex;
- int *poly_origindex;
- int *loop_origindex;
-
- /* Objects and derived meshes of left and right operands.
- * Used for custom data merge and interpolation.
- */
- Object *ob_left;
- Object *ob_right;
- DerivedMesh *dm_left;
- DerivedMesh *dm_right;
- MVert *mvert_left;
- MEdge *medge_left;
- MLoop *mloop_left;
- MPoly *mpoly_left;
- MVert *mvert_right;
- MEdge *medge_right;
- MLoop *mloop_right;
- MPoly *mpoly_right;
-
- float left_to_right_mat[4][4];
-
- /* Hash to map materials from right object to result. */
- GHash *material_hash;
-} ExportMeshData;
-
-BLI_INLINE Object *which_object(ExportMeshData *export_data, int which_mesh)
-{
- Object *object = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- object = export_data->ob_left;
- break;
- case CARVE_MESH_RIGHT:
- object = export_data->ob_right;
- break;
- }
- return object;
-}
-
-BLI_INLINE DerivedMesh *which_dm(ExportMeshData *export_data, int which_mesh)
-{
- DerivedMesh *dm = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- dm = export_data->dm_left;
- break;
- case CARVE_MESH_RIGHT:
- dm = export_data->dm_right;
- break;
- }
- return dm;
-}
-
-BLI_INLINE MVert *which_mvert(ExportMeshData *export_data, int which_mesh)
-{
- MVert *mvert = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- mvert = export_data->mvert_left;
- break;
- case CARVE_MESH_RIGHT:
- mvert = export_data->mvert_right;
- break;
- }
- return mvert;
-}
-
-BLI_INLINE MEdge *which_medge(ExportMeshData *export_data, int which_mesh)
-{
- MEdge *medge = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- medge = export_data->medge_left;
- break;
- case CARVE_MESH_RIGHT:
- medge = export_data->medge_right;
- break;
- }
- return medge;
-}
-
-BLI_INLINE MLoop *which_mloop(ExportMeshData *export_data, int which_mesh)
-{
- MLoop *mloop = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- mloop = export_data->mloop_left;
- break;
- case CARVE_MESH_RIGHT:
- mloop = export_data->mloop_right;
- break;
- }
- return mloop;
-}
-
-BLI_INLINE MPoly *which_mpoly(ExportMeshData *export_data, int which_mesh)
-{
- MPoly *mpoly = NULL;
- switch (which_mesh) {
- case CARVE_MESH_LEFT:
- mpoly = export_data->mpoly_left;
- break;
- case CARVE_MESH_RIGHT:
- mpoly = export_data->mpoly_right;
- break;
- }
- return mpoly;
-}
-
-/* Create new external mesh */
-static void exporter_InitGeomArrays(ExportMeshData *export_data,
- int num_verts, int num_edges,
- int num_loops, int num_polys)
-{
- DerivedMesh *dm = CDDM_new(num_verts, num_edges, 0,
- num_loops, num_polys);
- DerivedMesh *dm_left = export_data->dm_left,
- *dm_right = export_data->dm_right;
-
- /* Mask for custom data layers to be merged from operands. */
- CustomDataMask merge_mask = CD_MASK_DERIVEDMESH & ~CD_MASK_ORIGINDEX;
-
- export_data->dm = dm;
- export_data->mvert = dm->getVertArray(dm);
- export_data->medge = dm->getEdgeArray(dm);
- export_data->mloop = dm->getLoopArray(dm);
- export_data->mpoly = dm->getPolyArray(dm);
-
- /* Merge custom data layers from operands.
- *
- * Will only create custom data layers for all the layers which appears in
- * the operand. Data for those layers will not be allocated or initialized.
- */
-
- CustomData_merge(&dm_left->vertData, &dm->vertData, merge_mask, CD_DEFAULT, num_verts);
- CustomData_merge(&dm_right->vertData, &dm->vertData, merge_mask, CD_DEFAULT, num_verts);
-
- CustomData_merge(&dm_left->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops);
- CustomData_merge(&dm_right->loopData, &dm->loopData, merge_mask, CD_DEFAULT, num_loops);
-
- CustomData_merge(&dm_left->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys);
- CustomData_merge(&dm_right->polyData, &dm->polyData, merge_mask, CD_DEFAULT, num_polys);
-
- CustomData_merge(&dm_left->edgeData, &dm->edgeData, merge_mask, CD_DEFAULT, num_edges);
- CustomData_merge(&dm_right->edgeData, &dm->edgeData, merge_mask, CD_DEFAULT, num_edges);
-
- export_data->vert_origindex = dm->getVertDataArray(dm, CD_ORIGINDEX);
- export_data->edge_origindex = dm->getEdgeDataArray(dm, CD_ORIGINDEX);
- export_data->poly_origindex = dm->getPolyDataArray(dm, CD_ORIGINDEX);
- export_data->loop_origindex = dm->getLoopDataArray(dm, CD_ORIGINDEX);
-}
-
-/* Set coordinate of vertex with given index. */
-static void exporter_SetVert(ExportMeshData *export_data,
- int vert_index, float coord[3],
- int which_orig_mesh, int orig_vert_index)
-{
- DerivedMesh *dm = export_data->dm;
- DerivedMesh *dm_orig;
- MVert *mvert = export_data->mvert;
-
- BLI_assert(vert_index >= 0 && vert_index <= dm->getNumVerts(dm));
-
- dm_orig = which_dm(export_data, which_orig_mesh);
- if (dm_orig) {
- BLI_assert(orig_vert_index >= 0 && orig_vert_index < dm_orig->getNumVerts(dm_orig));
- mvert[vert_index] = which_mvert(export_data, which_orig_mesh)[orig_vert_index];
- CustomData_copy_data(&dm_orig->vertData, &dm->vertData, orig_vert_index, vert_index, 1);
- }
-
- /* Set original index of the vertex. */
- if (export_data->vert_origindex) {
- if (which_orig_mesh == CARVE_MESH_LEFT) {
- export_data->vert_origindex[vert_index] = orig_vert_index;
- }
- else {
- export_data->vert_origindex[vert_index] = ORIGINDEX_NONE;
- }
- }
-
- mul_v3_m4v3(mvert[vert_index].co, export_data->obimat, coord);
-}
-
-/* Set vertices which are adjucent to the edge specified by it's index. */
-static void exporter_SetEdge(ExportMeshData *export_data,
- int edge_index, int v1, int v2,
- int which_orig_mesh, int orig_edge_index)
-{
- DerivedMesh *dm = export_data->dm;
- MEdge *medge = &export_data->medge[edge_index];
- DerivedMesh *dm_orig;
-
- BLI_assert(edge_index >= 0 && edge_index < dm->getNumEdges(dm));
- BLI_assert(v1 >= 0 && v1 < dm->getNumVerts(dm));
- BLI_assert(v2 >= 0 && v2 < dm->getNumVerts(dm));
-
- dm_orig = which_dm(export_data, which_orig_mesh);
- if (dm_orig) {
- BLI_assert(orig_edge_index >= 0 && orig_edge_index < dm_orig->getNumEdges(dm_orig));
-
- *medge = which_medge(export_data, which_orig_mesh)[orig_edge_index];
-
- /* Copy all edge layers, including medge. */
- CustomData_copy_data(&dm_orig->edgeData, &dm->edgeData, orig_edge_index, edge_index, 1);
- }
-
- /* Set original index of the edge. */
- if (export_data->edge_origindex) {
- if (which_orig_mesh == CARVE_MESH_LEFT) {
- export_data->edge_origindex[edge_index] = orig_edge_index;
- }
- else {
- export_data->edge_origindex[edge_index] = ORIGINDEX_NONE;
- }
- }
-
- medge->v1 = v1;
- medge->v2 = v2;
-
- medge->flag |= ME_EDGEDRAW | ME_EDGERENDER;
-}
-
-static void setMPolyMaterial(ExportMeshData *export_data,
- MPoly *mpoly,
- int which_orig_mesh)
-{
- Object *orig_object;
- GHash *material_hash;
- Material *orig_mat;
-
- if (which_orig_mesh == CARVE_MESH_LEFT) {
- /* No need to change materian index for faces from left operand */
- return;
- }
-
- material_hash = export_data->material_hash;
- orig_object = which_object(export_data, which_orig_mesh);
-
- /* Set material, based on lookup in hash table. */
- orig_mat = give_current_material(orig_object, mpoly->mat_nr + 1);
-
- if (orig_mat) {
- /* For faces from right operand check if there's requested material
- * in the left operand. And if it is, use index of that material,
- * otherwise fallback to first material (material with index=0).
- */
- if (!BLI_ghash_haskey(material_hash, orig_mat)) {
- int a, mat_nr;
-
- mat_nr = 0;
- for (a = 0; a < export_data->ob_left->totcol; a++) {
- if (give_current_material(export_data->ob_left, a + 1) == orig_mat) {
- mat_nr = a;
- break;
- }
- }
-
- BLI_ghash_insert(material_hash, orig_mat, SET_INT_IN_POINTER(mat_nr));
-
- mpoly->mat_nr = mat_nr;
- }
- else
- mpoly->mat_nr = GET_INT_FROM_POINTER(BLI_ghash_lookup(material_hash, orig_mat));
- }
- else {
- mpoly->mat_nr = 0;
- }
-}
-
-/* Set list of adjucent loops to the poly specified by it's index. */
-static void exporter_SetPoly(ExportMeshData *export_data,
- int poly_index, int start_loop, int num_loops,
- int which_orig_mesh, int orig_poly_index)
-{
- DerivedMesh *dm = export_data->dm;
- MPoly *mpoly = &export_data->mpoly[poly_index];
- DerivedMesh *dm_orig;
- int i;
-
- /* Poly is always to be either from left or right operand. */
- dm_orig = which_dm(export_data, which_orig_mesh);
-
- BLI_assert(poly_index >= 0 && poly_index < dm->getNumPolys(dm));
- BLI_assert(start_loop >= 0 && start_loop <= dm->getNumLoops(dm) - num_loops);
- BLI_assert(num_loops >= 3);
- BLI_assert(dm_orig != NULL);
- BLI_assert(orig_poly_index >= 0 && orig_poly_index < dm_orig->getNumPolys(dm_orig));
-
- /* Copy all poly layers, including mpoly. */
- *mpoly = which_mpoly(export_data, which_orig_mesh)[orig_poly_index];
- CustomData_copy_data(&dm_orig->polyData, &dm->polyData, orig_poly_index, poly_index, 1);
-
- /* Set material of the curren poly.
- * This would re-map materials from right operand to materials from the
- * left one as well.
- */
- setMPolyMaterial(export_data, mpoly, which_orig_mesh);
-
- /* Set original index of the poly. */
- if (export_data->poly_origindex) {
- if (which_orig_mesh == CARVE_MESH_LEFT) {
- export_data->poly_origindex[poly_index] = orig_poly_index;
- }
- else {
- export_data->poly_origindex[poly_index] = ORIGINDEX_NONE;
- }
- }
-
- /* Set poly data itself. */
- mpoly->loopstart = start_loop;
- mpoly->totloop = num_loops;
-
- /* Interpolate data for poly loops. */
- {
- MVert *source_mverts = which_mvert(export_data, which_orig_mesh);
- MLoop *source_mloops = which_mloop(export_data, which_orig_mesh);
- MPoly *source_mpolys = which_mpoly(export_data, which_orig_mesh);
- MPoly *source_poly = &source_mpolys[orig_poly_index];
- MVert *target_mverts = export_data->mvert;
- MLoop *target_mloops = export_data->mloop;
- float (*transform)[4] = NULL;
-
- if (which_orig_mesh == CARVE_MESH_RIGHT) {
- transform = export_data->left_to_right_mat;
- }
-
- for (i = 0; i < mpoly->totloop; i++) {
- DM_loop_interp_from_poly(dm_orig,
- source_mverts,
- source_mloops,
- source_poly,
- dm,
- target_mverts,
- target_mloops,
- transform,
- i + mpoly->loopstart);
- }
- }
-}
-
-/* Set list vertex and edge which are adjucent to loop with given index. */
-static void exporter_SetLoop(ExportMeshData *export_data,
- int loop_index, int vertex, int edge,
- int which_orig_mesh, int orig_loop_index)
-{
- DerivedMesh *dm = export_data->dm;
- MLoop *mloop = &export_data->mloop[loop_index];
- DerivedMesh *dm_orig;
-
- BLI_assert(loop_index >= 0 && loop_index < dm->getNumLoops(dm));
- BLI_assert(vertex >= 0 && vertex < dm->getNumVerts(dm));
- BLI_assert(edge >= 0 && vertex < dm->getNumEdges(dm));
-
- dm_orig = which_dm(export_data, which_orig_mesh);
- if (dm_orig) {
- BLI_assert(orig_loop_index >= 0 && orig_loop_index < dm_orig->getNumLoops(dm_orig));
-
- /* Copy all loop layers, including mloop. */
- *mloop = which_mloop(export_data, which_orig_mesh)[orig_loop_index];
- CustomData_copy_data(&dm_orig->loopData, &dm->loopData, orig_loop_index, loop_index, 1);
- }
-
- /* Set original index of the loop. */
- if (export_data->loop_origindex) {
- if (which_orig_mesh == CARVE_MESH_LEFT) {
- export_data->loop_origindex[loop_index] = orig_loop_index;
- }
- else {
- export_data->loop_origindex[loop_index] = ORIGINDEX_NONE;
- }
- }
-
- mloop->v = vertex;
- mloop->e = edge;
-}
-
-/* Edge index from a loop index for a given original mesh. */
-static int exporter_MapLoopToEdge(ExportMeshData *export_data,
- int which_mesh, int loop_index)
-{
- DerivedMesh *dm = which_dm(export_data, which_mesh);
- MLoop *mloop = which_mloop(export_data, which_mesh);
-
- (void) dm; /* Unused in release builds. */
-
- BLI_assert(dm != NULL);
- BLI_assert(loop_index >= 0 && loop_index < dm->getNumLoops(dm));
-
- return mloop[loop_index].e;
-}
-
-static CarveMeshExporter MeshExporter = {
- exporter_InitGeomArrays,
- exporter_SetVert,
- exporter_SetEdge,
- exporter_SetPoly,
- exporter_SetLoop,
- exporter_MapLoopToEdge
-};
-
-static int operation_from_optype(int int_op_type)
-{
- int operation;
-
- switch (int_op_type) {
- case 1:
- operation = CARVE_OP_INTERSECTION;
- break;
- case 2:
- operation = CARVE_OP_UNION;
- break;
- case 3:
- operation = CARVE_OP_A_MINUS_B;
- break;
- default:
- BLI_assert(!"Should not happen");
- operation = -1;
- break;
- }
-
- return operation;
-}
-
-static void prepare_import_data(Object *object,
- DerivedMesh *dm,
- const DMArrays *dm_arrays,
- ImportMeshData *import_data)
-{
- import_data->dm = dm;
- copy_m4_m4(import_data->obmat, object->obmat);
- import_data->mvert = dm_arrays->mvert;
- import_data->medge = dm_arrays->medge;
- import_data->mloop = dm_arrays->mloop;
- import_data->mpoly = dm_arrays->mpoly;
-}
-
-static struct CarveMeshDescr *carve_mesh_from_dm(Object *object,
- DerivedMesh *dm,
- const DMArrays *dm_arrays)
-{
- ImportMeshData import_data;
- prepare_import_data(object, dm, dm_arrays, &import_data);
- return carve_addMesh(&import_data, &MeshImporter);
-}
-
-static void prepare_export_data(Object *object_left, DerivedMesh *dm_left, const DMArrays *dm_left_arrays,
- Object *object_right, DerivedMesh *dm_right, const DMArrays *dm_right_arrays,
- ExportMeshData *export_data)
-{
- float object_right_imat[4][4];
-
- invert_m4_m4(export_data->obimat, object_left->obmat);
-
- export_data->ob_left = object_left;
- export_data->ob_right = object_right;
-
- export_data->dm_left = dm_left;
- export_data->dm_right = dm_right;
-
- export_data->mvert_left = dm_left_arrays->mvert;
- export_data->medge_left = dm_left_arrays->medge;
- export_data->mloop_left = dm_left_arrays->mloop;
- export_data->mpoly_left = dm_left_arrays->mpoly;
- export_data->mvert_right = dm_right_arrays->mvert;
- export_data->medge_right = dm_right_arrays->medge;
- export_data->mloop_right = dm_right_arrays->mloop;
- export_data->mpoly_right = dm_right_arrays->mpoly;
-
- export_data->material_hash = BLI_ghash_ptr_new("CSG_mat gh");
-
- /* Matrix to convert coord from left object's loca; space to
- * right object's local space.
- */
- invert_m4_m4(object_right_imat, object_right->obmat);
- mul_m4_m4m4(export_data->left_to_right_mat, object_left->obmat,
- object_right_imat);
-}
-
-DerivedMesh *NewBooleanDerivedMesh(DerivedMesh *dm, struct Object *ob,
- DerivedMesh *dm_select, struct Object *ob_select,
- int int_op_type)
-{
-
- struct CarveMeshDescr *left, *right, *output = NULL;
- DerivedMesh *output_dm = NULL;
- int operation;
- bool result;
- DMArrays dm_left_arrays, dm_right_arrays;
-
- if (dm == NULL || dm_select == NULL) {
- return NULL;
- }
-
- operation = operation_from_optype(int_op_type);
- if (operation == -1) {
- return NULL;
- }
-
- dm_arrays_get(dm_select, &dm_left_arrays);
- dm_arrays_get(dm, &dm_right_arrays);
-
- left = carve_mesh_from_dm(ob_select, dm_select, &dm_left_arrays);
- right = carve_mesh_from_dm(ob, dm, &dm_right_arrays);
-
- result = carve_performBooleanOperation(left, right, operation, &output);
-
- carve_deleteMesh(left);
- carve_deleteMesh(right);
-
- if (result) {
- ExportMeshData export_data;
-
- prepare_export_data(ob_select, dm_select, &dm_left_arrays,
- ob, dm, &dm_right_arrays,
- &export_data);
-
- carve_exportMesh(output, &MeshExporter, &export_data);
- output_dm = export_data.dm;
-
- /* Free memory used by export mesh. */
- BLI_ghash_free(export_data.material_hash, NULL, NULL);
-
- output_dm->cd_flag |= dm->cd_flag | dm_select->cd_flag;
- output_dm->dirty |= DM_DIRTY_NORMALS;
- carve_deleteMesh(output);
- }
-
- dm_arrays_free(&dm_left_arrays);
- dm_arrays_free(&dm_right_arrays);
-
- return output_dm;
-}
diff --git a/source/blender/modifiers/intern/MOD_boolean_util.h b/source/blender/modifiers/intern/MOD_boolean_util.h
deleted file mode 100644
index 00d7c37b266..00000000000
--- a/source/blender/modifiers/intern/MOD_boolean_util.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * ***** BEGIN GPL LICENSE BLOCK *****
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * The Original Code is Copyright (C) Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/modifiers/intern/MOD_boolean_util.h
- * \ingroup modifiers
- */
-
-
-#ifndef __MOD_BOOLEAN_UTIL_H__
-#define __MOD_BOOLEAN_UTIL_H__
-
-struct Object;
-struct DerivedMesh;
-
-/* Performs a boolean between two mesh objects, it is assumed that both objects
- * are in fact mesh object. On success returns a DerivedMesh. On failure
- * returns NULL and reports an error. */
-
-struct DerivedMesh *NewBooleanDerivedMesh(struct DerivedMesh *dm, struct Object *ob,
- struct DerivedMesh *dm_select, struct Object *ob_select, int int_op_type);
-
-#endif /* MOD_BOOLEAN_UTILS */
diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.c
index 7a52ede8838..2e0b13b0603 100644
--- a/source/blender/modifiers/intern/MOD_build.c
+++ b/source/blender/modifiers/intern/MOD_build.c
@@ -154,7 +154,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
numLoops_dst += mp->totloop;
}
- BLI_assert(hash_num == BLI_ghash_size(vertHash));
+ BLI_assert(hash_num == BLI_ghash_len(vertHash));
/* get the set of edges that will be in the new mesh (i.e. all edges
* that have both verts in the new mesh)
@@ -187,7 +187,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
*/
medge = medge_src;
hash_num = 0;
- BLI_assert(hash_num == BLI_ghash_size(vertHash));
+ BLI_assert(hash_num == BLI_ghash_len(vertHash));
for (i = 0; i < numEdges_dst; i++) {
void **val_p;
me = medge + edgeMap[i];
@@ -201,11 +201,11 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
hash_num++;
}
}
- BLI_assert(hash_num == BLI_ghash_size(vertHash));
+ BLI_assert(hash_num == BLI_ghash_len(vertHash));
/* get the set of edges that will be in the new mesh */
for (i = 0; i < numEdges_dst; i++) {
- j = BLI_ghash_size(edgeHash);
+ j = BLI_ghash_len(edgeHash);
BLI_ghash_insert(edgeHash, SET_INT_IN_POINTER(j),
SET_INT_IN_POINTER(edgeMap[i]));
@@ -232,8 +232,8 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
/* now we know the number of verts, edges and faces, we can create
* the mesh
*/
- result = CDDM_from_template(dm, BLI_ghash_size(vertHash),
- BLI_ghash_size(edgeHash), 0, numLoops_dst, numFaces_dst);
+ result = CDDM_from_template(dm, BLI_ghash_len(vertHash),
+ BLI_ghash_len(edgeHash), 0, numLoops_dst, numFaces_dst);
/* copy the vertices across */
GHASH_ITER (gh_iter, vertHash) {
@@ -250,7 +250,7 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
}
/* copy the edges across, remapping indices */
- for (i = 0; i < BLI_ghash_size(edgeHash); i++) {
+ for (i = 0; i < BLI_ghash_len(edgeHash); i++) {
MEdge source;
MEdge *dest;
int oldIndex = GET_INT_FROM_POINTER(BLI_ghash_lookup(edgeHash, SET_INT_IN_POINTER(i)));
diff --git a/source/blender/modifiers/intern/MOD_cast.c b/source/blender/modifiers/intern/MOD_cast.c
index 93a5b9607bf..bf86377960a 100644
--- a/source/blender/modifiers/intern/MOD_cast.c
+++ b/source/blender/modifiers/intern/MOD_cast.c
@@ -102,16 +102,12 @@ static void foreachObjectLink(
walk(userData, ob, &cmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *object,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
CastModifierData *cmd = (CastModifierData *)md;
if (cmd->object != NULL) {
- DEG_add_object_relation(node, cmd->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
- DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
+ DEG_add_object_relation(ctx->node, cmd->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Cast Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_cloth.c b/source/blender/modifiers/intern/MOD_cloth.c
index b234cc63228..0c55d8f8beb 100644
--- a/source/blender/modifiers/intern/MOD_cloth.c
+++ b/source/blender/modifiers/intern/MOD_cloth.c
@@ -114,18 +114,14 @@ static void deformVerts(ModifierData *md, const struct EvaluationContext *eval_c
dm->release(dm);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ClothModifierData *clmd = (ClothModifierData *)md;
if (clmd != NULL) {
/* Actual code uses get_collisionobjects */
- DEG_add_collision_relations(node, scene, ob, clmd->coll_parms->group, eModifierType_Collision, NULL, true, "Cloth Collision");
+ DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, clmd->coll_parms->group, eModifierType_Collision, NULL, true, "Cloth Collision");
- DEG_add_forcefield_relations(node, scene, ob, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
+ DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, clmd->sim_parms->effector_weights, true, 0, "Cloth Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_curve.c b/source/blender/modifiers/intern/MOD_curve.c
index 62c9f8796a0..acb69de1e85 100644
--- a/source/blender/modifiers/intern/MOD_curve.c
+++ b/source/blender/modifiers/intern/MOD_curve.c
@@ -93,11 +93,7 @@ static void foreachObjectLink(
walk(userData, ob, &cmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *object,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
CurveModifierData *cmd = (CurveModifierData *)md;
if (cmd->object != NULL) {
@@ -107,12 +103,12 @@ static void updateDepsgraph(ModifierData *md,
/* TODO(sergey): Currently path is evaluated as a part of modifier stack,
* might be changed in the future.
*/
- struct Depsgraph *depsgraph = DEG_get_graph_from_handle(node);
- DEG_add_object_relation(node, cmd->object, DEG_OB_COMP_GEOMETRY, "Curve Modifier");
+ struct Depsgraph *depsgraph = DEG_get_graph_from_handle(ctx->node);
+ DEG_add_object_relation(ctx->node, cmd->object, DEG_OB_COMP_GEOMETRY, "Curve Modifier");
DEG_add_special_eval_flag(depsgraph, &cmd->object->id, DAG_EVAL_NEED_CURVE_PATH);
}
- DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Curve Modifier");
}
static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
diff --git a/source/blender/modifiers/intern/MOD_datatransfer.c b/source/blender/modifiers/intern/MOD_datatransfer.c
index e7069937868..a804a35954c 100644
--- a/source/blender/modifiers/intern/MOD_datatransfer.c
+++ b/source/blender/modifiers/intern/MOD_datatransfer.c
@@ -125,15 +125,11 @@ static void foreachObjectLink(
walk(userData, ob, &dtmd->ob_source, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
DataTransferModifierData *dtmd = (DataTransferModifierData *) md;
if (dtmd->ob_source != NULL) {
- DEG_add_object_relation(node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, "DataTransfer Modifier");
+ DEG_add_object_relation(ctx->node, dtmd->ob_source, DEG_OB_COMP_GEOMETRY, "DataTransfer Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_displace.c b/source/blender/modifiers/intern/MOD_displace.c
index 53a77b6fe38..7ec89b23f25 100644
--- a/source/blender/modifiers/intern/MOD_displace.c
+++ b/source/blender/modifiers/intern/MOD_displace.c
@@ -80,14 +80,6 @@ static void copyData(ModifierData *md, ModifierData *target)
modifier_copyData_generic(md, target);
}
-static void freeData(ModifierData *md)
-{
- DisplaceModifierData *dmd = (DisplaceModifierData *) md;
- if (dmd->texture) {
- id_us_min(&dmd->texture->id);
- }
-}
-
static CustomDataMask requiredDataMask(Object *UNUSED(ob), ModifierData *md)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
@@ -154,21 +146,17 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
return ((!dmd->texture && dmd->direction == MOD_DISP_DIR_RGB_XYZ) || dmd->strength == 0.0f);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
DisplaceModifierData *dmd = (DisplaceModifierData *)md;
if (dmd->map_object != NULL && dmd->texmapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(node, dmd->map_object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
+ DEG_add_object_relation(ctx->node, dmd->map_object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
}
if (dmd->texmapping == MOD_DISP_MAP_GLOBAL ||
(ELEM(dmd->direction, MOD_DISP_DIR_X, MOD_DISP_DIR_Y, MOD_DISP_DIR_Z, MOD_DISP_DIR_RGB_XYZ) &&
dmd->space == MOD_DISP_SPACE_GLOBAL))
{
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Displace Modifier");
}
}
@@ -426,7 +414,7 @@ ModifierTypeInfo modifierType_Displace = {
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ freeData,
+ /* freeData */ NULL,
/* isDisabled */ isDisabled,
/* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ dependsOnTime,
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
index cf3f84364ea..914b4101760 100644
--- a/source/blender/modifiers/intern/MOD_dynamicpaint.c
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -29,7 +29,7 @@
#include "DNA_dynamicpaint_types.h"
#include "DNA_object_types.h"
-#include "DNA_object_force.h"
+#include "DNA_object_force_types.h"
#include "DNA_scene_types.h"
#include "BLI_utildefines.h"
@@ -132,22 +132,18 @@ static bool is_brush_cb(Object *UNUSED(ob), ModifierData *pmd)
return ((DynamicPaintModifierData *)pmd)->brush != NULL;
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
DynamicPaintModifierData *pmd = (DynamicPaintModifierData *)md;
/* Add relation from canvases to all brush objects. */
if (pmd->canvas != NULL) {
for (DynamicPaintSurface *surface = pmd->canvas->surfaces.first; surface; surface = surface->next) {
if (surface->effect & MOD_DPAINT_EFFECT_DO_DRIP) {
- DEG_add_forcefield_relations(node, scene, ob, surface->effector_weights, true, 0, "Dynamic Paint Field");
+ DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, surface->effector_weights, true, 0, "Dynamic Paint Field");
}
/* Actual code uses custom loop over group/scene without layer checks in dynamicPaint_doStep */
- DEG_add_collision_relations(node, scene, ob, surface->brush_group, eModifierType_DynamicPaint, is_brush_cb, false, "Dynamic Paint Brush");
+ DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, surface->brush_group, eModifierType_DynamicPaint, is_brush_cb, false, "Dynamic Paint Brush");
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim.c b/source/blender/modifiers/intern/MOD_fluidsim.c
index f9e7f10653b..403a8706295 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim.c
@@ -34,7 +34,7 @@
#include "DNA_scene_types.h"
-#include "DNA_object_fluidsim.h"
+#include "DNA_object_fluidsim_types.h"
#include "DNA_object_types.h"
#include "BLI_utildefines.h"
@@ -103,28 +103,24 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
return result ? result : dm;
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
FluidsimModifierData *fluidmd = (FluidsimModifierData *) md;
if (fluidmd && fluidmd->fss) {
if (fluidmd->fss->type == OB_FLUIDSIM_DOMAIN) {
- FOREACH_SCENE_OBJECT(scene, ob1)
+ FOREACH_SCENE_OBJECT_BEGIN(ctx->scene, ob1)
{
- if (ob1 != ob) {
+ if (ob1 != ctx->object) {
FluidsimModifierData *fluidmdtmp =
(FluidsimModifierData *)modifiers_findByType(ob1, eModifierType_Fluidsim);
/* Only put dependencies from NON-DOMAIN fluids in here. */
if (fluidmdtmp && fluidmdtmp->fss && (fluidmdtmp->fss->type != OB_FLUIDSIM_DOMAIN)) {
- DEG_add_object_relation(node, ob1, DEG_OB_COMP_TRANSFORM, "Fluidsim Object");
+ DEG_add_object_relation(ctx->node, ob1, DEG_OB_COMP_TRANSFORM, "Fluidsim Object");
}
}
}
- FOREACH_SCENE_OBJECT_END
+ FOREACH_SCENE_OBJECT_END;
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_fluidsim_util.c b/source/blender/modifiers/intern/MOD_fluidsim_util.c
index c9f475ad228..72c44121e0b 100644
--- a/source/blender/modifiers/intern/MOD_fluidsim_util.c
+++ b/source/blender/modifiers/intern/MOD_fluidsim_util.c
@@ -40,7 +40,7 @@
#include "DNA_scene_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_object_fluidsim.h"
+#include "DNA_object_fluidsim_types.h"
#include "BLI_blenlib.h"
#include "BLI_math.h"
@@ -48,7 +48,9 @@
#include "BKE_fluidsim.h" /* ensure definitions here match */
#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h" /* G.main->name only */
+#ifdef WITH_MOD_FLUID
+# include "BKE_global.h"
+#endif
#include "MOD_fluidsim_util.h"
#include "MOD_modifiertypes.h"
diff --git a/source/blender/modifiers/intern/MOD_hook.c b/source/blender/modifiers/intern/MOD_hook.c
index 25617c84dac..00abcc1c65c 100644
--- a/source/blender/modifiers/intern/MOD_hook.c
+++ b/source/blender/modifiers/intern/MOD_hook.c
@@ -116,21 +116,17 @@ static void foreachObjectLink(
walk(userData, ob, &hmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
HookModifierData *hmd = (HookModifierData *)md;
if (hmd->object != NULL) {
if (hmd->subtarget[0]) {
- DEG_add_bone_relation(node, hmd->object, hmd->subtarget, DEG_OB_COMP_BONE, "Hook Modifier");
+ DEG_add_bone_relation(ctx->node, hmd->object, hmd->subtarget, DEG_OB_COMP_BONE, "Hook Modifier");
}
- DEG_add_object_relation(node, hmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
+ DEG_add_object_relation(ctx->node, hmd->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
}
/* We need own transformation as well. */
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Hook Modifier");
}
struct HookData_cb {
diff --git a/source/blender/modifiers/intern/MOD_lattice.c b/source/blender/modifiers/intern/MOD_lattice.c
index cd8b6139d75..4bf52f552ce 100644
--- a/source/blender/modifiers/intern/MOD_lattice.c
+++ b/source/blender/modifiers/intern/MOD_lattice.c
@@ -89,18 +89,14 @@ static void foreachObjectLink(
walk(userData, ob, &lmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *object,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
LatticeModifierData *lmd = (LatticeModifierData *)md;
if (lmd->object != NULL) {
- DEG_add_object_relation(node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
- DEG_add_object_relation(node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+ DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_GEOMETRY, "Lattice Modifier");
+ DEG_add_object_relation(ctx->node, lmd->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
}
- DEG_add_object_relation(node, object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Lattice Modifier");
}
static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
diff --git a/source/blender/modifiers/intern/MOD_mask.c b/source/blender/modifiers/intern/MOD_mask.c
index bcebbc40adb..080dc371508 100644
--- a/source/blender/modifiers/intern/MOD_mask.c
+++ b/source/blender/modifiers/intern/MOD_mask.c
@@ -78,18 +78,14 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->ob_arm, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
MaskModifierData *mmd = (MaskModifierData *)md;
if (mmd->ob_arm) {
bArmature *arm = (bArmature *)mmd->ob_arm->data;
/* Tag relationship in depsgraph, but also on the armature. */
/* TODO(sergey): Is it a proper relation here? */
- DEG_add_object_relation(node, mmd->ob_arm, DEG_OB_COMP_TRANSFORM, "Mask Modifier");
+ DEG_add_object_relation(ctx->node, mmd->ob_arm, DEG_OB_COMP_TRANSFORM, "Mask Modifier");
arm->flag |= ARM_HAS_VIZ_DEPS;
}
}
diff --git a/source/blender/modifiers/intern/MOD_meshdeform.c b/source/blender/modifiers/intern/MOD_meshdeform.c
index da233a18d0a..d7f4af8df63 100644
--- a/source/blender/modifiers/intern/MOD_meshdeform.c
+++ b/source/blender/modifiers/intern/MOD_meshdeform.c
@@ -49,6 +49,8 @@
#include "MEM_guardedalloc.h"
+#include "DEG_depsgraph.h"
+
#include "MOD_util.h"
#ifdef __SSE2__
@@ -120,16 +122,12 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->object, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
MeshDeformModifierData *mmd = (MeshDeformModifierData *)md;
if (mmd->object != NULL) {
/* TODO(sergey): Do we need transform component here? */
- DEG_add_object_relation(node, mmd->object, DEG_OB_COMP_GEOMETRY, "Mesh Deform Modifier");
+ DEG_add_object_relation(ctx->node, mmd->object, DEG_OB_COMP_GEOMETRY, "Mesh Deform Modifier");
}
}
@@ -300,7 +298,7 @@ static void meshdeformModifier_do(
*
* We'll support this case once granular dependency graph is landed.
*/
- if (mmd->object == md->scene->obedit) {
+ if (mmd->object->mode & OB_MODE_EDIT) {
BMEditMesh *em = BKE_editmesh_from_object(mmd->object);
tmpdm = editbmesh_get_derived_cage_and_final(eval_ctx, md->scene, mmd->object, em, 0, &cagedm);
if (tmpdm)
diff --git a/source/blender/modifiers/intern/MOD_meshsequencecache.c b/source/blender/modifiers/intern/MOD_meshsequencecache.c
index e28459814e2..10e1cdea4ca 100644
--- a/source/blender/modifiers/intern/MOD_meshsequencecache.c
+++ b/source/blender/modifiers/intern/MOD_meshsequencecache.c
@@ -33,7 +33,6 @@
#include "BKE_cachefile.h"
#include "BKE_DerivedMesh.h"
#include "BKE_cdderivedmesh.h"
-#include "BKE_global.h"
#include "BKE_library.h"
#include "BKE_library_query.h"
#include "BKE_scene.h"
@@ -44,6 +43,7 @@
#ifdef WITH_ALEMBIC
# include "ABC_alembic.h"
+# include "BKE_global.h"
#endif
static void initData(ModifierData *md)
@@ -74,10 +74,6 @@ static void freeData(ModifierData *md)
{
MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
- if (mcmd->cache_file) {
- id_us_min(&mcmd->cache_file->id);
- }
-
if (mcmd->reader) {
#ifdef WITH_ALEMBIC
CacheReader_free(mcmd->reader);
@@ -173,19 +169,13 @@ static void foreachIDLink(ModifierData *md, Object *ob,
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *bmain,
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
MeshSeqCacheModifierData *mcmd = (MeshSeqCacheModifierData *) md;
if (mcmd->cache_file != NULL) {
- DEG_add_object_cache_relation(node, mcmd->cache_file, DEG_OB_COMP_CACHE, "Mesh Cache File");
+ DEG_add_object_cache_relation(ctx->node, mcmd->cache_file, DEG_OB_COMP_CACHE, "Mesh Cache File");
}
-
- UNUSED_VARS(bmain, scene, ob);
}
ModifierTypeInfo modifierType_MeshSequenceCache = {
diff --git a/source/blender/modifiers/intern/MOD_mirror.c b/source/blender/modifiers/intern/MOD_mirror.c
index 1b725e335a4..62de2711b3d 100644
--- a/source/blender/modifiers/intern/MOD_mirror.c
+++ b/source/blender/modifiers/intern/MOD_mirror.c
@@ -76,17 +76,13 @@ static void foreachObjectLink(
walk(userData, ob, &mmd->mirror_ob, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
MirrorModifierData *mmd = (MirrorModifierData *)md;
if (mmd->mirror_ob != NULL) {
- DEG_add_object_relation(node, mmd->mirror_ob, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
+ DEG_add_object_relation(ctx->node, mmd->mirror_ob, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
}
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Mirror Modifier");
}
static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
diff --git a/source/blender/modifiers/intern/MOD_normal_edit.c b/source/blender/modifiers/intern/MOD_normal_edit.c
index 61a5b9bb03e..4fc49234468 100644
--- a/source/blender/modifiers/intern/MOD_normal_edit.c
+++ b/source/blender/modifiers/intern/MOD_normal_edit.c
@@ -509,15 +509,11 @@ static bool isDisabled(ModifierData *md, int UNUSED(useRenderParams))
return !is_valid_target(enmd);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
NormalEditModifierData *enmd = (NormalEditModifierData *) md;
if (enmd->target) {
- DEG_add_object_relation(node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
+ DEG_add_object_relation(ctx->node, enmd->target, DEG_OB_COMP_TRANSFORM, "NormalEdit Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_particleinstance.c b/source/blender/modifiers/intern/MOD_particleinstance.c
index 09966da13a2..7979751395a 100644
--- a/source/blender/modifiers/intern/MOD_particleinstance.c
+++ b/source/blender/modifiers/intern/MOD_particleinstance.c
@@ -44,7 +44,6 @@
#include "BKE_cdderivedmesh.h"
#include "BKE_effect.h"
-#include "BKE_global.h"
#include "BKE_lattice.h"
#include "BKE_library_query.h"
#include "BKE_modifier.h"
@@ -111,15 +110,11 @@ static bool isDisabled(ModifierData *md, int useRenderParams)
return false;
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ParticleInstanceModifierData *pimd = (ParticleInstanceModifierData *) md;
if (pimd->ob != NULL) {
- DEG_add_object_relation(node, pimd->ob, DEG_OB_COMP_TRANSFORM, "Particle Instance Modifier");
+ DEG_add_object_relation(ctx->node, pimd->ob, DEG_OB_COMP_TRANSFORM, "Particle Instance Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_screw.c b/source/blender/modifiers/intern/MOD_screw.c
index 979dc339e4e..5f30b762275 100644
--- a/source/blender/modifiers/intern/MOD_screw.c
+++ b/source/blender/modifiers/intern/MOD_screw.c
@@ -1117,15 +1117,11 @@ static DerivedMesh *applyModifier(ModifierData *md, const struct EvaluationConte
return result;
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ScrewModifierData *ltmd = (ScrewModifierData *)md;
if (ltmd->ob_axis != NULL) {
- DEG_add_object_relation(node, ltmd->ob_axis, DEG_OB_COMP_TRANSFORM, "Screw Modifier");
+ DEG_add_object_relation(ctx->node, ltmd->ob_axis, DEG_OB_COMP_TRANSFORM, "Screw Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_shrinkwrap.c b/source/blender/modifiers/intern/MOD_shrinkwrap.c
index c87fdd321ab..cbb96b31db1 100644
--- a/source/blender/modifiers/intern/MOD_shrinkwrap.c
+++ b/source/blender/modifiers/intern/MOD_shrinkwrap.c
@@ -142,20 +142,16 @@ static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUS
dm->release(dm);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
ShrinkwrapModifierData *smd = (ShrinkwrapModifierData *)md;
if (smd->target != NULL) {
- DEG_add_object_relation(node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
- DEG_add_object_relation(node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
+ DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
+ DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
}
if (smd->auxTarget != NULL) {
- DEG_add_object_relation(node, smd->auxTarget, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
- DEG_add_object_relation(node, smd->auxTarget, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
+ DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_TRANSFORM, "Shrinkwrap Modifier");
+ DEG_add_object_relation(ctx->node, smd->auxTarget, DEG_OB_COMP_GEOMETRY, "Shrinkwrap Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_simpledeform.c b/source/blender/modifiers/intern/MOD_simpledeform.c
index 6116e49d07d..8590deb508a 100644
--- a/source/blender/modifiers/intern/MOD_simpledeform.c
+++ b/source/blender/modifiers/intern/MOD_simpledeform.c
@@ -375,15 +375,11 @@ static void foreachObjectLink(
walk(userData, ob, &smd->origin, IDWALK_CB_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
SimpleDeformModifierData *smd = (SimpleDeformModifierData *)md;
if (smd->origin != NULL) {
- DEG_add_object_relation(node, smd->origin, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
+ DEG_add_object_relation(ctx->node, smd->origin, DEG_OB_COMP_TRANSFORM, "SimpleDeform Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_skin.c b/source/blender/modifiers/intern/MOD_skin.c
index 97afe6d5e87..4afe6ca33e2 100644
--- a/source/blender/modifiers/intern/MOD_skin.c
+++ b/source/blender/modifiers/intern/MOD_skin.c
@@ -1304,9 +1304,9 @@ static void skin_fix_hole_no_good_verts(BMesh *bm, Frame *frame, BMFace *split_f
else if (split_face->len > 4) {
/* Maintain a dynamic vert array containing the split_face's
* vertices, avoids frequent allocs in collapse_face_corners() */
- if (BLI_array_count(vert_buf) < split_face->len) {
+ if (BLI_array_len(vert_buf) < split_face->len) {
BLI_array_grow_items(vert_buf, (split_face->len -
- BLI_array_count(vert_buf)));
+ BLI_array_len(vert_buf)));
}
/* Get split face's verts */
@@ -1470,7 +1470,7 @@ static void hull_merge_triangles(SkinOutput *so, const SkinModifierData *smd)
while (!BLI_heap_is_empty(heap)) {
BMFace *adj[2];
- e = BLI_heap_popmin(heap);
+ e = BLI_heap_pop_min(heap);
if (BM_edge_face_pair(e, &adj[0], &adj[1])) {
/* If both triangles still free, and if they don't already
diff --git a/source/blender/modifiers/intern/MOD_smoke.c b/source/blender/modifiers/intern/MOD_smoke.c
index e66afe07841..e610ef5f78d 100644
--- a/source/blender/modifiers/intern/MOD_smoke.c
+++ b/source/blender/modifiers/intern/MOD_smoke.c
@@ -41,7 +41,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_smoke_types.h"
-#include "DNA_object_force.h"
+#include "DNA_object_force_types.h"
#include "BLI_utildefines.h"
@@ -131,20 +131,16 @@ static bool is_coll_cb(Object *UNUSED(ob), ModifierData *md)
return (smd->type & MOD_SMOKE_TYPE_COLL) && smd->coll;
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
SmokeModifierData *smd = (SmokeModifierData *)md;
if (smd && (smd->type & MOD_SMOKE_TYPE_DOMAIN) && smd->domain) {
/* Actual code uses get_collisionobjects */
- DEG_add_collision_relations(node, scene, ob, smd->domain->fluid_group, eModifierType_Smoke, is_flow_cb, true, "Smoke Flow");
- DEG_add_collision_relations(node, scene, ob, smd->domain->coll_group, eModifierType_Smoke, is_coll_cb, true, "Smoke Coll");
+ DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, smd->domain->fluid_group, eModifierType_Smoke, is_flow_cb, true, "Smoke Flow");
+ DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, smd->domain->coll_group, eModifierType_Smoke, is_coll_cb, true, "Smoke Coll");
- DEG_add_forcefield_relations(node, scene, ob, smd->domain->effector_weights, true, PFIELD_SMOKEFLOW, "Smoke Force Field");
+ DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, smd->domain->effector_weights, true, PFIELD_SMOKEFLOW, "Smoke Force Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_softbody.c b/source/blender/modifiers/intern/MOD_softbody.c
index 020dd3da6a5..8d5217391af 100644
--- a/source/blender/modifiers/intern/MOD_softbody.c
+++ b/source/blender/modifiers/intern/MOD_softbody.c
@@ -35,7 +35,7 @@
#include <stdio.h>
#include "DNA_scene_types.h"
-#include "DNA_object_force.h"
+#include "DNA_object_force_types.h"
#include "BLI_utildefines.h"
@@ -63,17 +63,13 @@ static bool dependsOnTime(ModifierData *UNUSED(md))
return true;
}
-static void updateDepsgraph(ModifierData *UNUSED(md),
- struct Main *UNUSED(bmain),
- struct Scene *scene,
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *UNUSED(md), const ModifierUpdateDepsgraphContext *ctx)
{
- if (ob->soft) {
+ if (ctx->object->soft) {
/* Actual code uses ccd_build_deflector_hash */
- DEG_add_collision_relations(node, scene, ob, ob->soft->collision_group, eModifierType_Collision, NULL, false, "Softbody Collision");
+ DEG_add_collision_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->collision_group, eModifierType_Collision, NULL, false, "Softbody Collision");
- DEG_add_forcefield_relations(node, scene, ob, ob->soft->effector_weights, true, 0, "Softbody Field");
+ DEG_add_forcefield_relations(ctx->node, ctx->scene, ctx->object, ctx->object->soft->effector_weights, true, 0, "Softbody Field");
}
}
diff --git a/source/blender/modifiers/intern/MOD_surfacedeform.c b/source/blender/modifiers/intern/MOD_surfacedeform.c
index 046a0ab27bf..30b569207db 100644
--- a/source/blender/modifiers/intern/MOD_surfacedeform.c
+++ b/source/blender/modifiers/intern/MOD_surfacedeform.c
@@ -11,6 +11,8 @@
#include "BKE_library_query.h"
#include "BKE_modifier.h"
+#include "DEG_depsgraph.h"
+
#include "MEM_guardedalloc.h"
#include "MOD_util.h"
@@ -168,15 +170,11 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
walk(userData, ob, &smd->target, IDWALK_NOP);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
if (smd->target != NULL) {
- DEG_add_object_relation(node, smd->target, DEG_OB_COMP_GEOMETRY, "Surface Deform Modifier");
+ DEG_add_object_relation(ctx->node, smd->target, DEG_OB_COMP_GEOMETRY, "Surface Deform Modifier");
}
}
@@ -1097,7 +1095,9 @@ static void deformVert(
}
}
-static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], unsigned int numverts, Object *ob)
+static void surfacedeformModifier_do(
+ ModifierData *md,
+ float (*vertexCos)[3], unsigned int numverts, Object *ob)
{
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
DerivedMesh *tdm;
@@ -1110,7 +1110,7 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un
}
/* Handle target mesh both in and out of edit mode */
- if (smd->target == md->scene->obedit) {
+ if (smd->target->mode & OB_MODE_EDIT) {
BMEditMesh *em = BKE_editmesh_from_object(smd->target);
tdm = em->derivedFinal;
}
@@ -1180,18 +1180,20 @@ static void surfacedeformModifier_do(ModifierData *md, float (*vertexCos)[3], un
}
}
-static void deformVerts(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
- Object *ob, DerivedMesh *UNUSED(derivedData),
- float (*vertexCos)[3], int numVerts,
- ModifierApplyFlag UNUSED(flag))
+static void deformVerts(
+ ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
+ Object *ob, DerivedMesh *UNUSED(derivedData),
+ float (*vertexCos)[3], int numVerts,
+ ModifierApplyFlag UNUSED(flag))
{
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
}
-static void deformVertsEM(ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
- Object *ob, struct BMEditMesh *UNUSED(editData),
- DerivedMesh *UNUSED(derivedData),
- float (*vertexCos)[3], int numVerts)
+static void deformVertsEM(
+ ModifierData *md, const struct EvaluationContext *UNUSED(eval_ctx),
+ Object *ob, struct BMEditMesh *UNUSED(editData),
+ DerivedMesh *UNUSED(derivedData),
+ float (*vertexCos)[3], int numVerts)
{
surfacedeformModifier_do(md, vertexCos, numVerts, ob);
}
diff --git a/source/blender/modifiers/intern/MOD_uvproject.c b/source/blender/modifiers/intern/MOD_uvproject.c
index 498dd2486f4..02f799fecb9 100644
--- a/source/blender/modifiers/intern/MOD_uvproject.c
+++ b/source/blender/modifiers/intern/MOD_uvproject.c
@@ -109,17 +109,13 @@ static void foreachIDLink(ModifierData *md, Object *ob,
foreachObjectLink(md, ob, (ObjectWalkFunc)walk, userData);
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
UVProjectModifierData *umd = (UVProjectModifierData *)md;
int i;
for (i = 0; i < umd->num_projectors; ++i) {
if (umd->projectors[i] != NULL) {
- DEG_add_object_relation(node, umd->projectors[i], DEG_OB_COMP_TRANSFORM, "UV Project Modifier");
+ DEG_add_object_relation(ctx->node, umd->projectors[i], DEG_OB_COMP_TRANSFORM, "UV Project Modifier");
}
}
}
diff --git a/source/blender/modifiers/intern/MOD_uvwarp.c b/source/blender/modifiers/intern/MOD_uvwarp.c
index 32974d68d9d..8af9fd6cde4 100644
--- a/source/blender/modifiers/intern/MOD_uvwarp.c
+++ b/source/blender/modifiers/intern/MOD_uvwarp.c
@@ -232,9 +232,9 @@ static void foreachObjectLink(ModifierData *md, Object *ob, ObjectWalkFunc walk,
walk(userData, ob, &umd->object_src, IDWALK_CB_NOP);
}
-static void uv_warp_deps_object_bone(struct DepsNodeHandle *node,
- Object *object,
- const char *bonename)
+static void uv_warp_deps_object_bone_new(struct DepsNodeHandle *node,
+ Object *object,
+ const char *bonename)
{
if (object != NULL) {
if (bonename[0])
@@ -244,16 +244,12 @@ static void uv_warp_deps_object_bone(struct DepsNodeHandle *node,
}
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
UVWarpModifierData *umd = (UVWarpModifierData *) md;
- uv_warp_deps_object_bone(node, umd->object_src, umd->bone_src);
- uv_warp_deps_object_bone(node, umd->object_dst, umd->bone_dst);
+ uv_warp_deps_object_bone_new(ctx->node, umd->object_src, umd->bone_src);
+ uv_warp_deps_object_bone_new(ctx->node, umd->object_dst, umd->bone_dst);
}
ModifierTypeInfo modifierType_UVWarp = {
diff --git a/source/blender/modifiers/intern/MOD_warp.c b/source/blender/modifiers/intern/MOD_warp.c
index be0be2671b9..204e344b8e1 100644
--- a/source/blender/modifiers/intern/MOD_warp.c
+++ b/source/blender/modifiers/intern/MOD_warp.c
@@ -137,19 +137,15 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
walk(userData, ob, md, "texture");
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WarpModifierData *wmd = (WarpModifierData *) md;
if (wmd->object_from != NULL && wmd->object_to != NULL) {
- DEG_add_object_relation(node, wmd->object_from, DEG_OB_COMP_TRANSFORM, "Warp Modifier from");
- DEG_add_object_relation(node, wmd->object_to, DEG_OB_COMP_TRANSFORM, "Warp Modifier to");
+ DEG_add_object_relation(ctx->node, wmd->object_from, DEG_OB_COMP_TRANSFORM, "Warp Modifier from");
+ DEG_add_object_relation(ctx->node, wmd->object_to, DEG_OB_COMP_TRANSFORM, "Warp Modifier to");
}
if ((wmd->texmapping == MOD_DISP_MAP_OBJECT) && wmd->map_object != NULL) {
- DEG_add_object_relation(node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Warp Modifier map");
+ DEG_add_object_relation(ctx->node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Warp Modifier map");
}
}
diff --git a/source/blender/modifiers/intern/MOD_wave.c b/source/blender/modifiers/intern/MOD_wave.c
index 1271cccd719..7921ea662a7 100644
--- a/source/blender/modifiers/intern/MOD_wave.c
+++ b/source/blender/modifiers/intern/MOD_wave.c
@@ -78,14 +78,6 @@ static void initData(ModifierData *md)
wmd->defgrp_name[0] = 0;
}
-static void freeData(ModifierData *md)
-{
- WaveModifierData *wmd = (WaveModifierData *) md;
- if (wmd->texture) {
- id_us_min(&wmd->texture->id);
- }
-}
-
static void copyData(ModifierData *md, ModifierData *target)
{
#if 0
@@ -127,18 +119,14 @@ static void foreachTexLink(ModifierData *md, Object *ob,
walk(userData, ob, md, "texture");
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *UNUSED(ob),
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WaveModifierData *wmd = (WaveModifierData *)md;
if (wmd->objectcenter != NULL) {
- DEG_add_object_relation(node, wmd->objectcenter, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
+ DEG_add_object_relation(ctx->node, wmd->objectcenter, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
}
if (wmd->map_object != NULL) {
- DEG_add_object_relation(node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
+ DEG_add_object_relation(ctx->node, wmd->map_object, DEG_OB_COMP_TRANSFORM, "Wave Modifier");
}
}
@@ -370,7 +358,7 @@ ModifierTypeInfo modifierType_Wave = {
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ freeData,
+ /* freeData */ NULL,
/* isDisabled */ NULL,
/* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ dependsOnTime,
diff --git a/source/blender/modifiers/intern/MOD_weightvgedit.c b/source/blender/modifiers/intern/MOD_weightvgedit.c
index 9aa4bad1707..6fdfe215c37 100644
--- a/source/blender/modifiers/intern/MOD_weightvgedit.c
+++ b/source/blender/modifiers/intern/MOD_weightvgedit.c
@@ -78,10 +78,6 @@ static void freeData(ModifierData *md)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *) md;
curvemapping_free(wmd->cmap_curve);
-
- if (wmd->mask_texture) {
- id_us_min(&wmd->mask_texture->id);
- }
}
static void copyData(ModifierData *md, ModifierData *target)
@@ -140,18 +136,14 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
walk(userData, ob, md, "mask_texture");
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WeightVGEditModifierData *wmd = (WeightVGEditModifierData *)md;
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
+ DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
}
if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGEdit Modifier");
}
}
diff --git a/source/blender/modifiers/intern/MOD_weightvgmix.c b/source/blender/modifiers/intern/MOD_weightvgmix.c
index ab1264cc9a0..45c41498792 100644
--- a/source/blender/modifiers/intern/MOD_weightvgmix.c
+++ b/source/blender/modifiers/intern/MOD_weightvgmix.c
@@ -125,14 +125,6 @@ static void initData(ModifierData *md)
wmd->mask_tex_mapping = MOD_DISP_MAP_LOCAL;
}
-static void freeData(ModifierData *md)
-{
- WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
- if (wmd->mask_texture) {
- id_us_min(&wmd->mask_texture->id);
- }
-}
-
static void copyData(ModifierData *md, ModifierData *target)
{
#if 0
@@ -189,20 +181,16 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
walk(userData, ob, md, "mask_texture");
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WeightVGMixModifierData *wmd = (WeightVGMixModifierData *) md;
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
- DEG_add_object_relation(node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
+ DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
+ DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
}
if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
- DEG_add_object_relation(node, ob, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGMix Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_GEOMETRY, "WeightVGMix Modifier");
}
}
@@ -413,7 +401,7 @@ ModifierTypeInfo modifierType_WeightVGMix = {
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ freeData,
+ /* freeData */ NULL,
/* isDisabled */ isDisabled,
/* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ dependsOnTime,
diff --git a/source/blender/modifiers/intern/MOD_weightvgproximity.c b/source/blender/modifiers/intern/MOD_weightvgproximity.c
index 8a5d0f833a8..84c5207830e 100644
--- a/source/blender/modifiers/intern/MOD_weightvgproximity.c
+++ b/source/blender/modifiers/intern/MOD_weightvgproximity.c
@@ -285,14 +285,6 @@ static void initData(ModifierData *md)
wmd->max_dist = 1.0f; /* vert arbitrary distance, but don't use 0 */
}
-static void freeData(ModifierData *md)
-{
- WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *) md;
- if (wmd->mask_texture) {
- id_us_min(&wmd->mask_texture->id);
- }
-}
-
static void copyData(ModifierData *md, ModifierData *target)
{
#if 0
@@ -350,24 +342,20 @@ static void foreachTexLink(ModifierData *md, Object *ob, TexWalkFunc walk, void
walk(userData, ob, md, "mask_texture");
}
-static void updateDepsgraph(ModifierData *md,
- struct Main *UNUSED(bmain),
- struct Scene *UNUSED(scene),
- Object *ob,
- struct DepsNodeHandle *node)
+static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphContext *ctx)
{
WeightVGProximityModifierData *wmd = (WeightVGProximityModifierData *)md;
if (wmd->proximity_ob_target != NULL) {
- DEG_add_object_relation(node, wmd->proximity_ob_target, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
- DEG_add_object_relation(node, wmd->proximity_ob_target, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, wmd->proximity_ob_target, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
}
if (wmd->mask_tex_map_obj != NULL && wmd->mask_tex_mapping == MOD_DISP_MAP_OBJECT) {
- DEG_add_object_relation(node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
- DEG_add_object_relation(node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, wmd->mask_tex_map_obj, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
}
if (wmd->mask_tex_mapping == MOD_DISP_MAP_GLOBAL) {
- DEG_add_object_relation(node, ob, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
- DEG_add_object_relation(node, ob, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "WeightVGProximity Modifier");
+ DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_GEOMETRY, "WeightVGProximity Modifier");
}
}
@@ -596,7 +584,7 @@ ModifierTypeInfo modifierType_WeightVGProximity = {
/* applyModifierEM */ NULL,
/* initData */ initData,
/* requiredDataMask */ requiredDataMask,
- /* freeData */ freeData,
+ /* freeData */ NULL,
/* isDisabled */ isDisabled,
/* updateDepsgraph */ updateDepsgraph,
/* dependsOnTime */ dependsOnTime,