[Bf-blender-cvs] [f22c39e] temp-array-modifier: Cleanup: comments

Campbell Barton noreply at git.blender.org
Tue Aug 12 04:51:56 CEST 2014


Commit: f22c39e11440b96da470fc84179e85c2b8e8d00a
Author: Campbell Barton
Date:   Tue Aug 12 12:51:39 2014 +1000
Branches: temp-array-modifier
https://developer.blender.org/rBf22c39e11440b96da470fc84179e85c2b8e8d00a

Cleanup: comments

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

M	source/blender/blenkernel/intern/cdderivedmesh.c
M	source/blender/modifiers/intern/MOD_array.c

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

diff --git a/source/blender/blenkernel/intern/cdderivedmesh.c b/source/blender/blenkernel/intern/cdderivedmesh.c
index bef3b56..3247295 100644
--- a/source/blender/blenkernel/intern/cdderivedmesh.c
+++ b/source/blender/blenkernel/intern/cdderivedmesh.c
@@ -2717,7 +2717,7 @@ typedef struct PolyKey {
 
 static unsigned int poly_ghash_hash_fn(const void *key) 
 {
-	PolyKey *pk = (PolyKey*)key;
+	PolyKey *pk = (PolyKey *)key;
 	return pk->hash_sum;
 }
 
@@ -2760,7 +2760,7 @@ static int poly_ghash_compare_fn(const void *k1, const void *k2)
  * Indeed it could be that all of a poly's vertices are merged,
  * but merged to vertices that do not make up a single poly,
  * in which case the original poly should not be dumped.
- * Actually this later behaviour could apply to the Mirror Modifier as well, but the additional checks are
+ * Actually this later behavior could apply to the Mirror Modifier as well, but the additional checks are
  * costly and not necessary in the case of mirror, because each vertex is only merged to its own mirror.
  *
  * \note #CDDM_recalc_tessellation has to run on the returned DM if you want to access tessfaces.
@@ -2879,7 +2879,8 @@ DerivedMesh *CDDM_merge_verts(DerivedMesh *dm, const int *vtargetmap, const int
 		PolyKey *mpgh;
 		poly_keys = MEM_mallocN(sizeof(PolyKey)* totpoly, "CDDM_merge_verts poly keys");
 		poly_ghash = BLI_ghash_new_ex(poly_ghash_hash_fn, poly_ghash_compare_fn, "CDDM_merge_verts poly hash", totpoly);
-		BLI_ghash_flag_set(poly_ghash, GHASH_FLAG_ALLOW_DUPES);  /* Duplicates allowed because our compare function is not pure equality */
+		/* Duplicates allowed because our compare function is not pure equality */
+		BLI_ghash_flag_set(poly_ghash, GHASH_FLAG_ALLOW_DUPES);
 
 		mp = cddm->mpoly;
 		mpgh = poly_keys;
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c
index adc48b3..76f3f52 100644
--- a/source/blender/modifiers/intern/MOD_array.c
+++ b/source/blender/modifiers/intern/MOD_array.c
@@ -157,11 +157,11 @@ BLI_INLINE float sum_v3(const float v[3])
 	return v[0] + v[1] + v[2];
 }
 
-/* Little structure used for sorting vertices, when processing doubles */
+/* Structure used for sorting vertices, when processing doubles */
 typedef struct SortVertsElem {
-	int vertex_num;   /* The original index of the vertex, prior to sorting */
-	float co[3];      /* Its coordinates */
-	float sum_co;     /* sum_v3(co), just so we don't do the sum many times.  */
+	int vertex_num;     /* The original index of the vertex, prior to sorting */
+	float co[3];        /* Its coordinates */
+	float sum_co;       /* sum_v3(co), just so we don't do the sum many times.  */
 } SortVertsElem;
 
 
@@ -185,11 +185,12 @@ static void svert_from_mvert(SortVertsElem *sv, const MVert *mv, const int i_beg
 	}
 }
 
