Fix last commit
This commit is contained in:
parent
bee00909bc
commit
fdffbf87ac
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue