Code Cleanup: remove object arg to CDDM_from_mesh mesh_create_derived
authorCampbell Barton <ideasman42@gmail.com>
Wed, 25 Dec 2013 21:26:41 +0000 (08:26 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 25 Dec 2013 21:27:08 +0000 (08:27 +1100)
18 files changed:
source/blender/blenkernel/BKE_DerivedMesh.h
source/blender/blenkernel/BKE_cdderivedmesh.h
source/blender/blenkernel/intern/DerivedMesh.c
source/blender/blenkernel/intern/cdderivedmesh.c
source/blender/blenkernel/intern/multires.c
source/blender/blenkernel/intern/particle_system.c
source/blender/blenkernel/intern/rigidbody.c
source/blender/blenkernel/intern/subsurf_ccg.c
source/blender/collada/collada_utils.cpp
source/blender/editors/object/object_bake.c
source/blender/editors/util/crazyspace.c
source/blender/makesrna/intern/rna_object_api.c
source/blender/modifiers/intern/MOD_armature.c
source/blender/modifiers/intern/MOD_collision.c
source/blender/modifiers/intern/MOD_util.c
source/blender/modifiers/intern/MOD_weightvgproximity.c
source/gameengine/Converter/BL_BlenderDataConversion.cpp
source/gameengine/Physics/Bullet/CcdPhysicsController.cpp

index 2bba968e03b3809e33e132813c90cc08211370ae..6ffa126713d2f26bd81d52e540c9c2410c4fe5a6 100644 (file)
@@ -651,7 +651,7 @@ DerivedMesh *getEditDerivedBMesh(struct BMEditMesh *em, struct Object *ob,
 DerivedMesh *mesh_create_derived_index_render(struct Scene *scene, struct Object *ob, CustomDataMask dataMask, int index);
 
 /* same as above but wont use render settings */
-DerivedMesh *mesh_create_derived(struct Mesh *me, struct Object *ob, float (*vertCos)[3]);
+DerivedMesh *mesh_create_derived(struct Mesh *me, float (*vertCos)[3]);
 DerivedMesh *mesh_create_derived_view(struct Scene *scene, struct Object *ob,
                                       CustomDataMask dataMask);
 DerivedMesh *mesh_create_derived_no_deform(struct Scene *scene, struct Object *ob,
index 560617db47433d25cfe2d650a3fb94ba14618d7e..7006b2904ac963b4f4ba5de8fc9ef8f4ce7e9a64 100644 (file)
@@ -53,7 +53,7 @@ int CDDM_Check(struct DerivedMesh *dm);
  * original data in Mesh, but it is safe to apply vertex coordinates or
  * calculate normals as those functions will automatically create new
  * data to not overwrite the original */
-struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh, struct Object *ob);
+struct DerivedMesh *CDDM_from_mesh(struct Mesh *mesh);
 
 struct DerivedMesh *CDDM_from_bmesh(struct BMesh *bm, int use_mdisps);
 
index 5c98fe48ea6948d039a82f08f7af7d1341e50c3a..341e8e671c7b1b66c73388182cad2d66251b0bb1 100644 (file)
@@ -838,9 +838,9 @@ void DM_interp_poly_data(DerivedMesh *source, DerivedMesh *dest,
 }
 
 ///
-DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3])
+DerivedMesh *mesh_create_derived(Mesh *me, float (*vertCos)[3])
 {
-       DerivedMesh *dm = CDDM_from_mesh(me, ob);
+       DerivedMesh *dm = CDDM_from_mesh(me);
        
        if (!dm)
                return NULL;
@@ -874,7 +874,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
                float (*deformedVerts)[3] = BKE_mesh_vertexCos_get(me, &numVerts);
 
                modwrap_deformVerts(md, ob, NULL, deformedVerts, numVerts, 0);
-               dm = mesh_create_derived(me, ob, deformedVerts);
+               dm = mesh_create_derived(me, deformedVerts);
 
                if (build_shapekey_layers)
                        add_shapekey_layers(dm, me, ob);
@@ -882,7 +882,7 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob,
                MEM_freeN(deformedVerts);
        }
        else {
-               DerivedMesh *tdm = mesh_create_derived(me, ob, NULL);
+               DerivedMesh *tdm = mesh_create_derived(me, NULL);
 
                if (build_shapekey_layers)
                        add_shapekey_layers(tdm, me, ob);
@@ -953,7 +953,7 @@ static DerivedMesh *create_orco_dm(Object *ob, Mesh *me, BMEditMesh *em, int lay
        int free;
 
        if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
-       else dm = CDDM_from_mesh(me, ob);
+       else dm = CDDM_from_mesh(me);
 
        orco = get_orco_coords_dm(ob, em, layer, &free);
 
@@ -1533,7 +1533,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                 * coordinates (vpaint, etc.)
                 */
                if (deform_r) {
-                       *deform_r = CDDM_from_mesh(me, ob);
+                       *deform_r = CDDM_from_mesh(me);
                         
                        if (build_shapekey_layers)
                                add_shapekey_layers(dm, me, ob);
@@ -1659,7 +1659,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
                                }
                        }
                        else {
-                               dm = CDDM_from_mesh(me, ob);
+                               dm = CDDM_from_mesh(me);
                                ASSERT_IS_VALID_DM(dm);
 
                                if (build_shapekey_layers)
@@ -1823,7 +1823,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos
 #endif
        }
        else {
-               finaldm = CDDM_from_mesh(me, ob);
+               finaldm = CDDM_from_mesh(me);
                
                if (build_shapekey_layers) {
                        add_shapekey_layers(finaldm, me, ob);
index d9447e51aa3fddc407a6ebfefbcceec4c6580be1..32914dedde19ee63cbd962924e59d1ed2755d12c 100644 (file)
@@ -1802,9 +1802,9 @@ DerivedMesh *CDDM_new(int numVerts, int numEdges, int numTessFaces, int numLoops
        return dm;
 }
 
-DerivedMesh *CDDM_from_mesh(Mesh *mesh, Object *UNUSED(ob))
+DerivedMesh *CDDM_from_mesh(Mesh *mesh)
 {
-       CDDerivedMesh *cddm = cdDM_create("CDDM_from_mesh dm");
+       CDDerivedMesh *cddm = cdDM_create(__func__);
        DerivedMesh *dm = &cddm->dm;
        CustomDataMask mask = CD_MASK_MESH & (~CD_MASK_MDISPS);
        int alloctype;
index 722ea536ed22e416eab3c7a2b049b110f305c952..2189fbd2f55bcaef3697f9726884037634fc23b2 100644 (file)
@@ -769,7 +769,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
        /* XXX - probably not necessary to regenerate the cddm so much? */
 
        /* generate highest level with displacements */
-       cddm = CDDM_from_mesh(me, NULL);
+       cddm = CDDM_from_mesh(me);
        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
        dispdm = multires_dm_create_local(ob, cddm, totlvl, totlvl, 0, 0);
        cddm->release(cddm);
@@ -782,7 +782,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
 
        /* heuristic to produce a better-fitting base mesh */
 
-       cddm = CDDM_from_mesh(me, NULL);
+       cddm = CDDM_from_mesh(me);
        pmap = cddm->getPolyMap(ob, cddm);
        origco = MEM_callocN(sizeof(float) * 3 * me->totvert, "multires apply base origco");
        for (i = 0; i < me->totvert; ++i)
@@ -865,7 +865,7 @@ void multiresModifier_base_apply(MultiresModifierData *mmd, Object *ob)
        BKE_mesh_calc_normals(me);
 
        /* subdivide the mesh to highest level without displacements */
-       cddm = CDDM_from_mesh(me, NULL);
+       cddm = CDDM_from_mesh(me);
        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
        origdm = subsurf_dm_create_local(ob, cddm, totlvl, 0, 0, mmd->flags & eMultiresModifierFlag_PlainUv, 0);
        cddm->release(cddm);
@@ -902,7 +902,7 @@ static void multires_subdivide(MultiresModifierData *mmd, Object *ob, int totlvl
                int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
 
                /* create subsurf DM from original mesh at high level */
-               cddm = CDDM_from_mesh(me, NULL);
+               cddm = CDDM_from_mesh(me);
                DM_set_only_copy(cddm, CD_MASK_BAREMESH);
                highdm = subsurf_dm_create_local(ob, cddm, totlvl, simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
                ss = ((CCGDerivedMesh *)highdm)->ss;
@@ -1174,7 +1174,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
 
                        /* create subsurf DM from original mesh at high level */
                        if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
-                       else cddm = CDDM_from_mesh(me, NULL);
+                       else cddm = CDDM_from_mesh(me);
                        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
 
                        highdm = subsurf_dm_create_local(ob, cddm, totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
@@ -1236,7 +1236,7 @@ void multires_modifier_update_mdisps(struct DerivedMesh *dm)
                        int has_mask = CustomData_has_layer(&me->ldata, CD_GRID_PAINT_MASK);
 
                        if (ob->derivedDeform) cddm = CDDM_copy(ob->derivedDeform);
-                       else cddm = CDDM_from_mesh(me, NULL);
+                       else cddm = CDDM_from_mesh(me);
                        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
 
                        subdm = subsurf_dm_create_local(ob, cddm, mmd->totlvl, mmd->simple, 0, mmd->flags & eMultiresModifierFlag_PlainUv, has_mask);
@@ -2114,7 +2114,7 @@ void multires_load_old(Object *ob, Mesh *me)
                multiresModifier_subdivide(mmd, ob, 1, 0);
 
        mmd->lvl = mmd->totlvl;
-       orig = CDDM_from_mesh(me, NULL);
+       orig = CDDM_from_mesh(me);
        /* XXX We *must* alloc paint mask here, else we have some kind of mismatch in
         *     multires_modifier_update_mdisps() (called by dm->release(dm)), which always creates the
         *     reference subsurfed dm with this option, before calling multiresModifier_disp_run(),
index 0f5707f9a60c8bfd24cabf8dd00cf6d6fbdc8065..37ca502970dde654f1d1e5e2d6335c8d04a5e970 100644 (file)
@@ -1106,7 +1106,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
                /* Grid distribution */
                if (part->distr==PART_DISTR_GRID && from != PART_FROM_VERT) {
                        BLI_srandom(31415926 + psys->seed);
-                       dm= CDDM_from_mesh((Mesh*)ob->data, ob);
+                       dm= CDDM_from_mesh((Mesh*)ob->data);
                        DM_ensure_tessface(dm);
                        distribute_grid(dm,psys);
                        dm->release(dm);
@@ -1145,7 +1145,7 @@ static int distribute_threads_init_data(ParticleThread *threads, Scene *scene, D
                if (psys->part->use_modifier_stack)
                        dm = finaldm;
                else
-                       dm= CDDM_from_mesh((Mesh*)ob->data, ob);
+                       dm= CDDM_from_mesh((Mesh*)ob->data);
 
                /* BMESH ONLY, for verts we don't care about tessfaces */
                if (from != PART_FROM_VERT) {
index 600805e71cec49e0e5f8c1420da9c15a349f61d2..1a7782f4b899fc5ed51cf16f9d7573490addc90f 100644 (file)
@@ -256,7 +256,7 @@ static rbCollisionShape *rigidbody_get_shape_trimesh_from_mesh(Object *ob)
        rbCollisionShape *shape = NULL;
 
        if (ob->type == OB_MESH) {
-               DerivedMesh *dm = CDDM_from_mesh(ob->data, ob);
+               DerivedMesh *dm = CDDM_from_mesh(ob->data);
 
                MVert *mvert;
                MFace *mface;
index e94db6f637c657c6699ed5e77b384639aa69cb7a..188c80e7cc8ffc10f856594045c7d1d570c4f702 100644 (file)
@@ -3693,7 +3693,7 @@ void subsurf_calculate_limit_positions(Mesh *me, float (*positions_r)[3])
        CCGSubSurf *ss = _getSubSurf(NULL, 1, 3, CCG_USE_ARENA);
        float edge_sum[3], face_sum[3];
        CCGVertIterator *vi;
-       DerivedMesh *dm = CDDM_from_mesh(me, NULL);
+       DerivedMesh *dm = CDDM_from_mesh(me);
 
        ss_sync_from_derivedmesh(ss, dm, NULL, 0);
 
index 2e805ce18f1bbc87c87d62e1e8d3a2b6e179dade..f5b81c6f6b0202dac2ce7e4d085b3899ef9c5994 100644 (file)
@@ -160,7 +160,7 @@ Mesh *bc_get_mesh_copy(Scene *scene, Object *ob, BC_export_mesh_type export_mesh
                }
        }
        else {
-               dm = mesh_create_derived((Mesh *)ob->data, ob, NULL);
+               dm = mesh_create_derived((Mesh *)ob->data, NULL);
        }
 
        tmpmesh = BKE_mesh_add(G.main, "ColladaMesh"); // name is not important here
index 55564703a87e2b4165dc56e84163dd1eba63fdec..b8a96bba87473d0c0699d677f08443c528d92f90 100644 (file)
@@ -209,7 +209,7 @@ static DerivedMesh *multiresbake_create_loresdm(Scene *scene, Object *ob, int *l
        MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
        Mesh *me = (Mesh *)ob->data;
        MultiresModifierData tmp_mmd = *mmd;
-       DerivedMesh *cddm = CDDM_from_mesh(me, ob);
+       DerivedMesh *cddm = CDDM_from_mesh(me);
 
        if (mmd->lvl > 0) {
                *lvl = mmd->lvl;
@@ -234,7 +234,7 @@ static DerivedMesh *multiresbake_create_hiresdm(Scene *scene, Object *ob, int *l
        Mesh *me = (Mesh *)ob->data;
        MultiresModifierData *mmd = get_multires_modifier(scene, ob, 0);
        MultiresModifierData tmp_mmd = *mmd;
-       DerivedMesh *cddm = CDDM_from_mesh(me, ob);
+       DerivedMesh *cddm = CDDM_from_mesh(me);
        DerivedMesh *dm;
 
        DM_set_only_copy(cddm, CD_MASK_BAREMESH);
index ff65e11f53ea92161f9aeab2e5753cd2c9b7a2c0..e8146c34f5eed2714cd7fd3098e4a1d62c52220c 100644 (file)
@@ -344,7 +344,7 @@ int sculpt_get_first_deform_matrices(Scene *scene, Object *ob, float (**deformma
                if (mti->type == eModifierTypeType_OnlyDeform) {
                        if (!defmats) {
                                Mesh *me = (Mesh *)ob->data;
-                               dm = mesh_create_derived(me, ob, NULL);
+                               dm = mesh_create_derived(me, NULL);
                                deformedVerts = BKE_mesh_vertexCos_get(me, &numVerts);
                                defmats = MEM_callocN(sizeof(*defmats) * numVerts, "defmats");
 
index 0f71e26b6872b03077512ce70947ad7b35235f42..f29eb7800b566b54e6c27d178b487df739597e66 100644 (file)
@@ -384,7 +384,7 @@ void rna_Object_dm_info(struct Object *ob, int type, char *result)
        switch (type) {
                case 0:
                        if (ob->type == OB_MESH) {
-                               dm = CDDM_from_mesh(ob->data, ob);
+                               dm = CDDM_from_mesh(ob->data);
                                ret = DM_debug_info(dm);
                                dm_release = TRUE;
                        }
index 3ab7bff0e63d2e3dcc0a21e0c12c1e9115d66940..e81fc44f2383fb00992ca205a13d4810edd256d5 100644 (file)
@@ -179,7 +179,7 @@ static void deformMatrices(ModifierData *md, Object *ob, DerivedMesh *derivedDat
        ArmatureModifierData *amd = (ArmatureModifierData *) md;
        DerivedMesh *dm = derivedData;
 
-       if (!derivedData) dm = CDDM_from_mesh((Mesh *)ob->data, ob);
+       if (!derivedData) dm = CDDM_from_mesh((Mesh *)ob->data);
 
        armature_deform_verts(amd->object, ob, dm, vertexCos, defMats, numVerts,
                              amd->deformflag, NULL, amd->defgrp_name);
index 9335d7577c7d349f4dc96353248d963e1c406650..1f24662960a93d9489991dfbb03eba803bf36c30 100644 (file)
@@ -116,7 +116,7 @@ static void deformVerts(ModifierData *md, Object *ob,
        
        /* if possible use/create DerivedMesh */
        if (derivedData) dm = CDDM_copy(derivedData);
-       else if (ob->type == OB_MESH) dm = CDDM_from_mesh(ob->data, ob);
+       else if (ob->type == OB_MESH) dm = CDDM_from_mesh(ob->data);
        
        if (!ob->pd) {
                printf("CollisionModifier deformVerts: Should not happen!\n");
index a46314cd749e97b79fd716175bcef558cd0a3af9..62a02928920b4713676f60cfa51a950db2baeb5f 100644 (file)
@@ -183,7 +183,7 @@ DerivedMesh *get_dm(Object *ob, struct BMEditMesh *em, DerivedMesh *dm,
        }
        else if (ob->type == OB_MESH) {
                if (em) dm = CDDM_from_editbmesh(em, FALSE, FALSE);
-               else dm = CDDM_from_mesh((struct Mesh *)(ob->data), ob);
+               else dm = CDDM_from_mesh((struct Mesh *)(ob->data));
 
                if (vertexCos) {
                        CDDM_apply_vert_coords(dm, vertexCos);
index 06f4664c11b50c9490eb3f2485dde6713084ef6d..ecb99974472fb46cbb339dac2b1ae9c6dba81a55 100644 (file)
@@ -473,7 +473,7 @@ static DerivedMesh *applyModifier(ModifierData *md, Object *ob, DerivedMesh *der
                                        if (me->edit_btmesh)
                                                target_dm = CDDM_from_editbmesh(me->edit_btmesh, FALSE, FALSE);
                                        else
-                                               target_dm = CDDM_from_mesh(me, obr);
+                                               target_dm = CDDM_from_mesh(me);
                                }
                                free_target_dm = TRUE;
                        }
index 9998f10e41718d91aa0857364ba95ba4b0f4b7b6..a1e4f9f22aee0211acba15eebc38287f5ba6ea1e 100644 (file)
@@ -949,7 +949,7 @@ RAS_MeshObject* BL_ConvertMesh(Mesh* mesh, Object* blenderobj, KX_Scene* scene,
        }
 
        // Get DerivedMesh data
-       DerivedMesh *dm = CDDM_from_mesh(mesh, blenderobj);
+       DerivedMesh *dm = CDDM_from_mesh(mesh);
        DM_ensure_tessface(dm);
 
        MVert *mvert = dm->getVertArray(dm);
index 6be6400e011036349f71dd1169f59ee6a4ce3e09..33726018268baf7bb11af2e2d07a72091414134b 100644 (file)
@@ -1728,7 +1728,7 @@ bool CcdShapeConstructionInfo::SetMesh(RAS_MeshObject* meshobj, DerivedMesh* dm,
 
        if (!dm) {
                free_dm = true;
-               dm = CDDM_from_mesh(meshobj->GetMesh(), NULL);
+               dm = CDDM_from_mesh(meshobj->GetMesh());
                DM_ensure_tessface(dm);
        }