[Bf-blender-cvs] [8366d1d] openvdb: Cycles: move routine to find an exiting grid slot to its own function.

Kévin Dietrich noreply at git.blender.org
Fri Jun 5 14:07:02 CEST 2015


Commit: 8366d1de704193bae5eba8cc123a25f369eb1269
Author: Kévin Dietrich
Date:   Mon May 18 21:34:02 2015 +0200
Branches: openvdb
https://developer.blender.org/rB8366d1de704193bae5eba8cc123a25f369eb1269

Cycles: move routine to find an exiting grid slot to its own function.

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

M	intern/cycles/render/openvdb.cpp
M	intern/cycles/render/openvdb.h

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

diff --git a/intern/cycles/render/openvdb.cpp b/intern/cycles/render/openvdb.cpp
index c8d4af5..f7eb2b2 100644
--- a/intern/cycles/render/openvdb.cpp
+++ b/intern/cycles/render/openvdb.cpp
@@ -55,12 +55,8 @@ static inline void catch_exceptions()
 	}
 }
 
-int OpenVDBManager::add_volume(const string &filename, const string &name, int sampling, int grid_type)
+int OpenVDBManager::find_existing_slot(const string &filename, const string &name, int sampling, int grid_type)
 {
-	using namespace openvdb;
-	size_t slot = -1;
-
-	/* Find existing grid */
 	for(size_t i = 0; i < current_grids.size(); ++i) {
 		GridDescription grid = current_grids[i];
 
@@ -99,6 +95,18 @@ int OpenVDBManager::add_volume(const string &filename, const string &name, int s
 		}
 	}
 
+	return -1;
+}
+
+int OpenVDBManager::add_volume(const string &filename, const string &name, int sampling, int grid_type)
+{
+	using namespace openvdb;
+	size_t slot = -1;
+
+	if((slot = find_existing_slot(filename, name, sampling, grid_type)) != -1) {
+		return slot;
+	}
+
 	try {
 		io::File file(filename);
 		file.open();
@@ -237,6 +245,15 @@ OpenVDBManager::~OpenVDBManager()
 {
 }
 
+int OpenVDBManager::find_existing_slot(const string &filename, const string &name, int sampling, int grid_type)
+{
+	(void)filename;
+	(void)name;
+	(void)sampling;
+
+	return -1;
+}
+
 int OpenVDBManager::add_volume(const string &filename, const string &name, int sampling, int grid_type)
 {
 	(void)filename;
diff --git a/intern/cycles/render/openvdb.h b/intern/cycles/render/openvdb.h
index b783fd7..41dd340 100644
--- a/intern/cycles/render/openvdb.h
+++ b/intern/cycles/render/openvdb.h
@@ -41,6 +41,7 @@ public:
 	~OpenVDBManager();
 
 	int add_volume(const string &filename, const string &name, int sampling, int grid_type);
+	int find_existing_slot(const string &filename, const string &name, int sampling, int grid_type);
 
 	void device_update(Device *device, DeviceScene *dscene, Scene *scene, Progress& progress);
 	void device_free(Device *device, DeviceScene *dscene);




More information about the Bf-blender-cvs mailing list