Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDalai Felinto <dfelinto@gmail.com>2012-11-07 01:36:44 +0400
committerDalai Felinto <dfelinto@gmail.com>2012-11-07 01:36:44 +0400
commit0890c2a4a021e7d5951abb0a7ebe138ed24ae28a (patch)
treeb6891b8a0b4d39b960a6556a214d5341cfee4097 /intern/cycles/render
parentd68981158b843d2b7c47d6e2e94e64d807dda569 (diff)
support for string parameters in OSL nodes
for now subtype is not defined, but once we start parsing the metadata we can set texture inputs as FILEPATH also, it takes relative strings and convert to absolute for all strings (which is arguably a good solution, but should work for now)
Diffstat (limited to 'intern/cycles/render')
-rw-r--r--intern/cycles/render/graph.cpp1
-rw-r--r--intern/cycles/render/graph.h5
-rw-r--r--intern/cycles/render/osl.cpp3
3 files changed, 8 insertions, 1 deletions
diff --git a/intern/cycles/render/graph.cpp b/intern/cycles/render/graph.cpp
index c1c976dc193..f71675dbda3 100644
--- a/intern/cycles/render/graph.cpp
+++ b/intern/cycles/render/graph.cpp
@@ -326,6 +326,7 @@ void ShaderGraph::remove_proxy_nodes(vector<bool>& removed)
/* transfer the default input value to the target socket */
to->set(input->value);
+ to->set(input->value_string);
}
}
diff --git a/intern/cycles/render/graph.h b/intern/cycles/render/graph.h
index b339c3c3847..373c7e0eaab 100644
--- a/intern/cycles/render/graph.h
+++ b/intern/cycles/render/graph.h
@@ -49,7 +49,8 @@ enum ShaderSocketType {
SHADER_SOCKET_VECTOR,
SHADER_SOCKET_POINT,
SHADER_SOCKET_NORMAL,
- SHADER_SOCKET_CLOSURE
+ SHADER_SOCKET_CLOSURE,
+ SHADER_SOCKET_STRING
};
/* Bump
@@ -120,6 +121,7 @@ public:
ShaderInput(ShaderNode *parent, const char *name, ShaderSocketType type);
void set(const float3& v) { value = v; }
void set(float f) { value = make_float3(f, 0, 0); }
+ void set(const ustring v) { value_string = v; }
const char *name;
ShaderSocketType type;
@@ -129,6 +131,7 @@ public:
DefaultValue default_value;
float3 value;
+ ustring value_string;
int stack_offset; /* for SVM compiler */
bool osl_only;
diff --git a/intern/cycles/render/osl.cpp b/intern/cycles/render/osl.cpp
index a8a40a4e596..8bdb09eaf70 100644
--- a/intern/cycles/render/osl.cpp
+++ b/intern/cycles/render/osl.cpp
@@ -403,6 +403,9 @@ void OSLCompiler::add(ShaderNode *node, const char *name, bool isfilepath)
case SHADER_SOCKET_INT:
parameter(param_name.c_str(), (int)input->value.x);
break;
+ case SHADER_SOCKET_STRING:
+ parameter(param_name.c_str(), input->value_string);
+ break;
case SHADER_SOCKET_CLOSURE:
break;
}