[Bf-blender-cvs] [4842cc0] openvdb: Removed the deprecated OpenVDB shader node for direct loading of .vdb files.

Lukas Tönne noreply at git.blender.org
Wed Nov 23 16:53:46 CET 2016


Commit: 4842cc017c3bb7df2070c2f96605190ff88e6a2e
Author: Lukas Tönne
Date:   Wed Nov 23 16:50:49 2016 +0100
Branches: openvdb
https://developer.blender.org/rB4842cc017c3bb7df2070c2f96605190ff88e6a2e

Removed the deprecated OpenVDB shader node for direct loading of .vdb files.

This node was already disabled. All vdb data should eventually be loaded
through the Cycles sync procedure as object data.

Specialized nodes for accessing voxel data may eventually be added again
for convenience, but these would just be advanced attribute nodes.

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

M	intern/cycles/blender/blender_shader.cpp
M	intern/cycles/kernel/CMakeLists.txt
M	intern/cycles/kernel/svm/svm.h
D	intern/cycles/kernel/svm/svm_openvdb.h
M	intern/cycles/kernel/svm/svm_types.h
M	intern/cycles/render/nodes.cpp
M	intern/cycles/render/nodes.h
M	intern/cycles/render/volume.cpp
M	intern/cycles/render/volume.h
M	release/scripts/startup/nodeitems_builtins.py
M	source/blender/blenkernel/BKE_node.h
M	source/blender/blenkernel/intern/node.c
M	source/blender/blenloader/intern/readfile.c
M	source/blender/blenloader/intern/writefile.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/makesdna/DNA_node_types.h
M	source/blender/makesrna/intern/rna_nodetree.c
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/NOD_shader.h
M	source/blender/nodes/NOD_static_types.h
M	source/blender/nodes/composite/nodes/node_composite_image.c
D	source/blender/nodes/shader/nodes/node_shader_openvdb.c

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

diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index f0eea66..f63f94a 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -845,43 +845,6 @@ static ShaderNode *add_node(Scene *scene,
 			        transform_inverse(get_transform(b_ob.matrix_world()));
 		}
 	}
