Fix for [#25198] Smoke gets shown before simulation starts

* Smoke is now only drawn/rendered after the simulation frame range starts.
* This does not apply to simulation end frame though, so that any remaining smoke can for example be faded away nicely through material settings.
This commit is contained in:
Janne Karhu
2010-12-14 14:45:56 +00:00
parent 295ce322e3
commit 93cbc840e0
2 changed files with 9 additions and 5 deletions

View File

@@ -6119,7 +6119,9 @@ void draw_object(Scene *scene, ARegion *ar, View3D *v3d, Base *base, int flag)
// only draw domains
if(smd->domain && smd->domain->fluid)
{
if(!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG))
if(CFRA < smd->domain->point_cache[0]->startframe)
; /* don't show smoke before simulation starts, this could be made an option in the future */
else if(!smd->domain->wt || !(smd->domain->viewsettings & MOD_SMOKE_VIEW_SHOWBIG))
{
// #if 0
smd->domain->tex = NULL;

View File

@@ -47,6 +47,7 @@
#include "smoke_API.h"
#include "DNA_texture_types.h"
#include "DNA_object_force.h"
#include "DNA_object_types.h"
#include "DNA_modifier_types.h"
#include "DNA_smoke_types.h"
@@ -179,7 +180,7 @@ static int read_voxeldata_header(FILE *fp, struct VoxelData *vd)
return 1;
}
static void init_frame_smoke(VoxelData *vd)
static void init_frame_smoke(VoxelData *vd, float cfra)
{
Object *ob;
ModifierData *md;
@@ -195,8 +196,9 @@ static void init_frame_smoke(VoxelData *vd)
if(smd->domain && smd->domain->fluid) {
if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
if(cfra < smd->domain->point_cache[0]->startframe)
; /* don't show smoke before simulation starts, this could be made an option in the future */
else if (vd->smoked_type == TEX_VD_SMOKEHEAT) {
int totRes;
float *heat;
int i;
@@ -294,7 +296,7 @@ static void cache_voxeldata(struct Render *re, Tex *tex)
load_frame_image_sequence(vd, tex);
return;
case TEX_VD_SMOKE:
init_frame_smoke(vd);
init_frame_smoke(vd, re->r.cfra);
return;
case TEX_VD_BLENDERVOXEL:
BLI_path_abs(path, G.main->name);