* 'master' of https://bitbucket.org/omigamedev/new_engine:
  export data flag, fix android create dir
This commit is contained in:
2019-09-23 01:01:04 +02:00
8 changed files with 21 additions and 12 deletions

View File

@@ -606,6 +606,7 @@ void App::dialog_ppbr_export()
info.email = dialog->txt_email->m_text;
info.descr = dialog->txt_descr->m_text;
info.header_image = dialog->m_header_image;
info.export_data = dialog->export_check->checked;
#if __IOS__
App::I->pick_file_save("ppbr",
[this, dialog, info] (std::string path) {

View File

@@ -53,6 +53,7 @@ void NodeDialogExportPPBR::init_controls()
txt_email = find<NodeTextInput>("info-email");
txt_url = find<NodeTextInput>("info-url");
txt_descr = find<NodeTextInput>("info-descr");
export_check = find<NodeCheckBox>("export-data");
}
void NodeDialogExportPPBR::open_header()

View File

@@ -5,6 +5,7 @@
#include "node_text.h"
#include "node_text_input.h"
#include "node_image_texture.h"
#include "node_checkbox.h"
class NodeDialogExportPPBR : public NodeBorder
{
@@ -22,6 +23,7 @@ public:
NodeTextInput* txt_descr;
NodeTextInput* txt_url;
NodeTextInput* txt_email;
NodeCheckBox* export_check;
virtual Node* clone_instantiate() const override;
virtual void clone_finalize(Node* dest) const override;
virtual void init() override;

View File

@@ -686,7 +686,9 @@ void NodePanelBrushPreset::add_brush(std::shared_ptr<Brush> brush)
bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo& info_data)
{
std::regex r(R"((.*)[\\/]([^\\/]+)\.(\w+)$)");
LOG("export ppbr to: %s", path.c_str());
std::regex r(R"((.*)[\\/]([^\\/]+)(\.\w+)?$)");
std::smatch m;
if (!std::regex_search(path, m, r))
return false;
@@ -695,7 +697,7 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
auto ext = m[3].str();
std::string out_path = base + "/" + name + "_data";
bool path_created = Asset::create_dir(out_path);
bool path_created = info_data.export_data ? Asset::create_dir(out_path) : false;
std::ofstream f(path, std::ios::binary);
if (f.good())
@@ -805,6 +807,7 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
return true;
}
LOG("export failed file creation");
return false;
}

View File

@@ -95,6 +95,7 @@ public:
std::string url;
std::string descr;
std::shared_ptr<Image> header_image;
bool export_data;
};
Node* m_container;

View File

@@ -579,8 +579,7 @@ std::wstring str2wstr(const std::string& str)
//return converted;
if (str.empty())
return {};
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterX;
return converterX.from_bytes(str);
}
@@ -594,8 +593,7 @@ std::string wstr2str(const std::wstring & wstr)
//return converted;
if (wstr.empty())
return {};
using convert_typeX = std::codecvt_utf8<wchar_t>;
std::wstring_convert<convert_typeX, wchar_t> converterX;
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converterX;
return converterX.to_bytes(wstr);
}