-/* map_doubles takes as inputs two sets of verts, to be processed for detection of doubles and mapping.
+/**
+ * Take as inputs two sets of verts, to be processed for detection of doubles and mapping.
  * Each set of verts is defined by its start within mverts array and its num_verts;
  * It builds a mapping for all vertices within source, to vertices within target, or -1 if no double found
  * The int doubles_map[num_verts_source] array must have been allocated by caller.
-*/
+ */
 static void dm_mvert_map_doubles(
         int *doubles_map,
         const MVert *mverts,
@@ -277,7 +278,8 @@ static void dm_mvert_map_doubles(
 			/* v_target is within dist3 of v_source in terms of sumco;  check real distance */
 			if (compare_len_v3v3(sve_source->co, sve_target->co, dist)) {
 				/* Double found */
-				/* If double target is itself already mapped to other vertex, behaviour depends on with_follow option */
+				/* If double target is itself already mapped to other vertex,
+				 * behavior depends on with_follow option */
 				int target_vertex = sve_target->vertex_num;
 				if (doubles_map[target_vertex] != -1) {
 					if (with_follow) { /* with_follow option:  map to initial target */
@@ -523,8 +525,8 @@ static DerivedMesh *arrayModifier_doArray(
 	DM_copy_loop_data(dm, result_dm, 0, 0, chunk_nloops);
 	DM_copy_poly_data(dm, result_dm, 0, 0, chunk_npolys);
 
-	/* subsurf for eg wont have mesh data in the */
-	/* now add mvert/medge/mface layers */
+	/* subsurf for eg wont have mesh data in the
+	 * now add mvert/medge/mface layers */
 
 	if (!CustomData_has_layer(&dm->vertData, CD_MVERT)) {
 		dm->copyVertArray(dm, result_dm_verts);
@@ -582,8 +584,8 @@ static DerivedMesh *arrayModifier_doArray(
 		/* Handle merge between chunk n and n-1 */
 		if ((amd->flags & MOD_ARR_MERGE) && (c >= 1)) {
 			if (!offset_has_scale && (c >= 2)) {
-				/* Mapping chunk 3 to chunk 2 is a translation of mapping 2 to 1 */
-				/* ... that is except if scaling makes the distance grow */
+				/* Mapping chunk 3 to chunk 2 is a translation of mapping 2 to 1
+				 * ... that is except if scaling makes the distance grow */
 				int k;
 				int this_chunk_index = c * chunk_nverts;
 				int prev_chunk_index = (c - 1) * chunk_nverts;
@@ -591,10 +593,11 @@ static DerivedMesh *arrayModifier_doArray(
 					int target = full_doubles_map[prev_chunk_index];
 					if (target != -1) {
 						target += chunk_nverts; /* translate mapping */
-						/* The rule here is to not follow mapping to chunk N-2, which could be too far */
-						/* so if target vertex was itself mapped, then this vertex is not mapped */
-						if (full_doubles_map[target] != -1)
+						/* The rule here is to not follow mapping to chunk N-2, which could be too far
+						 * so if target vertex was itself mapped, then this vertex is not mapped */
+						if (full_doubles_map[target] != -1) {
 							target = -1;
+						}
 					}
 					full_doubles_map[this_chunk_index] = target;
 				}
@@ -613,7 +616,7 @@ static DerivedMesh *arrayModifier_doArray(
 		}
 	}
 
-	last_chunk_start = (count -1) * chunk_nverts;
+	last_chunk_start = (count - 1) * chunk_nverts;
 	last_chunk_nverts = chunk_nverts;
 
 	copy_m4_m4(final_offset, current_offset);
@@ -683,7 +686,8 @@ static DerivedMesh *arrayModifier_doArray(
 			        amd->merge_dist,
 			        false);
 		}
-	}  /* Done capping */
+	}
+	/* done capping */
 
 	/* Handle merging */
 	tot_doubles = 0;




More information about the Bf-blender-cvs mailing list