[Bf-blender-cvs] [e23f77b] master: Code Cleanup: move mesh mapping functions into their own file/header

Campbell Barton noreply at git.blender.org
Thu Dec 12 06:29:50 CET 2013


Commit: e23f77b935c3d0a5f1cbc300d25000a0fdd1f765
Author: Campbell Barton
Date:   Thu Dec 12 16:26:11 2013 +1100
http://developer.blender.org/rBe23f77b935c3d0a5f1cbc300d25000a0fdd1f765

Code Cleanup: move mesh mapping functions into their own file/header

===================================================================

M	source/blender/blenkernel/BKE_mesh.h
A	source/blender/blenkernel/BKE_mesh_mapping.h
M	source/blender/blenkernel/CMakeLists.txt
M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/blenkernel/intern/mesh_evaluate.c
A	source/blender/blenkernel/intern/mesh_mapping.c
M	source/blender/blenkernel/intern/multires.c
M	source/blender/blenkernel/intern/subsurf_ccg.c
M	source/blender/editors/mesh/editmesh_utils.c
M	source/blender/editors/object/object_modifier.c
M	source/blender/editors/object/object_vgroup.c
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_uv.c
M	source/blender/editors/transform/transform_conversions.c
M	source/blender/editors/uvedit/uvedit_ops.c
M	source/blender/editors/uvedit/uvedit_smart_stitch.c
M	source/blender/makesrna/intern/rna_mesh_api.c
M	source/blender/modifiers/intern/MOD_laplaciandeform.c
M	source/blender/modifiers/intern/MOD_skin.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index a3d1eb7..500b3d8 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -201,89 +201,6 @@ bool BKE_mesh_center_median(struct Mesh *me, float cent[3]);
 bool BKE_mesh_center_bounds(struct Mesh *me, float cent[3]);
 bool BKE_mesh_center_centroid(struct Mesh *me, float cent[3]);
 
