[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [56924] trunk/blender: code cleanup: rename bmesh operator files to be more consistent

Campbell Barton ideasman42 at gmail.com
Mon May 20 09:38:12 CEST 2013


Revision: 56924
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=56924
Author:   campbellbarton
Date:     2013-05-20 07:38:11 +0000 (Mon, 20 May 2013)
Log Message:
-----------
code cleanup: rename bmesh operator files to be more consistent

Modified Paths:
--------------
    trunk/blender/build_files/cmake/project_info.py
    trunk/blender/source/blender/bmesh/CMakeLists.txt

Added Paths:
-----------
    trunk/blender/source/blender/bmesh/operators/bmo_fill_edgeloop.c
    trunk/blender/source/blender/bmesh/operators/bmo_fill_grid.c
    trunk/blender/source/blender/bmesh/operators/bmo_split_edges.c

Removed Paths:
-------------
    trunk/blender/source/blender/bmesh/operators/bmo_edgeloop_fill.c
    trunk/blender/source/blender/bmesh/operators/bmo_edgesplit.c
    trunk/blender/source/blender/bmesh/operators/bmo_grid_fill.c

Modified: trunk/blender/build_files/cmake/project_info.py
===================================================================
--- trunk/blender/build_files/cmake/project_info.py	2013-05-20 05:06:52 UTC (rev 56923)
+++ trunk/blender/build_files/cmake/project_info.py	2013-05-20 07:38:11 UTC (rev 56924)
@@ -26,8 +26,8 @@
 Example Win32 usage:
  c:\Python32\python.exe c:\blender_dev\blender\build_files\cmake\cmake_qtcreator_project.py c:\blender_dev\cmake_build
 
-example linux usage
- python .~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
+Example Linux usage:
+ python ~/blenderSVN/blender/build_files/cmake/cmake_qtcreator_project.py ~/blenderSVN/cmake
 """
 
 __all__ = (

Modified: trunk/blender/source/blender/bmesh/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/bmesh/CMakeLists.txt	2013-05-20 05:06:52 UTC (rev 56923)
+++ trunk/blender/source/blender/bmesh/CMakeLists.txt	2013-05-20 07:38:11 UTC (rev 56924)
@@ -46,11 +46,10 @@
 	operators/bmo_create.c
 	operators/bmo_dissolve.c
 	operators/bmo_dupe.c
-	operators/bmo_edgeloop_fill.c
 	operators/bmo_edgenet.c
-	operators/bmo_edgesplit.c
 	operators/bmo_extrude.c
-	operators/bmo_grid_fill.c
+	operators/bmo_fill_edgeloop.c
+	operators/bmo_fill_grid.c 
 	operators/bmo_hull.c
 	operators/bmo_inset.c
 	operators/bmo_join_triangles.c
@@ -61,8 +60,9 @@
 	operators/bmo_removedoubles.c
 	operators/bmo_similar.c
 	operators/bmo_smooth_laplacian.c
+	operators/bmo_split_edges.c
+	operators/bmo_subdivide.c
 	operators/bmo_symmetrize.c
-	operators/bmo_subdivide.c
 	operators/bmo_triangulate.c
 	operators/bmo_unsubdivide.c
 	operators/bmo_utils.c

Deleted: trunk/blender/source/blender/bmesh/operators/bmo_edgeloop_fill.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_edgeloop_fill.c	2013-05-20 05:06:52 UTC (rev 56923)
+++ trunk/blender/source/blender/bmesh/operators/bmo_edgeloop_fill.c	2013-05-20 07:38:11 UTC (rev 56924)
@@ -1,160 +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.
- *
- * Contributor(s): Campbell Barton.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/operators/bmo_edgeloop_fill.c
- *  \ingroup bmesh
- *
- * Fill discreet edge loop(s) with faces.
- */
-
-#include "MEM_guardedalloc.h"
-
-#include "BLI_listbase.h"
-
-#include "bmesh.h"
-
-#include "intern/bmesh_operators_private.h" /* own include */
-
-#define VERT_USED	1
-#define EDGE_MARK	2
-#define ELE_OUT		4
-
-void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
-{
-	/* first collect an array of unique from the edges */
-	const int tote = BMO_slot_buffer_count(op->slots_in, "edges");
-	const int totv = tote;  /* these should be the same */
-	BMVert **verts = MEM_mallocN(sizeof(*verts) * totv, __func__);
-
-	BMVert *v;
-	BMEdge *e;
-	int i;
-	bool ok = true;
-
-	BMOIter oiter;
-
-	const short mat_nr     = BMO_slot_int_get(op->slots_in,  "mat_nr");
-	const bool use_smooth  = BMO_slot_bool_get(op->slots_in, "use_smooth");
-
-	/* 'VERT_USED' will be disabled, so enable and fill the array */
-	i = 0;
-	BMO_ITER (e, &oiter, op->slots_in, "edges", BM_EDGE) {
-		BMIter viter;
-		BMO_elem_flag_enable(bm, e, EDGE_MARK);
-		BM_ITER_ELEM (v, &viter, e, BM_VERTS_OF_EDGE) {
-			if (BMO_elem_flag_test(bm, v, VERT_USED) == false) {
-				BMO_elem_flag_enable(bm, v, VERT_USED);
-				verts[i++] = v;
-				if (i == tote) {
-					break;
-				}
-			}
-		}
-		if (i > tote) {
-			break;
-		}
-	}
-
-	/* we have a different number of verts to edges */
-	if (i != tote) {
-		MEM_freeN(verts);
-		return;
-	}
-
-	/* loop over connected flagged edges and fill in faces,  this is made slightly more
-	 * complicated because there may be multiple disconnected loops to fill. */
-
-	/* sanity check - that each vertex has 2 edge users */
-	for (i = 0; i < totv; i++) {
-		v = verts[i];
-		/* count how many flagged edges this vertex uses */
-		if (BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, v, EDGE_MARK, true) != 2) {
-			ok = false;
-			break;
-		}
-	}
-
-	if (ok) {
-		/* note: in the case of multiple loops, this over-allocs (which is fine) */
-		BMVert **f_verts  = MEM_mallocN(sizeof(*verts) * totv, __func__);
-		BMIter eiter;
-
-		/* build array of connected verts and edges */
-		BMEdge *e_prev = NULL;
-		BMEdge *e_next = NULL;
-		int totv_used = 0;
-
-		while (totv_used < totv) {
-			for (i = 0; i < totv; i++) {
-				v = verts[i];
-				if (BMO_elem_flag_test(bm, v, VERT_USED)) {
-					break;
-				}
-			}
-
-			/* this should never fail, as long as (totv_used < totv)
-			 * we should have marked verts available */
-			BLI_assert(BMO_elem_flag_test(bm, v, VERT_USED));
-
-			/* watch it, 'i' is used for final face length */
-			i = 0;
-			do {
-				/* we know that there are 2 edges per vertex so no need to check */
-				BM_ITER_ELEM (e, &eiter, v, BM_EDGES_OF_VERT) {
-					if (BMO_elem_flag_test(bm, e, EDGE_MARK)) {
-						if (e != e_prev) {
-							e_next = e;
-							break;
-						}
-					}
-				}
-
-				/* fill in the array */
-				f_verts[i] = v;
-				BMO_elem_flag_disable(bm, v, VERT_USED);
-				totv_used++;
-
-				/* step over the edges */
-				v = BM_edge_other_vert(e_next, v);
-				e_prev = e_next;
-				i++;
-			} while ((v != f_verts[0]));
-
-			if (BM_face_exists(f_verts, i, NULL) == false) {
-				BMFace *f;
-
-				/* don't use calc_edges option because we already have the edges */
-				f = BM_face_create_ngon_verts(bm, f_verts, i, 0, true, false);
-				BMO_elem_flag_enable(bm, f, ELE_OUT);
-				f->mat_nr = mat_nr;
-				if (use_smooth) {
-					BM_elem_flag_enable(f, BM_ELEM_SMOOTH);
-				}
-			}
-		}
-		MEM_freeN(f_verts);
-
-		BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "faces.out", BM_FACE, ELE_OUT);
-	}
-
-	MEM_freeN(verts);
-}

Deleted: trunk/blender/source/blender/bmesh/operators/bmo_edgesplit.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_edgesplit.c	2013-05-20 05:06:52 UTC (rev 56923)
+++ trunk/blender/source/blender/bmesh/operators/bmo_edgesplit.c	2013-05-20 07:38:11 UTC (rev 56924)
@@ -1,54 +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.
- *
- * Contributor(s): Campbell Barton
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/operators/bmo_edgesplit.c
- *  \ingroup bmesh
- *
- * Just a wrapper around #BM_mesh_edgesplit
- */
-
-#include "BLI_utildefines.h"
-
-#include "bmesh.h"
-#include "tools/bmesh_edgesplit.h"
-
-#include "intern/bmesh_operators_private.h" /* own include */
-
-
-/* keep this operator fast, its used in a modifier */
-void bmo_split_edges_exec(BMesh *bm, BMOperator *op)
-{
-	const bool use_verts = BMO_slot_bool_get(op->slots_in, "use_verts");
-
-	BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false);
-	BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, false);
-
-	if (use_verts) {
-		/* this slows down the operation but its ok because the modifier doesn't use */
-		BMO_slot_buffer_hflag_enable(bm, op->slots_in, "verts", BM_VERT, BM_ELEM_TAG, false);
-	}
-
-	/* this is where everything happens */
-	BM_mesh_edgesplit(bm, use_verts, true);
-
-	BMO_slot_buffer_from_enabled_hflag(bm, op, op->slots_out, "edges.out", BM_EDGE, BM_ELEM_INTERNAL_TAG);
-}

Copied: trunk/blender/source/blender/bmesh/operators/bmo_fill_edgeloop.c (from rev 56916, trunk/blender/source/blender/bmesh/operators/bmo_edgeloop_fill.c)
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_fill_edgeloop.c	                        (rev 0)
+++ trunk/blender/source/blender/bmesh/operators/bmo_fill_edgeloop.c	2013-05-20 07:38:11 UTC (rev 56924)
@@ -0,0 +1,160 @@
+/*
+ * ***** 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.
+ *
+ * Contributor(s): Campbell Barton.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/operators/bmo_fill_edgeloop.c
+ *  \ingroup bmesh
+ *
+ * Fill discreet edge loop(s) with faces.
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_listbase.h"
+
+#include "bmesh.h"
+
+#include "intern/bmesh_operators_private.h" /* own include */
+
+#define VERT_USED	1
+#define EDGE_MARK	2
+#define ELE_OUT		4
+
+void bmo_edgeloop_fill_exec(BMesh *bm, BMOperator *op)
+{

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list