diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-26 09:46:58 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2018-04-26 09:46:58 +0300 |
commit | badab5cb7dbc83238616f7505c4b357ecbb6941e (patch) | |
tree | f409ec1176413c19becc06b487f489709987e572 | |
parent | 6c608b2f8af06184b8a3893e1cac0e981fdf7c4c (diff) |
Workbench: Hair rendering
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_materials.c | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_materials.c b/source/blender/draw/engines/workbench/workbench_materials.c index 2ee87c9f2ce..1b6927ed3ed 100644 --- a/source/blender/draw/engines/workbench/workbench_materials.c +++ b/source/blender/draw/engines/workbench/workbench_materials.c @@ -29,6 +29,8 @@ #include "BKE_particle.h" +#include "DNA_modifier_types.h" + #include "GPU_shader.h" #include "UI_resources.h" @@ -328,22 +330,26 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, IDPropert const DRWContextState *draw_ctx = DRW_context_state_get(); if (ob != draw_ctx->object_edit) { - for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) { - if (psys_check_enabled(ob, psys, false)) { - 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 && !psys->pathcache && !psys->childcache) { - draw_as = PART_DRAW_DOT; - } - - static float mat[4][4]; - unit_m4(mat); - - if (draw_as == PART_DRAW_PATH) { - struct Gwn_Batch *geom = DRW_cache_particles_get_hair(psys, NULL); - WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, props, ob); - DRW_shgroup_call_add(material->shgrp, geom, mat); + for (ModifierData *md = ob->modifiers.first; md; md = md->next) { + if (md->type == eModifierType_ParticleSystem) { + ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; + + if (psys_check_enabled(ob, psys, false)) { + 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 && !psys->pathcache && !psys->childcache) { + draw_as = PART_DRAW_DOT; + } + + static float mat[4][4]; + unit_m4(mat); + + if (draw_as == PART_DRAW_PATH) { + struct Gwn_Batch *geom = DRW_cache_particles_get_hair(psys, NULL); + WORKBENCH_MaterialData *material = get_or_create_material_data(vedata, props, ob); + DRW_shgroup_call_add(material->shgrp, geom, mat); + } } } } |