remove CDDM_copy second argument, added CDDM_copy_from_tessface instead.
authorCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2012 21:59:47 +0000 (21:59 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 29 Jan 2012 21:59:47 +0000 (21:59 +0000)
this function caused too many conflicts and in most cases was zero anyway.

25 files changed:
source/blender/blenkernel/BKE_cdderivedmesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/displist.c
source/blender/blenkernel/intern/dynamicpaint.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/particle.c
source/blender/blenkernel/intern/particle_system.c
source/blender/editors/mesh/bmesh_tools.c
source/blender/editors/object/object_bake.c
source/blender/editors/physics/particle_object.c
source/blender/modifiers/intern/MOD_bevel.c
source/blender/modifiers/intern/MOD_boolean.c
source/blender/modifiers/intern/MOD_cloth.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_decimate.c
source/blender/modifiers/intern/MOD_edgesplit.c
source/blender/modifiers/intern/MOD_multires.c
source/blender/modifiers/intern/MOD_ngoninterp.c
source/blender/modifiers/intern/MOD_ocean.c
source/blender/modifiers/intern/MOD_particlesystem.c
source/blender/modifiers/intern/MOD_remesh.c
source/blender/modifiers/intern/MOD_subsurf.c
source/blender/modifiers/intern/MOD_surface.c
source/blender/modifiers/intern/MOD_util.c

index db9f8e0..3f42133 100644 (file)
@@ -76,7 +76,8 @@ struct BMEditMesh *CDDM_To_BMesh(struct Object *ob, struct DerivedMesh *dm,
 /* Copies the given DerivedMesh with verts, faces & edges stored as
  * custom element data.
  */
-struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm, int faces_from_tessfaces);
+struct DerivedMesh *CDDM_copy(struct DerivedMesh *dm);
+struct DerivedMesh *CDDM_copy_from_tessface(struct DerivedMesh *dm);
 
 /* creates a CDDerivedMesh with the same layer stack configuration as the
  * given DerivedMesh and containing the requested numbers of elements.
index 686d6a4..9766d44 100644 (file)
@@ -1448,7 +1448,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                        /* apply vertex coordinates or build a DerivedMesh as necessary */
                        if(dm) {
                                if(deformedVerts) {
-                                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                                       DerivedMesh *tdm = CDDM_copy(dm);
                                        dm->release(dm);
                                        dm = tdm;
 
@@ -1582,7 +1582,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
         * DerivedMesh then we need to build one.
         */
        if(dm && deformedVerts) {
-               finaldm = CDDM_copy(dm, 0);
+               finaldm = CDDM_copy(dm);
 
                dm->release(dm);
 
@@ -1775,7 +1775,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
                        /* apply vertex coordinates or build a DerivedMesh as necessary */
                        if(dm) {
                                if(deformedVerts) {
-                                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                                       DerivedMesh *tdm = CDDM_copy(dm);
                                        if(!(cage_r && dm == *cage_r)) dm->release(dm);
                                        dm = tdm;
 
@@ -1784,7 +1784,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
                                } else if(cage_r && dm == *cage_r) {
                                        /* dm may be changed by this modifier, so we need to copy it
                                         */
-                                       dm = CDDM_copy(dm, 0);
+                                       dm = CDDM_copy(dm);
                                }
 
                        } else {
@@ -1846,7 +1846,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
 
                if(cage_r && i == cageIndex) {
                        if(dm && deformedVerts) {
-                               *cage_r = CDDM_copy(dm, 0);
+                               *cage_r = CDDM_copy(dm);
                                CDDM_apply_vert_coords(*cage_r, deformedVerts);
                        } else if(dm) {
                                *cage_r = dm;
@@ -1865,7 +1865,7 @@ static void editbmesh_calc_modifiers(Scene *scene, Object *ob, BMEditMesh *em, D
         * then we need to build one.
         */
        if(dm && deformedVerts) {
-               *final_r = CDDM_copy(dm, 0);
+               *final_r = CDDM_copy(dm);
 
                if(!(cage_r && dm == *cage_r)) dm->release(dm);
 
index 5133bb0..fac8895 100644 (file)
@@ -2124,7 +2124,7 @@ DerivedMesh *CDDM_from_BMEditMesh(BMEditMesh *em, Mesh *UNUSED(me), int use_mdis
        return dm;
 }
 
-DerivedMesh *CDDM_copy(DerivedMesh *source, int faces_from_tessfaces)
+static DerivedMesh *cddm_copy_ex(DerivedMesh *source, int faces_from_tessfaces)
 {
        CDDerivedMesh *cddm = cdDM_create("CDDM_copy cddm");
        DerivedMesh *dm = &cddm->dm;
@@ -2175,6 +2175,16 @@ DerivedMesh *CDDM_copy(DerivedMesh *source, int faces_from_tessfaces)
        return dm;
 }
 
+DerivedMesh *CDDM_copy(DerivedMesh *source)
+{
+       return cddm_copy_ex(source, 0);
+}
+
+DerivedMesh *CDDM_copy_from_tessface(DerivedMesh *source)
+{
+       return cddm_copy_ex(source, 1);
+}
+
 /* note, the CD_ORIGINDEX layers are all 0, so if there is a direct
  * relationship betwen mesh data this needs to be set by the caller. */
 DerivedMesh *CDDM_from_template(DerivedMesh *source,
index d944d12..c2c6f8d 100644 (file)
@@ -887,7 +887,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
                        if (dm) {
                                if (vertCos) {
-                                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                                       DerivedMesh *tdm = CDDM_copy(dm);
                                        dm->release(dm);
                                        dm = tdm;
 
@@ -928,7 +928,7 @@ static void curve_calc_modifiers_post(Scene *scene, Object *ob, ListBase *dispba
 
        if (vertCos) {
                if (dm) {
-                       DerivedMesh *tdm = CDDM_copy(dm, 0);
+                       DerivedMesh *tdm = CDDM_copy(dm);
                        dm->release(dm);
                        dm = tdm;
 
index f4e6962..9a8946a 100644 (file)
@@ -1572,7 +1572,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
                                                        Object *ob,
                                                        DerivedMesh *dm)
 {      
-       DerivedMesh *result = CDDM_copy(dm, 0);
+       DerivedMesh *result = CDDM_copy(dm);
 
        if(pmd->canvas && !(pmd->canvas->flags & MOD_DPAINT_BAKING)) {
 
@@ -1774,7 +1774,7 @@ static struct DerivedMesh *dynamicPaint_Modifier_apply(DynamicPaintModifierData
        /* make a copy of dm to use as brush data */
        if (pmd->brush) {
                if (pmd->brush->dm) pmd->brush->dm->release(pmd->brush->dm);
-               pmd->brush->dm = CDDM_copy(result, 0);
+               pmd->brush->dm = CDDM_copy(result);
        }
 
        return result;
@@ -1792,7 +1792,7 @@ void dynamicPaint_cacheUpdateFrames(DynamicPaintSurface *surface)
 void canvas_copyDerivedMesh(DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
 {
        if (canvas->dm) canvas->dm->release(canvas->dm);
-       canvas->dm = CDDM_copy(dm, 0);
+       canvas->dm = CDDM_copy(dm);
 }
 
 /*
@@ -3045,7 +3045,7 @@ static void dynamicPaint_brushMeshCalculateVelocity(Scene *scene, Object *ob, Dy
        scene->r.subframe = prev_sfra;
 
        subframe_updateObject(scene, ob, UPDATE_EVERYTHING, BKE_curframe(scene));
-       dm_p = CDDM_copy(brush->dm, 0);
+       dm_p = CDDM_copy(brush->dm);
        numOfVerts_p = dm_p->getNumVerts(dm_p);
        mvert_p = dm_p->getVertArray(dm_p);
        copy_m4_m4(prev_obmat, ob->obmat);
@@ -3150,7 +3150,7 @@ static int dynamicPaint_paintMesh(DynamicPaintSurface *surface,
                Bounds3D mesh_bb = {0};
                VolumeGrid *grid = bData->grid;
 
-               dm = CDDM_copy(brush->dm, 0);
+               dm = CDDM_copy(brush->dm);
                mvert = dm->getVertArray(dm);
                mface = dm->getTessFaceArray(dm);
                numOfVerts = dm->getNumVerts(dm);
index cba4780..1f154e1 100644 (file)
@@ -79,7 +79,7 @@ DerivedMesh *get_multires_dm(Scene *scene, MultiresModifierData *mmd, Object *ob
 
        dm = mti->applyModifier(md, ob, tdm, 0, 1);
        if (dm == tdm) {
-               dm = CDDM_copy(tdm, 0);
+               dm = CDDM_copy(tdm);
        }
 
        return dm;
@@ -238,7 +238,7 @@ int multiresModifier_reshapeFromDeformMod(Scene *scene, MultiresModifierData *mm
        dm->getVertCos(dm, deformedVerts);
        mti->deformVerts(md, ob, dm, deformedVerts, numVerts, 0, 0);
 
-       ndm= CDDM_copy(dm, 0);
+       ndm= CDDM_copy(dm);
        CDDM_apply_vert_coords(ndm, deformedVerts);
 
        MEM_freeN(deformedVerts);
@@ -846,7 +846,7 @@ static void multiresModifier_update(DerivedMesh *dm)
                        int i, j, numGrids, highGridSize, lowGridSize;
 
                        /* create subsurf DM from original mesh at high level */
-                       if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform, 0);
+                       if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
                        else cddm = CDDM_from_mesh(me, NULL);
                        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
 
@@ -900,7 +900,7 @@ static void multiresModifier_update(DerivedMesh *dm)
                else {
                        DerivedMesh *cddm, *subdm;
 
-                       if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform, 0);
+                       if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
                        else cddm = CDDM_from_mesh(me, NULL);
                        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
 
index 132b721..ef71e19 100644 (file)
@@ -699,7 +699,7 @@ void psys_render_set(Object *ob, ParticleSystem *psys, float viewmat[][4], float
        data->totchildcache= psys->totchildcache;
 
        if(psmd->dm)
-               data->dm= CDDM_copy(psmd->dm, 0);
+               data->dm= CDDM_copy(psmd->dm);
        data->totdmvert= psmd->totdmvert;
        data->totdmedge= psmd->totdmedge;
        data->totdmface= psmd->totdmface;
index f259ddb..5356615 100644 (file)
@@ -3584,7 +3584,7 @@ static void do_hair_dynamics(ParticleSimulationData *sim)
        psys->clmd->sim_parms->effector_weights = psys->part->effector_weights;
 
        deformedVerts = MEM_callocN(sizeof(*deformedVerts)*dm->getNumVerts(dm), "do_hair_dynamics vertexCos");
-       psys->hair_out_dm = CDDM_copy(dm, 0);
+       psys->hair_out_dm = CDDM_copy(dm);
        psys->hair_out_dm->getVertCos(psys->hair_out_dm, deformedVerts);
 
        clothModifier_do(psys->clmd, sim->scene, sim->ob, dm, deformedVerts);
index 532f071..8861f94 100644 (file)
@@ -4598,7 +4598,7 @@ static int mesh_export_obj_exec(bContext *C, wmOperator *op)
        } else {
                dm = mesh_get_derived_final(scene, ob, CD_MASK_DERIVEDMESH);
                if (!CDDM_Check(dm)) {
-                       dm = CDDM_copy(dm, 0);
+                       dm = CDDM_copy(dm);
                        free = 1;
                } else {
                        free = 0;
index 75fa52b..1293e62 100644 (file)
@@ -996,7 +996,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
 
        if(*lvl==0) {
                DerivedMesh *tmp_dm= CDDM_from_mesh(me, ob);
-               dm= CDDM_copy(tmp_dm, 0);
+               dm= CDDM_copy(tmp_dm);
                tmp_dm->release(tmp_dm);
        } else {
                MultiresModifierData tmp_mmd= *mmd;
index 5732f64..da3f7e1 100644 (file)
@@ -645,7 +645,7 @@ static void connect_hair(Scene *scene, Object *ob, ParticleSystem *psys)
        
        if(psmd->dm->deformedOnly)
                /* we don't want to mess up psmd->dm when converting to global coordinates below */
-               dm= CDDM_copy(psmd->dm, 0);
+               dm= CDDM_copy(psmd->dm);
        else
                dm= mesh_get_derived_deform(scene, ob, CD_MASK_BAREMESH);
 
index 75136e4..363f0f4 100644 (file)
@@ -120,7 +120,7 @@ static DerivedMesh *applyModifier(ModifierData *md, struct Object *ob,
        float threshold = cos((bmd->bevel_angle + 0.00001) * M_PI / 180.0);
 
        if (!CDDM_Check(dm)) {
-               cddm = CDDM_copy(dm, 0);
+               cddm = CDDM_copy(dm);
        } else cddm = dm;
 
        em = CDDM_To_BMesh(ob, dm, NULL, FALSE);
index e773b77..6014413 100644 (file)
@@ -101,7 +101,7 @@ static DerivedMesh *get_quick_derivedMesh(DerivedMesh *derivedData, DerivedMesh
 
                        case eBooleanModifierOp_Union:
                                if(derivedData->getNumPolys(derivedData)) result = derivedData;
-                               else result = CDDM_copy(dm, FALSE);
+                               else result = CDDM_copy(dm);
 
                                break;
 
index f626a2f..fdb584e 100644 (file)
@@ -85,7 +85,7 @@ static void deformVerts(ModifierData *md, Object *ob, DerivedMesh *derivedData,
 
        dm = get_dm(ob, NULL, derivedData, NULL, 0);
        if(dm == derivedData)
-               dm = CDDM_copy(dm, 0);
+               dm = CDDM_copy(dm);
 
        CDDM_apply_vert_coords(dm, vertexCos);
 
index 99d6083..92ef79b 100644 (file)
@@ -117,7 +117,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        MVert *tempVert = NULL;
        
        /* if possible use/create DerivedMesh */
-       if(derivedData) dm = CDDM_copy(derivedData, 0);
+       if(derivedData) dm = CDDM_copy(derivedData);
        else if(ob->type==OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
        
        if(!ob->pd)
index bb7e1f5..bc7771d 100644 (file)
@@ -98,7 +98,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
        if(numTris<3) {
                modifier_setError(md,
                        "Modifier requires more than 3 input faces (triangles).");
-               dm = CDDM_copy(dm, 0);
+               dm = CDDM_copy(dm);
                return dm;
        }
 
index b44eeb1..eec7c6b 100644 (file)
@@ -68,7 +68,7 @@ static DerivedMesh *doEdgeSplit(DerivedMesh *dm, EdgeSplitModifierData *emd, Obj
        float threshold = cos((emd->split_angle + 0.00001) * M_PI / 180.0);
        
        if (!CDDM_Check(dm)) {
-               cddm = CDDM_copy(dm, 0);
+               cddm = CDDM_copy(dm);
        } else cddm = dm;
        
        em = CDDM_To_BMesh(ob, dm, NULL, FALSE);
index de3989d..769ad86 100644 (file)
@@ -90,7 +90,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *dm,
                return dm;
 
        if(useRenderParams || !isFinalCalc) {
-               DerivedMesh *cddm= CDDM_copy(result, 0);
+               DerivedMesh *cddm= CDDM_copy(result);
                result->release(result);
                result= cddm;
        }
index 08d8301..264578e 100644 (file)
@@ -99,7 +99,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *UNUSED(ob),
                return dm;
        
        if (!CDDM_Check(dm)) {
-               dm = copy = CDDM_copy(dm, 0);
+               dm = copy = CDDM_copy(dm);
        }
        
        CDDM_recalc_tesselation(dm);
index 296e377..b3553c0 100644 (file)
@@ -437,7 +437,7 @@ static DerivedMesh *doOcean(ModifierData *md, Object *ob,
        if (omd->geometry_mode == MOD_OCEAN_GEOM_GENERATE)
                dm = generate_ocean_geometry(omd);
        else if (omd->geometry_mode == MOD_OCEAN_GEOM_DISPLACE) {
-               dm = CDDM_copy(derivedData, 0);
+               dm = CDDM_copy(derivedData);
        }
 
        cfra = md->scene->r.cfra;
index 4021a8a..98a1921 100644 (file)
@@ -164,7 +164,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        }
 
        /* make new dm */
-       psmd->dm=CDDM_copy(dm, 0);
+       psmd->dm=CDDM_copy(dm);
        CDDM_apply_vert_coords(psmd->dm, vertexCos);
        CDDM_calc_normals(psmd->dm);
 
index c37a8bc..ea50824 100644 (file)
@@ -197,7 +197,7 @@ static DerivedMesh *applyModifier(ModifierData *md,
 
 #else /* BMESH ONLY */
 
-       dm = CDDM_copy(result, 1); /*builds ngon faces from tess (mface) faces*/
+       dm = CDDM_copy_from_tessface(result); /*builds ngon faces from tess (mface) faces*/
        CDDM_calc_normals(dm);
        result->needsFree = 1;
        result->release(result);
index 7fd2d4c..5d6d6c2 100644 (file)
@@ -101,7 +101,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob,
                        useRenderParams, NULL, isFinalCalc, 0, (ob->flag & OB_MODE_EDIT));
        
        if(useRenderParams || !isFinalCalc) {
-               DerivedMesh *cddm= CDDM_copy(result, 0);
+               DerivedMesh *cddm= CDDM_copy(result);
                result->release(result);
                result= cddm;
        }
index 161bdca..7e85acd 100644 (file)
@@ -99,7 +99,7 @@ static void deformVerts(ModifierData *md, Object *ob,
                surmd->dm->release(surmd->dm);
 
        /* if possible use/create DerivedMesh */
-       if(derivedData) surmd->dm = CDDM_copy(derivedData, 0);
+       if(derivedData) surmd->dm = CDDM_copy(derivedData);
        else surmd->dm = get_dm(ob, NULL, NULL, NULL, 0);
        
        if(!ob->pd)
index 9c6d87d..6a84346 100644 (file)
@@ -168,7 +168,7 @@ DerivedMesh *get_cddm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm, float
                dm= get_dm(ob, em, dm, vertexCos, 0);
        }
        else {
-               dm= CDDM_copy(dm, 0);
+               dm= CDDM_copy(dm);
                CDDM_apply_vert_coords(dm, vertexCos);
        }