[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [34249] trunk/blender/source/blender/ blenkernel/intern: comment/ remove unused vars from particle and multires code.

Campbell Barton ideasman42 at gmail.com
Tue Jan 11 08:38:16 CET 2011


Revision: 34249
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=34249
Author:   campbellbarton
Date:     2011-01-11 07:38:16 +0000 (Tue, 11 Jan 2011)
Log Message:
-----------
comment/remove unused vars from particle and multires code.
also remove calls to dm->getFaceDataArray() within a loop for particle grid distribution,
instead call this once at the start and reuse the result.

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/multires.c
    trunk/blender/source/blender/blenkernel/intern/particle.c
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/source/blender/blenkernel/intern/multires.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/multires.c	2011-01-11 07:08:29 UTC (rev 34248)
+++ trunk/blender/source/blender/blenkernel/intern/multires.c	2011-01-11 07:38:16 UTC (rev 34249)
@@ -1299,7 +1299,6 @@
 	unsigned int i, j, totvert;
 
 	src = 0;
-	dst = 0;
 	vsrc = mr->verts;
 	vdst = dm->getVertArray(dm);
 	totvert = (unsigned int)dm->getNumVerts(dm);
@@ -1428,7 +1427,7 @@
 			dst = ldst;
 		}
 
-		lvl = lvl->next;
+		/*lvl = lvl->next;*/ /*UNUSED*/
 
 		for(i = 0; i < (unsigned int)(mr->level_count - 1); ++i) {
 			MEM_freeN(fmap[i]);
@@ -1596,10 +1595,9 @@
 	DMGridData **gridData, **subGridData;
 	Mesh *me= (Mesh*)ob->data;
 	MFace *mface= me->mface;
-	MVert *mvert= NULL;
 	MDisps *mdisps;
 	int *gridOffset;
-	int i, numGrids, gridSize, dGridSize, dSkip, totvert;
+	int i, /*numGrids,*/ gridSize, dGridSize, dSkip, totvert;
 	float (*vertCos)[3] = NULL;
 	MultiresModifierData *mmd= get_multires_modifier(scene, ob);
 	MultiresModifierData high_mmd;
@@ -1627,13 +1625,11 @@
 	CDDM_apply_vert_coords(cddm, vertCos);
 	MEM_freeN(vertCos);
 
-	mvert= cddm->getVertArray(cddm);
-
 	/* scaled ccgDM for tangent space of object with applied scale */
 	dm= subsurf_dm_create_local(ob, cddm, high_mmd.totlvl, high_mmd.simple, 0);
 	cddm->release(cddm);
 
-	numGrids= dm->getNumGrids(dm);
+	/*numGrids= dm->getNumGrids(dm);*/ /*UNUSED*/
 	gridSize= dm->getGridSize(dm);
 	gridData= dm->getGridData(dm);
 	gridOffset= dm->getGridOffset(dm);

Modified: trunk/blender/source/blender/blenkernel/intern/particle.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle.c	2011-01-11 07:08:29 UTC (rev 34248)
+++ trunk/blender/source/blender/blenkernel/intern/particle.c	2011-01-11 07:38:16 UTC (rev 34249)
@@ -197,7 +197,7 @@
 }
 Object *psys_find_object(Scene *scene, ParticleSystem *psys)
 {
-	Base *base = scene->base.first;
+	Base *base;
 	ParticleSystem *tpsys;
 
 	for(base = scene->base.first; base; base = base->next) {
@@ -3953,7 +3953,7 @@
 	float t, frs_sec = sim->scene->r.frs_sec;
 	float co[3], orco[3];
 	float hairmat[4][4];
-	int totparent = 0;
+	/*int totparent = 0;*/ /*UNUSED*/
 	int totpart = psys->totpart;
 	int totchild = psys->totchild;
 	short between = 0, edit = 0;
@@ -4009,11 +4009,12 @@
 			t = psys_get_child_time(psys, cpa, -state->time, NULL, NULL);
 		
 		if(totchild && part->from!=PART_FROM_PARTICLE && part->childtype==PART_CHILD_FACES){
+#if 0		/* totparent is UNUSED */
 			totparent=(int)(totchild*part->parents*0.3);
 			
 			if(G.rendering && part->child_nbr && part->ren_child_nbr)
 				totparent*=(float)part->child_nbr/(float)part->ren_child_nbr;
-			
+#endif
 			/* part->parents could still be 0 so we can't test with totparent */
 			between=1;
 		}

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2011-01-11 07:08:29 UTC (rev 34248)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2011-01-11 07:38:16 UTC (rev 34249)
@@ -467,13 +467,13 @@
 	else if(ELEM(from,PART_FROM_FACE,PART_FROM_VOLUME)){
 		float co1[3], co2[3];
 
-		MFace *mface=0;
+		MFace *mface= NULL, *mface_array;
 		float v1[3], v2[3], v3[3], v4[4], lambda;
 		int a, a1, a2, a0mul, a1mul, a2mul, totface;
 		int amax= from==PART_FROM_FACE ? 3 : 1;
 
 		totface=dm->getNumFaces(dm);
-		mface=dm->getFaceDataArray(dm,CD_MFACE);
+		mface_array= dm->getFaceDataArray(dm,CD_MFACE);
 		
 		for(a=0; a<amax; a++){
 			if(a==0){ a0mul=res*res; a1mul=res; a2mul=1; }
@@ -482,7 +482,7 @@
 
 			for(a1=0; a1<size[(a+1)%3]; a1++){
 				for(a2=0; a2<size[(a+2)%3]; a2++){
-					mface=dm->getFaceDataArray(dm,CD_MFACE);
+					mface= mface_array;
 
 					pa=psys->particles + a1*a1mul + a2*a2mul;
 					VECCOPY(co1,pa->fuv);
@@ -533,7 +533,7 @@
 	}
 
 	if(psys->part->flag & PART_GRID_INVERT){
-		for(i=0,pa=psys->particles; i<size[0]; i++){
+		for(i=0; i<size[0]; i++){
 			for(j=0; j<size[1]; j++){
 				pa=psys->particles + res*(i*res + j);
 				for(k=0; k<size[2]; k++, pa++){
@@ -810,7 +810,7 @@
 		if(ctx->tree){
 			KDTreeNearest ptn[10];
 			int w,maxw;//, do_seams;
-			float maxd,mind,dd,totw=0.0;
+			float maxd,mind,/*dd,*/totw=0.0;
 			int parent[10];
 			float pweight[10];
 
@@ -820,7 +820,7 @@
 
 			maxd=ptn[maxw-1].dist;
 			mind=ptn[0].dist;
-			dd=maxd-mind;
+			/*dd=maxd-mind;*/ /*UNUSED*/
 			
 			/* the weights here could be done better */
 			for(w=0; w<maxw; w++){
@@ -941,7 +941,7 @@
 	DerivedMesh *dm= NULL;
 	float *jit= NULL;
 	int i, seed, p=0, totthread= threads[0].tot;
-	int no_distr=0, cfrom=0;
+	int /*no_distr=0,*/ cfrom=0;
 	int tot=0, totpart, *index=0, children=0, totseam=0;
 	//int *vertpart=0;
 	int jitlevel= 1, distr;
@@ -1028,7 +1028,7 @@
 		DM_add_vert_layer(dm, CD_ORCO, CD_ASSIGN, get_mesh_orco_verts(ob));
 
 		distr=part->distr;
-		pa=psys->particles;
+
 		if(from==PART_FROM_VERT){
 			MVert *mv= dm->getVertDataArray(dm, CD_MVERT);
 			float (*orcodata)[3]= dm->getVertDataArray(dm, CD_ORCO);
@@ -1073,7 +1073,7 @@
 	}
 
 	if(tot==0){
-		no_distr=1;
+		/*no_distr=1;*/ /*UNUSED*/
 		if(children){
 			if(G.f & G_DEBUG)
 				fprintf(stderr,"Particle child distribution error: Nothing to emit from!\n");
@@ -2272,7 +2272,7 @@
 EdgeHash *build_fluid_springhash(ParticleSystem *psys)
 {
 	EdgeHash *springhash = NULL;
-	ParticleSpring *spring = psys->fluid_springs;
+	ParticleSpring *spring;
 	int i = 0;
 
 	springhash = BLI_edgehash_new();
@@ -2469,7 +2469,7 @@
 	ParticleKey states[5], tkey;
 	float timestep = psys_get_timestep(sim);
 	float force[3],impulse[3],dx[4][3],dv[4][3],oldpos[3];
-	float dtime=dfra*timestep, time, pa_mass=part->mass, fac, fra=sim->psys->cfra;
+	float dtime=dfra*timestep, time, pa_mass=part->mass, fac /*, fra=sim->psys->cfra*/;
 	int i, steps=1;
 	
 	/* maintain angular velocity */
@@ -2542,7 +2542,7 @@
 				if(i==0){
 					VECADDFAC(states[1].co,states->co,states->vel,dtime*0.5f);
 					VECADDFAC(states[1].vel,states->vel,force,dtime*0.5f);
-					fra=sim->psys->cfra+0.5f*dfra;
+					/*fra=sim->psys->cfra+0.5f*dfra;*/
 				}
 				else{
 					VECADDFAC(pa->state.co,states->co,states[1].vel,dtime);
@@ -2559,7 +2559,7 @@
 
 						VECADDFAC(states[1].co,states->co,dx[0],0.5f);
 						VECADDFAC(states[1].vel,states->vel,dv[0],0.5f);
-						fra=sim->psys->cfra+0.5f*dfra;
+						/*fra=sim->psys->cfra+0.5f*dfra;*/
 						break;
 					case 1:
 						VECADDFAC(dx[1],states->vel,dv[0],0.5f);
@@ -2578,7 +2578,7 @@
 
 						VECADD(states[3].co,states->co,dx[2]);
 						VECADD(states[3].vel,states->vel,dv[2]);
-						fra=cfra;
+						/*fra=cfra;*/
 						break;
 					case 3:
 						VECADD(dx[3],states->vel,dv[2]);
@@ -3353,15 +3353,12 @@
 	ParticleSystem *psys = sim->psys;
 	HairKey *key, *root;
 	PARTICLE_P;
-	int totpart;
 
 	invert_m4_m4(ob->imat, ob->obmat);
 	
 	psys->lattice= psys_get_lattice(sim);
 
 	if(psys->totpart==0) return;
-
-	totpart=psys->totpart;
 	
 	/* save new keys for elements if needed */
 	LOOP_PARTICLES {
@@ -3684,7 +3681,7 @@
 			char filename[256];
 			char debugStrBuffer[256];
 			int  curFrame = sim->scene->r.cfra -1; // warning - sync with derived mesh fsmesh loading
-			int  p, j, numFileParts, totpart;
+			int  p, j, totpart;
 			int readMask, activeParts = 0, fileParts = 0;
 			gzFile gzf;
 	
@@ -3706,7 +3703,6 @@
 			}
 	
 			gzread(gzf, &totpart, sizeof(totpart));
-			numFileParts = totpart;
 			totpart = (G.rendering)?totpart:(part->disp*totpart)/100;
 			
 			part->totpart= totpart;




More information about the Bf-blender-cvs mailing list