diff options
author | Alexander Gavrilov <angavrilov@gmail.com> | 2016-08-20 12:03:40 +0300 |
---|---|---|
committer | Alexander Gavrilov <angavrilov@gmail.com> | 2016-08-20 12:13:20 +0300 |
commit | 0e5e53c651effb6d33871f4a386c1b17c98aa9a1 (patch) | |
tree | b36ea8e57bf9cf22bbb465bf9721a404abed1713 /source/blender/blenkernel/intern/pointcache.c | |
parent | 36ab737ef79b669973e7f37b9f48ec6e2135da73 (diff) |
Fix crash in OpenVDB highres smoke cache when seeking to frame 0.
This code obviously should also use the cache_fields flag variable,
like the code for reading the lowres data in the same function.
This is because fluid_fields actually represents the old state before
smoke was reallocated to match cache_fields read from the file, and if
it has some fields enabled that aren't allocated any more, it crashes.
This also fixes a reverse glitch: when a file was loaded with
the current frame in the middle of a baked smoke+fire simulation,
smoke appeared immediately, but the fire didn't until the frame
was changed. The reason is the same: after file load no fields
are initially allocated and thus fluid_fields is 0.
Diffstat (limited to 'source/blender/blenkernel/intern/pointcache.c')
-rw-r--r-- | source/blender/blenkernel/intern/pointcache.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c index d08814e3373..30eb8dcb287 100644 --- a/source/blender/blenkernel/intern/pointcache.c +++ b/source/blender/blenkernel/intern/pointcache.c @@ -1137,13 +1137,13 @@ static int ptcache_smoke_openvdb_read(struct OpenVDBReader *reader, void *smoke_ OpenVDB_import_grid_fl(reader, "density", &dens, sds->res_wt); - if (fluid_fields & SM_ACTIVE_FIRE) { + if (cache_fields & SM_ACTIVE_FIRE) { OpenVDB_import_grid_fl(reader, "flame", &flame, sds->res_wt); OpenVDB_import_grid_fl(reader, "fuel", &fuel, sds->res_wt); OpenVDB_import_grid_fl(reader, "react", &react, sds->res_wt); } - if (fluid_fields & SM_ACTIVE_COLORS) { + if (cache_fields & SM_ACTIVE_COLORS) { OpenVDB_import_grid_vec(reader, "color", &r, &g, &b, sds->res_wt); } |