[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [31718] trunk/blender: Fix for [#23136] Particle display percentage "forgotten" after render

Janne Karhu jhkarh at gmail.com
Thu Sep 2 08:58:54 CEST 2010


Revision: 31718
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=31718
Author:   jhk
Date:     2010-09-02 08:58:54 +0200 (Thu, 02 Sep 2010)

Log Message:
-----------
Fix for [#23136] Particle display percentage "forgotten" after render
* The actual problem was that the total amount of particles was rendered at all, since only the displayed percentage was calculated correctly.
* New behavior is that before baking (baking is always done for full % of particles) the display % is used for rendering too for dynamic particles.
* Also added a warning below the display % slider to inform about the situation.

Modified Paths:
--------------
    trunk/blender/release/scripts/ui/properties_particle.py
    trunk/blender/source/blender/blenkernel/intern/particle_system.c

Modified: trunk/blender/release/scripts/ui/properties_particle.py
===================================================================
--- trunk/blender/release/scripts/ui/properties_particle.py	2010-09-02 06:35:00 UTC (rev 31717)
+++ trunk/blender/release/scripts/ui/properties_particle.py	2010-09-02 06:58:54 UTC (rev 31718)
@@ -862,6 +862,15 @@
         else:
             row.label(text="")
 
+        if part.draw_percentage != 100:
+            if part.type == 'HAIR':
+                if psys.hair_dynamics and psys.point_cache.is_baked == False:
+                    layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+            else:
+                phystype = part.physics_type
+                if phystype != 'NO' and phystype != 'KEYED' and psys.point_cache.is_baked == False:
+                    layout.row().label(text="Display percentage makes dynamics inaccurate without baking!")
+
         row = layout.row()
         col = row.column()
         col.prop(part, "show_size")

Modified: trunk/blender/source/blender/blenkernel/intern/particle_system.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/particle_system.c	2010-09-02 06:35:00 UTC (rev 31717)
+++ trunk/blender/source/blender/blenkernel/intern/particle_system.c	2010-09-02 06:58:54 UTC (rev 31718)
@@ -106,19 +106,25 @@
 /*			Reacting to system events			*/
 /************************************************/
 
-static int get_current_display_percentage(ParticleSystem *psys)
+static int particles_are_dynamic(ParticleSystem *psys) {
+	if(psys->pointcache->flag & PTCACHE_BAKED)
+		return 0;
+
+	if(psys->part->type == PART_HAIR)
+		return psys->flag & PSYS_HAIR_DYNAMICS;
+	else
+		return ELEM3(psys->part->phystype, PART_PHYS_NEWTON, PART_PHYS_BOIDS, PART_PHYS_FLUID);
+}
+int psys_get_current_display_percentage(ParticleSystem *psys)
 {
 	ParticleSettings *part=psys->part;
 
-	if(psys->renderdata || (part->child_nbr && part->childtype)
-		|| (psys->pointcache->flag & PTCACHE_BAKING))
+	if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
+		|| (part->child_nbr && part->childtype)	/* display percentage applies to children */
+		|| (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
 		return 100;
 
-	if(part->phystype==PART_PHYS_KEYED){
-		return psys->part->disp;
-	}
-	else
-		return psys->part->disp;
+	return psys->part->disp;
 }
 
 void psys_reset(ParticleSystem *psys, int mode)
@@ -3250,7 +3256,7 @@
 	ParticleSystem *psys = sim->psys;
 /*	ParticleSettings *part = psys->part; */
 	PARTICLE_P;
-	float disp = (float)get_current_display_percentage(psys)/100.0f;
+	float disp = (float)psys_get_current_display_percentage(psys)/100.0f;
 
 	BLI_srandom(psys->seed);
 
@@ -3518,7 +3524,7 @@
 
 	psys_update_effectors(sim);
 	
-	disp= (float)get_current_display_percentage(psys)/100.0f;
+	disp= (float)psys_get_current_display_percentage(psys)/100.0f;
 
 	LOOP_PARTICLES {
 		pa->size = part->size;
@@ -3785,7 +3791,7 @@
 
 /* 3. do dynamics */
 	/* set particles to be not calculated TODO: can't work with pointcache */
-	disp= (float)get_current_display_percentage(psys)/100.0f;
+	disp= (float)psys_get_current_display_percentage(psys)/100.0f;
 
 	BLI_srandom(psys->seed);
 	LOOP_PARTICLES {





More information about the Bf-blender-cvs mailing list