[Bf-blender-cvs] [99f7933] openvdb: Handle grid name lookups from cycles nodes as weak references and prevent exceptions.

Lukas Tönne noreply at git.blender.org
Tue Jun 9 12:13:52 CEST 2015


Commit: 99f79338d87605fd09c28af6f8f67e3ada6e68ed
Author: Lukas Tönne
Date:   Mon Jun 8 15:53:02 2015 +0200
Branches: openvdb
https://developer.blender.org/rB99f79338d87605fd09c28af6f8f67e3ada6e68ed

Handle grid name lookups from cycles nodes as weak references and
prevent exceptions.

The shader output names are not guaranteed to match the VDB grid names.
The grid info in nodes can get outdated, files can be manipulated
externally etc., so a failure of grid lookup from Cycles should be
handled gracefully.

===================================================================

M	intern/cycles/render/openvdb.cpp

===================================================================

diff --git a/intern/cycles/render/openvdb.cpp b/intern/cycles/render/openvdb.cpp
index 5635271..eb4a96d 100644
--- a/intern/cycles/render/openvdb.cpp
+++ b/intern/cycles/render/openvdb.cpp
@@ -164,6 +164,7 @@ size_t VolumeManager::add_openvdb_volume(const std::string& filename, const std:
 
 		if(slot == -1) return -1;
 
+		if (!file.hasGrid(name)) return -1;
 		FloatGrid::Ptr grid = gridPtrCast<FloatGrid>(file.readGrid(name));
 		vdb_float_volume *sampler = new vdb_float_volume(grid);
 
@@ -175,6 +176,7 @@ size_t VolumeManager::add_openvdb_volume(const std::string& filename, const std:
 
 		if(slot == -1) return -1;
 
+		if (!file.hasGrid(name)) return -1;
 		Vec3SGrid::Ptr grid = gridPtrCast<Vec3SGrid>(file.readGrid(name));
 		vdb_float3_volume *sampler = new vdb_float3_volume(grid);




More information about the Bf-blender-cvs mailing list