From 5c01ecd2bf5d0dc0d42f90aba2a3d9f948d16bb8 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Wed, 11 Nov 2020 18:40:46 +0100 Subject: Fix T82516: Cycles crash updateding animated volumes after NanoVDB Two issues: * Automatic deduplication of OpenVDB grid data was failing when Cycles had already cleared the OpenVDB grid, causing an empty grid. Instead rely on Blender return the same OpenVDB grid pointer when deduplication is possible. * The volume bounds mesh was not properly cleared when the OpenVDB grid was empty, causing a mismatch between mesh and voxel data. --- intern/cycles/blender/blender_volume.cpp | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) (limited to 'intern/cycles/blender/blender_volume.cpp') diff --git a/intern/cycles/blender/blender_volume.cpp b/intern/cycles/blender/blender_volume.cpp index e039d8a4895..48ae5a2c5ae 100644 --- a/intern/cycles/blender/blender_volume.cpp +++ b/intern/cycles/blender/blender_volume.cpp @@ -242,13 +242,6 @@ class BlenderVolumeLoader : public VDBImageLoader { #endif } - bool equals(const ImageLoader &other) const override - { - /* TODO: detect multiple volume datablocks with the same filepath. */ - const BlenderVolumeLoader &other_loader = (const BlenderVolumeLoader &)other; - return b_volume == other_loader.b_volume && grid_name == other_loader.grid_name; - } - BL::Volume b_volume; }; @@ -307,25 +300,10 @@ static void sync_volume_object(BL::BlendData &b_data, } } -/* If the voxel attributes change, we need to rebuild the bounding mesh. */ -static vector get_voxel_image_slots(Mesh *mesh) -{ - vector slots; - for (const Attribute &attr : mesh->attributes.attributes) { - if (attr.element == ATTR_ELEMENT_VOXEL) { - slots.push_back(attr.data_voxel().svm_slot()); - } - } - - return slots; -} - void BlenderSync::sync_volume(BL::Object &b_ob, Volume *volume, const vector &used_shaders) { - vector old_voxel_slots = get_voxel_image_slots(volume); - volume->clear(); volume->used_shaders = used_shaders; @@ -342,8 +320,7 @@ void BlenderSync::sync_volume(BL::Object &b_ob, } /* Tag update. */ - bool rebuild = (old_voxel_slots != get_voxel_image_slots(volume)); - volume->tag_update(scene, rebuild); + volume->tag_update(scene, true); } CCL_NAMESPACE_END -- cgit v1.2.3