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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-01 01:50:49 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2016-05-01 02:44:52 +0300
commit1422f0dd1697d7b671a7b447fd58db7dfe775821 (patch)
tree2429e10580ea795e091b9a0511515d4838ee5303 /intern/cycles/blender/blender_shader.cpp
parentabf6f9f6cf72e7ce0bb5feb9af328fc350e3d700 (diff)
Fix Cycles external OSL shader not working with relative file paths.
Diffstat (limited to 'intern/cycles/blender/blender_shader.cpp')
-rw-r--r--intern/cycles/blender/blender_shader.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/intern/cycles/blender/blender_shader.cpp b/intern/cycles/blender/blender_shader.cpp
index ba806e2bd24..3f919bcad88 100644
--- a/intern/cycles/blender/blender_shader.cpp
+++ b/intern/cycles/blender/blender_shader.cpp
@@ -602,12 +602,14 @@ static ShaderNode *add_node(Scene *scene,
* input/output type info needed for proper node construction.
*/
OSL::OSLQuery query;
+ string absolute_filepath;
if(!bytecode_hash.empty()) {
query.open_bytecode(b_script_node.bytecode());
}
else {
- OSLShaderManager::osl_query(query, b_script_node.filepath());
+ absolute_filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+ OSLShaderManager::osl_query(query, absolute_filepath);
}
/* TODO(sergey): Add proper query info error parsing. */
@@ -617,12 +619,11 @@ static ShaderNode *add_node(Scene *scene,
* so the names match those of the corresponding parameters exactly.
*
* Note 2: ShaderInput/ShaderOutput store shallow string copies only!
- * Socket names must be stored in the extra lists instead. */
+ * So we register them as ustring to ensure the pointer stays valid. */
BL::Node::inputs_iterator b_input;
for(b_script_node.inputs.begin(b_input); b_input != b_script_node.inputs.end(); ++b_input) {
- script_node->input_names.push_back(ustring(b_input->name()));
- ShaderInput *input = script_node->add_input(script_node->input_names.back().c_str(),
+ ShaderInput *input = script_node->add_input(ustring(b_input->name()).c_str(),
convert_osl_socket_type(query, *b_input));
set_default_value(input, *b_input, b_data, b_ntree);
}
@@ -630,8 +631,7 @@ static ShaderNode *add_node(Scene *scene,
BL::Node::outputs_iterator b_output;
for(b_script_node.outputs.begin(b_output); b_output != b_script_node.outputs.end(); ++b_output) {
- script_node->output_names.push_back(ustring(b_output->name()));
- script_node->add_output(script_node->output_names.back().c_str(),
+ script_node->add_output(ustring(b_output->name()).c_str(),
convert_osl_socket_type(query, *b_output));
}
@@ -645,7 +645,7 @@ static ShaderNode *add_node(Scene *scene,
}
else {
/* set filepath */
- script_node->filepath = blender_absolute_path(b_data, b_ntree, b_script_node.filepath());
+ script_node->filepath = absolute_filepath;
}
node = script_node;