add brush follow-orientation flag to stroke settings and fix stroke preview
This commit is contained in:
@@ -32,15 +32,18 @@ void NodePanelStroke::init_controls()
|
||||
init_slider(m_jitter_angle, "jitter-angle", &ui::Brush::m_jitter_angle);
|
||||
init_slider(m_jitter_spread, "jitter-spread", &ui::Brush::m_jitter_spread);
|
||||
init_slider(m_jitter_flow, "jitter-flow", &ui::Brush::m_jitter_flow);
|
||||
|
||||
init_checkbox(m_tip_angle_follow, "tip-angle-follow", &ui::Brush::m_tip_angle_follow);
|
||||
|
||||
//m_canvas->draw_stroke();
|
||||
}
|
||||
|
||||
void NodePanelStroke::init_slider(NodeSliderH*& slider, const char* id, float ui::Brush::* prop)
|
||||
void NodePanelStroke::init_slider(NodeSliderH*& target, const char* id, float ui::Brush::* prop)
|
||||
{
|
||||
slider = find<NodeSliderH>(id);
|
||||
slider->on_value_changed = std::bind(&NodePanelStroke::handle_slide,
|
||||
target = find<NodeSliderH>(id);
|
||||
target->on_value_changed = std::bind(&NodePanelStroke::handle_slide,
|
||||
this, prop, std::placeholders::_1, std::placeholders::_2);
|
||||
m_canvas->m_brush.*prop = slider->m_value.x;
|
||||
m_canvas->m_brush.*prop = target->m_value.x;
|
||||
}
|
||||
|
||||
void NodePanelStroke::handle_slide(float ui::Brush::* prop, Node* target, float value)
|
||||
@@ -50,3 +53,19 @@ void NodePanelStroke::handle_slide(float ui::Brush::* prop, Node* target, float
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
}
|
||||
|
||||
void NodePanelStroke::init_checkbox(NodeCheckBox*& target, const char* id, bool ui::Brush::* prop)
|
||||
{
|
||||
target = find<NodeCheckBox>(id);
|
||||
target->on_value_changed = std::bind(&NodePanelStroke::handle_checkbox,
|
||||
this, prop, std::placeholders::_1, std::placeholders::_2);
|
||||
m_canvas->m_brush.*prop = target->checked;
|
||||
}
|
||||
|
||||
void NodePanelStroke::handle_checkbox(bool ui::Brush::* prop, Node *target, bool value)
|
||||
{
|
||||
m_canvas->m_brush.*prop = value;
|
||||
m_canvas->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user