Cleanup: remove useless `DM_ensure_looptri()`.
authorBastien Montagne <montagne29@wanadoo.fr>
Fri, 11 Aug 2017 14:18:01 +0000 (16:18 +0200)
committerBastien Montagne <montagne29@wanadoo.fr>
Fri, 11 Aug 2017 15:08:41 +0000 (17:08 +0200)
That one was doing exactly same thing as `dm->getLoopTriArray()`, no
point in having twice the same code here...

12 files changed:
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cloth.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/fluidsim.c
source/blender/blenkernel/intern/mesh_remap.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/smoke.c
source/blender/editors/physics/particle_edit.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_laplaciandeform.c
source/blender/python/mathutils/mathutils_bvhtree.c

index a31a51f94022f4cf1833c49a6522bd99fdfad950..5a4fdcf25105b58803c92bed76793617511c17e2 100644 (file)
@@ -625,7 +625,6 @@ void DM_ensure_normals(DerivedMesh *dm);
 void DM_ensure_tessface(DerivedMesh *dm);
 
 void DM_ensure_looptri_data(DerivedMesh *dm);
-void DM_ensure_looptri(DerivedMesh *dm);
 void DM_verttri_from_looptri(MVertTri *verttri, const MLoop *mloop, const MLoopTri *looptri, int looptri_num);
 
 void DM_update_tessface_data(DerivedMesh *dm);
index 17e805cef70536301c3525b5af29937fcf3ffe1d..7a05ab4530cd9920e8ed8566225677c03f678214 100644 (file)
@@ -238,7 +238,7 @@ static int dm_getNumLoopTri(DerivedMesh *dm)
 static const MLoopTri *dm_getLoopTriArray(DerivedMesh *dm)
 {
        if (dm->looptris.array) {
-               BLI_assert(poly_to_tri_count(dm->numPolyData, dm->numLoopData) == dm->looptris.num);
+               BLI_assert(dm->getNumLoopTri(dm) == dm->looptris.num);
        }
        else {
                dm->recalcLoopTri(dm);
@@ -510,19 +510,6 @@ void DM_ensure_looptri_data(DerivedMesh *dm)
        }
 }
 
