[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13655] trunk/blender/source/blender: Fix for bug: [#8269] Particle / Vizualization / Draw / Disp reduces rendered particles

Janne Karhu jhkarh at utu.fi
Tue Feb 12 16:26:20 CET 2008


Revision: 13655
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13655
Author:   jhk
Date:     2008-02-12 16:26:20 +0100 (Tue, 12 Feb 2008)

Log Message:
-----------
Fix for bug: [#8269] Particle / Vizualization / Draw / Disp reduces rendered particles
- Hair didn't update the visibility flag of each particle
- Changing the disp value gave a too strong update call to particles
- Changed disp value behavior for dynamic particles a bit, now all particles are always calculated for uncached frames so that every particle gets it's data cached. Now the disp value actually does what it's supposed to do, it alters the amount of particles DISPlayed in viewport, but doesn't change the simulations. (With old particles it was possible to only calculate the disp amount of particles too as everything was always recalculated from scratch anyways, but now that particles are more complicated and cached etc. it's not an option anymore.)

Modified Paths:
--------------
    trunk/blender/source/blender/blenkernel/intern/particle_system.c
    trunk/blender/source/blender/src/buttons_object.c

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-02-12 14:47:55 UTC (rev 13654)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2008-02-12 15:26:20 UTC (rev 13655)
@@ -4026,7 +4026,7 @@
 			vg_size=psys_cache_vgroup(psmd->dm,psys,PSYS_VG_SIZE);
 
 		for(p=0, pa=psys->particles; p<totpart; p++,pa++){
-			if(pa->flag & (PARS_NO_DISP+PARS_UNEXIST)) continue;
+			if(pa->flag & PARS_UNEXIST) continue;
 
 			/* set correct ipo timing */
 			if((part->flag&PART_ABS_TIME)==0 && part->ipo){
@@ -4095,7 +4095,7 @@
 
 		/* main loop: calculate physics for all particles */
 		for(p=0, pa=psys->particles, key=outstate; p<totpart; p++,pa++,key++){
-			if(pa->flag & (PARS_NO_DISP|PARS_UNEXIST)) continue;
+			if(pa->flag & PARS_UNEXIST) continue;
 
 			copy_particle_key(key,&pa->state,1);
 			
@@ -4260,7 +4260,17 @@
 static void hair_step(Object *ob, ParticleSystemModifierData *psmd, ParticleSystem *psys, float cfra)
 {
 	ParticleSettings *part = psys->part;
+	ParticleData *pa;
+	int p;
+	float disp = (float)get_current_display_percentage(psys)/50.0f-1.0f;
 
+	for(p=0, pa=psys->particles; p<psys->totpart; p++,pa++){
+		if(pa->r_rot[0] > disp)
+			pa->flag |= PARS_NO_DISP;
+		else
+			pa->flag &= ~PARS_NO_DISP;
+	}
+
 	if(psys->recalc & PSYS_DISTR)
 		/* need this for changing subsurf levels */
 		psys_calc_dmfaces(ob, psmd->dm, psys);

Modified: trunk/blender/source/blender/src/buttons_object.c
===================================================================
--- trunk/blender/source/blender/src/buttons_object.c	2008-02-12 14:47:55 UTC (rev 13654)
+++ trunk/blender/source/blender/src/buttons_object.c	2008-02-12 15:26:20 UTC (rev 13655)
@@ -4244,7 +4244,7 @@
 	uiDefButBitS(block, TOG, PART_DRAW_SIZE, B_PART_REDRAW, "Size",	butx+butw/3,buty,butw/3,buth, &part->draw, 0, 0, 0, 0, "Show particle size");
 	uiDefButBitS(block, TOG, PART_DRAW_NUM, B_PART_REDRAW, "Num",	butx+2*butw/3,buty,butw/3,buth, &part->draw, 0, 0, 0, 0, "Show particle number");
 	uiDefButS(block, NUM, B_PART_REDRAW, "Draw Size:", butx,(buty-=buth),butw,buth, &part->draw_size, 0.0, 10.0, 0, 0, "Size of particles on viewport in pixels (0=default)");
-	uiDefButS(block, NUM, B_PART_RECALC, "Disp:",		butx,(buty-=buth),butw,buth, &part->disp, 0.0, 100.0, 10, 0, "Percentage of particles to calculate for 3d view");
+	uiDefButS(block, NUM, B_PART_RECALC_CHILD, "Disp:",		butx,(buty-=buth),butw,buth, &part->disp, 0.0, 100.0, 10, 0, "Percentage of particles to display in 3d view");
 	uiBlockEndAlign(block);
 
 	uiDefBut(block, LABEL, 0, "Render:",	butx,(buty-=buth),butw,buth, NULL, 0.0, 0, 0, 0, "");





More information about the Bf-blender-cvs mailing list