fix iOS text input and export ppbr
This commit is contained in:
@@ -211,11 +211,14 @@ std::recursive_mutex lock_mutex;
|
|||||||
|
|
||||||
- (void)insertText:(NSString *)text
|
- (void)insertText:(NSString *)text
|
||||||
{
|
{
|
||||||
if (const char* cstr = [text cStringUsingEncoding:NSASCIIStringEncoding])
|
if (const char* cstr = [text cStringUsingEncoding:NSISOLatin1StringEncoding])
|
||||||
|
{
|
||||||
|
char c = cstr[0];
|
||||||
App::I->ui_task_async([=]
|
App::I->ui_task_async([=]
|
||||||
{
|
{
|
||||||
App::I->key_char(cstr[0]);
|
App::I->key_char(c);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
NSLog(@"%@", text);
|
NSLog(@"%@", text);
|
||||||
// Do something with the typed character
|
// Do something with the typed character
|
||||||
}
|
}
|
||||||
@@ -491,7 +494,7 @@ std::set<UITouch*> ignored_touch;
|
|||||||
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
view.drawableDepthFormat = GLKViewDrawableDepthFormat24;
|
||||||
view.enableSetNeedsDisplay = NO;
|
view.enableSetNeedsDisplay = NO;
|
||||||
glview = view;
|
glview = view;
|
||||||
|
|
||||||
App::I->width = view.frame.size.width * view.contentScaleFactor;
|
App::I->width = view.frame.size.width * view.contentScaleFactor;
|
||||||
App::I->height = view.frame.size.height * view.contentScaleFactor;
|
App::I->height = view.frame.size.height * view.contentScaleFactor;
|
||||||
App::I->zoom = Settings::value_or<Serializer::Float>("ui-scale", (float)view.contentScaleFactor);
|
App::I->zoom = Settings::value_or<Serializer::Float>("ui-scale", (float)view.contentScaleFactor);
|
||||||
|
|||||||
@@ -602,19 +602,20 @@ void App::dialog_ppbr_export()
|
|||||||
auto root = layout[main_id];
|
auto root = layout[main_id];
|
||||||
auto dialog = root->add_child_ref<NodeDialogExportPPBR>();
|
auto dialog = root->add_child_ref<NodeDialogExportPPBR>();
|
||||||
dialog->btn_ok->on_click = [this, dialog] (Node*) {
|
dialog->btn_ok->on_click = [this, dialog] (Node*) {
|
||||||
|
NodePanelBrushPreset::PPBRInfo info;
|
||||||
|
info.author = dialog->txt_author->m_text;
|
||||||
|
info.url = dialog->txt_url->m_text;
|
||||||
|
info.email = dialog->txt_email->m_text;
|
||||||
|
info.descr = dialog->txt_descr->m_text;
|
||||||
|
info.header_image = dialog->m_header_image;
|
||||||
#if __IOS__
|
#if __IOS__
|
||||||
App::I->pick_file_save("ppbr", [this, dialog] (std::string path) {
|
App::I->pick_file_save("ppbr", [this, dialog, info] (std::string path) {
|
||||||
presets->export_ppbr(path, dialog->m_header_image);
|
presets->export_ppbr(path, info);
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
App::I->pick_file_save({ "ppbr" }, [this, dialog] (std::string path) {
|
App::I->pick_file_save({ "ppbr" }, [this, dialog, info] (std::string path) {
|
||||||
std::thread([this, path, dialog] {
|
std::thread([this, path, dialog, info] {
|
||||||
BT_SetTerminate();
|
BT_SetTerminate();
|
||||||
NodePanelBrushPreset::PPBRInfo info;
|
|
||||||
info.author = dialog->txt_author->m_text;
|
|
||||||
info.url = dialog->txt_url->m_text;
|
|
||||||
info.email = dialog->txt_email->m_text;
|
|
||||||
info.descr = dialog->txt_descr->m_text;
|
|
||||||
presets->export_ppbr(path, info);
|
presets->export_ppbr(path, info);
|
||||||
dialog->destroy();
|
dialog->destroy();
|
||||||
App::I->message_box("Export PPBR", "Brushes exported to:\n" + path);
|
App::I->message_box("Export PPBR", "Brushes exported to:\n" + path);
|
||||||
@@ -622,4 +623,4 @@ void App::dialog_ppbr_export()
|
|||||||
});
|
});
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ void NodeDialogExportPPBR::init_controls()
|
|||||||
};
|
};
|
||||||
btn_header_clear = find<NodeButton>("header-clear");
|
btn_header_clear = find<NodeButton>("header-clear");
|
||||||
btn_header_clear->on_click = [this] (Node*) {
|
btn_header_clear->on_click = [this] (Node*) {
|
||||||
m_header_image.destroy();
|
m_header_image.reset();
|
||||||
img_header->tex.destroy();
|
img_header->tex.destroy();
|
||||||
txt_header_descr->SetVisibility(true);
|
txt_header_descr->SetVisibility(true);
|
||||||
};
|
};
|
||||||
@@ -57,9 +57,10 @@ void NodeDialogExportPPBR::init_controls()
|
|||||||
void NodeDialogExportPPBR::open_header()
|
void NodeDialogExportPPBR::open_header()
|
||||||
{
|
{
|
||||||
App::I->pick_image([this](std::string path) {
|
App::I->pick_image([this](std::string path) {
|
||||||
m_header_image.load(path);
|
m_header_image = std::make_shared<Image>();
|
||||||
m_header_image.resize(256, 128);
|
m_header_image->load(path);
|
||||||
img_header->tex.create(m_header_image);
|
m_header_image->resize(256, 128);
|
||||||
|
img_header->tex.create(*m_header_image);
|
||||||
txt_header_descr->SetVisibility(false);
|
txt_header_descr->SetVisibility(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
NodeButton* btn_header_clear;
|
NodeButton* btn_header_clear;
|
||||||
NodeButton* btn_header_gen;
|
NodeButton* btn_header_gen;
|
||||||
NodeImageTexture* img_header;
|
NodeImageTexture* img_header;
|
||||||
Image m_header_image;
|
std::shared_ptr<Image> m_header_image;
|
||||||
NodeText* txt_header_descr;
|
NodeText* txt_header_descr;
|
||||||
NodeText* txt_author;
|
NodeText* txt_author;
|
||||||
NodeText* txt_descr;
|
NodeText* txt_descr;
|
||||||
|
|||||||
@@ -724,7 +724,7 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
|
|||||||
info.class_id = "ppbr_info";
|
info.class_id = "ppbr_info";
|
||||||
info.name = L"info header";
|
info.name = L"info header";
|
||||||
|
|
||||||
bool has_header_image = info_data.header_image.m_data != nullptr;
|
bool has_header_image = info_data.header_image != nullptr;
|
||||||
|
|
||||||
info.props["author"] = std::make_shared<Serializer::String>(info_data.author);
|
info.props["author"] = std::make_shared<Serializer::String>(info_data.author);
|
||||||
info.props["email"] = std::make_shared<Serializer::String>(info_data.email);
|
info.props["email"] = std::make_shared<Serializer::String>(info_data.email);
|
||||||
@@ -743,8 +743,8 @@ bool NodePanelBrushPreset::export_ppbr(const std::string& path, const PPBRInfo&
|
|||||||
// header image
|
// header image
|
||||||
if (has_header_image)
|
if (has_header_image)
|
||||||
{
|
{
|
||||||
sw << info_data.header_image;
|
sw << *info_data.header_image;
|
||||||
info_data.header_image.save_jpg(out_path + "/header.jpg", 75);
|
info_data.header_image->save_jpg(out_path + "/header.jpg", 75);
|
||||||
}
|
}
|
||||||
|
|
||||||
pb->increment();
|
pb->increment();
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public:
|
|||||||
std::string email;
|
std::string email;
|
||||||
std::string url;
|
std::string url;
|
||||||
std::string descr;
|
std::string descr;
|
||||||
Image header_image;
|
std::shared_ptr<Image> header_image;
|
||||||
};
|
};
|
||||||
|
|
||||||
Node* m_container;
|
Node* m_container;
|
||||||
|
|||||||
Reference in New Issue
Block a user