[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60022] trunk/blender: misc minor changes

Campbell Barton ideasman42 at gmail.com
Tue Sep 10 21:23:39 CEST 2013


Revision: 60022
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60022
Author:   campbellbarton
Date:     2013-09-10 19:23:39 +0000 (Tue, 10 Sep 2013)
Log Message:
-----------
misc minor changes
- make cmake osx use of -ftemplate-depth match scons.
- use array size within sizeof(), more compact.
- replace AT with __func__ where the function is unique enough.
- BLI_box_pack_2D -> 2d to match other functions.
- rename new mesh normal calculation to mesh.calc_normals_split()

Modified Paths:
--------------
    trunk/blender/CMakeLists.txt
    trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c
    trunk/blender/source/blender/blenlib/BLI_boxpack2d.h
    trunk/blender/source/blender/blenlib/intern/boxpack2d.c
    trunk/blender/source/blender/bmesh/operators/bmo_hull.c
    trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
    trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c
    trunk/blender/source/blender/python/mathutils/mathutils_geometry.c

Modified: trunk/blender/CMakeLists.txt
===================================================================
--- trunk/blender/CMakeLists.txt	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/CMakeLists.txt	2013-09-10 19:23:39 UTC (rev 60022)
@@ -1784,8 +1784,14 @@
 		set(CMAKE_CXX_FLAGS_RELEASE "-mdynamic-no-pic -fno-strict-aliasing")
 	endif()
 
-	# Xcode 5 has too low template depth of 128 for libmv
-	set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
+	if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+		if(${CMAKE_GENERATOR} MATCHES "Xcode")
+			if(${XCODE_VERSION} VERSION_EQUAL 5 OR ${XCODE_VERSION} VERSION_GREATER 5)
+				# Xcode 5 has too low template depth of 128 for libmv
+				set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=1024")
+			endif()
+		endif()
+	endif()
 endif()
 
 #-----------------------------------------------------------------------------

Modified: trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/blenkernel/intern/mesh_evaluate.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -118,8 +118,8 @@
 		return;
 	}
 
-	if (!pnors) pnors = MEM_callocN(sizeof(float) * 3 * (size_t)numPolys, __func__);
-	/* if (!fnors) fnors = MEM_callocN(sizeof(float) * 3 * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
+	if (!pnors) pnors = MEM_callocN(sizeof(float[3]) * (size_t)numPolys, __func__);
+	/* if (!fnors) fnors = MEM_callocN(sizeof(float[3]) * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
 
 
 	if (only_face_normals == FALSE) {
@@ -334,7 +334,7 @@
 	 *                                                      unset: INDEX_UNSET
 	 * Note that currently we only have two values for second loop of sharp edges. However, if needed, we can
 	 * store the negated value of loop index instead of INDEX_INVALID to retrieve th real value later in code).
-	 * Note also that lose edges always have the value 0!
+	 * Note also that lose edges always have both values set to 0!
 	 */
 	int (*edge_to_loops)[2] = MEM_callocN(sizeof(int[2]) * (size_t)numEdges, __func__);
 
@@ -1109,7 +1109,7 @@
                                    const MEdge *medge, int totvert, int totedge)
 {
 	MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totvert, "vert-edge map");
-	int *indices = MEM_mallocN(sizeof(int) * (size_t)totedge * 2, "vert-edge map mem");
+	int *indices = MEM_mallocN(sizeof(int[2]) * (size_t)totedge, "vert-edge map mem");
 	int *i_pt = indices;
 
 	int i;
@@ -1732,6 +1732,7 @@
 		else {
 			const int side = (int)sqrtf((float)(fd->totdisp / corners));
 			const int side_sq = side * side;
+			const size_t disps_size = sizeof(float[3]) * (size_t)side_sq;
 
 			for (i = 0; i < tot; i++, disps += side_sq, ld++) {
 				ld->totdisp = side_sq;
@@ -1740,12 +1741,12 @@
 				if (ld->disps)
 					MEM_freeN(ld->disps);
 
-				ld->disps = MEM_mallocN(sizeof(float) * (size_t)(3 * side_sq), "converted loop mdisps");
+				ld->disps = MEM_mallocN(disps_size, "converted loop mdisps");
 				if (fd->disps) {
-					memcpy(ld->disps, disps, sizeof(float) * (size_t)(3 * side_sq));
+					memcpy(ld->disps, disps, disps_size);
 				}
 				else {
-					memset(ld->disps, 0, sizeof(float) * (size_t)(3 * side_sq));
+					memset(ld->disps, 0, disps_size);
 				}
 			}
 		}

