diff options
author | Joseph Eagar <joeedh@gmail.com> | 2009-11-01 03:06:53 +0300 |
---|---|---|
committer | Joseph Eagar <joeedh@gmail.com> | 2009-11-01 03:06:53 +0300 |
commit | 2d0d4e7de4d31bd2f8485a9b7b4311bf8e254c3d (patch) | |
tree | a6f262fc2e8e7762599e12a0c9984fab02ce2bff /source/blender/editors/mesh | |
parent | 672c8926d7801fcc4b45e9dff75022e1ff9d240b (diff) |
commit before doing some hefty shapekey change, will break compilation
Diffstat (limited to 'source/blender/editors/mesh')
-rw-r--r-- | source/blender/editors/mesh/bmeshutils.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editface.c | 285 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh.c | 14 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_add.c | 39 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_loop.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_mods.c | 184 | ||||
-rw-r--r-- | source/blender/editors/mesh/editmesh_tools.c | 190 | ||||
-rw-r--r-- | source/blender/editors/mesh/loopcut.c | 4 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_intern.h | 5 | ||||
-rw-r--r-- | source/blender/editors/mesh/mesh_ops.c | 12 | ||||
-rw-r--r-- | source/blender/editors/mesh/meshtools.c | 59 |
11 files changed, 381 insertions, 419 deletions
diff --git a/source/blender/editors/mesh/bmeshutils.c b/source/blender/editors/mesh/bmeshutils.c index bf7889ef3c0..984c93a3a79 100644 --- a/source/blender/editors/mesh/bmeshutils.c +++ b/source/blender/editors/mesh/bmeshutils.c @@ -255,12 +255,14 @@ void EDBM_MakeEditBMesh(ToolSettings *ts, Scene *scene, Object *ob) BMesh *bm; if (!me->mpoly && me->totface) { + printf("yeek!! bmesh conversion issue! may lose shapekeys!\n"); + em = make_editMesh(scene, ob); bm = editmesh_to_bmesh(em); free_editMesh(em); } else { - bm = BKE_mesh_to_bmesh(me); + bm = BKE_mesh_to_bmesh(me, ob); } me->edit_btmesh = BMEdit_Create(bm); diff --git a/source/blender/editors/mesh/editface.c b/source/blender/editors/mesh/editface.c index bb69ab16a45..edc31bfa60b 100644 --- a/source/blender/editors/mesh/editface.c +++ b/source/blender/editors/mesh/editface.c @@ -60,6 +60,7 @@ #include "BKE_texture.h" #include "BKE_utildefines.h" #include "BKE_customdata.h" +#include "BKE_context.h" #include "BIF_gl.h" #include "BIF_glutil.h" @@ -72,6 +73,7 @@ #endif #include "ED_mesh.h" +#include "ED_screen.h" #include "ED_object.h" #include "ED_view3d.h" @@ -82,9 +84,6 @@ #include "mesh_intern.h" /* ***************** XXX **************** */ -static int sample_backbuf_rect() {return 0;} -static int sample_backbuf() {return 0;} -static void error() {} static int pupmenu() {return 0;} /* ***************** XXX **************** */ @@ -118,25 +117,30 @@ void object_facesel_flush_dm(Object *ob) } /* returns 0 if not found, otherwise 1 */ -int facesel_face_pick(View3D *v3d, Mesh *me, short *mval, unsigned int *index, short rect) +int facesel_face_pick(struct bContext *C, Mesh *me, short *mval, unsigned int *index, short rect) { + ViewContext vc; + view3d_set_viewcontext(C, &vc); + if (!me || me->totface==0) return 0; - if (v3d->flag & V3D_NEEDBACKBUFDRAW) { +// XXX if (v3d->flag & V3D_NEEDBACKBUFDRAW) { // XXX drawview.c! check_backbuf(); // XXX persp(PERSP_VIEW); - } +// XXX } if (rect) { /* sample rect to increase changes of selecting, so that when clicking on an edge in the backbuf, we can still select a face */ + int dist; - *index = sample_backbuf_rect(mval, 3, 1, me->totface+1, &dist,0,NULL); + *index = view3d_sample_backbuf_rect(&vc, mval, 3, 1, me->totface+1, &dist,0,NULL, NULL); } - else + else { /* sample only on the exact position */ - *index = sample_backbuf(mval[0], mval[1]); + *index = view3d_sample_backbuf(&vc, mval[0], mval[1]); + } if ((*index)<=0 || (*index)>(unsigned int)me->totface) return 0; @@ -231,35 +235,156 @@ void hide_tface(Scene *scene) // XXX notifier! object_tface_flags_changed(OBACT, 0); } -void select_linked_tfaces(Scene *scene, View3D *v3d, int mode) +/* Set tface seams based on edge data, uses hash table to find seam edges. */ + +static void hash_add_face(EdgeHash *ehash, MFace *mf) +{ + BLI_edgehash_insert(ehash, mf->v1, mf->v2, NULL); + BLI_edgehash_insert(ehash, mf->v2, mf->v3, NULL); + if(mf->v4) { + BLI_edgehash_insert(ehash, mf->v3, mf->v4, NULL); + BLI_edgehash_insert(ehash, mf->v4, mf->v1, NULL); + } + else + BLI_edgehash_insert(ehash, mf->v3, mf->v1, NULL); +} + + +void select_linked_tfaces_with_seams(int mode, Mesh *me, unsigned int index) +{ + MFace *mf; + int a, doit=1, mark=0; + char *linkflag; + EdgeHash *ehash, *seamhash; + MEdge *med; + + ehash= BLI_edgehash_new(); + seamhash = BLI_edgehash_new(); + linkflag= MEM_callocN(sizeof(char)*me->totface, "linkflaguv"); + + for(med=me->medge, a=0; a < me->totedge; a++, med++) + if(med->flag & ME_SEAM) + BLI_edgehash_insert(seamhash, med->v1, med->v2, NULL); + + if (mode==0 || mode==1) { + /* only put face under cursor in array */ + mf= ((MFace*)me->mface) + index; + hash_add_face(ehash, mf); + linkflag[index]= 1; + } + else { + /* fill array by selection */ + mf= me->mface; + for(a=0; a<me->totface; a++, mf++) { + if(mf->flag & ME_HIDE); + else if(mf->flag & ME_FACE_SEL) { + hash_add_face(ehash, mf); + linkflag[a]= 1; + } + } + } + + while(doit) { + doit= 0; + + /* expand selection */ + mf= me->mface; + for(a=0; a<me->totface; a++, mf++) { + if(mf->flag & ME_HIDE) + continue; + + if(!linkflag[a]) { + mark= 0; + + if(!BLI_edgehash_haskey(seamhash, mf->v1, mf->v2)) + if(BLI_edgehash_haskey(ehash, mf->v1, mf->v2)) + mark= 1; + if(!BLI_edgehash_haskey(seamhash, mf->v2, mf->v3)) + if(BLI_edgehash_haskey(ehash, mf->v2, mf->v3)) + mark= 1; + if(mf->v4) { + if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v4)) + if(BLI_edgehash_haskey(ehash, mf->v3, mf->v4)) + mark= 1; + if(!BLI_edgehash_haskey(seamhash, mf->v4, mf->v1)) + if(BLI_edgehash_haskey(ehash, mf->v4, mf->v1)) + mark= 1; + } + else if(!BLI_edgehash_haskey(seamhash, mf->v3, mf->v1)) + if(BLI_edgehash_haskey(ehash, mf->v3, mf->v1)) + mark = 1; + + if(mark) { + linkflag[a]= 1; + hash_add_face(ehash, mf); + doit= 1; + } + } + } + + } + + BLI_edgehash_free(ehash, NULL); + BLI_edgehash_free(seamhash, NULL); + + if(mode==0 || mode==2) { + for(a=0, mf=me->mface; a<me->totface; a++, mf++) + if(linkflag[a]) + mf->flag |= ME_FACE_SEL; + else + mf->flag &= ~ME_FACE_SEL; + } + else if(mode==1) { + for(a=0, mf=me->mface; a<me->totface; a++, mf++) + if(linkflag[a] && (mf->flag & ME_FACE_SEL)) + break; + + if (a<me->totface) { + for(a=0, mf=me->mface; a<me->totface; a++, mf++) + if(linkflag[a]) + mf->flag &= ~ME_FACE_SEL; + } + else { + for(a=0, mf=me->mface; a<me->totface; a++, mf++) + if(linkflag[a]) + mf->flag |= ME_FACE_SEL; + } + } + + MEM_freeN(linkflag); + + // BIF_undo_push("Select linked UV face"); + // object_tface_flags_changed(OBACT, 0); +} + +void select_linked_tfaces(bContext *C, Object *ob, short mval[2], int mode) { - Object *ob; Mesh *me; - short mval[2]; unsigned int index=0; - ob = OBACT; me = get_mesh(ob); if(me==0 || me->totface==0) return; if (mode==0 || mode==1) { - if (!(ob->lay & v3d->lay)) - error("The active object is not in this layer"); - -// XXX getmouseco_areawin(mval); - if (!facesel_face_pick(v3d, me, mval, &index, 1)) return; + // XXX - Causes glitches, not sure why + /* + if (!facesel_face_pick(C, me, mval, &index, 1)) + return; + */ } -// XXX unwrapper.c select_linked_tfaces_with_seams(mode, me, index); + select_linked_tfaces_with_seams(mode, me, index); + + object_facesel_flush_dm(ob); } -void deselectall_tface(Scene *scene) +void deselectall_tface(Object *ob) { Mesh *me; MFace *mface; int a, sel; - - me= get_mesh(OBACT); + + me= get_mesh(ob); if(me==0) return; mface= me->mface; @@ -285,7 +410,7 @@ void deselectall_tface(Scene *scene) mface++; } - object_facesel_flush_dm(OBACT); + object_facesel_flush_dm(ob); // XXX notifier! object_tface_flags_changed(OBACT, 0); } @@ -646,32 +771,25 @@ void seam_mark_clear_tface(Scene *scene, short mode) // XXX notifier! object_tface_flags_changed(OBACT, 1); } -void face_select(Scene *scene, View3D *v3d) +int face_select(struct bContext *C, Object *ob, short mval[2], int extend) { - Object *ob; Mesh *me; MFace *mface, *msel; - short mval[2]; unsigned int a, index; - int shift= 0; // XXX /* Get the face under the cursor */ - ob = OBACT; - if (!(ob->lay & v3d->lay)) { - error("The active object is not in this layer"); - } me = get_mesh(ob); -// XXX getmouseco_areawin(mval); - if (!facesel_face_pick(v3d, me, mval, &index, 1)) return; + if (!facesel_face_pick(C, me, mval, &index, 1)) + return 0; msel= (((MFace*)me->mface)+index); - if (msel->flag & ME_HIDE) return; + if (msel->flag & ME_HIDE) return 0; /* clear flags */ mface = me->mface; a = me->totface; - if ((shift)==0) { + if (!extend) { while (a--) { mface->flag &= ~ME_FACE_SEL; mface++; @@ -680,7 +798,7 @@ void face_select(Scene *scene, View3D *v3d) me->act_face = (int)index; - if (shift) { + if (extend) { if (msel->flag & ME_FACE_SEL) msel->flag &= ~ME_FACE_SEL; else @@ -690,77 +808,70 @@ void face_select(Scene *scene, View3D *v3d) /* image window redraw */ - object_facesel_flush_dm(OBACT); + object_facesel_flush_dm(ob); // XXX notifier! object_tface_flags_changed(OBACT, 1); + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, ob->data); + ED_region_tag_redraw(CTX_wm_region(C)); // XXX - should redraw all 3D views + return 1; } -void face_borderselect(Scene *scene, ScrArea *sa, ARegion *ar) +void face_borderselect(struct bContext *C, Object *ob, rcti *rect, int select) { Mesh *me; MFace *mface; - rcti rect; struct ImBuf *ibuf; unsigned int *rt; - int a, sx, sy, index, val= 0; + int a, sx, sy, index; char *selar; - me= get_mesh(OBACT); + ViewContext vc; + view3d_set_viewcontext(C, &vc); + + me= get_mesh(ob); if(me==0) return; if(me->totface==0) return; - -// XXX val= get_border(&rect, 3); - - if(val) { - /* without this border select often fails */ -#if 0 /* XXX untested in 2.5 */ - if (v3d->flag & V3D_NEEDBACKBUFDRAW) { - check_backbuf(); - persp(PERSP_VIEW); - } -#endif - - selar= MEM_callocN(me->totface+1, "selar"); - - sx= (rect.xmax-rect.xmin+1); - sy= (rect.ymax-rect.ymin+1); - if(sx*sy<=0) return; - - ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); - rt = ibuf->rect; - glReadPixels(rect.xmin+ar->winrct.xmin, rect.ymin+ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); - if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); - - a= sx*sy; - while(a--) { - if(*rt) { - index= WM_framebuffer_to_index(*rt); - if(index<=me->totface) selar[index]= 1; - } - rt++; + + selar= MEM_callocN(me->totface+1, "selar"); + + sx= (rect->xmax-rect->xmin+1); + sy= (rect->ymax-rect->ymin+1); + if(sx*sy<=0) return; + + view3d_validate_backbuf(&vc); + + ibuf = IMB_allocImBuf(sx,sy,32,IB_rect,0); + rt = ibuf->rect; + glReadPixels(rect->xmin+vc.ar->winrct.xmin, rect->ymin+vc.ar->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + if(ENDIAN_ORDER==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); + + a= sx*sy; + while(a--) { + if(*rt) { + index= WM_framebuffer_to_index(*rt); + if(index<=me->totface) selar[index]= 1; } - - mface= me->mface; - for(a=1; a<=me->totface; a++, mface++) { - if(selar[a]) { - if(mface->flag & ME_HIDE); - else { - if(val==LEFTMOUSE) mface->flag |= ME_FACE_SEL; - else mface->flag &= ~ME_FACE_SEL; - } + rt++; + } + + mface= me->mface; + for(a=1; a<=me->totface; a++, mface++) { + if(selar[a]) { + if(mface->flag & ME_HIDE); + else { + if(select) mface->flag |= ME_FACE_SEL; + else mface->flag &= ~ME_FACE_SEL; } } - - IMB_freeImBuf(ibuf); - MEM_freeN(selar); + } + + IMB_freeImBuf(ibuf); + MEM_freeN(selar); // XXX notifier! object_tface_flags_changed(OBACT, 0); - } #ifdef __APPLE__ glReadBuffer(GL_BACK); #endif - object_facesel_flush_dm(OBACT); + object_facesel_flush_dm(ob); } - - diff --git a/source/blender/editors/mesh/editmesh.c b/source/blender/editors/mesh/editmesh.c index e2bbb63f5c5..e43a9903586 100644 --- a/source/blender/editors/mesh/editmesh.c +++ b/source/blender/editors/mesh/editmesh.c @@ -719,7 +719,7 @@ EditMesh *make_editMesh(Scene *scene, Object *ob) EditFace *efa; EditEdge *eed; EditSelection *ese; - float *co; + float *co, (*keyco)[3]= NULL; int tot, a, eekadoodle= 0; em= MEM_callocN(sizeof(EditMesh), "editmesh"); @@ -732,7 +732,8 @@ EditMesh *make_editMesh(Scene *scene, Object *ob) actkey = ob_get_keyblock(ob); if(actkey) { - tot= actkey->totelem; + keyco= actkey->data; + em->shapenr= ob->shapenr; } /* make editverts */ @@ -745,8 +746,8 @@ EditMesh *make_editMesh(Scene *scene, Object *ob) co= mvert->co; /* edit the shape key coordinate if available */ - if(actkey && a < actkey->totelem) - co= (float*)actkey->data + 3*a; + if(keyco && a < actkey->totelem) + co= keyco[a]; eve= addvertlist(em, co, NULL); evlist[a]= eve; @@ -1129,7 +1130,8 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em) /* are there keys? */ if(me->key) { - KeyBlock *currkey, *actkey = ob_get_keyblock(ob); + KeyBlock *currkey; + KeyBlock *actkey= BLI_findlink(&me->key->block, em->shapenr-1); /* Lets reorder the key data so that things line up roughly * with the way things were before editmode */ @@ -1146,7 +1148,7 @@ void load_editMesh(Scene *scene, Object *ob, EditMesh *em) while(eve) { if (eve->keyindex >= 0 && eve->keyindex < currkey->totelem) { // valid old vertex if(currkey == actkey) { - if (actkey == me->key->refkey) { + if(actkey == me->key->refkey) { VECCOPY(fp, mvert->co); } else { diff --git a/source/blender/editors/mesh/editmesh_add.c b/source/blender/editors/mesh/editmesh_add.c index e6baa6d9db8..1be2cf85ef6 100644 --- a/source/blender/editors/mesh/editmesh_add.c +++ b/source/blender/editors/mesh/editmesh_add.c @@ -1208,7 +1208,7 @@ static void make_prim_ext(bContext *C, int type, int tot, int seg, int subdiv, float dia, float depth, int ext, int fill) { Object *obedit= CTX_data_edit_object(C); - int newob; + int newob = 0; float mat[4][4]; if(obedit==NULL || obedit->type!=OB_MESH) { @@ -1308,49 +1308,21 @@ void MESH_OT_primitive_circle_add(wmOperatorType *ot) RNA_def_boolean(ot->srna, "fill", 0, "Fill", ""); } -static int add_primitive_cylinder_exec(bContext *C, wmOperator *op) -{ - make_prim_ext(C, PRIM_CYLINDER, RNA_int_get(op->ptr, "vertices"), 0, 0, - RNA_float_get(op->ptr,"radius"), - RNA_float_get(op->ptr, "depth"), 1, 1); - - return OPERATOR_FINISHED; -} - -void MESH_OT_primitive_cylinder_add(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Add Cylinder"; - ot->description= "Construct a cylindrical mesh (ends filled)."; - ot->idname= "MESH_OT_primitive_cylinder_add"; - - /* api callbacks */ - ot->exec= add_primitive_cylinder_exec; - ot->poll= ED_operator_scene_editable; - - /* flags */ - ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; - - /* props */ - RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", 2, 500); - RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); - RNA_def_float(ot->srna, "depth", 1.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); -} - static int add_primitive_tube_exec(bContext *C, wmOperator *op) { make_prim_ext(C, PRIM_CYLINDER, RNA_int_get(op->ptr, "vertices"), 0, 0, RNA_float_get(op->ptr,"radius"), - RNA_float_get(op->ptr, "depth"), 1, 0); + RNA_float_get(op->ptr, "depth"), 1, + RNA_boolean_get(op->ptr, "cap_ends")); - return OPERATOR_FINISHED; + return OPERATOR_FINISHED; } void MESH_OT_primitive_tube_add(wmOperatorType *ot) { /* identifiers */ ot->name= "Add Tube"; - ot->description= "Construct a cylindrical mesh (ends not filled)."; + ot->description= "Construct a tube mesh."; ot->idname= "MESH_OT_primitive_tube_add"; /* api callbacks */ @@ -1364,6 +1336,7 @@ void MESH_OT_primitive_tube_add(wmOperatorType *ot) RNA_def_int(ot->srna, "vertices", 32, INT_MIN, INT_MAX, "Vertices", "", 2, 500); RNA_def_float(ot->srna, "radius", 1.0f, 0.0, FLT_MAX, "Radius", "", 0.001, 100.00); RNA_def_float(ot->srna, "depth", 1.0f, 0.0, FLT_MAX, "Depth", "", 0.001, 100.00); + RNA_def_boolean(ot->srna, "cap_ends", 1, "Cap Ends", ""); } static int add_primitive_cone_exec(bContext *C, wmOperator *op) diff --git a/source/blender/editors/mesh/editmesh_loop.c b/source/blender/editors/mesh/editmesh_loop.c index 03f29edc3fd..3d430d4bf53 100644 --- a/source/blender/editors/mesh/editmesh_loop.c +++ b/source/blender/editors/mesh/editmesh_loop.c @@ -210,7 +210,7 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts) EditEdge *nearest=NULL, *eed; float fac; int keys = 0, holdnum=0, selectmode, dist; - short mvalo[2] = {0,0}, mval[2]; + short mvalo[2] = {0, 0}, mval[2] = {0, 0}; short event=0, val, choosing=1, cancel=0, cuthalf = 0, smooth=0; short hasHidden = 0; char msg[128]; @@ -254,7 +254,7 @@ void CutEdgeloop(Object *obedit, wmOperator *op, EditMesh *em, int numcuts) // } #endif } - else PIL_sleep_ms(10); // idle + else PIL_sleep_ms(10); // idle while(qtest()) diff --git a/source/blender/editors/mesh/editmesh_mods.c b/source/blender/editors/mesh/editmesh_mods.c index a57d56ec1eb..2928b48e69f 100644 --- a/source/blender/editors/mesh/editmesh_mods.c +++ b/source/blender/editors/mesh/editmesh_mods.c @@ -99,41 +99,43 @@ static int pupmenu() {return 0;} /* ****************************** MIRROR **************** */ -void EM_select_mirrored(Object *obedit, EditMesh *em) +void EM_cache_x_mirror_vert(struct Object *ob, struct EditMesh *em) { -#if 0 - if(em->selectmode & SCE_SELECT_VERTEX) { - EditVert *eve, *v1; - - for(eve= em->verts.first; eve; eve= eve->next) { - if(eve->f & SELECT) { - v1= editmesh_get_x_mirror_vert(obedit, em, eve->co); - if(v1) { - eve->f &= ~SELECT; - v1->f |= SELECT; - } + EditVert *eve, *eve_mirror; + + for(eve= em->verts.first; eve; eve= eve->next) { + eve->tmp.v= NULL; + } + + for(eve= em->verts.first; eve; eve= eve->next) { + if(eve->tmp.v==NULL) { + eve_mirror = editmesh_get_x_mirror_vert(ob, em, eve->co); + if(eve_mirror) { + eve->tmp.v= eve_mirror; + eve_mirror->tmp.v = eve; } } } -#endif } -void EM_automerge(int update) +void EM_select_mirrored(Object *obedit, EditMesh *em, int extend) { -// XXX int len; - -// if ((scene->automerge) && -// (obedit && obedit->type==OB_MESH) && -// (((Mesh*)obedit->data)->mr==NULL) -// ) { -// len = removedoublesflag(1, 1, scene->toolsettings->doublimit); -// if (len) { -// em->totvert -= len; /* saves doing a countall */ -// if (update) { -// DAG_id_flush_update(obedit->data, OB_RECALC_DATA); -// } -// } -// } + + EditVert *eve; + + EM_cache_x_mirror_vert(obedit, em); + + for(eve= em->verts.first; eve; eve= eve->next) { + if(eve->f & SELECT && eve->tmp.v) { + eve->tmp.v->f |= SELECT; + + if(extend==FALSE) + eve->f &= ~SELECT; + + /* remove the interference */ + eve->tmp.v->tmp.v= eve->tmp.v= NULL; + } + } } /* ****************************** SELECTION ROUTINES **************** */ @@ -1247,6 +1249,39 @@ void MESH_OT_select_by_number_vertices(wmOperatorType *ot) RNA_def_enum(ot->srna, "type", type_items, 3, "Type", "Type of elements to select."); } + +int select_mirror_exec(bContext *C, wmOperator *op) +{ + Object *obedit= CTX_data_edit_object(C); + EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); + + int extend= RNA_boolean_get(op->ptr, "extend"); + + EM_select_mirrored(obedit, em, extend); + + WM_event_add_notifier(C, NC_GEOM|ND_SELECT, obedit->data); + + return OPERATOR_FINISHED; +} + +void MESH_OT_select_mirror(wmOperatorType *ot) +{ + /* identifiers */ + ot->name= "Select Mirror"; + ot->description= "Select mesh items at mirrored locations."; + ot->idname= "MESH_OT_select_mirror"; + + /* api callbacks */ + ot->exec= select_mirror_exec; + ot->poll= ED_operator_editmesh; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* props */ + RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection"); +} + static int select_sharp_edges_exec(bContext *C, wmOperator *op) { /* Find edges that have exactly two neighboring faces, @@ -2295,99 +2330,6 @@ void vertexnoise(Object *obedit, EditMesh *em) } -static void vertices_to_sphere(Scene *scene, View3D *v3d, Object *obedit, EditMesh *em, float perc) -{ - EditVert *eve; - float *curs, len, vec[3], cent[3], fac, facm, imat[3][3], bmat[3][3]; - int tot; - -// XXX if(button(&perc, 1, 100, "Percentage:")==0) return; - - fac= perc/100.0f; - facm= 1.0f-fac; - - Mat3CpyMat4(bmat, obedit->obmat); - Mat3Inv(imat, bmat); - - /* center */ - curs= give_cursor(scene, v3d); - cent[0]= curs[0]-obedit->obmat[3][0]; - cent[1]= curs[1]-obedit->obmat[3][1]; - cent[2]= curs[2]-obedit->obmat[3][2]; - Mat3MulVecfl(imat, cent); - - len= 0.0; - tot= 0; - eve= em->verts.first; - while(eve) { - if(eve->f & SELECT) { - tot++; - len+= VecLenf(cent, eve->co); - } - eve= eve->next; - } - len/=tot; - - if(len==0.0) len= 10.0; - - eve= em->verts.first; - while(eve) { - if(eve->f & SELECT) { - vec[0]= eve->co[0]-cent[0]; - vec[1]= eve->co[1]-cent[1]; - vec[2]= eve->co[2]-cent[2]; - - Normalize(vec); - - eve->co[0]= fac*(cent[0]+vec[0]*len) + facm*eve->co[0]; - eve->co[1]= fac*(cent[1]+vec[1]*len) + facm*eve->co[1]; - eve->co[2]= fac*(cent[2]+vec[2]*len) + facm*eve->co[2]; - - } - eve= eve->next; - } - - recalc_editnormals(em); -// DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - -} - -static int vertices_to_sphere_exec(bContext *C, wmOperator *op) -{ - Scene *scene= CTX_data_scene(C); - Object *obedit= CTX_data_edit_object(C); - View3D *v3d = CTX_wm_view3d(C); - EditMesh *em= BKE_mesh_get_editmesh(((Mesh *)obedit->data)); - - vertices_to_sphere(scene, v3d, obedit, em, RNA_float_get(op->ptr,"percent")); - - BKE_mesh_end_editmesh(obedit->data, em); - - DAG_id_flush_update(obedit->data, OB_RECALC_DATA); - WM_event_add_notifier(C, NC_GEOM|ND_DATA, obedit->data); - - return OPERATOR_FINISHED; -} - -void MESH_OT_vertices_transform_to_sphere(wmOperatorType *ot) -{ - /* identifiers */ - ot->name= "Vertices to Sphere"; - //added "around cursor" to differentiate between "TFM_OT_tosphere()" - ot->description= "Move selected vertices outward in a spherical shape around cursor."; - ot->idname= "MESH_OT_vertices_transform_to_sphere"; - - /* api callbacks */ - ot->exec= vertices_to_sphere_exec; - ot->poll= ED_operator_editmesh; - - /* flags */ - ot->flag= OPTYPE_REGISTER/*|OPTYPE_UNDO*/; - - /* props */ - RNA_def_float(ot->srna, "percent", 100.0f, 0.0f, 100.0f, "Percent", "DOC_BROKEN", 0.01f, 100.0f); -} - void flipface(EditMesh *em, EditFace *efa) { if(efa->v4) { diff --git a/source/blender/editors/mesh/editmesh_tools.c b/source/blender/editors/mesh/editmesh_tools.c index 9c26c812de9..eb90e901acf 100644 --- a/source/blender/editors/mesh/editmesh_tools.c +++ b/source/blender/editors/mesh/editmesh_tools.c @@ -69,6 +69,7 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "BKE_customdata.h" #include "BKE_depsgraph.h" #include "BKE_global.h" +#include "BKE_key.h" #include "BKE_library.h" #include "BKE_mesh.h" #include "BKE_object.h" @@ -96,10 +97,8 @@ editmesh_tool.c: UI called tools for editmesh, geometry changes here, otherwise #include "bmesh.h" /* XXX */ -static int extern_qread() {return 0;} static void waitcursor(int val) {} static int pupmenu() {return 0;} -static int qtest() {return 0;} #define add_numbut(a, b, c, d, e, f, g) {} /* XXX */ @@ -4245,6 +4244,7 @@ void mesh_set_face_flags(EditMesh *em, short mode) /************************ Shape Operators *************************/ +#if 0 void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op) { EditVert *ev = NULL; @@ -4286,8 +4286,9 @@ void shape_propagate(Scene *scene, Object *obedit, EditMesh *em, wmOperator *op) DAG_id_flush_update(obedit->data, OB_RECALC_DATA); return; } +#endif -void shape_copy_from_lerp(EditMesh *em, KeyBlock* thisBlock, KeyBlock* fromBlock) +static int blend_from_shape_exec(bContext *C, wmOperator *op) { #if 0 //BMESH_TODO EditVert *ev = NULL; @@ -4295,65 +4296,34 @@ void shape_copy_from_lerp(EditMesh *em, KeyBlock* thisBlock, KeyBlock* fromBlock float perc = 0; char str[64]; float *data, *odata; + Object *obedit= CTX_data_edit_object(C); + Mesh *me= obedit->data; + Key *key= me->key; + EditMesh *em= BKE_mesh_get_editmesh(me); + EditVert *eve; + KeyBlock *kb; + float *data, co[3]; + float blend= RNA_float_get(op->ptr, "blend"); + int shape= RNA_enum_get(op->ptr, "shape"); + int add= RNA_int_get(op->ptr, "add"); + int blended= 0; - data = fromBlock->data; - odata = thisBlock->data; - -// XXX getmouseco_areawin(mval); - curval[0] = mval[0] + 1; curval[1] = mval[1] + 1; - - while (finished == 0) - { -// XXX getmouseco_areawin(mval); - if (mval[0] != curval[0] || mval[1] != curval[1]) - { - - if(mval[0] > curval[0]) - perc += 0.1; - else if(mval[0] < curval[0]) - perc -= 0.1; - - if(perc < 0) perc = 0; - if(perc > 1) perc = 1; - - curval[0] = mval[0]; - curval[1] = mval[1]; - - if(fullcopy == 1){ - perc = 1; - } - - for(ev = em->verts.first; ev ; ev = ev->next){ - if(ev->f & SELECT){ - VecLerpf(ev->co,odata+(ev->keyindex*3),data+(ev->keyindex*3),perc); - } - } - sprintf(str,"Blending at %d%c MMB to Copy at 100%c",(int)(perc*100),'%','%'); -// DAG_id_flush_update(obedit->data, OB_RECALC_DATA); -// headerprint(str); -// force_draw(0); + if(key && (kb= BLI_findlink(&key->block, shape))) { + data= kb->data; - if(fullcopy == 1){ - break; - } + for(eve=em->verts.first; eve; eve=eve->next){ + if(eve->f & SELECT) { + if(eve->keyindex >= 0 && eve->keyindex < kb->totelem) { + VECCOPY(co, data + eve->keyindex*3); - } else { - PIL_sleep_ms(10); - } + if(add) { + VecMulf(co, blend); + VecAddf(eve->co, eve->co, co); + } + else + VecLerpf(eve->co, eve->co, co, blend); - while(qtest()) { - short val=0; - event= extern_qread(&val); - if(val){ - if(ELEM3(event, PADENTER, LEFTMOUSE, RETKEY)){ - finished = 1; - } - else if (event == MIDDLEMOUSE){ - fullcopy = 1; - } - else if (ELEM3(event,ESCKEY,RIGHTMOUSE,RIGHTMOUSE)){ - canceled = 1; - finished = 1; + blended= 1; } } } @@ -4367,73 +4337,63 @@ void shape_copy_from_lerp(EditMesh *em, KeyBlock* thisBlock, KeyBlock* fromBlock } return; #endif + return OPERATOR_CANCELLED; } - - -void shape_copy_select_from(Object *obedit, EditMesh *em, wmOperator *op) -{ - Mesh* me = (Mesh*)obedit->data; - EditVert *ev = NULL; - int totverts = 0,curshape = obedit->shapenr; - - Key* ky = NULL; - KeyBlock *kb = NULL,*thisBlock = NULL; - int maxlen=32, nr=0, a=0; - char *menu; - - if(me->key){ - ky = me->key; - } else { - BKE_report(op->reports, RPT_ERROR, "Object Has No Key"); - return; - } - - if(ky->block.first){ - for(kb=ky->block.first;kb;kb = kb->next){ - maxlen += 40; // Size of a block name - if(a == curshape-1){ - thisBlock = kb; - } - - a++; - } - a=0; - menu = MEM_callocN(maxlen, "Copy Shape Menu Text"); - strcpy(menu, "Copy Vert Positions from Shape %t|"); - for(kb=ky->block.first;kb;kb = kb->next){ - if(a != curshape-1){ - sprintf(menu,"%s %s %cx%d|",menu,kb->name,'%',a); +static EnumPropertyItem *shape_itemf(bContext *C, PointerRNA *ptr, int *free) +{ + Object *obedit= CTX_data_edit_object(C); + Mesh *me= (obedit) ? obedit->data : NULL; + Key *key; + KeyBlock *kb, *actkb; + EnumPropertyItem tmp= {0, "", 0, "", ""}, *item= NULL; + int totitem= 0, a; + + if(obedit && obedit->type == OB_MESH) { + key= me->key; + actkb= ob_get_keyblock(obedit); + + if(key && actkb) { + for(kb=key->block.first, a=0; kb; kb=kb->next, a++) { + if(kb != actkb) { + tmp.value= a; + tmp.identifier= kb->name; + tmp.name= kb->name; + RNA_enum_item_add(&item, &totitem, &tmp); + } } - a++; } -// XXX nr = pupmenu_col(menu, 20); - MEM_freeN(menu); - } else { - BKE_report(op->reports, RPT_ERROR, "Object Has No Blendshapes"); - return; } - a = 0; + RNA_enum_item_end(&item, &totitem); + *free= 1; - for(kb=ky->block.first;kb;kb = kb->next){ - if(a == nr){ + return item; +} - for(ev = em->verts.first;ev;ev = ev->next){ - totverts++; - } +void MESH_OT_blend_from_shape(wmOperatorType *ot) +{ + PropertyRNA *prop; + static EnumPropertyItem shape_items[]= {{0, NULL, 0, NULL, NULL}}; - if(me->totvert != totverts){ - BKE_report(op->reports, RPT_ERROR, "Shape Has had Verts Added/Removed, please cycle editmode before copying"); - return; - } - shape_copy_from_lerp(em, thisBlock,kb); + /* identifiers */ + ot->name= "Blend From Shape"; + ot->description= "Blend in shape from a shape key."; + ot->idname= "MESH_OT_blend_from_shape"; - return; - } - a++; - } - return; + /* api callbacks */ + ot->exec= blend_from_shape_exec; + ot->invoke= WM_operator_props_popup; + ot->poll= ED_operator_editmesh; + + /* flags */ + ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO; + + /* properties */ + prop= RNA_def_enum(ot->srna, "shape", shape_items, 0, "Shape", "Shape key to use for blending."); + RNA_def_enum_funcs(prop, shape_itemf); + RNA_def_float(ot->srna, "blend", 1.0f, -FLT_MAX, FLT_MAX, "Blend", "Blending factor.", -2.0f, 2.0f); + RNA_def_boolean(ot->srna, "add", 1, "Add", "Add rather then blend between shapes."); } /************************ Merge Operator *************************/ diff --git a/source/blender/editors/mesh/loopcut.c b/source/blender/editors/mesh/loopcut.c index 9a2a953f643..b40e50646b8 100644 --- a/source/blender/editors/mesh/loopcut.c +++ b/source/blender/editors/mesh/loopcut.c @@ -301,7 +301,7 @@ static int ringsel_init (bContext *C, wmOperator *op, int do_cut) /* assign the drawing handle for drawing preview line... */ lcd->ar= CTX_wm_region(C); - lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST); + lcd->draw_handle= ED_region_draw_cb_activate(lcd->ar->type, ringsel_draw, lcd, REGION_DRAW_POST_VIEW); lcd->ob = CTX_data_edit_object(C); lcd->em= ((Mesh *)lcd->ob->data)->edit_btmesh; lcd->extend = do_cut ? 0 : RNA_boolean_get(op->ptr, "extend"); @@ -480,5 +480,5 @@ void MESH_OT_loopcut (wmOperatorType *ot) ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO|OPTYPE_BLOCKING; /* properties */ - RNA_def_int(ot->srna, "number_cuts", 1, 1, 10, "Number of Cuts", "", 1, INT_MAX); + RNA_def_int(ot->srna, "number_cuts", 1, 1, INT_MAX, "Number of Cuts", "", 1, 10); } diff --git a/source/blender/editors/mesh/mesh_intern.h b/source/blender/editors/mesh/mesh_intern.h index 4a1532af3b0..465a2932d1f 100644 --- a/source/blender/editors/mesh/mesh_intern.h +++ b/source/blender/editors/mesh/mesh_intern.h @@ -118,7 +118,6 @@ void MESH_OT_separate(struct wmOperatorType *ot); void MESH_OT_primitive_plane_add(struct wmOperatorType *ot); void MESH_OT_primitive_cube_add(struct wmOperatorType *ot); void MESH_OT_primitive_circle_add(struct wmOperatorType *ot); -void MESH_OT_primitive_cylinder_add(struct wmOperatorType *ot); void MESH_OT_primitive_tube_add(struct wmOperatorType *ot); void MESH_OT_primitive_cone_add(struct wmOperatorType *ot); void MESH_OT_primitive_grid_add(struct wmOperatorType *ot); @@ -204,13 +203,13 @@ void MESH_OT_unpin(struct wmOperatorType *ot); void MESH_OT_hide(struct wmOperatorType *ot); void MESH_OT_reveal(struct wmOperatorType *ot); void MESH_OT_select_by_number_vertices(struct wmOperatorType *ot); +void MESH_OT_select_mirror(struct wmOperatorType *ot); void MESH_OT_normals_make_consistent(struct wmOperatorType *ot); void MESH_OT_faces_select_linked_flat(struct wmOperatorType *ot); void MESH_OT_edges_select_sharp(struct wmOperatorType *ot); void MESH_OT_select_shortest_path(struct wmOperatorType *ot); void MESH_OT_select_similar(struct wmOperatorType *ot); void MESH_OT_select_random(struct wmOperatorType *ot); -void MESH_OT_vertices_transform_to_sphere(struct wmOperatorType *ot); void MESH_OT_selection_type(struct wmOperatorType *ot); void MESH_OT_loop_multi_select(struct wmOperatorType *ot); void MESH_OT_mark_seam(struct wmOperatorType *ot); @@ -282,6 +281,8 @@ void MESH_OT_colors_reverse(struct wmOperatorType *ot); void MESH_OT_delete(struct wmOperatorType *ot); void MESH_OT_rip(struct wmOperatorType *ot); +void MESH_OT_blend_from_shape(struct wmOperatorType *ot); + /* ******************* mesh_layers.c */ void MESH_OT_uv_texture_add(struct wmOperatorType *ot); diff --git a/source/blender/editors/mesh/mesh_ops.c b/source/blender/editors/mesh/mesh_ops.c index 7b2522ac3d2..6289503ed59 100644 --- a/source/blender/editors/mesh/mesh_ops.c +++ b/source/blender/editors/mesh/mesh_ops.c @@ -82,6 +82,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_hide); WM_operatortype_append(MESH_OT_reveal); WM_operatortype_append(MESH_OT_select_by_number_vertices); + WM_operatortype_append(MESH_OT_select_mirror); WM_operatortype_append(MESH_OT_normals_make_consistent); WM_operatortype_append(MESH_OT_merge); WM_operatortype_append(MESH_OT_subdivide); @@ -90,7 +91,6 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_primitive_plane_add); WM_operatortype_append(MESH_OT_primitive_cube_add); WM_operatortype_append(MESH_OT_primitive_circle_add); - WM_operatortype_append(MESH_OT_primitive_cylinder_add); WM_operatortype_append(MESH_OT_primitive_tube_add); WM_operatortype_append(MESH_OT_primitive_cone_add); WM_operatortype_append(MESH_OT_primitive_grid_add); @@ -105,7 +105,6 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_spin); WM_operatortype_append(MESH_OT_screw); - WM_operatortype_append(MESH_OT_vertices_transform_to_sphere); WM_operatortype_append(MESH_OT_split); WM_operatortype_append(MESH_OT_extrude_repeat); WM_operatortype_append(MESH_OT_edge_rotate); @@ -143,6 +142,7 @@ void ED_operatortypes_mesh(void) WM_operatortype_append(MESH_OT_flip_normals); WM_operatortype_append(MESH_OT_knife_cut); WM_operatortype_append(MESH_OT_rip); + WM_operatortype_append(MESH_OT_blend_from_shape); WM_operatortype_append(MESH_OT_uv_texture_add); WM_operatortype_append(MESH_OT_uv_texture_remove); @@ -236,8 +236,6 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_faces_select_linked_flat", FKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); RNA_float_set(WM_keymap_add_item(keymap, "MESH_OT_edges_select_sharp", SKEY, KM_PRESS, (KM_CTRL|KM_SHIFT|KM_ALT), 0)->ptr,"sharpness",135.0); - - WM_keymap_add_item(keymap, "MESH_OT_vertices_transform_to_sphere", SKEY, KM_PRESS, KM_CTRL|KM_SHIFT , 0); WM_keymap_add_item(keymap, "MESH_OT_select_similar", GKEY, KM_PRESS, KM_SHIFT, 0); WM_keymap_add_item(keymap, "MESH_OT_edge_split", MKEY, KM_PRESS, 0, 0); @@ -299,8 +297,10 @@ void ED_keymap_mesh(wmKeyConfig *keyconf) RNA_string_set(kmi->ptr, "name", "INFO_MT_mesh_add"); WM_keymap_add_item(keymap, "MESH_OT_separate", PKEY, KM_PRESS, 0, 0); - /* use KM_RELEASE because same key is used for tweaks */ - WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, KM_CTRL, 0); + /* use KM_RELEASE because same key is used for tweaks + * TEMPORARY REMAP TO ALT+CTRL TO AVOID CONFLICT + * */ + WM_keymap_add_item(keymap, "MESH_OT_dupli_extrude_cursor", LEFTMOUSE, KM_RELEASE, KM_CTRL|KM_ALT, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", XKEY, KM_PRESS, 0, 0); WM_keymap_add_item(keymap, "MESH_OT_delete", DELKEY, KM_PRESS, 0, 0); diff --git a/source/blender/editors/mesh/meshtools.c b/source/blender/editors/mesh/meshtools.c index 629e7bacc20..06ea163eb8d 100644 --- a/source/blender/editors/mesh/meshtools.c +++ b/source/blender/editors/mesh/meshtools.c @@ -850,7 +850,7 @@ static void mesh_octree_add_nodes(MocNode **basetable, float *co, float *offs, f } -static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mvert, float *co) +static intptr_t mesh_octree_find_index(MocNode **bt, MVert *mvert, float *co) { float *vec; int a; @@ -861,12 +861,7 @@ static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mv for(a=0; a<MOC_NODE_RES; a++) { if((*bt)->index[a]) { /* does mesh verts and editmode, code looks potential dangerous, octree should really be filled OK! */ - if(orco) { - vec= orco[(*bt)->index[a]-1]; - if(FloatCompare(vec, co, MOC_THRESH)) - return (*bt)->index[a]-1; - } - else if(mvert) { + if(mvert) { vec= (mvert+(*bt)->index[a]-1)->co; if(FloatCompare(vec, co, MOC_THRESH)) return (*bt)->index[a]-1; @@ -880,7 +875,7 @@ static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mv else return -1; } if( (*bt)->next) - return mesh_octree_find_index(&(*bt)->next, orco, mvert, co); + return mesh_octree_find_index(&(*bt)->next, mvert, co); return -1; } @@ -888,9 +883,7 @@ static intptr_t mesh_octree_find_index(MocNode **bt, float (*orco)[3], MVert *mv static struct { MocNode **table; float offs[3], div[3]; - float (*orco)[3]; - float orcoloc[3]; -} MeshOctree = {NULL, {0, 0, 0}, {0, 0, 0}, NULL}; +} MeshOctree = {NULL, {0, 0, 0}, {0, 0, 0}}; /* mode is 's' start, or 'e' end, or 'u' use */ /* if end, ob can be NULL */ @@ -906,9 +899,9 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) Mesh *me= ob->data; bt= MeshOctree.table + mesh_octree_get_base_offs(co, MeshOctree.offs, MeshOctree.div); if(em) - return mesh_octree_find_index(bt, NULL, NULL, co); + return mesh_octree_find_index(bt, NULL, co); else - return mesh_octree_find_index(bt, MeshOctree.orco, me->mvert, co); + return mesh_octree_find_index(bt, me->mvert, co); } return -1; } @@ -930,16 +923,10 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) } else { MVert *mvert; - float *vco; - int a, totvert; - - MeshOctree.orco= mesh_getRefKeyCos(me, &totvert); - mesh_get_texspace(me, MeshOctree.orcoloc, NULL, NULL); + int a; - for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) { - vco= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co; - DO_MINMAX(vco, min, max); - } + for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) + DO_MINMAX(mvert->co, min, max); } /* for quick unit coordinate calculus */ @@ -974,13 +961,10 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) } else { MVert *mvert; - float *vco; int a; - for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) { - vco= (MeshOctree.orco)? MeshOctree.orco[a]: mvert->co; - mesh_octree_add_nodes(MeshOctree.table, vco, MeshOctree.offs, MeshOctree.div, a+1); - } + for(a=0, mvert= me->mvert; a<me->totvert; a++, mvert++) + mesh_octree_add_nodes(MeshOctree.table, mvert->co, MeshOctree.offs, MeshOctree.div, a+1); } } else if(mode=='e') { /* end table */ @@ -993,10 +977,6 @@ intptr_t mesh_octree_table(Object *ob, BMEditMesh *em, float *co, char mode) MEM_freeN(MeshOctree.table); MeshOctree.table= NULL; } - if(MeshOctree.orco) { - MEM_freeN(MeshOctree.orco); - MeshOctree.orco= NULL; - } } return 0; } @@ -1007,19 +987,10 @@ int mesh_get_x_mirror_vert(Object *ob, int index) MVert *mvert; float vec[3]; - if(MeshOctree.orco) { - float *loc= MeshOctree.orcoloc; - - vec[0]= -(MeshOctree.orco[index][0] + loc[0]) - loc[0]; - vec[1]= MeshOctree.orco[index][1]; - vec[2]= MeshOctree.orco[index][2]; - } - else { - mvert= me->mvert+index; - vec[0]= -mvert->co[0]; - vec[1]= mvert->co[1]; - vec[2]= mvert->co[2]; - } + mvert= me->mvert+index; + vec[0]= -mvert->co[0]; + vec[1]= mvert->co[1]; + vec[2]= mvert->co[2]; return mesh_octree_table(ob, NULL, vec, 'u'); } |