From d76f9b5847fd98eaf5bfd7337cd086f4fe12224f Mon Sep 17 00:00:00 2001 From: omigamedev Date: Mon, 23 Sep 2019 09:37:36 +0200 Subject: [PATCH] add extension when exporting brushes --- src/log.h | 1 + src/node_panel_brush.cpp | 13 ++++++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/log.h b/src/log.h index 5707b04..5c295f7 100644 --- a/src/log.h +++ b/src/log.h @@ -5,6 +5,7 @@ #define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); } #elif __ANDROID__ #define LOG(...) { ((void)__android_log_print(ANDROID_LOG_INFO, "PanoPainterCPP", __VA_ARGS__)); LogRemote::I.log(__VA_ARGS__); } + #define LOGW #elif _WIN32 #define LOG(M,...) { printf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); } #define LOGW(M,...) { wprintf(M"\n", ##__VA_ARGS__); LogRemote::I.log(M, ##__VA_ARGS__); } diff --git a/src/node_panel_brush.cpp b/src/node_panel_brush.cpp index f59255d..9464678 100644 --- a/src/node_panel_brush.cpp +++ b/src/node_panel_brush.cpp @@ -684,11 +684,14 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr brush) m_notification->SetVisibility(m_container->m_children.size() == 0); } -bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo& info_data) +bool NodePanelBrushPreset::export_ppbr(const std::string& path_in, const PPBRInfo& info_data) { + std::string path = path_in; + if (path_in.find(".ppbr") == std::string::npos) + path += ".ppbr"; LOG("export ppbr to: %s", path.c_str()); - std::regex r(R"((.*)[\\/]([^\\/]+)(\.\w+)?$)"); + std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)?$)"); std::smatch m; if (!std::regex_search(path, m, r)) return false; @@ -937,13 +940,17 @@ bool NodePanelBrushPreset::import_ppbr(const std::string& path) return false; } -bool NodePanelBrushPreset::import_abr(const std::string& path) +bool NodePanelBrushPreset::import_abr(const std::string& path_in) { BT_SetTerminate(); ABR abr; LOG("ABR detected"); + std::string path = path_in; + if (path_in.find(".abr") == std::string::npos) + path += ".abr"; + std::string name, base, ext; std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)"); std::smatch m;