[Bf-blender-cvs] [fe753e7] mesh-transfer-data: Cleanup: BKE_mesh_ prefix for loop island functions

Campbell Barton noreply at git.blender.org
Mon Nov 17 14:24:20 CET 2014


Commit: fe753e7f6d6480bd7e9ce56391efc7a0539dd38b
Author: Campbell Barton
Date:   Mon Nov 17 14:23:24 2014 +0100
Branches: mesh-transfer-data
https://developer.blender.org/rBfe753e7f6d6480bd7e9ce56391efc7a0539dd38b

Cleanup: BKE_mesh_ prefix for loop island functions

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

M	source/blender/blenkernel/BKE_mesh_mapping.h
M	source/blender/blenkernel/BKE_mesh_remap.h
M	source/blender/blenkernel/intern/data_transfer.c
M	source/blender/blenkernel/intern/mesh_mapping.c
M	source/blender/blenkernel/intern/mesh_remap.c

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

diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index d6fa468..0ae740a 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -152,12 +152,15 @@ typedef struct MeshIslands {
 	size_t allocated_islands;
 } MeshIslands;
 
-void BKE_loop_islands_init(MeshIslands *islands, const short item_type, const int num_items, const short island_type);
-void BKE_loop_islands_free(MeshIslands *islands);
-void BKE_loop_islands_add_island(MeshIslands *islands, const int num_items, int *item_indices,
-                                 const int num_island_items, int *island_item_indices);
-
-typedef bool (*loop_island_compute)(
+void BKE_mesh_loop_islands_init(
+        MeshIslands *islands,
+        const short item_type, const int num_items, const short island_type);
+void BKE_mesh_loop_islands_free(MeshIslands *islands);
+void BKE_mesh_loop_islands_add(
+        MeshIslands *islands, const int num_items, int *item_indices,
+        const int num_island_items, int *island_item_indices);
+
+typedef bool (*MeshRemapIslandsCalc)(
         struct MVert *verts, const int totvert,
         struct MEdge *edges, const int totedge,
         struct MPoly *polys, const int totpoly,
@@ -167,32 +170,19 @@ typedef bool (*loop_island_compute)(
 /* Above vert/UV mapping stuff does not do what we need here, but does things we do not need here.
  * So better keep them separated for now, I think.
  */
-bool BKE_loop_poly_island_compute_uv(
+bool BKE_mesh_calc_islands_loop_poly_uv(
         struct MVert *verts, const int totvert,
         struct MEdge *edges, const int totedge,
         struct MPoly *polys, const int totpoly,
         struct MLoop *loops, const int totloop,
         MeshIslands *r_islands);
 
-
 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);
 
-/** Callback deciding whether the given poly/loop/edge define an island boundary or not.
- */
-typedef bool (*MeshRemap_CheckIslandBoundary)(
-        const struct MPoly *mpoly, const struct MLoop *mloop, const struct MEdge *medge,
-        const int nbr_egde_users);
-
-void BKE_poly_loop_islands_compute(
-        const struct MEdge *medge, const int totedge, const struct MPoly *mpoly, const int totpoly,
-        const struct MLoop *mloop, const int totloop, const bool use_bitflags,
-        MeshRemap_CheckIslandBoundary edge_boundary_check,
-        int **r_poly_groups, int *r_totgroup);
-
 /* No good (portable) way to have exported inlined functions... */
 #define BKE_MESH_TESSFACE_VINDEX_ORDER(_mf, _v)  (                          \
     (CHECK_TYPE_INLINE(_mf, MFace *),                                       \
diff --git a/source/blender/blenkernel/BKE_mesh_remap.h b/source/blender/blenkernel/BKE_mesh_remap.h
index 535684b..1b88d05 100644
--- a/source/blender/blenkernel/BKE_mesh_remap.h
+++ b/source/blender/blenkernel/BKE_mesh_remap.h
@@ -156,7 +156,7 @@ void BKE_dm2mesh_mapping_loops_compute(
         struct MLoop *loops_dst, const int numloops_dst, struct MPoly *polys_dst, const int numpolys_dst,
         struct CustomData *ldata_dst, struct CustomData *pdata_dst, const float split_angle_dst,
         const bool dirty_nors_dst,
-        struct DerivedMesh *dm_src, loop_island_compute gen_islands_src, struct Mesh2MeshMapping *r_map);
+        struct DerivedMesh *dm_src, MeshRemapIslandsCalc gen_islands_src, struct Mesh2MeshMapping *r_map);
 
 void BKE_dm2mesh_mapping_polys_compute(
         const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
diff --git a/source/blender/blenkernel/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 6485636..f2f35d1 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -239,11 +239,11 @@ int BKE_data_transfer_dttype_to_fromto_idx(const int dtdata_type)
 
 /* ********** */
 
-static loop_island_compute data_transfer_get_loop_islands_generator(const int cddata_type)
+static MeshRemapIslandsCalc data_transfer_get_loop_islands_generator(const int cddata_type)
 {
 	switch (cddata_type) {
 		case CD_FAKE_UV:
-			return BKE_loop_poly_island_compute_uv;
+			return BKE_mesh_calc_islands_loop_poly_uv;
 			break;
 		default:
 			break;
@@ -935,7 +935,7 @@ bool BKE_data_transfer_dm(
 			CustomData *ldata_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
 			const int num_create = use_create ? me_dst->totloop : 0;
 
-			loop_island_compute island_callback = data_transfer_get_loop_islands_generator(cddata_type);
+			MeshRemapIslandsCalc island_callback = data_transfer_get_loop_islands_generator(cddata_type);
 
 			if (!geom_map_init[LDATA]) {
 				if ((map_loop_mode == M2MMAP_MODE_TOPOLOGY) && (num_loops_dst != dm_src->getNumLoops(dm_src))) {
diff --git a/source/blender/blenkernel/intern/mesh_mapping.c b/source/blender/blenkernel/intern/mesh_mapping.c
index b37be42..928d300 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.c
+++ b/source/blender/blenkernel/intern/mesh_mapping.c
@@ -381,7 +381,13 @@ void BKE_mesh_origindex_map_create(MeshElemMap **r_map, int **r_mem,
  * Used currently for UVs and 'smooth groups'.
  * \{ */
 
-void BKE_poly_loop_islands_compute(
+/** Callback deciding whether the given poly/loop/edge define an island boundary or not.
+ */
+typedef bool (*MeshRemap_CheckIslandBoundary)(
+        const struct MPoly *mpoly, const struct MLoop *mloop, const struct MEdge *medge,
+        const int nbr_egde_users);
+
+static void poly_loop_islands_calc(
         const MEdge *medge, const int totedge, const MPoly *mpoly, const int totpoly,
         const MLoop *mloop, const int totloop, const bool use_bitflags,
         MeshRemap_CheckIslandBoundary edge_boundary_check,
@@ -556,21 +562,24 @@ int *BKE_mesh_calc_smoothgroups(const MEdge *medge, const int totedge,
 {
 	int *poly_groups = NULL;
 
-	BKE_poly_loop_islands_compute(medge, totedge, mpoly, totpoly, mloop, totloop, use_bitflags,
-	                              poly_is_island_boundary_smooth_cb, &poly_groups, r_totgroup);
+	poly_loop_islands_calc(
+	        medge, totedge, mpoly, totpoly, mloop, totloop, use_bitflags,
+	        poly_is_island_boundary_smooth_cb, &poly_groups, r_totgroup);
 
 	return poly_groups;
 }
 
 
-void BKE_loop_islands_init(MeshIslands *islands, const short item_type, const int num_items, const short island_type)
+void BKE_mesh_loop_islands_init(
+        MeshIslands *islands,
+        const short item_type, const int num_items, const short island_type)
 {
 	MemArena *mem = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
 
 	BLI_assert(ELEM(item_type, MISLAND_TYPE_VERT, MISLAND_TYPE_EDGE, MISLAND_TYPE_POLY, MISLAND_TYPE_LOOP));
 	BLI_assert(ELEM(island_type, MISLAND_TYPE_VERT, MISLAND_TYPE_EDGE, MISLAND_TYPE_POLY, MISLAND_TYPE_LOOP));
 
-	BKE_loop_islands_free(islands);
+	BKE_mesh_loop_islands_free(islands);
 
 	islands->item_type = item_type;
 	islands->nbr_items = num_items;
@@ -583,7 +592,7 @@ void BKE_loop_islands_init(MeshIslands *islands, const short item_type, const in
 	islands->mem = mem;
 }
 
-void BKE_loop_islands_free(MeshIslands *islands)
+void BKE_mesh_loop_islands_free(MeshIslands *islands)
 {
 	MemArena *mem = islands->mem;
 
@@ -603,8 +612,9 @@ void BKE_loop_islands_free(MeshIslands *islands)
 	islands->allocated_islands = 0;
 }
 
-void BKE_loop_islands_add_island(MeshIslands *islands, const int num_items, int *items_indices,
-                                 const int num_island_items, int *island_item_indices)
+void BKE_mesh_loop_islands_add(
+        MeshIslands *islands, const int num_items, int *items_indices,
+        const int num_island_items, int *island_item_indices)
 {
 	MemArena *mem = islands->mem;
 
@@ -647,9 +657,12 @@ static bool mesh_check_island_boundary_uv(
 	return (me->flag & ME_SEAM) != 0;
 }
 
-/* Note: all this could be optimized... Not sure it would be worth the more complex code, though, those loops
- *       are supposed to be really quick to do... */
-bool BKE_loop_poly_island_compute_uv(
+/**
+ * \note all this could be optimized...
+ * Not sure it would be worth the more complex code, though, those loops
+ * are supposed to be really quick to do...
+ */
+bool BKE_mesh_calc_islands_loop_poly_uv(
         MVert *UNUSED(verts), const int UNUSED(totvert),
         MEdge *edges, const int totedge,
         MPoly *polys, const int totpoly,
@@ -666,10 +679,10 @@ bool BKE_loop_poly_island_compute_uv(
 
 	int grp_idx, p_idx, pl_idx, l_idx;
 
-	BKE_loop_islands_free(r_islands);
-	BKE_loop_islands_init(r_islands, MISLAND_TYPE_LOOP, totloop, MISLAND_TYPE_POLY);
+	BKE_mesh_loop_islands_free(r_islands);
+	BKE_mesh_loop_islands_init(r_islands, MISLAND_TYPE_LOOP, totloop, MISLAND_TYPE_POLY);
 
-	BKE_poly_loop_islands_compute(
+	poly_loop_islands_calc(
 	        edges, totedge, polys, totpoly, loops, totloop, false,
 	        mesh_check_island_boundary_uv, &poly_groups, &num_poly_groups);
 
@@ -696,7 +709,7 @@ bool BKE_loop_poly_island_compute_uv(
 			}
 		}
 
-		BKE_loop_islands_add_island(r_islands, num_lidx, loop_indices, num_pidx, poly_indices);
+		BKE_mesh_loop_islands_add(r_islands, num_lidx, loop_indices, num_pidx, poly_indices);
 	}
 
 	MEM_freeN(poly_indices);
diff --git a/source/blender/blenkernel/intern/mesh_remap.c b/source/blender/blenkernel/intern/mesh_remap.c
index be171c4..676a955 100644
--- a/source/blender/blenkernel/intern/mesh_remap.c
+++ b/source/blender/blenkernel/intern/mesh_remap.c
@@ -738,7 +738,7 @@ void BKE_dm2mesh_mapping_loops_compute(
         MVert *verts_dst, const int numverts_dst, MEdge *edges_dst, const int numedges_dst,
         MLoop *loops_dst, const int numloops_dst, MPoly *polys_dst, const int numpolys_dst,
         CustomData *ldata_dst, CustomData *pdata_dst, const float split_angle_dst, const bool dirty_nors_dst,
-        DerivedMesh *dm_src, loop_island_compute gen_islands_src, Mesh2MeshMapping *r_map)
+        DerivedMesh *dm_src, MeshRemapIslandsCalc gen

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list