change brush size based on camera fov / zoom, refactor brush value curves
This commit is contained in:
@@ -21,9 +21,9 @@ void NodePanelStroke::init()
|
||||
|
||||
void NodePanelStroke::set_params(const ui::Brush &b)
|
||||
{
|
||||
m_tip_size->m_value.x = b.m_tip_size;
|
||||
m_tip_spacing->m_value.x = b.m_tip_spacing;
|
||||
m_tip_flow->m_value.x = b.m_tip_flow;
|
||||
m_tip_size->m_value.x = glm::pow(b.m_tip_size, 1.f/3.f);
|
||||
m_tip_spacing->m_value.x = glm::pow(b.m_tip_spacing, 1.f/2.f) / 4.f;
|
||||
m_tip_flow->m_value.x = glm::pow(b.m_tip_flow, 1.f/2.f);
|
||||
m_tip_opacity->m_value.x = b.m_tip_opacity;
|
||||
m_tip_angle->m_value.x = b.m_tip_angle;
|
||||
m_jitter_scale->m_value.x = b.m_jitter_scale;
|
||||
@@ -50,6 +50,9 @@ 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);
|
||||
m_curves[m_tip_size] = [](float v){ return glm::pow(v, 3.f); };
|
||||
m_curves[m_tip_spacing] = [](float v){ return glm::pow(v * 4.f, 2.f); };
|
||||
m_curves[m_tip_flow] = [](float v){ return glm::pow(v, 2.f); };
|
||||
|
||||
init_checkbox(m_tip_angle_follow, "tip-angle-follow", &ui::Brush::m_tip_angle_follow);
|
||||
init_checkbox(m_tip_flow_pressure, "tip-flow-pressure", &ui::Brush::m_tip_flow_pressure);
|
||||
@@ -68,7 +71,8 @@ void NodePanelStroke::init_slider(NodeSliderH*& target, const char* id, float ui
|
||||
|
||||
void NodePanelStroke::handle_slide(float ui::Brush::* prop, Node* target, float value)
|
||||
{
|
||||
m_canvas->m_brush.*prop = value;
|
||||
auto curve = m_curves.find((NodeSliderH*)target);
|
||||
m_canvas->m_brush.*prop = curve != m_curves.end() ? curve->second(value) : value;
|
||||
m_canvas->draw_stroke();
|
||||
if (on_stroke_change)
|
||||
on_stroke_change(this);
|
||||
|
||||
Reference in New Issue
Block a user