implementing separate pen/erase brush settings
This commit is contained in:
@@ -93,6 +93,9 @@ public:
|
||||
I->m_mode = &modes[(int)mode];
|
||||
I->m_state = mode;
|
||||
I->m_current_mode = mode;
|
||||
if (I->m_mode)
|
||||
for (auto& m : *I->m_mode)
|
||||
m->enter();
|
||||
}
|
||||
|
||||
std::vector<Layer::Snapshot> m_layers_snapshot;
|
||||
|
||||
@@ -132,6 +132,17 @@ void CanvasModePen::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
}
|
||||
}
|
||||
|
||||
void CanvasModePen::leave()
|
||||
{
|
||||
m_brush = node->m_brush;
|
||||
}
|
||||
|
||||
void CanvasModePen::enter()
|
||||
{
|
||||
if (node)
|
||||
node->m_brush = m_brush;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
void CanvasModeLine::on_MouseEvent(MouseEvent* me, glm::vec2& loc)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
#include "event.h"
|
||||
#include "shape.h"
|
||||
#include "brush.h"
|
||||
|
||||
NS_START
|
||||
class Canvas;
|
||||
@@ -16,6 +17,7 @@ public:
|
||||
virtual void on_GestureEvent(GestureEvent* ge) {}
|
||||
virtual void on_Draw(const glm::mat4& ortho, const glm::mat4& proj, const glm::mat4& camera) {}
|
||||
virtual void init() {}
|
||||
virtual void enter() {}
|
||||
virtual void leave() {}
|
||||
};
|
||||
|
||||
@@ -39,8 +41,11 @@ class CanvasModePen : public CanvasMode
|
||||
float m_camera_fov;
|
||||
float m_zoom_canvas = 1.f;
|
||||
float m_zoom_start;
|
||||
ui::Brush m_brush;
|
||||
public:
|
||||
virtual void on_MouseEvent(MouseEvent* me, glm::vec2& loc) override;
|
||||
virtual void enter() override;
|
||||
virtual void leave() override;
|
||||
bool m_picking = false;
|
||||
};
|
||||
|
||||
|
||||
@@ -19,6 +19,22 @@ void NodePanelStroke::init()
|
||||
init_controls();
|
||||
}
|
||||
|
||||
void NodePanelStroke::set_params(const ui::Brush &b)
|
||||
{
|
||||
m_tip_size->set_value(b.m_tip_size);
|
||||
m_tip_spacing->set_value(b.m_tip_spacing);
|
||||
m_tip_flow->set_value(b.m_tip_flow);
|
||||
m_tip_opacity->set_value(b.m_tip_opacity);
|
||||
m_tip_angle->set_value(b.m_tip_angle);
|
||||
m_jitter_scale->set_value(b.m_jitter_scale);
|
||||
m_jitter_angle->set_value(b.m_jitter_angle);
|
||||
m_jitter_spread->set_value(b.m_jitter_spread);
|
||||
m_jitter_flow->set_value(b.m_jitter_flow);
|
||||
m_tip_angle_follow->checked = b.m_tip_angle_follow;
|
||||
m_tip_flow_pressure->checked = b.m_tip_flow_pressure;
|
||||
m_tip_size_pressure->checked = b.m_tip_size_pressure;
|
||||
}
|
||||
|
||||
void NodePanelStroke::init_controls()
|
||||
{
|
||||
m_canvas = find<NodeStrokePreview>("canvas");
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
virtual void clone_finalize(Node* dest) const override;
|
||||
virtual void init() override;
|
||||
void init_controls();
|
||||
void set_params(const ui::Brush& b);
|
||||
|
||||
void init_slider(NodeSliderH*& slider, const char* id, float ui::Brush::* prop);
|
||||
void handle_slide(float ui::Brush::* prop, Node* target, float value);
|
||||
|
||||
Reference in New Issue
Block a user