Modified: trunk/blender/source/blender/blenlib/BLI_boxpack2d.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_boxpack2d.h	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/blenlib/BLI_boxpack2d.h	2013-09-10 19:23:39 UTC (rev 60022)
@@ -46,7 +46,7 @@
 	struct BoxVert *v[4];
 } BoxPack;
 
-void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height);
+void BLI_box_pack_2d(BoxPack *boxarray, const int len, float *tot_width, float *tot_height);
 
 #endif
 

Modified: trunk/blender/source/blender/blenlib/intern/boxpack2d.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/boxpack2d.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/blenlib/intern/boxpack2d.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -156,7 +156,7 @@
  *  len - the number of boxes in the array.
  *	tot_width and tot_height are set so you can normalize the data.
  *  */
-void BLI_box_pack_2D(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
+void BLI_box_pack_2d(BoxPack *boxarray, const int len, float *tot_width, float *tot_height)
 {
 	BoxVert *vert; /* the current vert */
 	int box_index, verts_pack_len, i, j, k, isect;

Modified: trunk/blender/source/blender/bmesh/operators/bmo_hull.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_hull.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/bmesh/operators/bmo_hull.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -444,7 +444,7 @@
 static float (*hull_verts_for_bullet(BMVert **input_verts,
                                      const int num_input_verts))[3]
 {
-	float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, AT);
+	float (*coords)[3] = MEM_callocN(sizeof(*coords) * num_input_verts, __func__);
 	int i;
 
 	for (i = 0; i < num_input_verts; i++) {

Modified: trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c
===================================================================
--- trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/editors/uvedit/uvedit_parametrizer.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -4513,7 +4513,7 @@
 		}
 	}
 	
-	BLI_box_pack_2D(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
+	BLI_box_pack_2d(boxarray, phandle->ncharts - unpacked, &tot_width, &tot_height);
 	
 	if (tot_height > tot_width)
 		scale = 1.0f / tot_height;

Modified: trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/makesrna/intern/rna_mesh_api.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -58,7 +58,7 @@
 	return ret;
 }
 
-static void rna_Mesh_calc_split_normals(Mesh *mesh, float min_angle)
+static void rna_Mesh_calc_normals_split(Mesh *mesh, float min_angle)
 {
 	float (*r_loopnors)[3];
 	float (*polynors)[3];
@@ -78,7 +78,7 @@
 		polynors = CustomData_get_layer(&mesh->pdata, CD_NORMAL);
 	}
 	else {
-		polynors = MEM_mallocN(sizeof(float [3]) * mesh->totpoly, AT);
+		polynors = MEM_mallocN(sizeof(float[3]) * mesh->totpoly, __func__);
 		BKE_mesh_calc_normals_poly(mesh->mvert, mesh->totvert, mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
 		                           polynors, false);
 		free_polynors = true;
@@ -124,7 +124,7 @@
 	func = RNA_def_function(srna, "calc_normals", "BKE_mesh_calc_normals");
 	RNA_def_function_ui_description(func, "Calculate vertex normals");
 
-	func = RNA_def_function(srna, "calc_split_normals", "rna_Mesh_calc_split_normals");
+	func = RNA_def_function(srna, "calc_normals_split", "rna_Mesh_calc_normals_split");
 	RNA_def_function_ui_description(func, "Calculate split vertex normals, which preserve sharp edges");
 	parm = RNA_def_float(func, "split_angle", M_PI, 0.0f, M_PI, "",
 	                     "Angle between polys' normals above which an edge is always sharp (180° to disable)",

Modified: trunk/blender/source/blender/python/mathutils/mathutils_geometry.c
===================================================================
--- trunk/blender/source/blender/python/mathutils/mathutils_geometry.c	2013-09-10 19:23:06 UTC (rev 60021)
+++ trunk/blender/source/blender/python/mathutils/mathutils_geometry.c	2013-09-10 19:23:39 UTC (rev 60022)
@@ -1493,7 +1493,7 @@
 		}
 
 		/* Non Python function */
-		BLI_box_pack_2D(boxarray, len, &tot_width, &tot_height);
+		BLI_box_pack_2d(boxarray, len, &tot_width, &tot_height);
 
 		boxPack_ToPyObject(boxlist, &boxarray);
 	}




More information about the Bf-blender-cvs mailing list