[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55225] trunk/blender/source/blender/bmesh : code cleanup: remove bmesh subdivide header, all definitions can be included in bmo_subdivide.c.
Campbell Barton
ideasman42 at gmail.com
Wed Mar 13 06:33:23 CET 2013
Revision: 55225
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55225
Author: campbellbarton
Date: 2013-03-13 05:33:23 +0000 (Wed, 13 Mar 2013)
Log Message:
-----------
code cleanup: remove bmesh subdivide header, all definitions can be included in bmo_subdivide.c.
also only initialize random numbers when fractal option is set.
Modified Paths:
--------------
trunk/blender/source/blender/bmesh/CMakeLists.txt
trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c
Removed Paths:
-------------
trunk/blender/source/blender/bmesh/operators/bmo_subdivide.h
Modified: trunk/blender/source/blender/bmesh/CMakeLists.txt
===================================================================
--- trunk/blender/source/blender/bmesh/CMakeLists.txt 2013-03-13 05:23:53 UTC (rev 55224)
+++ trunk/blender/source/blender/bmesh/CMakeLists.txt 2013-03-13 05:33:23 UTC (rev 55225)
@@ -57,7 +57,6 @@
operators/bmo_smooth_laplacian.c
operators/bmo_symmetrize.c
operators/bmo_subdivide.c
- operators/bmo_subdivide.h
operators/bmo_triangulate.c
operators/bmo_unsubdivide.c
operators/bmo_utils.c
Modified: trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c 2013-03-13 05:23:53 UTC (rev 55224)
+++ trunk/blender/source/blender/bmesh/operators/bmo_subdivide.c 2013-03-13 05:33:23 UTC (rev 55225)
@@ -40,8 +40,48 @@
#include "intern/bmesh_operators_private.h" /* own include */
-#include "bmo_subdivide.h" /* own include */
+typedef struct SubDParams {
+ int numcuts;
+ float smooth;
+ float fractal;
+ float along_normal;
+ //int beauty;
+ bool use_smooth;
+ bool use_sphere;
+ bool use_fractal;
+ int seed;
+ int origkey; /* shapekey holding displaced vertex coordinates for current geometry */
+ BMOperator *op;
+ BMOpSlot *slot_edge_percents; /* BMO_slot_get(params->op->slots_in, "edge_percents"); */
+ BMOpSlot *slot_custom_patterns; /* BMO_slot_get(params->op->slots_in, "custom_patterns"); */
+ float fractal_ofs[3];
+} SubDParams;
+typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
+ const SubDParams *params);
+
+/*
+ * note: this is a pattern-based edge subdivider.
+ * it tries to match a pattern to edge selections on faces,
+ * then executes functions to cut them.
+ */
+typedef struct SubDPattern {
+ int seledges[20]; /* selected edges mask, for splitting */
+
+ /* verts starts at the first new vert cut, not the first vert in the face */
+ subd_pattern_fill_fp connectexec;
+ int len; /* total number of verts, before any subdivision */
+} SubDPattern;
+
+/* generic subdivision rules:
+ *
+ * - two selected edges in a face should make a link
+ * between them.
+ *
+ * - one edge should do, what? make pretty topology, or just
+ * split the edge only?
+ */
+
/* flags for all elements share a common bitfield space */
#define SUBD_SPLIT 1
@@ -151,7 +191,7 @@
mid_v3_v3v3(normal, vsta->no, vend->no);
ortho_basis_v3v3_v3(base1, base2, normal);
- add_v3_v3v3(co2, v->co, params->off);
+ add_v3_v3v3(co2, v->co, params->fractal_ofs);
mul_v3_fl(co2, 10.0f);
tvec[0] = fac * (BLI_gTurbulence(1.0, co2[0], co2[1], co2[2], 15, 0, 2) - 0.5f);
@@ -731,9 +771,7 @@
use_grid_fill = BMO_slot_bool_get(op->slots_in, "use_grid_fill");
use_only_quads = BMO_slot_bool_get(op->slots_in, "use_only_quads");
use_sphere = BMO_slot_bool_get(op->slots_in, "use_sphere");
-
- BLI_srandom(seed);
-
+
patterns[1] = NULL;
/* straight cut is patterns[1] == NULL */
switch (cornertype) {
@@ -790,9 +828,14 @@
params.use_fractal = (fractal != 0.0f);
params.use_sphere = use_sphere;
params.origkey = skey;
- params.off[0] = (float)BLI_drand() * 200.0f;
- params.off[1] = (float)BLI_drand() * 200.0f;
- params.off[2] = (float)BLI_drand() * 200.0f;
+
+ if (params.use_fractal) {
+ BLI_srandom(seed);
+
+ params.fractal_ofs[0] = (float)BLI_drand() * 200.0f;
+ params.fractal_ofs[1] = (float)BLI_drand() * 200.0f;
+ params.fractal_ofs[2] = (float)BLI_drand() * 200.0f;
+ }
BMO_slot_map_to_flag(bm, op->slots_in, "custom_patterns",
BM_FACE, FACE_CUSTOMFILL);
Deleted: trunk/blender/source/blender/bmesh/operators/bmo_subdivide.h
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_subdivide.h 2013-03-13 05:23:53 UTC (rev 55224)
+++ trunk/blender/source/blender/bmesh/operators/bmo_subdivide.h 2013-03-13 05:33:23 UTC (rev 55225)
@@ -1,72 +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): Joseph Eagar.
- *
- * ***** END GPL LICENSE BLOCK *****
- */
-
-/** \file blender/bmesh/operators/bmo_subdivide.h
- * \ingroup bmesh
- */
-
-#ifndef __BMO_SUBDIVIDE_H__
-#define __BMO_SUBDIVIDE_H__
-
-typedef struct SubDParams {
- int numcuts;
- float smooth;
- float fractal;
- float along_normal;
- //int beauty;
- short use_smooth;
- short use_sphere;
- short use_fractal;
- int seed;
- int origkey; /* shapekey holding displaced vertex coordinates for current geometry */
- BMOperator *op;
- BMOpSlot *slot_edge_percents; /* BMO_slot_get(params->op->slots_in, "edge_percents"); */
- BMOpSlot *slot_custom_patterns; /* BMO_slot_get(params->op->slots_in, "custom_patterns"); */
- float off[3];
-} SubDParams;
-
-typedef void (*subd_pattern_fill_fp)(BMesh *bm, BMFace *face, BMVert **verts,
- const SubDParams *params);
-
-/*
- * note: this is a pattern-based edge subdivider.
- * it tries to match a pattern to edge selections on faces,
- * then executes functions to cut them.
- */
-typedef struct SubDPattern {
- int seledges[20]; /* selected edges mask, for splitting */
-
- /* verts starts at the first new vert cut, not the first vert in the face */
- subd_pattern_fill_fp connectexec;
- int len; /* total number of verts, before any subdivision */
-} SubDPattern;
-
-/* generic subdivision rules:
- *
- * - two selected edges in a face should make a link
- * between them.
- *
- * - one edge should do, what? make pretty topology, or just
- * split the edge only?
- */
-
-#endif /* __BMO_SUBDIVIDE_H__ */
More information about the Bf-blender-cvs
mailing list