diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-02-11 18:15:35 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2011-02-11 18:15:35 +0300 |
commit | f9fb95b9c1f58b95c861b0bc9bc6bf8218ec839c (patch) | |
tree | f022226729cfabb08d490b3b0e4d73f251eb4b4a | |
parent | dcf7642f76bc4f1d2899249f7ce9b5c24c4fafad (diff) |
Made some function from DerivedMesh.c be avaliable from other modules.
Some naming changes to make naming more uniform. No functional changes.
It's necessery for further crazyspace changes and improvenments.
-rw-r--r-- | source/blender/blenkernel/BKE_DerivedMesh.h | 4 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 28 |
2 files changed, 18 insertions, 14 deletions
diff --git a/source/blender/blenkernel/BKE_DerivedMesh.h b/source/blender/blenkernel/BKE_DerivedMesh.h index 48127d3cf4c..e7ce3f27431 100644 --- a/source/blender/blenkernel/BKE_DerivedMesh.h +++ b/source/blender/blenkernel/BKE_DerivedMesh.h @@ -481,6 +481,7 @@ DerivedMesh *mesh_create_derived_render(struct Scene *scene, 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_view(struct Scene *scene, struct Object *ob, CustomDataMask dataMask); DerivedMesh *mesh_create_derived_no_deform(struct Scene *scene, struct Object *ob, @@ -495,12 +496,15 @@ DerivedMesh *mesh_create_derived_no_virtual(struct Scene *scene, struct Object * DerivedMesh *mesh_create_derived_physics(struct Scene *scene, struct Object *ob, float (*vertCos)[3], CustomDataMask dataMask); +DerivedMesh *editmesh_get_derived(struct EditMesh *em, float (*vertexCos)[3]); DerivedMesh *editmesh_get_derived_base(struct Object *, struct EditMesh *em); DerivedMesh *editmesh_get_derived_cage(struct Scene *scene, struct Object *, struct EditMesh *em, CustomDataMask dataMask); DerivedMesh *editmesh_get_derived_cage_and_final(struct Scene *scene, struct Object *, struct EditMesh *em, DerivedMesh **final_r, CustomDataMask dataMask); +float (*editmesh_get_vertex_cos(struct EditMesh *em, int *numVerts_r))[3]; +int editmesh_modifier_is_enabled(struct Scene *scene, struct ModifierData *md, DerivedMesh *dm); void makeDerivedMesh(struct Scene *scene, struct Object *ob, struct EditMesh *em, CustomDataMask dataMask); /* returns an array of deform matrices for crazyspace correction, and the diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index a58aff6d4dc..be9cda6c58f 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -432,7 +432,7 @@ void DM_swap_face_data(DerivedMesh *dm, int index, const int *corner_indices) /// -static DerivedMesh *getMeshDerivedMesh(Mesh *me, Object *ob, float (*vertCos)[3]) +DerivedMesh *mesh_create_derived(Mesh *me, Object *ob, float (*vertCos)[3]) { DerivedMesh *dm = CDDM_from_mesh(me, ob); @@ -1330,7 +1330,7 @@ static void emDM_release(DerivedMesh *dm) } } -static DerivedMesh *getEditMeshDerivedMesh(EditMesh *em, float (*vertexCos)[3]) +DerivedMesh *editmesh_get_derived(EditMesh *em, float (*vertexCos)[3]) { EditMeshDerivedMesh *emdm = MEM_callocN(sizeof(*emdm), "emdm"); @@ -1447,11 +1447,11 @@ DerivedMesh *mesh_create_derived_for_modifier(Scene *scene, Object *ob, Modifier float (*deformedVerts)[3] = mesh_getVertexCos(me, &numVerts); mti->deformVerts(md, ob, NULL, deformedVerts, numVerts, 0, 0); - dm = getMeshDerivedMesh(me, ob, deformedVerts); + dm = mesh_create_derived(me, ob, deformedVerts); MEM_freeN(deformedVerts); } else { - DerivedMesh *tdm = getMeshDerivedMesh(me, ob, NULL); + DerivedMesh *tdm = mesh_create_derived(me, ob, NULL); dm = mti->applyModifier(md, ob, tdm, 0, 0); if(tdm != dm) tdm->release(tdm); @@ -2003,7 +2003,7 @@ static void mesh_calc_modifiers(Scene *scene, Object *ob, float (*inputVertexCos BLI_linklist_free(datamasks, NULL); } -static float (*editmesh_getVertexCos(EditMesh *em, int *numVerts_r))[3] +float (*editmesh_get_vertex_cos(EditMesh *em, int *numVerts_r))[3] { int i, numVerts = *numVerts_r = BLI_countlist(&em->verts); float (*cos)[3]; @@ -2017,7 +2017,7 @@ static float (*editmesh_getVertexCos(EditMesh *em, int *numVerts_r))[3] return cos; } -static int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) +int editmesh_modifier_is_enabled(Scene *scene, ModifierData *md, DerivedMesh *dm) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); int required_mode = eModifierMode_Realtime | eModifierMode_Editmode; @@ -2046,7 +2046,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri modifiers_clearErrors(ob); if(cage_r && cageIndex == -1) { - *cage_r = getEditMeshDerivedMesh(em, NULL); + *cage_r = editmesh_get_derived(em, NULL); } dm = NULL; @@ -2088,7 +2088,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri MEM_mallocN(sizeof(*deformedVerts) * numVerts, "dfmv"); dm->getVertCos(dm, deformedVerts); } else { - deformedVerts = editmesh_getVertexCos(em, &numVerts); + deformedVerts = editmesh_get_vertex_cos(em, &numVerts); } } @@ -2178,7 +2178,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri *cage_r = dm; } else { *cage_r = - getEditMeshDerivedMesh(em, + editmesh_get_derived(em, deformedVerts ? MEM_dupallocN(deformedVerts) : NULL); } } @@ -2202,7 +2202,7 @@ static void editmesh_calc_modifiers(Scene *scene, Object *ob, EditMesh *em, Deri } else if (!deformedVerts && cage_r && *cage_r) { *final_r = *cage_r; } else { - *final_r = getEditMeshDerivedMesh(em, deformedVerts); + *final_r = editmesh_get_derived(em, deformedVerts); deformedVerts = NULL; } @@ -2425,7 +2425,7 @@ DerivedMesh *editmesh_get_derived_cage(Scene *scene, Object *obedit, EditMesh *e DerivedMesh *editmesh_get_derived_base(Object *UNUSED(obedit), EditMesh *em) { - return getEditMeshDerivedMesh(em, NULL); + return editmesh_get_derived(em, NULL); } @@ -2511,8 +2511,8 @@ int editmesh_get_first_deform_matrices(Scene *scene, Object *ob, EditMesh *em, f if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatricesEM) { if(!defmats) { - dm= getEditMeshDerivedMesh(em, NULL); - deformedVerts= editmesh_getVertexCos(em, &numVerts); + dm= editmesh_get_derived(em, NULL); + deformedVerts= editmesh_get_vertex_cos(em, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); for(a=0; a<numVerts; a++) @@ -2565,7 +2565,7 @@ void sculpt_get_deform_matrices(Scene *scene, Object *ob, float (**deformmats)[3 if(mti->type==eModifierTypeType_OnlyDeform && mti->deformMatrices) { if(!defmats) { Mesh *me= (Mesh*)ob->data; - dm= getMeshDerivedMesh(me, ob, NULL); + dm= mesh_create_derived(me, ob, NULL); deformedVerts= mesh_getVertexCos(me, &numVerts); defmats= MEM_callocN(sizeof(*defmats)*numVerts, "defmats"); |