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.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user