[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [45118] trunk/blender/source/blender/ editors/mesh: code cleanup: bmesh_ source files in our editor dir, they are the same as other editmesh_ files.

Campbell Barton ideasman42 at gmail.com
Sat Mar 24 01:20:46 CET 2012


Revision: 45118
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=45118
Author:   campbellbarton
Date:     2012-03-24 00:20:36 +0000 (Sat, 24 Mar 2012)
Log Message:
-----------
code cleanup: bmesh_  source files in our editor dir, they are the same as other editmesh_ files.

Modified Paths:
--------------
    trunk/blender/source/blender/editors/mesh/CMakeLists.txt
    trunk/blender/source/blender/editors/mesh/editmesh_bvh.c

Added Paths:
-----------
    trunk/blender/source/blender/editors/mesh/editmesh_knife.c
    trunk/blender/source/blender/editors/mesh/editmesh_loopcut.c
    trunk/blender/source/blender/editors/mesh/editmesh_select.c
    trunk/blender/source/blender/editors/mesh/editmesh_tools.c
    trunk/blender/source/blender/editors/mesh/editmesh_utils.c

Removed Paths:
-------------
    trunk/blender/source/blender/editors/mesh/bmesh_select.c
    trunk/blender/source/blender/editors/mesh/bmesh_tools.c
    trunk/blender/source/blender/editors/mesh/bmesh_utils.c
    trunk/blender/source/blender/editors/mesh/knifetool.c
    trunk/blender/source/blender/editors/mesh/loopcut.c

Modified: trunk/blender/source/blender/editors/mesh/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/editors/mesh/CMakeLists.txt	2012-03-23 23:41:33 UTC (rev 45117)
+++ trunk/blender/source/blender/editors/mesh/CMakeLists.txt	2012-03-24 00:20:36 UTC (rev 45118)
@@ -38,14 +38,14 @@
 )
 
 set(SRC
-	bmesh_select.c
-	bmesh_tools.c
-	bmesh_utils.c
 	editface.c
 	editmesh_add.c
 	editmesh_bvh.c
-	knifetool.c
-	loopcut.c
+	editmesh_knife.c
+	editmesh_loopcut.c
+	editmesh_select.c
+	editmesh_tools.c
+	editmesh_utils.c
 	mesh_data.c
 	mesh_ops.c
 	meshtools.c

Deleted: trunk/blender/source/blender/editors/mesh/bmesh_select.c
===================================================================
--- trunk/blender/source/blender/editors/mesh/bmesh_select.c	2012-03-23 23:41:33 UTC (rev 45117)
+++ trunk/blender/source/blender/editors/mesh/bmesh_select.c	2012-03-24 00:20:36 UTC (rev 45118)
@@ -1,2763 +0,0 @@
-/*
- * ***** 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) 2004 Blender Foundation.
- * All rights reserved.
- *
- * The Original Code is: all of this file.
- *
- * Contributor(s): none yet.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_blenlib.h"
-#include "BLI_math.h"
-#include "BLI_rand.h"
-#include "BLI_array.h"
-#include "BLI_smallhash.h"
-#include "BLI_heap.h"
-
-#include "BKE_context.h"
-#include "BKE_displist.h"
-#include "BKE_depsgraph.h"
-#include "BKE_report.h"
-#include "BKE_paint.h"
-#include "BKE_tessmesh.h"
-
-#include "IMB_imbuf_types.h"
-#include "IMB_imbuf.h"
-
-#include "WM_api.h"
-#include "WM_types.h"
-
-#include "RNA_access.h"
-#include "RNA_define.h"
-
-#include "ED_mesh.h"
-#include "ED_screen.h"
-#include "ED_view3d.h"
-
-#include "BIF_gl.h"
-
-#include "DNA_scene_types.h"
-#include "DNA_object_types.h"
-#include "DNA_mesh_types.h"
-
-#include "mesh_intern.h"
-
-
-/* ****************************** MIRROR **************** */
-
-void EDBM_select_mirrored(Object *UNUSED(obedit), BMEditMesh *em, int extend)
-{
-	BMVert *v1, *v2;
-	BMIter iter;
-
-	BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-		if (!BM_elem_flag_test(v1, BM_ELEM_SELECT) || BM_elem_flag_test(v1, BM_ELEM_HIDDEN)) {
-			BM_elem_flag_disable(v1, BM_ELEM_TAG);
-		}
-		else {
-			BM_elem_flag_enable(v1, BM_ELEM_TAG);
-		}
-	}
-
-	EDBM_CacheMirrorVerts(em, TRUE);
-
-	if (!extend)
-		EDBM_flag_disable_all(em, BM_ELEM_SELECT);
-
-	BM_ITER(v1, &iter, em->bm, BM_VERTS_OF_MESH, NULL) {
-		if (!BM_elem_flag_test(v1, BM_ELEM_TAG) || BM_elem_flag_test(v1, BM_ELEM_HIDDEN))
-			continue;
-
-		v2 = EDBM_GetMirrorVert(em, v1);
-		if (v2 && !BM_elem_flag_test(v2, BM_ELEM_HIDDEN)) {
-			BM_elem_select_set(em->bm, v2, TRUE);
-		}
-	}
-
-	EDBM_EndMirrorCache(em);
-}
-
-void EDBM_automerge(Scene *scene, Object *obedit, int update)
-{
-	BMEditMesh *em;
-	
-	if ((scene->toolsettings->automerge) &&
-	    (obedit && obedit->type == OB_MESH))
-	{
-		em = BMEdit_FromObject(obedit);
-		if (!em)
-			return;
-
-		BMO_op_callf(em->bm, "automerge verts=%hv dist=%f", BM_ELEM_SELECT, scene->toolsettings->doublimit);
-		if (update) {
-			DAG_id_tag_update(obedit->data, OB_RECALC_DATA);
-		}
-	}
-}
-
-/* ****************************** SELECTION ROUTINES **************** */
-
-unsigned int bm_solidoffs = 0, bm_wireoffs = 0, bm_vertoffs = 0;	/* set in drawobject.c ... for colorindices */
-
-/* facilities for border select and circle select */
-static char *selbuf = NULL;
-
-/* opengl doesn't support concave... */
-static void draw_triangulated(int mcords[][2], short tot)
-{
-	ListBase lb = {NULL, NULL};
-	DispList *dl;
-	float *fp;
-	int a;
-	
-	/* make displist */
-	dl = MEM_callocN(sizeof(DispList), "poly disp");
-	dl->type = DL_POLY;
-	dl->parts = 1;
-	dl->nr = tot;
-	dl->verts = fp = MEM_callocN(tot * 3 * sizeof(float), "poly verts");
-	BLI_addtail(&lb, dl);
-	
-	for (a = 0; a < tot; a++, fp += 3) {
-		fp[0] = (float)mcords[a][0];
-		fp[1] = (float)mcords[a][1];
-	}
-	
-	/* do the fill */
-	filldisplist(&lb, &lb, 0);
-
-	/* do the draw */
-	dl = lb.first;  /* filldisplist adds in head of list */
-	if (dl->type == DL_INDEX3) {
-		int *index;
-		
-		a = dl->parts;
-		fp = dl->verts;
-		index = dl->index;
-		glBegin(GL_TRIANGLES);
-		while (a--) {
-			glVertex3fv(fp + 3 * index[0]);
-			glVertex3fv(fp + 3 * index[1]);
-			glVertex3fv(fp + 3 * index[2]);
-			index += 3;
-		}
-		glEnd();
-	}
-	
-	freedisplist(&lb);
-}
-
-
-/* reads rect, and builds selection array for quick lookup */
-/* returns if all is OK */
-int EDBM_init_backbuf_border(ViewContext *vc, short xmin, short ymin, short xmax, short ymax)
-{
-	struct ImBuf *buf;
-	unsigned int *dr;
-	int a;
-	
-	if (vc->obedit == NULL || vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
-		return 0;
-	}
-	
-	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if (buf == NULL) return 0;
-	if (bm_vertoffs == 0) return 0;
-
-	dr = buf->rect;
-	
-	/* build selection lookup */
-	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
-	
-	a = (xmax - xmin + 1) * (ymax - ymin + 1);
-	while (a--) {
-		if (*dr > 0 && *dr <= bm_vertoffs)
-			selbuf[*dr] = 1;
-		dr++;
-	}
-	IMB_freeImBuf(buf);
-	return 1;
-}
-
-int EDBM_check_backbuf(unsigned int index)
-{
-	if (selbuf == NULL) return 1;
-	if (index > 0 && index <= bm_vertoffs)
-		return selbuf[index];
-	return 0;
-}
-
-void EDBM_free_backbuf(void)
-{
-	if (selbuf) MEM_freeN(selbuf);
-	selbuf = NULL;
-}
-
-/* mcords is a polygon mask
- * - grab backbuffer,
- * - draw with black in backbuffer, 
- * - grab again and compare
- * returns 'OK' 
- */
-int EDBM_mask_init_backbuf_border(ViewContext *vc, int mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax)
-{
-	unsigned int *dr, *drm;
-	struct ImBuf *buf, *bufmask;
-	int a;
-	
-	/* method in use for face selecting too */
-	if (vc->obedit == NULL) {
-		if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
-			return 0;
-		}
-	}
-	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) {
-		return 0;
-	}
-
-	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if (buf == NULL) return 0;
-	if (bm_vertoffs == 0) return 0;
-
-	dr = buf->rect;
-
-	/* draw the mask */
-	glDisable(GL_DEPTH_TEST);
-	
-	glColor3ub(0, 0, 0);
-	
-	/* yah, opengl doesn't do concave... tsk! */
-	ED_region_pixelspace(vc->ar);
-	draw_triangulated(mcords, tot);
-	
-	glBegin(GL_LINE_LOOP);  /* for zero sized masks, lines */
-	for (a = 0; a < tot; a++) {
-		glVertex2iv(mcords[a]);
-	}
-	glEnd();
-	
-	glFinish();	/* to be sure readpixels sees mask */
-	
-	/* grab mask */
-	bufmask = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	drm = bufmask->rect;
-	if (bufmask == NULL) {
-		return 0; /* only when mem alloc fails, go crash somewhere else! */
-	}
-	
-	/* build selection lookup */
-	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
-	
-	a = (xmax - xmin + 1) * (ymax - ymin + 1);
-	while (a--) {
-		if (*dr > 0 && *dr <= bm_vertoffs && *drm == 0) selbuf[*dr] = 1;
-		dr++; drm++;
-	}
-	IMB_freeImBuf(buf);
-	IMB_freeImBuf(bufmask);
-
-	return 1;
-}
-
-/* circle shaped sample area */
-int EDBM_init_backbuf_circle(ViewContext *vc, short xs, short ys, short rads)
-{
-	struct ImBuf *buf;
-	unsigned int *dr;
-	short xmin, ymin, xmax, ymax, xc, yc;
-	int radsq;
-	
-	/* method in use for face selecting too */
-	if (vc->obedit == NULL) {
-		if (!(paint_facesel_test(vc->obact) || paint_vertsel_test(vc->obact))) {
-			return 0;
-		}
-	}
-	else if (vc->v3d->drawtype < OB_SOLID || (vc->v3d->flag & V3D_ZBUF_SELECT) == 0) return 0;
-	
-	xmin = xs - rads; xmax = xs + rads;
-	ymin = ys - rads; ymax = ys + rads;
-	buf = view3d_read_backbuf(vc, xmin, ymin, xmax, ymax);
-	if (bm_vertoffs == 0) return 0;
-	if (buf == NULL) return 0;
-
-	dr = buf->rect;
-	
-	/* build selection lookup */
-	selbuf = MEM_callocN(bm_vertoffs + 1, "selbuf");
-	radsq = rads * rads;
-	for (yc = -rads; yc <= rads; yc++) {
-		for (xc = -rads; xc <= rads; xc++, dr++) {
-			if (xc * xc + yc * yc < radsq) {
-				if (*dr > 0 && *dr <= bm_vertoffs) selbuf[*dr] = 1;
-			}
-		}
-	}
-
-	IMB_freeImBuf(buf);
-	return 1;
-	
-}
-
-static void findnearestvert__doClosest(void *userData, BMVert *eve, int x, int y, int index)
-{
-	struct { short mval[2], pass, select, strict; int dist, lastIndex, closestIndex; BMVert *closest; } *data = userData;
-
-	if (data->pass == 0) {
-		if (index <= data->lastIndex)
-			return;
-	}
-	else {
-		if (index > data->lastIndex)
-			return;
-	}
-
-	if (data->dist > 3) {
-		int temp = abs(data->mval[0] - x) + abs(data->mval[1]- y);
-		if (BM_elem_flag_test(eve, BM_ELEM_SELECT) == data->select) {
-			if (data->strict == 1) {
-				return;
-			}
-			else {
-				temp += 5;
-			}
-		}
-
-		if (temp < data->dist) {
-			data->dist = temp;
-			data->closest = eve;
-			data->closestIndex = index;
-		}
-	}
-}
-
-
-
-
-static unsigned int findnearestvert__backbufIndextest(void *handle, unsigned int index)
-{
-	BMEditMesh *em = (BMEditMesh *)handle;
-	BMVert *eve = BM_vert_at_index(em->bm, index - 1);
-
-	if (eve && BM_elem_flag_test(eve, BM_ELEM_SELECT)) return 0;
-	return 1;
-}
-/**
- * findnearestvert
- * 
- * dist (in/out): minimal distance to the nearest and at the end, actual distance
- * sel: selection bias
- * 		if SELECT, selected vertice are given a 5 pixel bias to make them further than unselect verts
- * 		if 0, unselected vertice are given the bias
- * strict: if 1, the vertice corresponding to the sel parameter are ignored and not just biased 
- */
-BMVert *EDBM_findnearestvert(ViewContext *vc, int *dist, short sel, short strict)
-{
-	if (vc->v3d->drawtype > OB_WIRE && (vc->v3d->flag & V3D_ZBUF_SELECT)) {
-		int distance;
-		unsigned int index;
-		BMVert *eve;
-		
-		if (strict) {
-			index = view3d_sample_backbuf_rect(vc, vc->mval, 50, bm_wireoffs, 0xFFFFFF, &distance,

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list