diff options
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_cdderivedmesh.h | 3 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/cdderivedmesh.c | 12 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/displist.c | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/dynamicpaint.c | 10 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/multires.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/particle_system.c | 2 |
8 files changed, 32 insertions, 21 deletions
diff --git a/source/blender/blenkernel/BKE_cdderivedmesh.h b/source/blender/blenkernel/BKE_cdderivedmesh.h index db9f8e0527f..3f421331f0a 100644 --- a/source/blender/blenkernel/BKE_cdderivedmesh.h +++ b/source/blender/blenkernel/BKE_cdderivedmesh.h @@ -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. diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 686d6a4018c..9766d4461c2 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -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); diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c index 5133bb0a22b..fac88956375 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.c +++ b/source/blender/blenkernel/intern/cdderivedmesh.c @@ -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, diff --git a/source/blender/blenkernel/intern/displist.c b/source/blender/blenkernel/intern/displist.c index d944d12b0c0..c2c6f8d5b92 100644 --- a/source/blender/blenkernel/intern/displist.c +++ b/source/blender/blenkernel/intern/displist.c @@ -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; diff --git a/source/blender/blenkernel/intern/dynamicpaint.c b/source/blender/blenkernel/intern/dynamicpaint.c index f4e69624839..9a8946ae61e 100644 --- a/source/blender/blenkernel/intern/dynamicpaint.c +++ b/source/blender/blenkernel/intern/dynamicpaint.c @@ -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); diff --git a/source/blender/blenkernel/intern/multires.c b/source/blender/blenkernel/intern/multires.c index cba4780e282..1f154e17492 100644 --- a/source/blender/blenkernel/intern/multires.c +++ b/source/blender/blenkernel/intern/multires.c @@ -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); diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 132b721006e..ef71e1947e9 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -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; diff --git a/source/blender/blenkernel/intern/particle_system.c b/source/blender/blenkernel/intern/particle_system.c index f259ddbf577..5356615b122 100644 --- a/source/blender/blenkernel/intern/particle_system.c +++ b/source/blender/blenkernel/intern/particle_system.c @@ -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); |