diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-03-30 11:28:37 +0400 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-03-30 11:28:37 +0400 |
commit | 89b906db9f758fb9642e01d9b4433b97557369fb (patch) | |
tree | 89f0e670a581728e7102a9ca00c5261befb18a57 /source/blender/editors/object/object_edit.c | |
parent | 22fec544c8d07e6099580b0e799e309dcfeeed6b (diff) |
editmesh accessor functions. most editmesh access now goes through:
EditMesh *EM_GetEditMesh(Mesh *me);
void EM_EndEditMesh(Mesh *me, EditMesh *em);
as discussed on the mailling list, this is to facilitate migration to bmesh.
next step is to merge this this to the bmesh branch. this was done in the 2.5
branch to prevent too great a divergance.
also, made makesdna/makesrna work on cygwin/msvc2008/scons.
Diffstat (limited to 'source/blender/editors/object/object_edit.c')
-rw-r--r-- | source/blender/editors/object/object_edit.c | 32 |
1 files changed, 23 insertions, 9 deletions
diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index 29e3d880c16..59d7ad7ad26 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -920,7 +920,7 @@ static int return_editmesh_vgroup(Object *obedit, EditMesh *em, char *name, floa static void select_editmesh_hook(Object *ob, HookModifierData *hmd) { Mesh *me= ob->data; - EditMesh *em= me->edit_mesh; + EditMesh *em= EM_GetEditMesh(me); EditVert *eve; int index=0, nr=0; @@ -931,6 +931,8 @@ static void select_editmesh_hook(Object *ob, HookModifierData *hmd) } } EM_select_flush(em); + + EM_EndEditMesh(me, em); } static int return_editlattice_indexar(Lattice *editlatt, int *tot, int **indexar, float *cent) @@ -1103,9 +1105,16 @@ int hook_getIndexArray(Object *obedit, int *tot, int **indexar, char *name, floa case OB_MESH: { Mesh *me= obedit->data; + EditMesh *em = EM_GetEditMesh(me); + /* check selected vertices first */ - if( return_editmesh_indexar(me->edit_mesh, tot, indexar, cent_r)) return 1; - else return return_editmesh_vgroup(obedit, me->edit_mesh, name, cent_r); + if( return_editmesh_indexar(em, tot, indexar, cent_r)) { + EM_EndEditMesh(me, em); + return 1; + } else { + int ret = return_editmesh_vgroup(obedit, em, name, cent_r); + EM_EndEditMesh(me, em); + } } case OB_CURVE: case OB_SURF: @@ -2202,8 +2211,9 @@ void make_vertex_parent(Scene *scene, Object *obedit, View3D *v3d) if(obedit->type==OB_MESH) { Mesh *me= obedit->data; - - eve= me->edit_mesh->verts.first; + EditMesh *em = EM_GetEditMesh(me); + + eve= em->verts.first; while(eve) { if(eve->f & 1) { if(v1==0) v1= nr; @@ -2215,6 +2225,8 @@ void make_vertex_parent(Scene *scene, Object *obedit, View3D *v3d) nr++; eve= eve->next; } + + EM_EndEditMesh(me, em); } else if(ELEM(obedit->type, OB_SURF, OB_CURVE)) { ListBase *editnurb= curve_get_editcurve(obedit); @@ -2834,8 +2846,9 @@ static int object_center_set_exec(bContext *C, wmOperator *op) if(obedit->type==OB_MESH) { Mesh *me= obedit->data; - - for(eve= me->edit_mesh->verts.first; eve; eve= eve->next) { + EditMesh *em = EM_GetEditMesh(me); + + for(eve= em->verts.first; eve; eve= eve->next) { if(v3d->around==V3D_CENTROID) { total++; VECADD(cent, cent, eve->co); @@ -2854,13 +2867,14 @@ static int object_center_set_exec(bContext *C, wmOperator *op) cent[2]= (min[2]+max[2])/2.0f; } - for(eve= me->edit_mesh->verts.first; eve; eve= eve->next) { + for(eve= em->verts.first; eve; eve= eve->next) { VecSubf(eve->co, eve->co, cent); } - recalc_editnormals(me->edit_mesh); + recalc_editnormals(em); tot_change++; DAG_object_flush_update(scene, obedit, OB_RECALC_DATA); + EM_EndEditMesh(me, em); } } |