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:
authorJoseph Eagar <joeedh@gmail.com>2021-09-21 10:13:43 +0300
committerJoseph Eagar <joeedh@gmail.com>2021-09-21 10:13:43 +0300
commitfdffbf87accfe9daee329340680a0b16c58e96f4 (patch)
treed51a8b4046fb7e4b80aef41a1f0d00b7e3424131
parentbee00909bc1025bc5a180ea18fe0e75adf03c031 (diff)
Fix last commit
-rw-r--r--source/blender/blenloader/intern/versioning_cpp.cc36
1 files changed, 34 insertions, 2 deletions
diff --git a/source/blender/blenloader/intern/versioning_cpp.cc b/source/blender/blenloader/intern/versioning_cpp.cc
index 11f15406040..317a96b4a8e 100644
--- a/source/blender/blenloader/intern/versioning_cpp.cc
+++ b/source/blender/blenloader/intern/versioning_cpp.cc
@@ -5,11 +5,13 @@
#include <string>
#include "BLI_compiler_attrs.h"
+#include <cstdio>
+#include <vector>
using namespace std;
extern "C" {
-const char *sculpt_keymap_fix(const char *str)
+ATTR_NO_OPT const char *sculpt_keymap_fix_intern(const char *str)
{
basic_string repl = regex_replace(str, regex("unified_"), "");
repl = regex_replace(repl, regex("size"), "radius");
@@ -31,7 +33,7 @@ const char *sculpt_keymap_fix(const char *str)
basic_string type = "float";
- if (propname == "strength") {
+ if (regex_search(str, regex("strength"))) {
type = "factor";
}
else if (regex_search(str, regex("color"))) {
@@ -71,4 +73,34 @@ const char *sculpt_keymap_fix(const char *str)
return ret;
}
+
+ATTR_NO_OPT static void test_regexp()
+{
+ // TODO: figure out blender's testing framework
+
+ std::vector<basic_string<char>> strings = {
+ "tool_settings.sculpt.brush.size",
+ "tool_settings.unified_paint_settings.size",
+ "tool_settings.unified_paint_settings.use_unified_size",
+ "tool_settings.sculpt.brush.color",
+ "tool_settings.unified_paint_settings.color",
+ "tool_settings.unified_paint_settings.use_unified_color",
+ "tool_settings.sculpt.brush.strength",
+ "tool_settings.unified_paint_settings.strength",
+ "tool_settings.unified_paint_settings.use_unified_strength",
+ };
+
+ for (auto str : strings) {
+ printf("\n%s\n%s\n\n", str.c_str(), sculpt_keymap_fix_intern(str.c_str()));
+ }
+
+ fflush(stdout);
+}
+
+const char *sculpt_keymap_fix(const char *str)
+{
+ // test_regexp();
+
+ return sculpt_keymap_fix_intern(str);
+}
}