diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-13 20:04:40 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2019-03-13 20:35:32 +0300 |
commit | 18a9e0776c2e9400449a43f28707cc3e62b0c160 (patch) | |
tree | 764b832367fd4f3338fecb7e142605d9f69a3850 /source | |
parent | 1c9e898e8fdd25bbc41400b6833d9d5ebe80b2d5 (diff) |
Fix T62156: Hair particle only shows up in final render when visible in viewport
Draw manager was checking for particles being enabled in viewport, but
actual evaluation was happening for render. Now the check in draw manager
properly follows current evaluation mode.
Additionally, de-duplicated some check, by moving everything needed to
a single place.
Annoying part is the const-cast, that could be cleaned up later by
modifying some underlying functions.
Diffstat (limited to 'source')
6 files changed, 9 insertions, 15 deletions
diff --git a/source/blender/draw/engines/basic/basic_engine.c b/source/blender/draw/engines/basic/basic_engine.c index 2f1708f56be..b851a0c4df5 100644 --- a/source/blender/draw/engines/basic/basic_engine.c +++ b/source/blender/draw/engines/basic/basic_engine.c @@ -139,9 +139,6 @@ static void basic_cache_populate(void *vedata, Object *ob) psys != NULL; psys = psys->next) { - if (!psys_check_enabled(ob, psys, false)) { - continue; - } if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { continue; } diff --git a/source/blender/draw/engines/eevee/eevee_materials.c b/source/blender/draw/engines/eevee/eevee_materials.c index 4e6d5ce386a..efe53bcbf19 100644 --- a/source/blender/draw/engines/eevee/eevee_materials.c +++ b/source/blender/draw/engines/eevee/eevee_materials.c @@ -38,6 +38,8 @@ #include "GPU_material.h" +#include "DEG_depsgraph_query.h" + #include "eevee_engine.h" #include "eevee_lut.h" #include "eevee_private.h" @@ -1649,9 +1651,6 @@ void EEVEE_hair_cache_populate(EEVEE_Data *vedata, EEVEE_ViewLayerData *sldata, continue; } ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; - if (!psys_check_enabled(ob, psys, false)) { - continue; - } if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { continue; } diff --git a/source/blender/draw/engines/workbench/workbench_deferred.c b/source/blender/draw/engines/workbench/workbench_deferred.c index f886b88828f..21bb7c6128d 100644 --- a/source/blender/draw/engines/workbench/workbench_deferred.c +++ b/source/blender/draw/engines/workbench/workbench_deferred.c @@ -843,9 +843,6 @@ static void workbench_cache_populate_particles(WORKBENCH_Data *vedata, Object *o continue; } ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; - if (!psys_check_enabled(ob, psys, false)) { - continue; - } if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { continue; } diff --git a/source/blender/draw/engines/workbench/workbench_forward.c b/source/blender/draw/engines/workbench/workbench_forward.c index ef9e1682a8b..685c37b51df 100644 --- a/source/blender/draw/engines/workbench/workbench_forward.c +++ b/source/blender/draw/engines/workbench/workbench_forward.c @@ -448,9 +448,6 @@ static void workbench_forward_cache_populate_particles(WORKBENCH_Data *vedata, O continue; } ParticleSystem *psys = ((ParticleSystemModifierData *)md)->psys; - if (!psys_check_enabled(ob, psys, false)) { - continue; - } if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { continue; } diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index c409d015330..a34d2532bb5 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -217,6 +217,13 @@ bool DRW_object_is_visible_psys_in_active_context( const Object *object, const ParticleSystem *psys) { + const bool for_render = DRW_state_is_image_render(); + /* NOTE: psys_check_enabled is using object and particle system for only + * reading, but is using some other functions which are more generic and + * which are hard to make const-pointer. */ + if (!psys_check_enabled((Object *)object, (ParticleSystem *)psys, for_render)) { + return false; + } const DRWContextState *draw_ctx = DRW_context_state_get(); const Scene *scene = draw_ctx->scene; if (object == draw_ctx->object_edit) { diff --git a/source/blender/draw/modes/object_mode.c b/source/blender/draw/modes/object_mode.c index 1a7e9e40d6d..f73aacf15d2 100644 --- a/source/blender/draw/modes/object_mode.c +++ b/source/blender/draw/modes/object_mode.c @@ -2803,9 +2803,6 @@ static void OBJECT_cache_populate_particles( OBJECT_PassList *psl) { for (ParticleSystem *psys = ob->particlesystem.first; psys; psys = psys->next) { - if (!psys_check_enabled(ob, psys, false)) { - continue; - } if (!DRW_object_is_visible_psys_in_active_context(ob, psys)) { continue; } |