forked from bartvdbraak/blender
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.
This commit is contained in:
parent
ad0a176a22
commit
35535c2cb9
@ -862,6 +862,15 @@ class PARTICLE_PT_draw(ParticleButtonsPanel, bpy.types.Panel):
|
|||||||
else:
|
else:
|
||||||
row.label(text="")
|
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()
|
row = layout.row()
|
||||||
col = row.column()
|
col = row.column()
|
||||||
col.prop(part, "show_size")
|
col.prop(part, "show_size")
|
||||||
|
@ -106,19 +106,25 @@
|
|||||||
/* Reacting to system events */
|
/* 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;
|
ParticleSettings *part=psys->part;
|
||||||
|
|
||||||
if(psys->renderdata || (part->child_nbr && part->childtype)
|
if((psys->renderdata && !particles_are_dynamic(psys)) /* non-dynamic particles can be rendered fully */
|
||||||
|| (psys->pointcache->flag & PTCACHE_BAKING))
|
|| (part->child_nbr && part->childtype) /* display percentage applies to children */
|
||||||
|
|| (psys->pointcache->flag & PTCACHE_BAKING)) /* baking is always done with full amount */
|
||||||
return 100;
|
return 100;
|
||||||
|
|
||||||
if(part->phystype==PART_PHYS_KEYED){
|
return psys->part->disp;
|
||||||
return psys->part->disp;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return psys->part->disp;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void psys_reset(ParticleSystem *psys, int mode)
|
void psys_reset(ParticleSystem *psys, int mode)
|
||||||
@ -3250,7 +3256,7 @@ static void hair_step(ParticleSimulationData *sim, float cfra)
|
|||||||
ParticleSystem *psys = sim->psys;
|
ParticleSystem *psys = sim->psys;
|
||||||
/* ParticleSettings *part = psys->part; */
|
/* ParticleSettings *part = psys->part; */
|
||||||
PARTICLE_P;
|
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);
|
BLI_srandom(psys->seed);
|
||||||
|
|
||||||
@ -3518,7 +3524,7 @@ static void cached_step(ParticleSimulationData *sim, float cfra)
|
|||||||
|
|
||||||
psys_update_effectors(sim);
|
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 {
|
LOOP_PARTICLES {
|
||||||
pa->size = part->size;
|
pa->size = part->size;
|
||||||
@ -3785,7 +3791,7 @@ static void system_step(ParticleSimulationData *sim, float cfra)
|
|||||||
|
|
||||||
/* 3. do dynamics */
|
/* 3. do dynamics */
|
||||||
/* set particles to be not calculated TODO: can't work with pointcache */
|
/* 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);
|
BLI_srandom(psys->seed);
|
||||||
LOOP_PARTICLES {
|
LOOP_PARTICLES {
|
||||||
|
Loading…
Reference in New Issue
Block a user