-
-/* map from uv vertex to face (for select linked, stitch, uv suburf) */
-
-/* UvVertMap */
-#define STD_UV_CONNECT_LIMIT  0.0001f
-
-typedef struct UvVertMap {
-	struct UvMapVert **vert;
-	struct UvMapVert *buf;
-} UvVertMap;
-
-typedef struct UvMapVert {
-	struct UvMapVert *next;
-	unsigned int f;
-	unsigned char tfindex, separate, flag;
-} UvMapVert;
-
-/* UvElement stores per uv information so that we can quickly access information for a uv.
- * it is actually an improved UvMapVert, including an island and a direct pointer to the face
- * to avoid initializing face arrays */
-typedef struct UvElement {
-	/* Next UvElement corresponding to same vertex */
-	struct UvElement *next;
-	/* Face the element belongs to */
-	struct BMLoop *l;
-	/* index in loop. */
-	unsigned short tfindex;
-	/* Whether this element is the first of coincident elements */
-	unsigned char separate;
-	/* general use flag */
-	unsigned char flag;
-	/* If generating element map with island sorting, this stores the island index */
-	unsigned short island;
-} UvElement;
-
-
-/* UvElementMap is a container for UvElements of a mesh. It stores some UvElements belonging to the
- * same uv island in sequence and the number of uvs per island so it is possible to access all uvs
- * belonging to an island directly by iterating through the buffer.
- */
-typedef struct UvElementMap {
-	/* address UvElements by their vertex */
-	struct UvElement **vert;
-	/* UvElement Store */
-	struct UvElement *buf;
-	/* Total number of UVs in the layer. Useful to know */
-	int totalUVs;
-	/* Number of Islands in the mesh */
-	int totalIslands;
-	/* Stores the starting index in buf where each island begins */
-	int *islandIndices;
-} UvElementMap;
-
-/* invalid island index is max short. If any one has the patience
- * to make that many islands, he can bite me :p */
-#define INVALID_ISLAND 0xFFFF
-
-/* Connectivity data */
-typedef struct MeshElemMap {
-	int *indices;
-	int count;
-} MeshElemMap;
-
-/* mapping */
-UvVertMap *BKE_mesh_uv_vert_map_create(
-        struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
-        unsigned int totpoly, unsigned int totvert, int selected, float *limit);
-UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v);
-void       BKE_mesh_uv_vert_map_free(UvVertMap *vmap);
-
-void BKE_mesh_vert_poly_map_create(
-        MeshElemMap **r_map, int **r_mem,
-        const struct MPoly *mface, const struct MLoop *mloop,
-        int totvert, int totface, int totloop);
-void BKE_mesh_vert_edge_map_create(
-        MeshElemMap **r_map, int **r_mem,
-        const struct MEdge *medge, int totvert, int totedge);
-void BKE_mesh_edge_poly_map_create(
-        MeshElemMap **r_map, int **r_mem,
-        const struct MEdge *medge, const int totedge,
-        const struct MPoly *mpoly, const int totpoly,
-        const struct MLoop *mloop, const int totloop);
-
 /* tessface */
 void BKE_mesh_loops_to_mface_corners(
         struct CustomData *fdata, struct CustomData *ldata,
@@ -335,13 +252,6 @@ void BKE_mesh_flush_select_from_verts_ex(
         struct MPoly *mpoly,       const int totpoly);
 void BKE_mesh_flush_select_from_verts(struct Mesh *me);
 
-/* smoothgroups */
-int *BKE_mesh_calc_smoothgroups(
-        const struct MEdge *medge, const int totedge,
-        const struct MPoly *mpoly, const int totpoly,
-        const struct MLoop *mloop, const int totloop,
-        int *r_totgroup, const bool use_bitflags);
-
 /* spatial evaluation */
 void BKE_mesh_calc_relative_deform(
         const struct MPoly *mpoly, const int totpoly,
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
new file mode 100644
index 0000000..3c5377d
--- /dev/null
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -0,0 +1,128 @@
+/*
+ * ***** 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): (mar-2001 nzc)
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+#ifndef __BKE_MESH_MAPPING_H__
+#define __BKE_MESH_MAPPING_H__
+
+/** \file BKE_mesh_mapping.h
+ *  \ingroup bke
+ */
+
+struct MPoly;
+struct MEdge;
+struct MLoop;
+struct MLoopUV;
+
+/* map from uv vertex to face (for select linked, stitch, uv suburf) */
+
+/* UvVertMap */
+#define STD_UV_CONNECT_LIMIT  0.0001f
+
+typedef struct UvVertMap {
+	struct UvMapVert **vert;
+	struct UvMapVert *buf;
+} UvVertMap;
+
+typedef struct UvMapVert {
+	struct UvMapVert *next;
+	unsigned int f;
+	unsigned char tfindex, separate, flag;
+} UvMapVert;
+
+/* UvElement stores per uv information so that we can quickly access information for a uv.
+ * it is actually an improved UvMapVert, including an island and a direct pointer to the face
+ * to avoid initializing face arrays */
+typedef struct UvElement {
+	/* Next UvElement corresponding to same vertex */
+	struct UvElement *next;
+	/* Face the element belongs to */
+	struct BMLoop *l;
+	/* index in loop. */
+	unsigned short tfindex;
+	/* Whether this element is the first of coincident elements */
+	unsigned char separate;
+	/* general use flag */
+	unsigned char flag;
+	/* If generating element map with island sorting, this stores the island index */
+	unsigned short island;
+} UvElement;
+
+
+/* UvElementMap is a container for UvElements of a mesh. It stores some UvElements belonging to the
+ * same uv island in sequence and the number of uvs per island so it is possible to access all uvs
+ * belonging to an island directly by iterating through the buffer.
+ */
+typedef struct UvElementMap {
+	/* address UvElements by their vertex */
+	struct UvElement **vert;
+	/* UvElement Store */
+	struct UvElement *buf;
+	/* Total number of UVs in the layer. Useful to know */
+	int totalUVs;
+	/* Number of Islands in the mesh */
+	int totalIslands;
+	/* Stores the starting index in buf where each island begins */
+	int *islandIndices;
+} UvElementMap;
+
+/* invalid island index is max short. If any one has the patience
+ * to make that many islands, he can bite me :p */
+#define INVALID_ISLAND 0xFFFF
+
+/* Connectivity data */
+typedef struct MeshElemMap {
+	int *indices;
+	int count;
+} MeshElemMap;
+
+/* mapping */
+UvVertMap *BKE_mesh_uv_vert_map_create(
+        struct MPoly *mpoly, struct MLoop *mloop, struct MLoopUV *mloopuv,
+        unsigned int totpoly, unsigned int totvert, int selected, float *limit);
+UvMapVert *BKE_mesh_uv_vert_map_get_vert(UvVertMap *vmap, unsigned int v);
+void       BKE_mesh_uv_vert_map_free(UvVertMap *vmap);
+
+void BKE_mesh_vert_poly_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const struct MPoly *mface, const struct MLoop *mloop,
+        int totvert, int totface, int totloop);
+void BKE_mesh_vert_edge_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const struct MEdge *medge, int totvert, int totedge);
+void BKE_mesh_edge_poly_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const struct MEdge *medge, const int totedge,
+        const struct MPoly *mpoly, const int totpoly,
+        const struct MLoop *mloop, const int totloop);
+
+/* smoothgroups */
+int *BKE_mesh_calc_smoothgroups(
+        const struct MEdge *medge, const int totedge,
+        const struct MPoly *mpoly, const int totpoly,
+        const struct MLoop *mloop, const int totloop,
+        int *r_totgroup, const bool use_bitflags);
+
+#endif  /* __BKE_MESH_MAPPING_H__ */
diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt
index 437956f..c4c4427 100644
--- a/source/blender/blenkernel/CMakeLists.txt
+++ b/source/blender/blenkernel/CMakeLists.txt
@@ -115,6 +115,7 @@ set(SRC
 	intern/mball.c
 	intern/mesh.c
 	intern/mesh_evaluate.c
+    intern/mesh_mapping.c
 	intern/mesh_validate.c
 	intern/modifier.c
 	intern/modifiers_bmesh.c
@@ -212,6 +213,7 @@ set(SRC
 	BKE_material.h
 	BKE_mball.h
 	BKE_mesh.h
+    BKE_mesh_mapping.h
 	BKE_modifier.h
 	BKE_movieclip.h
 	BKE_multires.h
diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index d57d918..e95847b 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -48,6 +48,7 @@
 #include "BKE_cdderivedmesh.h"
 #include "BKE_global.h"
 #include "BKE_mesh.h"
+#include "BKE_mesh_mapping.h"
 #include "BKE_paint.h"
 #include "BKE_editmesh.h"
 #include "BKE_curve.h"
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c
index 0a85d2b..24362c1 100644
--- a/source/blender/blenkernel/intern/mesh_evaluate.c
+++ b/source/blender/blenkernel/intern/mesh_evaluate.c
@@ -942,259 +942,6 @@ bool BKE_mesh_center_centroid(Mesh *me, float cent[3])
 
 /* -------------------------------------------------------------------- */
 
-/** \name Mesh Connectivity Mapping
- * \{ */
-
-
-/* ngon version wip, based on BM_uv_vert_map_create */
-/* this replaces the non bmesh function (in trunk) 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list