Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukas Tönne <lukas.toenne@gmail.com>2014-11-27 21:18:46 +0300
committerLukas Tönne <lukas.toenne@gmail.com>2015-04-20 13:14:30 +0300
commit5f44f4a2ffcbe7ab12aa02aac7ed22471d6807f5 (patch)
treea8a3142265dd402a8a5f9df61980b40a95fb0102 /source/blender/bmesh/intern/bmesh_strands.c
parentb0a9e48a19788145bf6c6a19ca080af7dec97614 (diff)
Intermediate commit: switching strand edit data to BMesh.
Hair/Strand editing will only use a subset of the bmesh topology and expect a specific topology that needs to be verified and enforced. However, this extra requirement is much less work than reimplementing a whole edit data system with the same feature set as bmesh and avoids much redundant code. Conflicts: source/blender/blenkernel/intern/customdata.c source/blender/makesdna/DNA_customdata_types.h
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_strands.c')
-rw-r--r--source/blender/bmesh/intern/bmesh_strands.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_strands.c b/source/blender/bmesh/intern/bmesh_strands.c
new file mode 100644
index 00000000000..efd40044f66
--- /dev/null
+++ b/source/blender/bmesh/intern/bmesh_strands.c
@@ -0,0 +1,77 @@
+/*
+ * ***** 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): Lukas Toenne.
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+/** \file blender/bmesh/intern/bmesh_strands.c
+ * \ingroup bmesh
+ */
+
+#include "MEM_guardedalloc.h"
+
+#include "BLI_utildefines.h"
+#include "BLI_mempool.h"
+
+#include "bmesh.h"
+#include "bmesh_private.h"
+
+/*
+ * STRANDS OF MESH CALLBACKS
+ */
+
+void bmstranditer__strands_of_mesh_begin(struct BMIter__elem_of_mesh *iter)
+{
+ BLI_mempool_iternew(iter->pooliter.pool, &iter->pooliter);
+}
+
+void *bmstranditer__strands_of_mesh_step(struct BMIter__elem_of_mesh *iter)
+{
+ BMVert *v;
+
+ do {
+ v = BLI_mempool_iterstep(&iter->pooliter);
+ } while (v && !BM_strands_vert_is_root(v));
+
+ return v;
+}
+
+/*
+ * VERTS OF STRAND CALLBACKS
+ */
+
+void bmstranditer__verts_of_strand_begin(struct BMIter__vert_of_edge *UNUSED(iter))
+{
+}
+
+void *bmstranditer__verts_of_strand_step(struct BMIter__vert_of_edge *iter)
+{
+ if (iter->edata) {
+ /* by definition the all strand edges run in the same direction,
+ * with the root being v1 of the first edge.
+ */
+ BMVert *v_curr = iter->edata->v1;
+
+ iter->edata = bmesh_disk_edge_next(iter->edata, iter->edata->v2);
+
+ return v_curr;
+ }
+ else
+ return NULL;
+}