fix mixer rect, textures popup, parallel abr import
This commit is contained in:
@@ -77,6 +77,7 @@ void NodePanelStroke::init_controls()
|
||||
{
|
||||
m_brush_popup = std::make_shared<NodePanelBrush>();
|
||||
m_brush_popup->m_manager = m_manager;
|
||||
m_brush_popup->m_dir_name = "brushes";
|
||||
m_brush_popup->init();
|
||||
m_brush_popup->create();
|
||||
m_brush_popup->loaded();
|
||||
@@ -86,6 +87,18 @@ void NodePanelStroke::init_controls()
|
||||
m_brush_popup->m_flood_events = true;
|
||||
m_brush_popup->m_capture_children = false;
|
||||
|
||||
m_texture_popup = std::make_shared<NodePanelBrush>();
|
||||
m_texture_popup->m_manager = m_manager;
|
||||
m_texture_popup->m_dir_name = "textures";
|
||||
m_texture_popup->init();
|
||||
m_texture_popup->create();
|
||||
m_texture_popup->loaded();
|
||||
m_texture_popup->SetPositioning(YGPositionTypeAbsolute);
|
||||
m_texture_popup->SetSize(300, 400);
|
||||
m_texture_popup->m_mouse_ignore = false;
|
||||
m_texture_popup->m_flood_events = true;
|
||||
m_texture_popup->m_capture_children = false;
|
||||
|
||||
m_presets_popup = std::make_shared<NodePanelBrushPreset>();
|
||||
m_presets_popup->m_manager = m_manager;
|
||||
m_presets_popup->init();
|
||||
@@ -98,6 +111,7 @@ void NodePanelStroke::init_controls()
|
||||
m_presets_popup->m_capture_children = false;
|
||||
|
||||
int br_idx = std::max(m_brush_popup->find_brush("Round-Hard"), 0);
|
||||
|
||||
// init main brush
|
||||
auto b = std::make_shared<Brush>();
|
||||
b->load_texture(m_brush_popup->get_texture_path(br_idx), m_brush_popup->get_thumb_path(br_idx));
|
||||
@@ -219,11 +233,45 @@ void NodePanelStroke::init_controls()
|
||||
if (on_dual_changed)
|
||||
on_dual_changed(this, m_brush_popup->get_texture_path(index), m_brush_popup->get_thumb_path(index));
|
||||
m_dual_brush_thumb->set_image(m_brush_popup->get_thumb_path(index));
|
||||
//m_brush_popup->mouse_release();
|
||||
//m_brush_popup->parent->remove_child(m_brush_popup.get());
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// TEXTURE IMAGE
|
||||
|
||||
m_texture_thumb = find<NodeImage>("texture-change-thumb");
|
||||
m_texture_thumb->set_image(m_texture_popup->get_thumb_path(0));
|
||||
m_texture_button = find<NodeButtonCustom>("texture-change");
|
||||
m_texture_button->on_click = [this](Node*) {
|
||||
auto screen = root()->m_size;
|
||||
glm::vec2 pos = m_texture_button->m_pos + glm::vec2(m_texture_button->m_size.x, 0);
|
||||
root()->add_child(m_texture_popup);
|
||||
auto tick = root()->add_child<NodeImage>();
|
||||
tick->SetPositioning(YGPositionTypeAbsolute);
|
||||
tick->SetSize(16, 32);
|
||||
tick->SetPosition(pos.x, pos.y + (m_texture_button->m_size.y - 32) * 0.5f);
|
||||
tick->set_image("data/ui/popup-tick.png");
|
||||
root()->update();
|
||||
if ((pos.y + m_texture_popup->m_size.y) > screen.y)
|
||||
pos.y = screen.y - m_texture_popup->m_size.y;
|
||||
if (pos.y < 0)
|
||||
pos.y = 0;
|
||||
m_texture_popup->SetPosition(pos.x + 16, pos.y);
|
||||
m_texture_popup->mouse_capture();
|
||||
root()->update();
|
||||
|
||||
m_texture_popup->on_popup_close = [this, tick](Node*) {
|
||||
tick->destroy();
|
||||
};
|
||||
|
||||
m_texture_popup->on_brush_changed = [this](Node*, int index) {
|
||||
if (on_texture_changed)
|
||||
on_texture_changed(this, m_texture_popup->get_texture_path(index), m_texture_popup->get_thumb_path(index));
|
||||
m_texture_thumb->set_image(m_texture_popup->get_thumb_path(index));
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
m_preview = find<NodeStrokePreview>("canvas");
|
||||
m_blend_mode = find<NodeComboBox>("blend-mode");
|
||||
m_blend_mode->on_select = [this](Node*, int index) {
|
||||
@@ -308,19 +356,21 @@ void NodePanelStroke::init_controls()
|
||||
m_preview->m_brush = Canvas::I->m_current_brush;
|
||||
m_preview->draw_stroke();
|
||||
|
||||
/*
|
||||
auto load_stencil = find<NodeButton>("tip-stencil-load");
|
||||
load_stencil->on_click = [this](Node*) {
|
||||
App::I.pick_image([this](std::string path) {
|
||||
App::I.async_start();
|
||||
if (TextureManager::load(path.c_str()))
|
||||
{
|
||||
if (on_stencil_changed)
|
||||
on_stencil_changed(this, path, "");
|
||||
if (on_texture_changed)
|
||||
on_texture_changed(this, path, "");
|
||||
}
|
||||
App::I.async_redraw();
|
||||
App::I.async_end();
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
update_controls();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user