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:
authorLukas Stockner <lukas.stockner@freenet.de>2020-10-02 01:48:01 +0300
committerLukas Stockner <lukas.stockner@freenet.de>2020-10-02 20:26:35 +0300
commitcfa101c22871c3d115f854e23f8b656b1c58a304 (patch)
tree33051b28379c0e23d0948c61ee63d9a95dd45266 /intern/cycles/util
parent90a27d5aa91a1b6a25ea14e11c889d47f77f4cf7 (diff)
Cycles: Add command line option for overriding the compute device
The current way of setting the compute device makes sense for local use, but for headless rendering it it a massive pain to get Cycles to use the correct device, usually involving entire Python scripts. Therefore, this patch adds a simple command-line option to Blender for specifying the type of device that should be used. If the option is present, the settings in the user preferences and the scene are ignored, and instead all devices matching the specified type are used. Differential Revision: https://developer.blender.org/D9086
Diffstat (limited to 'intern/cycles/util')
-rw-r--r--intern/cycles/util/util_string.cpp6
-rw-r--r--intern/cycles/util/util_string.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/intern/cycles/util/util_string.cpp b/intern/cycles/util/util_string.cpp
index afcca7e0411..4dfebf14923 100644
--- a/intern/cycles/util/util_string.cpp
+++ b/intern/cycles/util/util_string.cpp
@@ -117,14 +117,14 @@ bool string_startswith(const string &s, const char *start)
return strncmp(s.c_str(), start, len) == 0;
}
-bool string_endswith(const string &s, const char *end)
+bool string_endswith(const string &s, const string &end)
{
- size_t len = strlen(end);
+ size_t len = end.length();
if (len > s.size())
return 0;
else
- return strncmp(s.c_str() + s.size() - len, end, len) == 0;
+ return s.compare(s.length() - len, len, end) == 0;
}
string string_strip(const string &s)
diff --git a/intern/cycles/util/util_string.h b/intern/cycles/util/util_string.h
index ce2d4acdde4..f51aa7111e8 100644
--- a/intern/cycles/util/util_string.h
+++ b/intern/cycles/util/util_string.h
@@ -46,7 +46,7 @@ void string_split(vector<string> &tokens,
bool skip_empty_tokens = true);
void string_replace(string &haystack, const string &needle, const string &other);
bool string_startswith(const string &s, const char *start);
-bool string_endswith(const string &s, const char *end);
+bool string_endswith(const string &s, const string &end);
string string_strip(const string &s);
string string_remove_trademark(const string &s);
string string_from_bool(const bool var);