[Bf-blender-cvs] [ce53958] master: Cycles Standalone: Support for relative paths and string OSL parameters.

Thomas Dinges noreply at git.blender.org
Fri Mar 21 17:24:22 CET 2014


Commit: ce5395868fde010e39d0e2db2e48aa4d84d9a40a
Author: Thomas Dinges
Date:   Fri Mar 21 17:22:41 2014 +0100
https://developer.blender.org/rBce5395868fde010e39d0e2db2e48aa4d84d9a40a

Cycles Standalone: Support for relative paths and string OSL parameters.

Patch by John Haddon.
Differential Revision: https://developer.blender.org/D418

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

M	intern/cycles/app/cycles_xml.cpp
M	intern/cycles/util/util_path.cpp
M	intern/cycles/util/util_path.h

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

diff --git a/intern/cycles/app/cycles_xml.cpp b/intern/cycles/app/cycles_xml.cpp
index 998531a..8db9607 100644
--- a/intern/cycles/app/cycles_xml.cpp
+++ b/intern/cycles/app/cycles_xml.cpp
@@ -406,7 +406,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
 
 			/* Source */
 			xml_read_string(&osl->filepath, node, "src");
-			osl->filepath = path_join(state.base, osl->filepath);
+			if(path_is_relative(osl->filepath)) {
+				osl->filepath = path_join(state.base, osl->filepath);
+			}
 
 			/* Generate inputs/outputs from node sockets
 			 *
@@ -763,6 +765,9 @@ static void xml_read_shader_graph(const XMLReadState& state, Shader *shader, pug
 							case SHADER_SOCKET_NORMAL:
 								xml_read_float3(&in->value, node, attr.name());
 								break;
+							case SHADER_SOCKET_STRING:
+								xml_read_ustring( &in->value_string, node, attr.name() );
+								break;
 							default:
 								break;
 						}
diff --git a/intern/cycles/util/util_path.cpp b/intern/cycles/util/util_path.cpp
index 4fd5df4..85d19b6 100644
--- a/intern/cycles/util/util_path.cpp
+++ b/intern/cycles/util/util_path.cpp
@@ -111,6 +111,11 @@ string path_escape(const string& path)
 	return result;
 }
 
+bool path_is_relative(const string& path)
+{
+	return to_boost(path).is_relative();
+}
+
 bool path_exists(const string& path)
 {
 	return boost::filesystem::exists(to_boost(path));
diff --git a/intern/cycles/util/util_path.h b/intern/cycles/util/util_path.h
index e9041e6..fd9ea11 100644
--- a/intern/cycles/util/util_path.h
+++ b/intern/cycles/util/util_path.h
@@ -41,6 +41,7 @@ string path_filename(const string& path);
 string path_dirname(const string& path);
 string path_join(const string& dir, const string& file);
 string path_escape(const string& path);
+bool path_is_relative(const string& path);
 
 /* file info */
 bool path_exists(const string& path);




More information about the Bf-blender-cvs mailing list