[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [18899] branches/blender2.5/blender/source /blender: 2.5: Silencing MSVC warnings in a few files ( many files still have many to clean out some other day).

Joshua Leung aligorith at gmail.com
Tue Feb 10 10:18:05 CET 2009


Revision: 18899
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18899
Author:   aligorith
Date:     2009-02-10 10:18:04 +0100 (Tue, 10 Feb 2009)

Log Message:
-----------
2.5: Silencing MSVC warnings in a few files (many files still have many to clean out some other day).

Modified Paths:
--------------
    branches/blender2.5/blender/source/blender/blenkernel/intern/object.c
    branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c
    branches/blender2.5/blender/source/blender/editors/armature/editarmature.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner.c
    branches/blender2.5/blender/source/blender/editors/space_outliner/outliner_header.c
    branches/blender2.5/blender/source/blender/editors/space_time/space_time.c
    branches/blender2.5/blender/source/blender/editors/space_time/time_header.c
    branches/blender2.5/blender/source/blender/editors/space_view3d/drawarmature.c

Modified: branches/blender2.5/blender/source/blender/blenkernel/intern/object.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenkernel/intern/object.c	2009-02-10 06:12:35 UTC (rev 18898)
+++ branches/blender2.5/blender/source/blender/blenkernel/intern/object.c	2009-02-10 09:18:04 UTC (rev 18899)
@@ -699,7 +699,7 @@
 {
 	Camera *cam = (Camera *)ob->data; 
 	if (ob->type != OB_CAMERA)
-		return 0.0;
+		return 0.0f;
 	if (cam->dof_ob) {	
 		/* too simple, better to return the distance on the view axis only
 		 * return VecLenf(ob->obmat[3], cam->dof_ob->obmat[3]); */
@@ -709,7 +709,7 @@
 		Mat4Ortho(obmat);
 		Mat4Invert(ob->imat, obmat);
 		Mat4MulMat4(mat, cam->dof_ob->obmat, ob->imat);
-		return fabs(mat[3][2]);
+		return (float)fabs(mat[3][2]);
 	}
 	return cam->YF_dofdist;
 }
@@ -720,26 +720,26 @@
 	
 	la=  alloc_libblock(&G.main->lamp, ID_LA, name);
 	
-	la->r= la->g= la->b= la->k= 1.0;
-	la->haint= la->energy= 1.0;
-	la->dist= 20.0;
-	la->spotsize= 45.0;
-	la->spotblend= 0.15;
-	la->att2= 1.0;
+	la->r= la->g= la->b= la->k= 1.0f;
+	la->haint= la->energy= 1.0f;
+	la->dist= 20.0f;
+	la->spotsize= 45.0f;
+	la->spotblend= 0.15f;
+	la->att2= 1.0f;
 	la->mode= LA_SHAD_BUF;
 	la->bufsize= 512;
-	la->clipsta= 0.5;
-	la->clipend= 40.0;
-	la->shadspotsize= 45.0;
+	la->clipsta= 0.5f;
+	la->clipend= 40.0f;
+	la->shadspotsize= 45.0f;
 	la->samp= 3;
-	la->bias= 1.0;
-	la->soft= 3.0;
+	la->bias= 1.0f;
+	la->soft= 3.0f;
 	la->ray_samp= la->ray_sampy= la->ray_sampz= 1; 
-	la->area_size=la->area_sizey=la->area_sizez= 1.0; 
+	la->area_size=la->area_sizey=la->area_sizez= 1.0f; 
 	la->buffers= 1;
 	la->buftype= LA_SHADBUF_HALFWAY;
 	la->ray_samp_method = LA_SAMP_HALTON;
-	la->adapt_thresh = 0.001;
+	la->adapt_thresh = 0.001f;
 	la->preview=NULL;
 	la->falloff_type = LA_FALLOFF_INVLINEAR;
 	la->curfalloff = curvemapping_add(1, 0.0f, 1.0f, 1.0f, 0.0f);
@@ -748,12 +748,12 @@
 	la->spread = 1.0;
 	la->sun_brightness = 1.0;
 	la->sun_size = 1.0;
-	la->backscattered_light = 1.0;
-	la->atm_turbidity = 2.0;
-	la->atm_inscattering_factor = 1.0;
-	la->atm_extinction_factor = 1.0;
-	la->atm_distance_factor = 1.0;
-	la->sun_intensity = 1.0;
+	la->backscattered_light = 1.0f;
+	la->atm_turbidity = 2.0f;
+	la->atm_inscattering_factor = 1.0f;
+	la->atm_extinction_factor = 1.0f;
+	la->atm_distance_factor = 1.0f;
+	la->sun_intensity = 1.0f;
 	la->skyblendtype= MA_RAMP_ADD;
 	la->skyblendfac= 1.0f;
 	la->sky_colorspace= BLI_CS_CIE;
@@ -1864,7 +1864,6 @@
 		/* and even worse, it gives bad effects for NLA stride too (try ctime != par->ctime, with MBlur) */
 		pop= 0;
 		if(no_parent_ipo==0 && stime != par->ctime) {
-		
 			// only for ipo systems? 
 			pushdata(par, sizeof(Object));
 			pop= 1;
@@ -1874,16 +1873,15 @@
 		}
 		
 		solve_parenting(scene, ob, par, ob->obmat, slowmat, 0);
-
+		
 		if(pop) {
 			poplast(par);
 		}
 		
 		if(ob->partype & PARSLOW) {
 			// include framerate
-
-			fac1= (1.0f/(1.0f+ fabs(give_timeoffset(ob))));
-			if(fac1>=1.0) return;
+			fac1= ( 1.0f / (1.0f + (float)fabs(give_timeoffset(ob))) );
+			if(fac1 >= 1.0f) return;
 			fac2= 1.0f-fac1;
 			
 			fp1= ob->obmat[0];
@@ -1892,7 +1890,6 @@
 				fp1[0]= fac1*fp1[0] + fac2*fp2[0];
 			}
 		}
