implement tip popup tip selection and change default brush color to black
This commit is contained in:
@@ -119,7 +119,7 @@ void App::init_sidebar()
|
||||
//color = layout[main_id]->find<NodePanelColor>("panel-color");
|
||||
//stroke = layout[main_id]->find<NodePanelStroke>("panel-stroke");
|
||||
|
||||
brushes = find_or_create_panel<NodePanelBrush>(panels);
|
||||
//brushes = find_or_create_panel<NodePanelBrush>(panels);
|
||||
layers = find_or_create_panel<NodePanelLayer>(panels);
|
||||
color = find_or_create_panel<NodePanelColor>(panels);
|
||||
stroke = find_or_create_panel<NodePanelStroke>(panels);
|
||||
@@ -132,11 +132,11 @@ void App::init_sidebar()
|
||||
// stroke->m_canvas->draw_stroke();
|
||||
// }
|
||||
|
||||
brushes->on_brush_changed = [this](Node* target, int index) {
|
||||
Canvas::I->m_current_brush.m_tex_id = brushes->get_texture_id(index);
|
||||
Canvas::I->m_current_brush.id = brushes->get_brush_id(index);
|
||||
stroke->m_preview->draw_stroke();
|
||||
};
|
||||
//brushes->on_brush_changed = [this](Node* target, int index) {
|
||||
// Canvas::I->m_current_brush.m_tex_id = brushes->get_texture_id(index);
|
||||
// Canvas::I->m_current_brush.id = brushes->get_brush_id(index);
|
||||
// stroke->m_preview->draw_stroke();
|
||||
//};
|
||||
presets->on_brush_changed = [this](Node* target, int index) {
|
||||
auto b = presets->get_brush(index);
|
||||
// don't change some params
|
||||
@@ -154,10 +154,15 @@ void App::init_sidebar()
|
||||
// if (canvas)
|
||||
// canvas->m_brush = stroke->m_canvas->m_brush;
|
||||
// };
|
||||
stroke->on_stencil_changed = [this](Node*target, uint16_t id) {
|
||||
Canvas::I->m_current_brush.m_tex_stencil_id = id;
|
||||
stroke->m_preview->draw_stroke();
|
||||
};
|
||||
stroke->on_brush_changed = [this](Node* target, int brush_id, uint16_t brush_tex) {
|
||||
Canvas::I->m_current_brush.m_tex_id = brush_tex;
|
||||
Canvas::I->m_current_brush.id = brush_id;
|
||||
stroke->m_preview->draw_stroke();
|
||||
};
|
||||
stroke->on_stencil_changed = [this](Node*target, uint16_t id) {
|
||||
Canvas::I->m_current_brush.m_tex_stencil_id = id;
|
||||
stroke->m_preview->draw_stroke();
|
||||
};
|
||||
|
||||
layers->on_layer_add = [this](Node*) {
|
||||
canvas->m_canvas->layer_add(layers->m_layers.back()->m_label_text.c_str());
|
||||
@@ -216,14 +221,14 @@ void App::init_sidebar()
|
||||
button->set_color(panels->get_child_index(stroke.get()) == -1 ? color_button_normal : color_button_hlight);
|
||||
};
|
||||
}
|
||||
if (auto* button = layout[main_id]->find<NodeButtonCustom>("btn-brush"))
|
||||
{
|
||||
button->on_click = [this, button](Node*) {
|
||||
panels->get_child_index(brushes.get()) == -1 ? panels->add_child(brushes) : panels->remove_child(brushes.get());
|
||||
panels->fix_scroll();
|
||||
button->set_color(panels->get_child_index(brushes.get()) == -1 ? color_button_normal : color_button_hlight);
|
||||
};
|
||||
}
|
||||
//if (auto* button = layout[main_id]->find<NodeButtonCustom>("btn-brush"))
|
||||
//{
|
||||
// button->on_click = [this, button](Node*) {
|
||||
// panels->get_child_index(brushes.get()) == -1 ? panels->add_child(brushes) : panels->remove_child(brushes.get());
|
||||
// panels->fix_scroll();
|
||||
// button->set_color(panels->get_child_index(brushes.get()) == -1 ? color_button_normal : color_button_hlight);
|
||||
// };
|
||||
//}
|
||||
if (auto* button = layout[main_id]->find<NodeButton>("btn-brush-preset"))
|
||||
{
|
||||
button->on_click = [this, button](Node*) {
|
||||
@@ -803,14 +808,15 @@ void App::initLayout()
|
||||
}
|
||||
|
||||
Brush b;
|
||||
int br_idx = brushes->find_brush("Round-Hard");
|
||||
b.m_tex_id = brushes->get_texture_id(br_idx);
|
||||
b.id = brushes->get_brush_id(br_idx);
|
||||
int br_idx = stroke->m_brush_popup->find_brush("Round-Hard");
|
||||
b.m_tex_id = stroke->m_brush_popup->get_texture_id(br_idx);
|
||||
b.id = stroke->m_brush_popup->get_brush_id(br_idx);
|
||||
b.m_tip_size = .1f;
|
||||
b.m_tip_flow = .5f;
|
||||
b.m_tip_spacing = .1f;
|
||||
b.m_tip_opacity = 1.f;
|
||||
Canvas::I->m_current_brush = b;
|
||||
stroke->m_brush_thumb->set_image(stroke->m_brush_popup->get_thumb_path(br_idx));
|
||||
|
||||
brush_update();
|
||||
|
||||
@@ -887,7 +893,7 @@ void App::initLayout()
|
||||
{
|
||||
LOG("restore layout");
|
||||
layout.restore_context();
|
||||
if (panels->get_child_index(brushes.get()) == -1) brushes->restore_context();
|
||||
//if (panels->get_child_index(brushes.get()) == -1) brushes->restore_context();
|
||||
if (panels->get_child_index(layers.get()) == -1) layers->restore_context();
|
||||
if (panels->get_child_index(color.get()) == -1) color->restore_context();
|
||||
if (panels->get_child_index(stroke.get()) == -1) stroke->restore_context();
|
||||
|
||||
Reference in New Issue
Block a user