Commit: c034193821ec7e67a0ae1050c8ccef7b5cd5473b
Author: Bastien Montagne
Date:   Fri Aug 11 16:18:01 2017 +0200
Branches: master
https://developer.blender.org/rBc034193821ec7e67a0ae1050c8ccef7b5cd5473b

Cleanup: remove useless `DM_ensure_looptri()`.

That one was doing exactly same thing as `dm->getLoopTriArray()`, no
point in having twice the same code here...

===================================================================

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

===================================================================

diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h 
b/source/blender/blenkernel/BKE_DerivedMesh.h
index a31a51f9402..5a4fdcf2510 100644
--- a/source/blender/blenkernel/BKE_DerivedMesh.h
+++ b/source/blender/blenkernel/BKE_DerivedMesh.h
@@ -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);
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c 
b/source/blender/blenkernel/intern/DerivedMesh.c
index 17e805cef70..7a05ab4530c 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -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
diff --git a/source/blender/blenkernel/intern/cloth.c 
b/source/blender/blenkernel/intern/cloth.c
index ee0fde1ea61..dd93606a67c 100644
--- a/source/blender/blenkernel/intern/cloth.c
+++ b/source/blender/blenkernel/intern/cloth.c
@@ -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
diff --git a/source/blender/blenkernel/intern/dynamicpaint.c 
b/source/blender/blenkernel/intern/dynamicpaint.c
index 1db69d23607..ae896176b6d 100644
--- a/source/blender/blenkernel/intern/dynamicpaint.c
+++ b/source/blender/blenkernel/intern/dynamicpaint.c
@@ -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);
 
diff --git a/source/blender/blenkernel/intern/fluidsim.c 
b/source/blender/blenkernel/intern/fluidsim.c
index 8247336d915..8e98a9f672d 100644
--- a/source/blender/blenkernel/intern/fluidsim.c
+++ b/source/blender/blenkernel/intern/fluidsim.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/mesh_remap.c 
b/source/blender/blenkernel/intern/mesh_remap.c
index 624898d47a5..d2fe8f27f4a 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -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;
                                }
diff --git a/source/blender/blenkernel/intern/rigidbody.c 
b/source/blender/blenkernel/intern/rigidbody.c
index 8bfc1e81c73..167b3ad1fec 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -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);
diff --git a/source/blender/blenkernel/intern/smoke.c 
b/source/blender/blenkernel/intern/smoke.c
index d0ef5cfc092..adecea7080c 100644
--- a/source/blender/blenkernel/intern/smoke.c
+++ b/source/blender/blenkernel/intern/smoke.c
@@ -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;
diff --git a/source/blender/editors/physics/particle_edit.c 
b/source/blender/editors/physics/particle_edit.c
index 2541aaa4b11..72c5a74aee9 100644
--- a/source/blender/editors/physics/particle_edit.c
+++ b/source/blender/editors/physics/particle_edit.c
@@ -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);
 }
 
diff --git a/source/blender/modifiers/intern/MOD_collision.c 
b/source/blender/modifiers/intern/MOD_collision.c
index 33e834f3023..74e49dda074 100644
--- a/source/blender/modifiers/intern/MOD_collision.c
+++ b/source/blender/modifiers/intern/MOD_collision.c
@@ -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);
                                {
diff --git a/source/blender/modifiers/intern/MOD_laplaciandeform.c 
b/source/blender/modifiers/intern/MOD_laplaciandeform.c
index ce3fdc4bbe8..153670d327c 100644
--- a/source/blender/modifiers/intern/MOD_laplaciandeform.c
+++ b/source/blender/modifiers/intern/MOD_laplaciandeform.c
@@ -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);
diff --git a/source/blender/python/mathutils/mathutils_bvhtree.c 
b/source/blender/python/mathutils/mathutils_bvhtree.c
index 1eb8644a9a6..9217d8260ab 100644
--- a/source/blender/python/mathutils/mathutils_bvhtree.c
+++ b/source/blender/python/mathutils/mathutils_bvhtree.c
@@ -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);

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to