implement brush preset import
This commit is contained in:
@@ -463,6 +463,24 @@ void NodePanelBrushPreset::init()
|
|||||||
root()->update();
|
root()->update();
|
||||||
auto bounds = root()->GetSize() - zw(popup->get_children_rect());
|
auto bounds = root()->GetSize() - zw(popup->get_children_rect());
|
||||||
popup->SetPosition(glm::clamp(popup->m_pos, { 0, 0 }, bounds));
|
popup->SetPosition(glm::clamp(popup->m_pos, { 0, 0 }, bounds));
|
||||||
|
popup->on_select = [this, popup] (Node* target, int index) {
|
||||||
|
switch (index)
|
||||||
|
{
|
||||||
|
case 0: // download
|
||||||
|
break;
|
||||||
|
case 1: // import
|
||||||
|
App::I->pick_file({".abr", ".ABR"}, [] (std::string path) {
|
||||||
|
std::thread([path] {
|
||||||
|
BT_SetTerminate();
|
||||||
|
App::I->stroke->import_abr(path);
|
||||||
|
}).detach();
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
case 2: // export
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
popup->destroy();
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
if (Asset::exist(App::I->data_path + "/settings/presets.bin") && !restore())
|
if (Asset::exist(App::I->data_path + "/settings/presets.bin") && !restore())
|
||||||
|
|||||||
Reference in New Issue
Block a user