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:
Weizhen Huang
2025-06-05 20:53:48 +02:00
committed by Gitea
parent 27cf3990e9
commit 1dfe8047d3
2 changed files with 11 additions and 0 deletions

View File

@@ -200,6 +200,8 @@ static void sync_smoke_volume(
ATTR_STD_VOLUME_VELOCITY,
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++) {
const AttributeStandard std = attributes[i];
if (!volume->need_attribute(scene, std)) {
@@ -210,6 +212,11 @@ static void sync_smoke_volume(
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);
ImageParams params;
params.frame = frame;

View File

@@ -677,6 +677,10 @@ void GeometryManager::create_volume_mesh(const Scene *scene, Volume *volume, Pro
ImageHandle &handle = attr.data_voxel();
if (handle.empty()) {
continue;
}
/* Try building from OpenVDB grid directly. */
VDBImageLoader *vdb_loader = handle.vdb_loader();
openvdb::GridBase::ConstPtr grid;