[Bf-blender-cvs] [d3db6e7] mesh-transfer-data: Cleanup/reorganization: follow convention for vert/edge/loop/poly order.

Bastien Montagne noreply at git.blender.org
Sun Nov 9 18:45:20 CET 2014


Commit: d3db6e72997afb82d839dda938684e26d3ea3396
Author: Bastien Montagne
Date:   Sun Nov 9 18:11:37 2014 +0100
Branches: mesh-transfer-data
https://developer.blender.org/rBd3db6e72997afb82d839dda938684e26d3ea3396

Cleanup/reorganization: follow convention for vert/edge/loop/poly order.

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

M	source/blender/blenkernel/BKE_data_transfer.h
M	source/blender/blenkernel/BKE_mesh_mapping.h
M	source/blender/blenkernel/intern/data_transfer.c
M	source/blender/blenkernel/intern/mesh_mapping.c
M	source/blender/editors/object/object_data_transfer.c
M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_datatransfer.c

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

diff --git a/source/blender/blenkernel/BKE_data_transfer.h b/source/blender/blenkernel/BKE_data_transfer.h
index fdc46a0..c1e376d 100644
--- a/source/blender/blenkernel/BKE_data_transfer.h
+++ b/source/blender/blenkernel/BKE_data_transfer.h
@@ -114,14 +114,14 @@ enum {
 
 bool BKE_data_transfer_mesh(
         struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, const int data_types, const bool use_create,
-        const int map_vert_mode, const int map_edge_mode, const int map_poly_mode, const int map_loop_mode,
+        const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode,
         struct SpaceTransform *space_transform, const float max_distance, const float precision,
         const int fromlayers_select[DT_MULTILAYER_IDX_MAX], const int tolayers_select[DT_MULTILAYER_IDX_MAX],
         const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup);
 bool BKE_data_transfer_dm(
         struct Scene *scene, struct Object *ob_src, struct Object *ob_dst, struct DerivedMesh *dm_dst,
         const int data_types, const bool use_create,
-        const int map_vert_mode, const int map_edge_mode, const int map_poly_mode, const int map_loop_mode,
+        const int map_vert_mode, const int map_edge_mode, const int map_loop_mode, const int map_poly_mode,
         struct SpaceTransform *space_transform, const float max_distance, const float ray_radius,
         const int fromlayers_select[DT_MULTILAYER_IDX_MAX], const int tolayers_select[DT_MULTILAYER_IDX_MAX],
         const int mix_mode, const float mix_factor, const char *vgroup_name, const bool invert_vgroup);
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index 521dc4f..47ffe1f 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -203,8 +203,8 @@ void BKE_mesh2mesh_mapping_item_define_invalid(Mesh2MeshMapping *map, const int
 enum {
 	M2MMAP_USE_VERT                      = 1 << 4,
 	M2MMAP_USE_EDGE                      = 1 << 5,
-	M2MMAP_USE_POLY                      = 1 << 6,
-	M2MMAP_USE_LOOP                      = 1 << 7,
+	M2MMAP_USE_LOOP                      = 1 << 6,
+	M2MMAP_USE_POLY                      = 1 << 7,
 
 	M2MMAP_USE_NEAREST                   = 1 << 8,
 	M2MMAP_USE_NORPROJ                   = 1 << 9,
@@ -245,21 +245,10 @@ enum {
 	/* Cast a set of rays from along dest edge, interpolating its vertices' normals, and use hit source edges. */
 	M2MMAP_MODE_EDGE_EDGEINTERP_VNORPROJ = M2MMAP_MODE_EDGE | M2MMAP_USE_VERT | M2MMAP_USE_NORPROJ | M2MMAP_USE_INTERP,
 
-	/* ***** Target's polygons ***** */
-	M2MMAP_MODE_POLY                     = 1 << 26,
-
-	/* Nearest source poly. */
-	M2MMAP_MODE_POLY_NEAREST             = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NEAREST,
-	/* Source poly from best normal-matching dest poly. */
-	M2MMAP_MODE_POLY_NOR                 = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NORMAL,
-
-	/* Project dest poly onto source mesh using its normal, and use interpolation of all intersecting source polys. */
-	M2MMAP_MODE_POLY_POLYINTERP_PNORPROJ = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NORPROJ | M2MMAP_USE_INTERP,
-
 	/* ***** Target's loops ***** */
 	/* Note: when islands are given to loop mapping func, all loops from the same destination face will always be mapped
 	 *       to loops of source faces within a same island, regardless of mapping mode. */
-	M2MMAP_MODE_LOOP                     = 1 << 27,
+	M2MMAP_MODE_LOOP                     = 1 << 26,
 
 	/* Best normal-matching loop from nearest vert. */
 	M2MMAP_MODE_LOOP_NEAREST_LOOPNOR     = M2MMAP_MODE_LOOP | M2MMAP_USE_LOOP | M2MMAP_USE_VERT | M2MMAP_USE_NEAREST | M2MMAP_USE_NORMAL,
@@ -274,8 +263,19 @@ enum {
 	/* Point on nearest face hit by ray from target loop's normal. */
 	M2MMAP_MODE_LOOP_POLYINTERP_LNORPROJ = M2MMAP_MODE_LOOP | M2MMAP_USE_POLY | M2MMAP_USE_NORPROJ | M2MMAP_USE_INTERP,
 
+	/* ***** Target's polygons ***** */
+	M2MMAP_MODE_POLY                     = 1 << 27,
+
+	/* Nearest source poly. */
+	M2MMAP_MODE_POLY_NEAREST             = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NEAREST,
+	/* Source poly from best normal-matching dest poly. */
+	M2MMAP_MODE_POLY_NOR                 = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NORMAL,
+
+	/* Project dest poly onto source mesh using its normal, and use interpolation of all intersecting source polys. */
+	M2MMAP_MODE_POLY_POLYINTERP_PNORPROJ = M2MMAP_MODE_POLY | M2MMAP_USE_POLY | M2MMAP_USE_NORPROJ | M2MMAP_USE_INTERP,
+
 	/* ***** Same topology, applies to all four elements types. ***** */
-	M2MMAP_MODE_TOPOLOGY                 = M2MMAP_MODE_VERT | M2MMAP_MODE_EDGE | M2MMAP_MODE_POLY | M2MMAP_MODE_LOOP,
+	M2MMAP_MODE_TOPOLOGY                 = M2MMAP_MODE_VERT | M2MMAP_MODE_EDGE | M2MMAP_MODE_LOOP | M2MMAP_MODE_POLY,
 };
 
 /* TODO add mesh2mesh versions (we'll need mesh versions of bvhtree funcs too, though!). */
@@ -290,19 +290,20 @@ void BKE_dm2mesh_mapping_edges_compute(
         const struct MVert *verts_dst, const int numverts_dst, const struct MEdge *edges_dst, const int numedges_dst,
         struct DerivedMesh *dm_src, 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,
-        struct MVert *verts_dst, const int numverts_dst, struct MPoly *polys_dst, const int numpolys_dst,
-        struct MLoop *loops_dst, const int numloops_dst, struct CustomData *pdata_dst, struct DerivedMesh *dm_src,
-        struct Mesh2MeshMapping *r_map);
-
 void BKE_dm2mesh_mapping_loops_compute(
         const int mode, const struct SpaceTransform *space_transform, const float max_dist, const float ray_radius,
         struct MVert *verts_dst, const int numverts_dst, struct MEdge *edges_dst, const int numedges_dst,
-        struct MPoly *polys_dst, const int numpolys_dst, struct MLoop *loops_dst, const int numloops_dst,
-        struct CustomData *pdata_dst, struct CustomData *ldata_dst, const float split_angle_dst,
+        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,
         struct DerivedMesh *dm_src, loop_island_compute 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,
+        struct MVert *verts_dst, const int numverts_dst, struct MLoop *loops_dst, const int numloops_dst,
+        struct MPoly *polys_dst, const int numpolys_dst, struct CustomData *pdata_dst, struct DerivedMesh *dm_src,
+        struct Mesh2MeshMapping *r_map);
+
+
 /* 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/intern/data_transfer.c b/source/blender/blenkernel/intern/data_transfer.c
index 5b3d806..8967143d 100644
--- a/source/blender/blenkernel/intern/data_transfer.c
+++ b/source/blender/blenkernel/intern/data_transfer.c
@@ -580,7 +580,7 @@ static bool data_transfer_layersmapping_generate(
 			return false;
 		}
 	}
-	if (elem_type == ME_EDGE) {
+	else if (elem_type == ME_EDGE) {
 		if (!(cddata_type & CD_FAKE)) {  /* Unused for edges, currently... */
 			cd_src = dm_src->getEdgeDataLayout(dm_src);
 			cd_dst = dm_dst ? dm_dst->getEdgeDataLayout(dm_dst) : &me_dst->edata;
@@ -663,14 +663,14 @@ static bool data_transfer_layersmapping_generate(
 			return false;
 		}
 	}
-	if (elem_type == ME_POLY) {
+	else if (elem_type == ME_LOOP) {
 		if (cddata_type == CD_FAKE_UV) {
-			cddata_type = CD_MTEXPOLY;
+			cddata_type = CD_MLOOPUV;
 		}
 
 		if (!(cddata_type & CD_FAKE)) {
-			cd_src = dm_src->getPolyDataLayout(dm_src);
-			cd_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
+			cd_src = dm_src->getLoopDataLayout(dm_src);
+			cd_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
 
 			if (!CustomData_has_layer(cd_src, cddata_type)) {
 				return false;
@@ -685,31 +685,18 @@ static bool data_transfer_layersmapping_generate(
 			}
 			return true;
 		}
-		else if (cddata_type == CD_FAKE_SHARP) {
-			const size_t elem_size = sizeof(*((MPoly *)NULL));
-			const size_t data_size = sizeof(((MPoly *)NULL)->flag);
-			const size_t data_offset = offsetof(MPoly, flag);
-			const uint64_t data_flag = ME_SMOOTH;
-			data_transfer_layersmapping_add_item(r_map, cddata_type, mix_mode, mix_factor, mix_weights,
-			                                     dm_src->getPolyArray(dm_src),
-			                                     dm_dst ? dm_dst->getPolyArray(dm_dst) : me_dst->mpoly,
-			                                     dm_src->getNumPolys(dm_src),
-			                                     dm_dst ? dm_dst->getNumPolys(dm_dst) : me_dst->totpoly,
-			                                     elem_size, data_size, data_offset, data_flag, NULL);
-			return true;
-		}
 		else {
 			return false;
 		}
 	}
-	if (elem_type == ME_LOOP) {
+	else if (elem_type == ME_POLY) {
 		if (cddata_type == CD_FAKE_UV) {
-			cddata_type = CD_MLOOPUV;
+			cddata_type = CD_MTEXPOLY;
 		}
 
 		if (!(cddata_type & CD_FAKE)) {
-			cd_src = dm_src->getLoopDataLayout(dm_src);
-			cd_dst = dm_dst ? dm_dst->getLoopDataLayout(dm_dst) : &me_dst->ldata;
+			cd_src = dm_src->getPolyDataLayout(dm_src);
+			cd_dst = dm_dst ? dm_dst->getPolyDataLayout(dm_dst) : &me_dst->pdata;
 
 			if (!CustomData_has_layer(cd_src, cddata_type)) {
 				return false;
@@ -724,6 +711,19 @@ static bool data_transfer_layersmapping_generate(
 			}
 			return true;
 		}
+		else if (cddata_type == CD_FAKE_SHARP) {
+			const size_t elem_size = sizeof(*((MPoly *)NULL));
+			const size_t data_size = sizeof(((MPoly *)NULL)->flag);
+			const size_t data_offset = offsetof(MPoly, flag);
+			const uint64_t data_flag = ME_SMOOTH;
+			data_transfer_layersmapping_add_it

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list