Add global control over disabling high-resolution smoke draw

Can be found in the viewport's simplify panel, allows to easily
disable high-res display for all the smokes in the scene.
This commit is contained in:
Sergey Sharybin 2019-02-15 17:55:24 +01:00
parent 14c00cda39
commit 6e40e3489f
8 changed files with 37 additions and 7 deletions

View File

@ -1912,7 +1912,7 @@ class CYCLES_RENDER_PT_simplify_viewport(CyclesButtonsPanel, Panel):
col.prop(rd, "simplify_child_particles", text="Child Particles")
col.prop(cscene, "texture_limit", text="Texture Limit")
col.prop(cscene, "ao_bounces", text="AO Bounces")
col.prop(rd, "use_simplify_smoke_highres")
class CYCLES_RENDER_PT_simplify_render(CyclesButtonsPanel, Panel):
bl_label = "Render"

View File

@ -614,6 +614,9 @@ class RENDER_PT_simplify_viewport(RenderButtonsPanel, Panel):
col = flow.column()
col.prop(rd, "simplify_child_particles", text="Max Child Particles")
col = flow.column()
col.prop(rd, "use_simplify_smoke_highres")
class RENDER_PT_simplify_render(RenderButtonsPanel, Panel):
bl_label = "Render"

View File

@ -23,6 +23,10 @@
/** \file \ingroup bke
*/
struct Scene;
struct SmokeDomainSettings;
struct SmokeModifierData;
typedef float (*bresenham_callback)(float *result, float *input, int res[3], int *pixel, float *tRay, float correct);
struct Mesh *smokeModifier_do(
@ -34,7 +38,7 @@ void smokeModifier_free(struct SmokeModifierData *smd);
void smokeModifier_reset(struct SmokeModifierData *smd);
void smokeModifier_reset_turbulence(struct SmokeModifierData *smd);
void smokeModifier_createType(struct SmokeModifierData *smd);
void smokeModifier_copy(const SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag);
void smokeModifier_copy(const struct SmokeModifierData *smd, struct SmokeModifierData *tsmd, const int flag);
void BKE_smoke_reallocate_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
void BKE_smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float dx, int res[3], int free_old);
@ -42,4 +46,6 @@ void BKE_smoke_reallocate_highres_fluid(struct SmokeDomainSettings *sds, float d
float BKE_smoke_get_velocity_at(struct Object *ob, float position[3], float velocity[3]);
int BKE_smoke_get_data_flags(struct SmokeDomainSettings *sds);
bool BKE_smoke_show_highres(struct Scene *scene, struct SmokeDomainSettings *sds);
#endif /* __BKE_SMOKE_H__ */

View File

@ -3148,3 +3148,14 @@ int BKE_smoke_get_data_flags(SmokeDomainSettings *sds)
}
#endif /* WITH_SMOKE */
bool BKE_smoke_show_highres(Scene *scene, SmokeDomainSettings *sds)
{
if ((sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES) == 0) {
return false;
}
if (scene->r.mode & R_SIMPLIFY) {
return !scene->r.simplify_smoke_ignore_highres;
}
return true;
}

View File

@ -32,6 +32,7 @@
#include "BKE_modifier.h"
#include "BKE_mesh.h"
#include "BKE_smoke.h"
#include "ED_screen.h"
@ -506,10 +507,11 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
const bool show_smoke = ((int)DEG_get_ctime(draw_ctx->depsgraph) >= sds->point_cache[0]->startframe);
if (sds->fluid && show_smoke) {
if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES)) {
const bool show_highres = BKE_smoke_show_highres(scene, sds);
if (!sds->wt || !show_highres) {
GPU_create_smoke(smd, 0);
}
else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES)) {
else if (sds->wt && show_highres) {
GPU_create_smoke(smd, 1);
}
BLI_addtail(&e_data.smoke_domains, BLI_genericNodeN(smd));

View File

@ -22,6 +22,7 @@
#include "workbench_private.h"
#include "BKE_object.h"
#include "BKE_smoke.h"
#include "BLI_rand.h"
#include "BLI_dynstr.h"
@ -124,13 +125,14 @@ void workbench_volume_cache_populate(WORKBENCH_Data *vedata, Scene *scene, Objec
}
wpd->volumes_do = true;
const bool show_highres = BKE_smoke_show_highres(scene, sds);
if (sds->use_coba) {
GPU_create_smoke_coba_field(smd);
}
else if (!sds->wt || !(sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES)) {
else if (!sds->wt || !show_highres) {
GPU_create_smoke(smd, 0);
}
else if (sds->wt && (sds->viewsettings & MOD_SMOKE_VIEW_SHOW_HIGHRES)) {
else if (sds->wt && show_highres) {
GPU_create_smoke(smd, 1);
}

View File

@ -738,7 +738,7 @@ typedef struct RenderData {
short simplify_subsurf;
short simplify_subsurf_render;
short simplify_gpencil;
short pad10;
short simplify_smoke_ignore_highres;
float simplify_particles;
float simplify_particles_render;

View File

@ -1556,6 +1556,7 @@ static void rna_Scene_use_simplify_update(Main *bmain, Scene *UNUSED(scene), Poi
}
WM_main_add_notifier(NC_GEOM | ND_DATA, NULL);
WM_main_add_notifier(NC_OBJECT | ND_DRAW, NULL);
DEG_id_tag_update(&sce->id, 0);
}
@ -5490,6 +5491,11 @@ static void rna_def_scene_render_data(BlenderRNA *brna)
RNA_def_property_ui_text(prop, "Simplify Child Particles", "Global child particles percentage during rendering");
RNA_def_property_update(prop, 0, "rna_Scene_simplify_update");
prop = RNA_def_property(srna, "use_simplify_smoke_highres", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_negative_sdna(prop, NULL, "simplify_smoke_ignore_highres", 1);
RNA_def_property_ui_text(prop, "Use Smoke Highres", "Allow drawing high-res smoke in viewport");
RNA_def_property_update(prop, NC_OBJECT | ND_DRAW, NULL);
/* Grease Pencil - Simplify Options */
prop = RNA_def_property(srna, "simplify_gpencil", PROP_BOOLEAN, PROP_NONE);
RNA_def_property_boolean_sdna(prop, NULL, "simplify_gpencil", SIMPLIFY_GPENCIL_ENABLE);