-/**
- * The purpose of this function is that we can call:
- * `dm->getLoopTriArray(dm)` and get the array returned.
- */
-void DM_ensure_looptri(DerivedMesh *dm)
-{
-       const int numPolys =  dm->getNumPolys(dm);
-
-       if ((dm->looptris.num == 0) && (numPolys != 0)) {
-               dm->recalcLoopTri(dm);
-       }
-}
-
 void DM_verttri_from_looptri(MVertTri *verttri, const MLoop *mloop, const MLoopTri *looptri, int looptri_num)
 {
        int i;
@@ -2214,7 +2201,6 @@ static void mesh_calc_modifiers(
                if (dataMask & CD_MASK_MFACE) {
                        DM_ensure_tessface(finaldm);
                }
-               DM_ensure_looptri(finaldm);
 
                /* without this, drawing ngon tri's faces will show ugly tessellated face
                 * normals and will also have to calculate normals on the fly, try avoid
index ee0fde1ea61298d1057049db5071cf7a2bc52482..dd93606a67ccfa9f32aa95ce1dbed5b1ee369b38 100644 (file)
@@ -807,7 +807,6 @@ static int cloth_from_object(Object *ob, ClothModifierData *clmd, DerivedMesh *d
        if ( !dm )
                return 0;
 
-       DM_ensure_looptri(dm);
        cloth_from_mesh ( clmd, dm );
 
        // create springs
index 1db69d23607e87b789412f4cb36114cb5af0d250..ae896176b6d14c83a00aa6d8448c98e53c3a126e 100644 (file)
@@ -2060,9 +2060,6 @@ DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scene *scen
        if (pmd->canvas) {
                DerivedMesh *ret;
 
-               /* For now generate looptris in every case */
-               DM_ensure_looptri(dm);
-
                /* Update canvas data for a new frame */
                dynamicPaint_frameUpdate(pmd, scene, ob, dm);
 
@@ -2072,9 +2069,6 @@ DerivedMesh *dynamicPaint_Modifier_do(DynamicPaintModifierData *pmd, Scene *scen
                return ret;
        }
        else {
-               /* For now generate looptris in every case */
-               DM_ensure_looptri(dm);
-
                /* Update canvas data for a new frame */
                dynamicPaint_frameUpdate(pmd, scene, ob, dm);
 
index 8247336d91566330132d4a9044e2c4f69dbec644..8e98a9f672d8f957399317d72ff0c0eb44edbd6d 100644 (file)
@@ -80,8 +80,6 @@ void initElbeemMesh(struct Scene *scene, struct Object *ob,
 
        dm = mesh_create_derived_index_render(scene, ob, CD_MASK_BAREMESH, modifierIndex);
 
-       DM_ensure_looptri(dm);
-
        mvert = dm->getVertArray(dm);
        mloop = dm->getLoopArray(dm);
        looptri = dm->getLoopTriArray(dm);
index 624898d47a54a125f224aab6ad471123b8608734..d2fe8f27f4ab1f980d4af52ef3f81f1a76f5f0a7 100644 (file)
@@ -1373,7 +1373,6 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                if (dirty_tess_flag) {
                                        dm_src->dirty &= ~dirty_tess_flag;
                                }
-                               DM_ensure_looptri(dm_src);
                                if (dirty_tess_flag) {
                                        dm_src->dirty |= dirty_tess_flag;
                                }
index 8bfc1e81c737e5e371b751eeb044db18beb40654..167b3ad1fec345b2de84de831d5d50a6da475362 100644 (file)
@@ -291,8 +291,6 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
                if (dm == NULL)
                        return NULL;
 
-               DM_ensure_looptri(dm);
-
                mvert   = dm->getVertArray(dm);
                totvert = dm->getNumVerts(dm);
                looptri = dm->getLoopTriArray(dm);
@@ -524,8 +522,6 @@ void BKE_rigidbody_calc_volume(Object *ob, float *r_vol)
                                if (dm == NULL)
                                        return;
                        
-                               DM_ensure_looptri(dm);
-                       
                                mvert   = dm->getVertArray(dm);
                                totvert = dm->getNumVerts(dm);
                                lt = dm->getLoopTriArray(dm);
@@ -609,8 +605,6 @@ void BKE_rigidbody_calc_center_of_mass(Object *ob, float r_center[3])
                                if (dm == NULL)
                                        return;
                        
-                               DM_ensure_looptri(dm);
-                       
                                mvert   = dm->getVertArray(dm);
                                totvert = dm->getNumVerts(dm);
                                looptri = dm->getLoopTriArray(dm);
index d0ef5cfc0928ef3939fb5b2f071a82a0b4fd7542..adecea7080ca676c16d72190bfa441239a000b8a 100644 (file)
@@ -2692,7 +2692,6 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
 
                if (smd->flow->dm) smd->flow->dm->release(smd->flow->dm);
                smd->flow->dm = CDDM_copy(dm);
-               DM_ensure_looptri(smd->flow->dm);
 
                if (scene->r.cfra > smd->time)
                {
@@ -2715,7 +2714,6 @@ static void smokeModifier_process(SmokeModifierData *smd, Scene *scene, Object *
                                smd->coll->dm->release(smd->coll->dm);
 
                        smd->coll->dm = CDDM_copy(dm);
-                       DM_ensure_looptri(smd->coll->dm);
                }
 
                smd->time = scene->r.cfra;
index 2541aaa4b11625cc653dc9ffb51718d036dd93e0..72c5a74aee97512caff500b8c6fc77507e829d7b 100644 (file)
@@ -424,7 +424,6 @@ static bool PE_create_shape_tree(PEData *data, Object *shapeob)
                return false;
        }
        
-       DM_ensure_looptri(dm);
        return (bvhtree_from_mesh_looptri(&data->shape_bvh, dm, 0.0f, 4, 8) != NULL);
 }
 
index 33e834f3023c6bc314d972d17bb23ea3b9eef2b3..74e49dda0747f446f6d214b513b72063924da1b5 100644 (file)
@@ -153,8 +153,6 @@ static void deformVerts(ModifierData *md, Object *ob,
                                collmd->current_v = MEM_dupallocN(collmd->x); // inter-frame
 
                                collmd->mvert_num = mvert_num;
-                               
-                               DM_ensure_looptri(dm);
 
                                collmd->tri_num = dm->getNumLoopTri(dm);
                                {
index ce3fdc4bbe826fecc384f2cc83b4d56a48a3b505..153670d327c5fba2c6be52847d79bcf5bfc19194 100644 (file)
@@ -539,7 +539,7 @@ static void initSystem(LaplacianDeformModifierData *lmd, Object *ob, DerivedMesh
                                STACK_PUSH(index_anchors, i);
                        }
                }
-               DM_ensure_looptri(dm);
+
                total_anchors = STACK_SIZE(index_anchors);
                lmd->cache_system = initLaplacianSystem(numVerts, dm->getNumEdges(dm), dm->getNumLoopTri(dm),
                                                       total_anchors, lmd->anchor_grp_name, lmd->repeat);
index 1eb8644a9a65a18d7ae6c21512497b7c6e37f31c..9217d8260ab726298e849b72d05a04abba3d81b2 100644 (file)
@@ -1156,7 +1156,6 @@ static PyObject *C_BVHTree_FromObject(PyObject *UNUSED(cls), PyObject *args, PyO
 
        /* Get data for tessellation */
        {
-               DM_ensure_looptri(dm);
                lt = dm->getLoopTriArray(dm);
 
                tris_len = (unsigned int)dm->getNumLoopTri(dm);