58 lines
1.9 KiB
C++
58 lines
1.9 KiB
C++
#pragma once
|
|
#include "node.h"
|
|
#include "node_button_custom.h"
|
|
#include "node_border.h"
|
|
#include "node_dialog_picker.h"
|
|
#include "brush.h"
|
|
#include "node_stroke_preview.h"
|
|
|
|
class NodePanelQuick : public NodeBorder
|
|
{
|
|
public:
|
|
struct MiniState
|
|
{
|
|
int brush_index;
|
|
int color_index;
|
|
std::array<glm::vec4, 3> colors;
|
|
std::array<std::shared_ptr<Brush>, 3> brushes;
|
|
};
|
|
|
|
std::function<void(Node* target, glm::vec3 rgb)> on_color_change;
|
|
std::function<void(Node* target, float value)> on_flow_change;
|
|
std::function<void(Node* target, float value)> on_size_change;
|
|
std::function<void(Node* target, std::shared_ptr<Brush> b)> on_brush_change;
|
|
|
|
using this_class = NodePanelQuick;
|
|
using parent = NodeBorder;
|
|
|
|
NodeSliderV* m_slider_size;
|
|
NodeSliderV* m_slider_flow;
|
|
std::array<NodeButtonCustom*, 3> m_button_colors;
|
|
NodeButtonCustom* m_button_color_current;
|
|
NodeBorder* m_button_color_current_inner;
|
|
std::array<NodeButtonCustom*, 3> m_button_brushes;
|
|
NodeButtonCustom* m_button_brush_current;
|
|
NodeStrokePreview* m_button_brush_current_preview;
|
|
std::shared_ptr<NodeColorPicker> m_picker;
|
|
|
|
virtual Node* clone_instantiate() const override;
|
|
virtual void clone_finalize(Node* dest) const override;
|
|
virtual void init() override;
|
|
|
|
void set_color(glm::vec3 color);
|
|
int get_selected_brush_index() const;
|
|
void set_selected_brush_index(int idx, bool fire_event = false);
|
|
int get_selected_color_index() const;
|
|
void set_selected_color_index(int idx, bool fire_event = false);
|
|
MiniState get_state() const;
|
|
void set_state(const MiniState& state, bool fire_event = false);
|
|
void reset_state(bool fire_events = false);
|
|
|
|
private:
|
|
void init_controls();
|
|
NodeButtonCustom* init_button_brush(const std::string& name, bool szp, bool flp);
|
|
void handle_button_brush_click(Node* target);
|
|
void handle_button_color_click(Node* target);
|
|
};
|
|
|