Extract brush refresh and thin unmerged NodeCanvas pass

This commit is contained in:
2026-06-16 17:32:42 +02:00
parent 69bcb1bc38
commit 0441dc4077
7 changed files with 213 additions and 141 deletions

View File

@@ -9,7 +9,6 @@
#include "node_panel_floating.h"
#include "app_core/about_menu.h"
#include "app_core/app_preferences.h"
#include "app_core/brush_ui.h"
#include "app_core/document_layer.h"
#include "app_core/document_canvas.h"
#include "app_core/app_status.h"
@@ -114,64 +113,6 @@ void App::init_menu_about()
pp::panopainter::bind_legacy_about_menu(*this);
}
void App::brush_update(bool update_color, bool update_brush)
{
// brushes->select_brush(canvas->m_brush->id);
// stroke->set_params(canvas->m_brush);
render_task_async([this, update_color, update_brush]
{
pp::app::BrushUiRefreshInput input;
input.update_color = update_color;
input.update_brush = update_brush;
auto current_brush = Canvas::I ? Canvas::I->m_current_brush : nullptr;
input.has_current_brush = current_brush != nullptr;
input.has_floating_picker = floating_picker != nullptr;
input.has_floating_color_panel = floating_color != nullptr;
if (input.has_current_brush)
{
input.tip_flow = current_brush->m_tip_flow;
input.tip_size = current_brush->m_tip_size;
input.r = current_brush->m_tip_color.r;
input.g = current_brush->m_tip_color.g;
input.b = current_brush->m_tip_color.b;
input.a = current_brush->m_tip_color.a;
}
const auto view = pp::app::plan_brush_ui_refresh(input);
if (!view) {
LOG("Brush UI refresh failed: %s", view.status().message);
return;
}
if (view.value().updates_stroke_controls)
{
stroke->update_controls();
}
if (view.value().updates_quick_flow)
{
quick->m_slider_flow->set_value(stroke->m_tip_flow->get_value());
}
if (view.value().updates_quick_size)
{
quick->m_slider_size->set_value(stroke->m_tip_size->get_value());
}
if (view.value().updates_quick_brush_preview && current_brush)
{
*quick->m_button_brush_current_preview->m_brush = *current_brush;
quick->m_button_brush_current_preview->draw_stroke();
}
if (view.value().updates_quick_color)
{
const glm::vec4 color(view.value().r, view.value().g, view.value().b, view.value().a);
quick->m_button_color_current_inner->m_color = color;
if (view.value().updates_floating_picker)
floating_picker->set_color(color);
if (view.value().updates_floating_color_panel)
floating_color->set_color(color);
}
}, true);
}
void App::init_menu_layer()
{
pp::panopainter::bind_legacy_layer_menu(*this);