-	
 	}
 	else {
 		object_to_mat4(ob, ob->obmat);
@@ -1902,7 +1899,6 @@
 	if(ob->track) {
 		if( ctime != ob->track->ctime) where_is_object_time(scene, ob->track, ctime);
 		solve_tracking (ob, ob->track->obmat);
-		
 	}
 
 	/* solve constraints */
@@ -2088,7 +2084,7 @@
 		bConstraintOb *cob;
 		
 		cob= constraints_make_evalob(scene, ob, NULL, CONSTRAINT_OBTYPE_OBJECT);
-		solve_constraints (&ob->constraints, cob, scene->r.cfra);
+		solve_constraints(&ob->constraints, cob, (float)scene->r.cfra);
 		constraints_clear_evalob(cob);
 	}
 	
@@ -2127,7 +2123,7 @@
 BoundBox *unit_boundbox()
 {
 	BoundBox *bb;
-	float min[3] = {-1,-1,-1}, max[3] = {-1,-1,-1};
+	float min[3] = {-1.0f,-1.0f,-1.0f}, max[3] = {-1.0f,-1.0f,-1.0f};
 
 	bb= MEM_callocN(sizeof(BoundBox), "bb");
 	boundbox_set_from_min_max(bb, min, max);

Modified: branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c
===================================================================
--- branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c	2009-02-10 06:12:35 UTC (rev 18898)
+++ branches/blender2.5/blender/source/blender/blenlib/intern/arithb.c	2009-02-10 09:18:04 UTC (rev 18899)
@@ -1599,16 +1599,16 @@
 	cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ;
 	
 	/* rotate around shortest angle */
-	if ((1.0 + cosom) > 0.0001) {
+	if ((1.0f + cosom) > 0.0001f) {
 		
-		if ((1.0 - cosom) > 0.0001) {
-			omega = acos(cosom);
-			sinom = sin(omega);
-			sc1 = sin((1.0 - t) * omega) / sinom;
-			sc2 = sin(t * omega) / sinom;
+		if ((1.0f - cosom) > 0.0001f) {
+			omega = (float)acos(cosom);
+			sinom = (float)sin(omega);
+			sc1 = (float)sin((1.0 - t) * omega) / sinom;
+			sc2 = (float)sin(t * omega) / sinom;
 		} 
 		else {
-			sc1 = 1.0 - t;
+			sc1 = 1.0f - t;
 			sc2 = t;
 		}
 		result[0] = sc1*quat1[0] + sc2*quat2[0];
@@ -1622,9 +1622,9 @@
 		result[2] = quat2[1];
 		result[3] = -quat2[0];
 		
-		sc1 = sin((1.0 - t)*M_PI_2);
-		sc2 = sin(t*M_PI_2);
-
+		sc1 = (float)sin((1.0 - t)*M_PI_2);
+		sc2 = (float)sin(t*M_PI_2);
+		
 		result[0] = sc1*quat1[0] + sc2*result[0];
 		result[1] = sc1*quat1[1] + sc2*result[1];
 		result[2] = sc1*quat1[2] + sc2*result[2];
@@ -1639,7 +1639,7 @@
 	cosom = quat1[0]*quat2[0] + quat1[1]*quat2[1] + quat1[2]*quat2[2] + quat1[3]*quat2[3] ;
 	
 	/* rotate around shortest angle */
-	if (cosom < 0.0) {
+	if (cosom < 0.0f) {
 		cosom = -cosom;
 		quat[0]= -quat1[0];
 		quat[1]= -quat1[1];
@@ -1653,13 +1653,13 @@
 		quat[3]= quat1[3];
 	}
 	
-	if ((1.0 - cosom) > 0.0001) {
-		omega = acos(cosom);
-		sinom = sin(omega);
-		sc1 = sin((1 - t) * omega) / sinom;
-		sc2 = sin(t * omega) / sinom;
+	if ((1.0f - cosom) > 0.0001f) {
+		omega = (float)acos(cosom);
+		sinom = (float)sin(omega);
+		sc1 = (float)sin((1 - t) * omega) / sinom;
+		sc2 = (float)sin(t * omega) / sinom;
 	} else {
-		sc1= 1.0 - t;
+		sc1= 1.0f - t;
 		sc2= t;
 	}
 	
@@ -1775,7 +1775,7 @@
 	QuatCopy(q0, dq->quat);
 
 	/* normalize */
-	len= sqrt(QuatDot(q0, q0)); 
+	len= (float)sqrt(QuatDot(q0, q0)); 
 	if(len != 0.0f)
 		QuatMulf(q0, 1.0f/len);
 	
@@ -1784,9 +1784,9 @@
 
 	/* translation */
 	t= dq->trans;
-	mat[3][0]= 2.0*(-t[0]*q0[1] + t[1]*q0[0] - t[2]*q0[3] + t[3]*q0[2]);
-	mat[3][1]= 2.0*(-t[0]*q0[2] + t[1]*q0[3] + t[2]*q0[0] - t[3]*q0[1]);
-	mat[3][2]= 2.0*(-t[0]*q0[3] - t[1]*q0[2] + t[2]*q0[1] + t[3]*q0[0]);
+	mat[3][0]= 2.0f*(-t[0]*q0[1] + t[1]*q0[0] - t[2]*q0[3] + t[3]*q0[2]);
+	mat[3][1]= 2.0f*(-t[0]*q0[2] + t[1]*q0[3] + t[2]*q0[0] - t[3]*q0[1]);
+	mat[3][2]= 2.0f*(-t[0]*q0[3] - t[1]*q0[2] + t[2]*q0[1] + t[3]*q0[0]);
 
 	/* note: this does not handle scaling */
 }	
@@ -1815,10 +1815,10 @@
 	/* interpolate scale - but only if needed */
 	if (dq->scale_weight) {
 		float wmat[4][4];
-
+		
 		if(flipped)	/* we don't want negative weights for scaling */
 			weight= -weight;
-
+		
 		Mat4CpyMat4(wmat, dq->scale);
 		Mat4MulFloat((float*)wmat, weight);
 		Mat4AddMat4(dqsum->scale, dqsum->scale, wmat);
@@ -1835,7 +1835,7 @@
 	
 	if(dq->scale_weight) {
 		float addweight= totweight - dq->scale_weight;
-
+		
 		if(addweight) {
 			dq->scale[0][0] += addweight;
 			dq->scale[1][1] += addweight;
@@ -2197,7 +2197,7 @@
 
 void VecOrthoBasisf(float *v, float *v1, float *v2)
 {
-	float f = sqrt(v[0]*v[0] + v[1]*v[1]);
+	float f = (float)sqrt(v[0]*v[0] + v[1]*v[1]);
 
 	if (f < 1e-35f) {
 		// degenerate case
@@ -2349,9 +2349,9 @@
 
 void NormalShortToFloat(float *out, short *in)
 {
-	out[0] = in[0] / 32767.0;
-	out[1] = in[1] / 32767.0;
-	out[2] = in[2] / 32767.0;
+	out[0] = in[0] / 32767.0f;
+	out[1] = in[1] / 32767.0f;
+	out[2] = in[2] / 32767.0f;
 }
 
 void NormalFloatToShort(short *out, float *in)
@@ -2488,15 +2488,15 @@
 	*/
 	float div, labda, mu;
 	
-	div= (v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]);
-	if(div==0.0) return -1;
+	div= (float)((v2[0]-v1[0])*(v4[1]-v3[1])-(v2[1]-v1[1])*(v4[0]-v3[0]));
+	if(div==0.0f) return -1;
 	
 	labda= ((float)(v1[1]-v3[1])*(v4[0]-v3[0])-(v1[0]-v3[0])*(v4[1]-v3[1]))/div;
 	
 	mu= ((float)(v1[1]-v3[1])*(v2[0]-v1[0])-(v1[0]-v3[0])*(v2[1]-v1[1]))/div;
 	
-	if(labda>=0.0 && labda<=1.0 && mu>=0.0 && mu<=1.0) {
-		if(labda==0.0 || labda==1.0 || mu==0.0 || mu==1.0) return 1;
+	if(labda>=0.0f && labda<=1.0f && mu>=0.0f && mu<=1.0f) {
+		if(labda==0.0f || labda==1.0f || mu==0.0f || mu==1.0f) return 1;
 		return 2;
 	}
 	return 0;
@@ -2655,9 +2655,9 @@
 
 	/* find best projection of face XY, XZ or YZ: barycentric weights of
 	   the 2d projected coords are the same and faster to compute */
-	xn= fabs(n[0]);
-	yn= fabs(n[1]);
-	zn= fabs(n[2]);
+	xn= (float)fabs(n[0]);
+	yn= (float)fabs(n[1]);
+	zn= (float)fabs(n[2]);
 	if(zn>=xn && zn>=yn) {i= 0; j= 1;}
 	else if(yn>=xn && yn>=zn) {i= 0; j= 2;}
 	else {i= 1; j= 2;} 
@@ -2889,12 +2889,12 @@
 {
 	float tempMat[3][3];
 
-	Mat3CpyMat4 (tempMat, tmat);
+	Mat3CpyMat4(tempMat, tmat);
 	Mat3Ortho(tempMat);
 	Mat3ToEul(tempMat, eul);
 }
 
-void QuatToEul( float *quat, float *eul)
+void QuatToEul(float *quat, float *eul)
 {
 	float mat[3][3];
 	
@@ -2903,7 +2903,7 @@
 }
 
 
-void EulToQuat( float *eul, float *quat)
+void EulToQuat(float *eul, float *quat)
 {
     float ti, tj, th, ci, cj, ch, si, sj, sh, cc, cs, sc, ss;
  
@@ -2918,7 +2918,7 @@
 	quat[3] = cj*cs - sj*sc;
 }
 
-void VecRotToMat3( float *vec, float phi, float mat[][3])
+void VecRotToMat3(float *vec, float phi, float mat[][3])
 {
 	/* rotation of phi radials around vec */
 	float vx, vx2, vy, vy2, vz, vz2, co, si;
@@ -2944,7 +2944,7 @@
 	
 }
 
-void VecRotToMat4( float *vec, float phi, float mat[][4])
+void VecRotToMat4(float *vec, float phi, float mat[][4])
 {
 	float tmat[3][3];
 	
@@ -2953,7 +2953,7 @@
 	Mat4CpyMat3(mat, tmat);
 }
 
-void VecRotToQuat( float *vec, float phi, float *quat)
+void VecRotToQuat(float *vec, float phi, float *quat)
 {
 	/* rotation of phi radials around vec */
 	float si;
@@ -2962,7 +2962,7 @@
 	quat[2]= vec[1];
 	quat[3]= vec[2];
 	
-	if( Normalize(quat+1) == 0.0) {
+	if( Normalize(quat+1) == 0.0f) {
 		QuatOne(quat);
 	}
 	else {
@@ -2986,7 +2986,7 @@
 	Normalize(vec1);
 	Normalize(vec2);
 
-	return NormalizedVecAngle2(vec1, vec2) * 180.0/M_PI;
+	return NormalizedVecAngle2(vec1, vec2) * (float)(180.0/M_PI);
 }
 
 float VecAngle3_2D(float *v1, float *v2, float *v3)
@@ -3002,7 +3002,7 @@
 	Normalize2(vec1);
 	Normalize2(vec2);
 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list