diff options
author | Thomas Dinges <blender@dingto.org> | 2016-01-07 03:38:25 +0300 |
---|---|---|
committer | Thomas Dinges <blender@dingto.org> | 2016-01-07 03:38:25 +0300 |
commit | 3da0af1464947df6d8002166332f2e74b0a85aaf (patch) | |
tree | 06e49b6e0d7a45bade8da420246896cb46fe1543 | |
parent | db72639e1f452014b7ac4e251946ee716a3fb507 (diff) |
Cycles: Add utility function to convert bool to string.
-rw-r--r-- | intern/cycles/device/device.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/util/util_string.cpp | 8 | ||||
-rw-r--r-- | intern/cycles/util/util_string.h | 1 |
3 files changed, 14 insertions, 5 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index fc9959e0b48..f3fd462d4c1 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 66856dd8331..a3b35346d76 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 6cb8d8df1e1..2b493a2b1a0 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 |