Fix T63447 Particle system: No particles after switching from hair to ...

... emitter type
This commit is contained in:
Clément Foucault 2019-07-08 18:00:57 +02:00
parent 3f6e17ddaf
commit 8d6a5fb5d3
Notes: blender-bot 2023-09-08 04:55:43 +02:00
Referenced by commit 45761e4c7c, Revert "Fix T63447 Particle system: No particles after switching from hair to ..."
Referenced by issue #63447, Particle system does not spawn particles after switching to hair and back to emitter
1 changed files with 7 additions and 3 deletions

View File

@ -3277,7 +3277,12 @@ static void OBJECT_cache_populate_particles(OBJECT_Shaders *sh_data,
ParticleSettings *part = psys->part;
int draw_as = (part->draw_as == PART_DRAW_REND) ? part->ren_as : part->draw_as;
if (draw_as != PART_DRAW_PATH) {
if (part->type == PART_HAIR) {
/* Hairs should have been rendered by the render engine.*/
continue;
}
if (!ELEM(draw_as, PART_DRAW_NOT, PART_DRAW_OB, PART_DRAW_GR)) {
struct GPUBatch *geom = DRW_cache_particles_get_dots(ob, psys);
DRWShadingGroup *shgrp = NULL;
struct GPUBatch *shape = NULL;
@ -3287,6 +3292,7 @@ static void OBJECT_cache_populate_particles(OBJECT_Shaders *sh_data,
Material *ma = give_current_material(ob, part->omat);
switch (draw_as) {
default:
case PART_DRAW_DOT:
shgrp = DRW_shgroup_create(sh_data->part_dot, psl->particle);
DRW_shgroup_uniform_vec3(shgrp, "color", ma ? &ma->r : def_prim_col, 1);
@ -3321,8 +3327,6 @@ static void OBJECT_cache_populate_particles(OBJECT_Shaders *sh_data,
DRW_shgroup_uniform_bool_copy(shgrp, "screen_space", false);
DRW_shgroup_call_instances_with_attribs(shgrp, NULL, shape, geom);
break;
default:
break;
}
}
}