[Bf-blender-cvs] [fdffbf87acc] temp_test_sc_keymap: Fix last commit
Joseph Eagar
noreply at git.blender.org
Tue Sep 21 09:13:57 CEST 2021
Commit: fdffbf87accfe9daee329340680a0b16c58e96f4
Author: Joseph Eagar
Date: Tue Sep 21 00:13:43 2021 -0700
Branches: temp_test_sc_keymap
https://developer.blender.org/rBfdffbf87accfe9daee329340680a0b16c58e96f4
Fix last commit
===================================================================
M source/blender/blenloader/intern/versioning_cpp.cc
===================================================================
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);
+}
}
More information about the Bf-blender-cvs
mailing list