Fix #105546: Cycles volume uninitialized when frame is beyond valid range
Pull Request: https://projects.blender.org/blender/blender/pulls/139930
This commit is contained in:
@@ -200,6 +200,8 @@ static void sync_smoke_volume(
|
|||||||
ATTR_STD_VOLUME_VELOCITY,
|
ATTR_STD_VOLUME_VELOCITY,
|
||||||
ATTR_STD_NONE};
|
ATTR_STD_NONE};
|
||||||
|
|
||||||
|
const Interval<int> frame_interval = {b_domain.cache_frame_start(), b_domain.cache_frame_end()};
|
||||||
|
|
||||||
for (int i = 0; attributes[i] != ATTR_STD_NONE; i++) {
|
for (int i = 0; attributes[i] != ATTR_STD_NONE; i++) {
|
||||||
const AttributeStandard std = attributes[i];
|
const AttributeStandard std = attributes[i];
|
||||||
if (!volume->need_attribute(scene, std)) {
|
if (!volume->need_attribute(scene, std)) {
|
||||||
@@ -210,6 +212,11 @@ static void sync_smoke_volume(
|
|||||||
|
|
||||||
Attribute *attr = volume->attributes.add(std);
|
Attribute *attr = volume->attributes.add(std);
|
||||||
|
|
||||||
|
if (!frame_interval.contains(frame)) {
|
||||||
|
attr->data_voxel().clear();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
unique_ptr<ImageLoader> loader = make_unique<BlenderSmokeLoader>(b_ob_info.real_object, std);
|
unique_ptr<ImageLoader> loader = make_unique<BlenderSmokeLoader>(b_ob_info.real_object, std);
|
||||||
ImageParams params;
|
ImageParams params;
|
||||||
params.frame = frame;
|
params.frame = frame;
|
||||||
|
|||||||
@@ -677,6 +677,10 @@ void GeometryManager::create_volume_mesh(const Scene *scene, Volume *volume, Pro
|
|||||||
|
|
||||||
ImageHandle &handle = attr.data_voxel();
|
ImageHandle &handle = attr.data_voxel();
|
||||||
|
|
||||||
|
if (handle.empty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
/* Try building from OpenVDB grid directly. */
|
/* Try building from OpenVDB grid directly. */
|
||||||
VDBImageLoader *vdb_loader = handle.vdb_loader();
|
VDBImageLoader *vdb_loader = handle.vdb_loader();
|
||||||
openvdb::GridBase::ConstPtr grid;
|
openvdb::GridBase::ConstPtr grid;
|
||||||
|
|||||||
Reference in New Issue
Block a user