[Bf-blender-cvs] [3da0af1] master: Cycles: Add utility function to convert bool to string.

Thomas Dinges noreply at git.blender.org
Thu Jan 7 01:39:06 CET 2016


Commit: 3da0af1464947df6d8002166332f2e74b0a85aaf
Author: Thomas Dinges
Date:   Thu Jan 7 01:38:25 2016 +0100
Branches: master
https://developer.blender.org/rB3da0af1464947df6d8002166332f2e74b0a85aaf

Cycles: Add utility function to convert bool to string.

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

M	intern/cycles/device/device.cpp
M	intern/cycles/util/util_string.cpp
M	intern/cycles/util/util_string.h

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

diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp
index fc9959e..f3fd462 100644
--- a/intern/cycles/device/device.cpp
+++ b/intern/cycles/device/device.cpp
@@ -28,6 +28,7 @@
 #include "util_time.h"
 #include "util_types.h"
 #include "util_vector.h"
+#include "util_string.h"
 
 CCL_NAMESPACE_BEGIN
 
@@ -42,15 +43,14 @@ std::ostream& operator <<(std::ostream &os,
 	os << "Max nodes group: " << requested_features.max_nodes_group << std::endl;
 	/* TODO(sergey): Decode bitflag into list of names. */
 	os << "Nodes features: " << requested_features.nodes_features << std::endl;
-	/* TODO(sergey): Make it utility function to convert bool to string. */
 	os << "Use hair: "
-	   << (requested_features.use_hair ? "True" : "False")  << std::endl;
+	   << bool_to_string(requested_features.use_hair)  << std::endl;
 	os << "Use object motion: "
-	   << (requested_features.use_object_motion ? "True" : "False")  << std::endl;
+	   << bool_to_string(requested_features.use_object_motion)  << std::endl;
 	os << "Use camera motion: "
-	   << (requested_features.use_camera_motion ? "True" : "False")  << std::endl;
+	   << bool_to_string(requested_features.use_camera_motion)  << std::endl;
 	os << "Use Baking: "
-	   << (requested_features.use_baking ? "True" : "False")  << std::endl;
+	   << bool_to_string(requested_features.use_baking)  << std::endl;
 	return os;
 }
 
diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp
index 66856dd..a3b3534 100644
--- a/intern/cycles/util/util_string.cpp
+++ b/intern/cycles/util/util_string.cpp
@@ -122,5 +122,13 @@ string string_remove_trademark(const string &s)
 	return string_strip(result);
 }
 
+string bool_to_string(bool var)
+{
+	if(var)
+		return "True";
+	else
+		return "False";
+}
+
 CCL_NAMESPACE_END
 
diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h
index 6cb8d8d..2b493a2 100644
--- a/intern/cycles/util/util_string.h
+++ b/intern/cycles/util/util_string.h
@@ -44,6 +44,7 @@ void string_replace(string& haystack, const string& needle, const string& other)
 bool string_endswith(const string& s, const char *end);
 string string_strip(const string& s);
 string string_remove_trademark(const string& s);
+string bool_to_string(bool var);
 
 CCL_NAMESPACE_END




More information about the Bf-blender-cvs mailing list