[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41282] branches/bmesh/blender/source/ blender/editors/mesh: Fix bugs to get X-Mirror editing functionality working again
Andrew Wiggin
ender79bl at gmail.com
Tue Oct 25 18:17:28 CEST 2011
Revision: 41282
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41282
Author: ender79
Date: 2011-10-25 16:17:26 +0000 (Tue, 25 Oct 2011)
Log Message:
-----------
Fix bugs to get X-Mirror editing functionality working again
Modified Paths:
--------------
branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.c
branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.h
branches/bmesh/blender/source/blender/editors/mesh/editface.c
branches/bmesh/blender/source/blender/editors/mesh/knifetool.c
branches/bmesh/blender/source/blender/editors/mesh/meshtools.c
Modified: branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/bmeshutils.c 2011-10-25 16:17:26 UTC (rev 41282)
@@ -509,8 +509,9 @@
if (flag & BM_SELECT) {
BM_Select(em->bm, ele, 1);
}
-
- BM_SetHFlag(ele, flag & ~BM_SELECT);
+ else {
+ BM_SetHFlag(ele, flag);
+ }
}
}
}
@@ -787,12 +788,17 @@
void EDBM_CacheMirrorVerts(BMEditMesh *em)
{
+ Mesh *me = em->me;
BMBVHTree *tree = BMBVH_NewBVH(em, 0, NULL, NULL);
BMIter iter;
BMVert *v;
float invmat[4][4];
- int li, i;
+ int li, i, topo = 0;
+ if (me && (me->editflag & ME_EDIT_MIRROR_TOPO)) {
+ topo = 1;
+ }
+
if (!em->vert_index) {
EDBM_init_index_arrays(em, 1, 0, 0);
em->mirr_free_arrays = 1;
@@ -805,18 +811,7 @@
li = CustomData_get_named_layer_index(&em->bm->vdata, CD_PROP_INT, "__mirror_index");
em->bm->vdata.layers[li].flag |= CD_FLAG_TEMPORARY;
- /*multiply verts by object matrix, temporarily*/
-
- i = 0;
BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- BM_SetIndex(v, i);
- i++;
-
- if (em->ob)
- mul_m4_v3(em->ob->obmat, v->co);
- }
-
- BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
BMVert *mirr;
int *idx = CustomData_bmesh_get_layer_n(&em->bm->vdata, v->head.data, li);
float co[3] = {-v->co[0], v->co[1], v->co[2]};
@@ -825,7 +820,9 @@
if (!BM_TestHFlag(v, BM_SELECT))
continue;
- mirr = BMBVH_FindClosestVertTopo(tree, co, BM_SEARCH_MAXDIST, v);
+ mirr = topo ?
+ BMBVH_FindClosestVertTopo(tree, co, BM_SEARCH_MAXDIST, v) :
+ BMBVH_FindClosestVert(tree, co, BM_SEARCH_MAXDIST);
if (mirr && mirr != v) {
*idx = BM_GetIndex(mirr);
idx = CustomData_bmesh_get_layer_n(&em->bm->vdata,mirr->head.data, li);
@@ -833,19 +830,7 @@
} else *idx = -1;
}
- /*unmultiply by object matrix*/
- if (em->ob) {
- i = 0;
- invert_m4_m4(invmat, em->ob->obmat);
- BM_ITER(v, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
- BM_SetIndex(v, i);
- i++;
-
- mul_m4_v3(invmat, v->co);
- }
-
- BMBVH_FreeBVH(tree);
- }
+ BMBVH_FreeBVH(tree);
}
BMVert *EDBM_GetMirrorVert(BMEditMesh *em, BMVert *v)
Modified: branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.c 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.c 2011-10-25 16:17:26 UTC (rev 41282)
@@ -304,6 +304,7 @@
VECCOPY(hit->co, ls[i]->v->co);
VECCOPY(hit->no, ls[i]->v->no);
hit->dist = dist;
+ hit->index = index;
}
}
}
@@ -336,7 +337,7 @@
}
}
- return ls[i]->v;
+ return ls[cur]->v;
}
return NULL;
Modified: branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.h
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.h 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/editbmesh_bvh.h 2011-10-25 16:17:26 UTC (rev 41282)
@@ -1,3 +1,34 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
+ * All rights reserved.
+ *
+ * The Original Code is: all of this file.
+ *
+ * Contributor(s): none yet.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/editors/mesh/editbmesh_bvh.h
+ * \ingroup edmesh
+ */
+
#ifndef _EDITBMESH_BVH
#define _EDITBMESH_BVH
Modified: branches/bmesh/blender/source/blender/editors/mesh/editface.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/editface.c 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/editface.c 2011-10-25 16:17:26 UTC (rev 41282)
@@ -73,7 +73,7 @@
Mesh *me = get_mesh(ob);
DerivedMesh *dm = ob->derivedFinal;
MPoly *polys, *mp_orig;
- MFace *faces, *mf;
+ MFace *faces;
int *index_array = NULL;
int totface, totpoly;
int i;
Modified: branches/bmesh/blender/source/blender/editors/mesh/knifetool.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/knifetool.c 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/knifetool.c 2011-10-25 16:17:26 UTC (rev 41282)
@@ -1,6 +1,4 @@
-/**
- * $Id$
- *
+/*
* ***** BEGIN GPL LICENSE BLOCK *****
*
* This program is free software; you can redistribute it and/or
Modified: branches/bmesh/blender/source/blender/editors/mesh/meshtools.c
===================================================================
--- branches/bmesh/blender/source/blender/editors/mesh/meshtools.c 2011-10-25 14:39:27 UTC (rev 41281)
+++ branches/bmesh/blender/source/blender/editors/mesh/meshtools.c 2011-10-25 16:17:26 UTC (rev 41282)
@@ -790,7 +790,7 @@
return (*bt)->index[a]-1;
}
else {
- EditVert *eve= (EditVert *)((*bt)->index[a]);
+ BMVert *eve= (BMVert *)((*bt)->index[a]);
if(compare_v3v3(eve->co, co, MOC_THRESH))
return (*bt)->index[a];
}
More information about the Bf-blender-cvs
mailing list