-	else if(b_node.is_a(&RNA_ShaderNodeOpenVDB)) {
-		BL::ShaderNodeOpenVDB b_vdb_node(b_node);
-		OpenVDBNode *vdb_node = new OpenVDBNode();
-		vdb_node->filename = b_vdb_node.filename();
-		vdb_node->sampling = b_vdb_node.sampling();
-
-		/* TODO(kevin) */
-		if(b_vdb_node.source() == BL::ShaderNodeOpenVDB::source_SEQUENCE) {
-			string filename = b_vdb_node.filename();
-			string basename = filename.substr(0, filename.size() - 8);
-			stringstream ss;
-			ss << b_scene.frame_current();
-			string frame = ss.str();
-			frame.insert(frame.begin(), 4 - frame.size(), '0');
-
-			vdb_node->filename = ustring::format("%s%s.vdb", basename, frame);
-		}
-
-		BL::Node::outputs_iterator b_output;
-
-		vdb_node->output_sockets.resize(b_vdb_node.outputs.length());
-		int i = 0;
-		for(b_vdb_node.outputs.begin(b_output); b_output != b_vdb_node.outputs.end(); ++b_output, ++i) {
-			SocketType &socket = vdb_node->output_sockets.at(i);
-			socket.name = ustring(b_output->name());
-			socket.ui_name = ustring(b_output->name());
-			socket.type = convert_socket_type(*b_output);
-			socket.struct_offset = 0;
-			socket.default_value = NULL;
-			socket.enum_values = NULL;
-			socket.node_type = NULL;
-			socket.flags = SocketType::LINKABLE;
-			vdb_node->outputs.push_back(new ShaderOutput(socket, vdb_node));
-		}
-
-		node = vdb_node;
-	}
 
 	if(node) {
 		node->name = b_node.name();
diff --git a/intern/cycles/kernel/CMakeLists.txt b/intern/cycles/kernel/CMakeLists.txt
index 1052073..5322f6a 100644
--- a/intern/cycles/kernel/CMakeLists.txt
+++ b/intern/cycles/kernel/CMakeLists.txt
@@ -143,7 +143,6 @@ set(SRC_SVM_HEADERS
 	svm/svm_noise.h
 	svm/svm_noisetex.h
 	svm/svm_normal.h
-	svm/svm_openvdb.h
 	svm/svm_ramp.h
 	svm/svm_ramp_util.h
 	svm/svm_sepcomb_hsv.h
diff --git a/intern/cycles/kernel/svm/svm.h b/intern/cycles/kernel/svm/svm.h
index f7ce0c8..88ec7fe 100644
--- a/intern/cycles/kernel/svm/svm.h
+++ b/intern/cycles/kernel/svm/svm.h
@@ -169,7 +169,6 @@ CCL_NAMESPACE_END
 #include "svm_wave.h"
 #include "svm_math.h"
 #include "svm_mix.h"
-#include "svm_openvdb.h"
 #include "svm_ramp.h"
 #include "svm_sepcomb_hsv.h"
 #include "svm_sepcomb_vector.h"
@@ -462,11 +461,6 @@ ccl_device_noinline void svm_eval_nodes(KernelGlobals *kg, ShaderData *sd, ccl_a
 				break;
 #  endif  /* NODES_FEATURE(NODE_FEATURE_VOLUME) */
 #endif  /* NODES_GROUP(NODE_GROUP_LEVEL_3) */
-#ifdef __OPENVDB__
-			case NODE_OPENVDB:
-				svm_node_openvdb(kg, sd, stack, node);
-				break;
-#endif
 			case NODE_END:
 				return;
 			default:
diff --git a/intern/cycles/kernel/svm/svm_openvdb.h b/intern/cycles/kernel/svm/svm_openvdb.h
deleted file mode 100644
index 3b82e76..0000000
--- a/intern/cycles/kernel/svm/svm_openvdb.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2015 Blender Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-CCL_NAMESPACE_BEGIN
-
-#ifdef __OPENVDB__
-
-ccl_device void svm_node_openvdb(KernelGlobals *kg, ShaderData *sd, float *stack, uint4 node)
-{
-	float3 co = ccl_fetch(sd, P);
-	uint type, out_offset, sampling, slot;
-	decode_node_uchar4(node.y, &slot, &type, &out_offset, &sampling);
-
-	if(type == NODE_VDB_FLOAT) {
-		float out = kernel_tex_voxel_float(slot, co.x, co.y, co.z, sampling);
-
-		if(stack_valid(out_offset)) {
-			stack_store_float(stack, out_offset, out);
-		}
-	}
-	else if(type == NODE_VDB_FLOAT3) {
-		float3 out = kernel_tex_voxel_float3(slot, co.x, co.y, co.z, sampling);
-
-		if(stack_valid(out_offset)) {
-			stack_store_float3(stack, out_offset, out);
-		}
-	}
-}
-
-#endif
-
-CCL_NAMESPACE_END
-
diff --git a/intern/cycles/kernel/svm/svm_types.h b/intern/cycles/kernel/svm/svm_types.h
index 9867390..5adf7d3 100644
--- a/intern/cycles/kernel/svm/svm_types.h
+++ b/intern/cycles/kernel/svm/svm_types.h
@@ -132,7 +132,6 @@ typedef enum ShaderNodeType {
 	NODE_TEX_VOXEL,
 	NODE_ENTER_BUMP_EVAL,
 	NODE_LEAVE_BUMP_EVAL,
-	NODE_OPENVDB,
 } ShaderNodeType;
 
 typedef enum NodeAttributeType {
@@ -377,11 +376,6 @@ typedef enum NodeTexVoxelSpace {
 	NODE_TEX_VOXEL_SPACE_WORLD  = 1,
 } NodeTexVoxelSpace;
 
-typedef enum NodeOpenVDBType {
-	NODE_VDB_FLOAT  = 0,
-	NODE_VDB_FLOAT3 = 1,
-} NodeOpenVDBType;
-
 typedef enum ShaderType {
 	SHADER_TYPE_SURFACE,
 	SHADER_TYPE_VOLUME,
diff --git a/intern/cycles/render/nodes.cpp b/intern/cycles/render/nodes.cpp
index e9b6cdf..f293af3 100644
--- a/intern/cycles/render/nodes.cpp
+++ b/intern/cycles/render/nodes.cpp
@@ -24,16 +24,11 @@
 #include "svm_math_util.h"
 #include "osl.h"
 #include "constant_fold.h"
-#include "volume.h"
 
 #include "util_sky_model.h"
 #include "util_foreach.h"
 #include "util_transform.h"
 
-#ifdef WITH_OPENVDB
-#include "../kernel/openvdb/vdb_thread.h"
-#endif
-
 CCL_NAMESPACE_BEGIN
 
 /* Texture Mapping */
@@ -5375,70 +5370,4 @@ void TangentNode::compile(OSLCompiler& compiler)
 	compiler.add(this, "node_tangent"); 
 }
 
-NODE_DEFINE(OpenVDBNode)
-{
-	NodeType* type = NodeType::add("openvdb", create, NodeType::SHADER);
-
-	SOCKET_STRING(filename, "Filename", ustring(""));
-
-	static NodeEnum sampling_enum;
-	sampling_enum.insert("point", OPENVDB_SAMPLE_POINT);
-	sampling_enum.insert("box", OPENVDB_SAMPLE_BOX);
-	SOCKET_ENUM(sampling, "Sampling", sampling_enum, OPENVDB_SAMPLE_POINT);
-
-	return type;
-}
-
-OpenVDBNode::OpenVDBNode()
-: ShaderNode(node_type)
-{
-	volume_manager = NULL;
-}
-
-void OpenVDBNode::attributes(Shader *shader, AttributeRequestSet *attributes)
-{
-	ShaderNode::attributes(shader, attributes);
-}
-
-void OpenVDBNode::compile(SVMCompiler& compiler)
-{
-	volume_manager = compiler.volume_manager;
-
-	for(size_t i = 0; i < outputs.size(); ++i) {
-		ShaderOutput *out = outputs[i];
-
-		if(out->links.empty()) {
-			continue;
-		}
-
-		int type = NODE_VDB_FLOAT;
-
-		if(out->type() == SocketType::VECTOR || out->type() == SocketType::COLOR) {
-			type = NODE_VDB_FLOAT3;
-		}
-
-//		grid_slot = volume_manager->add_volume(filename.string(),
-//		                                       output_names[i].string(),
-//		                                       sampling, type);
-
-		if(grid_slot == -1) {
-			continue;
-		}
-
-		compiler.stack_assign(out);
-
-		compiler.add_node(NODE_OPENVDB,
-		                  compiler.encode_uchar4(grid_slot, type, out->stack_offset, sampling));
-	}
-}
-
-void OpenVDBNode::add_output(ustring name, SocketType::Type socket_type)
-{
-	const_cast<NodeType*>(type)->register_output(name, name, socket_type);
-}
-
-void OpenVDBNode::compile(OSLCompiler& /*compiler*/)
-{
-}
-
 CCL_NAMESPACE_END
diff --git a/intern/cycles/render/nodes.h b/intern/cycles/render/nodes.h
index a16c7ff..eb0f797 100644
--- a/intern/cycles/render/nodes.h
+++ b/intern/cycles/render/nodes.h
@@ -27,7 +27,6 @@ CCL_NAMESPACE_BEGIN
 class ImageManager;
 class Scene;
 class Shader;
-class VolumeManager;
 
 /* Texture Mapping */
 
@@ -980,22 +979,6 @@ public:
 	float3 normal_osl;
 };
 
-class OpenVDBNode : public ShaderNode {
-public:
-	SHADER_NODE_CLASS(OpenVDBNode)
-	void attributes(Shader *shader, AttributeRequestSet *attributes);
-	bool has_spatial_varying() { return true; }
-
-	void add_output(ustring name, SocketType::Type type);
-
-	ustring filename;
-	VolumeManager *volume_manager;
-
-	int grid_slot;
-	int sampling;
-	vector<SocketType> output_sockets;
-};
-
 CCL_NAMESPACE_END
 
 #endif /* __NODES_H__ */
diff --git a/intern/cycles/render/volume.cpp b/intern/cycles/render/volume.cpp
index 0fcb9a9..c677f1d 100644
--- a/intern/cycles/render/volume.cpp
+++ b/intern/cycles/render/volume.cpp
@@ -65,34 +65,6 @@ static inline void catch_exceptions()
 #endif
 }
 
-#if 0
-int VolumeManager::add_volume(const string& filename, const string& name, int sampling, int grid_type)
-{
-	size_t slot = -1;
-
-	if((slot = find_existing_slot(filename, name, sampling, grid_type)) != -1) {
-		return slot;
-	}
-
-	try {
-		if(is_openvdb_file(filename)) {
-			slot = add_openvdb_volume(filename, name, sampling, grid_type);
-		}
-
-		add_grid_description(filename, name, sampling, slot);
-
-		need_update = true;
-	}
-	catch(...) {
-		catch_exceptions();
-		need_update = false;
-		slot = -1;
-	}
-
-	return slot;
-}
-#endif
-
 int VolumeManager::add_volume(Volume *volume, const std::string &filename, const std::string &name)
 {
 	size_t slot = -1;
@@ -123,29 +95,6 @@ int VolumeManager::add_volume(Volume *volume, const std::string &filename, const
 	return slot;
 }
 
-#if 0
-int VolumeManager::find_existing_slot(const string& filename, const string& name, int sampling, int grid_type)
-{
-	for(size_t i = 0; i < current_grids.size(); ++i) {
-		GridDescription grid = current_grids[i];
-
-		if(grid.filename == filename && grid.name == name) {
-			if(grid.sampling == sampling) {
-				return grid.slot;
-			}
-			else {
-				/* remove the grid description too */
-				std::swap(current_grids[i], current_grids.back());
-				current_grids.pop_back();
-				break;
-			}
-		}
-	}
-
-	return -1;
-}
-#endif
-
 int VolumeManager::find_existing_slot(Volume *volume, const std::string &filename, const std::string &name)
 {
 	for(size_t i = 0; i < current_grids.size(); ++i) {
@@ -212,46 +161,6 @@ size_t find_empty_slot(Container container)
 	return slot;
 }
 
-#if 0
-size_t VolumeManager::add_openvdb_volume(const std::string& filename, const std::string& name, int /*sampling*/, int grid_type)
-{
-	size_t slot = -1;
-
-#ifdef WITH_OPENVDB
-	using namespace openvdb;
-
-	io::Fil

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list