added pressure driven HSV brush modifier
This commit is contained in:
@@ -156,6 +156,9 @@
|
||||
<node height="20" justify="center"><text text="Stencil" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Wet" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Noise" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Hue" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Sat" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Val" font-face="arial" font-size="11"/></node>
|
||||
</node>
|
||||
<border dir="col" align="center" grow="1" width="1" flood-events="1">
|
||||
<node height="30" pad="1" width="100%" dir="row">
|
||||
@@ -190,6 +193,24 @@
|
||||
</node>
|
||||
<node height="20" pad="1" width="100%"><slider-h id="tip-wet"/></node>
|
||||
<node height="20" pad="1" width="100%"><slider-h id="tip-noise"/></node>
|
||||
<node height="20" pad="1" width="100%" dir="row">
|
||||
<slider-h id="tip-hue" width="1" grow="1"/>
|
||||
<node width="20" pad="0" margin="0 0 0 2">
|
||||
<checkbox id="tip-hue-pressure"></checkbox>
|
||||
</node>
|
||||
</node>
|
||||
<node height="20" pad="1" width="100%" dir="row">
|
||||
<slider-h id="tip-sat" width="1" grow="1"/>
|
||||
<node width="20" pad="0" margin="0 0 0 2">
|
||||
<checkbox id="tip-sat-pressure"></checkbox>
|
||||
</node>
|
||||
</node>
|
||||
<node height="20" pad="1" width="100%" dir="row">
|
||||
<slider-h id="tip-val" width="1" grow="1"/>
|
||||
<node width="20" pad="0" margin="0 0 0 2">
|
||||
<checkbox id="tip-val-pressure"></checkbox>
|
||||
</node>
|
||||
</node>
|
||||
</border>
|
||||
</node>
|
||||
|
||||
@@ -201,8 +222,8 @@
|
||||
<node height="20" justify="center"><text text="Spread" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Flow" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Hue" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Saturation" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Value" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Sat" font-face="arial" font-size="11"/></node>
|
||||
<node height="20" justify="center"><text text="Val" font-face="arial" font-size="11"/></node>
|
||||
</node>
|
||||
<border dir="col" align="center" grow="1" width="1">
|
||||
<node height="20" pad="1" width="100%"><slider-h id="jitter-scale"/></node>
|
||||
|
||||
@@ -144,9 +144,9 @@ ui::StrokeSample ui::Stroke::randomize_sample(const glm::vec2& pos, float pressu
|
||||
s.size = 800.f * m_brush.m_tip_size * (1.f - rnd_nor() * m_brush.m_jitter_scale) * size_dyn;
|
||||
s.flow = m_brush.m_tip_flow * (1.f - rnd_nor() * m_brush.m_jitter_flow) * flow_dyn;
|
||||
auto hsv = convert_rgb2hsv(m_brush.m_tip_color);
|
||||
hsv.x = hsv.x + (rnd_nor() - 0.5f) * m_brush.m_jitter_hue;
|
||||
hsv.y = hsv.y + (rnd_nor() - 0.5f) * m_brush.m_jitter_sat;
|
||||
hsv.z = hsv.z + (rnd_nor() - 0.5f) * m_brush.m_jitter_val;
|
||||
hsv.x = hsv.x + (rnd_nor() - 0.5f) * m_brush.m_jitter_hue + (pressure * 2.0f - 0.5f) * m_brush.m_tip_hue * m_brush.m_tip_hue_pressure;
|
||||
hsv.y = hsv.y + (rnd_nor() - 0.5f) * m_brush.m_jitter_sat + (pressure * 2.0f - 0.5f) * m_brush.m_tip_sat * m_brush.m_tip_sat_pressure;
|
||||
hsv.z = hsv.z + (rnd_nor() - 0.5f) * m_brush.m_jitter_val + (pressure * 2.0f - 0.5f) * m_brush.m_tip_val * m_brush.m_tip_val_pressure;
|
||||
s.col = convert_hsv2rgb(hsv);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,15 @@ public:
|
||||
float m_tip_stencil = 0;
|
||||
float m_tip_wet = 0;
|
||||
float m_tip_noise = 0;
|
||||
float m_tip_hue = 0;
|
||||
float m_tip_sat = 0;
|
||||
float m_tip_val = 0;
|
||||
bool m_tip_angle_follow = false;
|
||||
bool m_tip_flow_pressure = false;
|
||||
bool m_tip_size_pressure = false;
|
||||
bool m_tip_hue_pressure = false;
|
||||
bool m_tip_sat_pressure = false;
|
||||
bool m_tip_val_pressure = false;
|
||||
float m_jitter_scale = 0;
|
||||
float m_jitter_angle = 0;
|
||||
float m_jitter_spread = 0;
|
||||
|
||||
@@ -61,6 +61,9 @@ void NodePanelStroke::init_controls()
|
||||
init_slider(m_tip_stencil, "tip-stencil", &ui::Brush::m_tip_stencil);
|
||||
init_slider(m_tip_wet, "tip-wet", &ui::Brush::m_tip_wet);
|
||||
init_slider(m_tip_noise, "tip-noise", &ui::Brush::m_tip_noise);
|
||||
init_slider(m_tip_hue, "tip-hue", &ui::Brush::m_tip_hue);
|
||||
init_slider(m_tip_sat, "tip-sat", &ui::Brush::m_tip_sat);
|
||||
init_slider(m_tip_val, "tip-val", &ui::Brush::m_tip_val);
|
||||
init_slider(m_jitter_scale, "jitter-scale", &ui::Brush::m_jitter_scale);
|
||||
init_slider(m_jitter_angle, "jitter-angle", &ui::Brush::m_jitter_angle);
|
||||
init_slider(m_jitter_spread, "jitter-spread", &ui::Brush::m_jitter_spread);
|
||||
@@ -75,6 +78,9 @@ void NodePanelStroke::init_controls()
|
||||
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);
|
||||
init_checkbox(m_tip_size_pressure, "tip-size-pressure", &ui::Brush::m_tip_size_pressure);
|
||||
init_checkbox(m_tip_hue_pressure, "tip-hue-pressure", &ui::Brush::m_tip_hue_pressure);
|
||||
init_checkbox(m_tip_sat_pressure, "tip-sat-pressure", &ui::Brush::m_tip_sat_pressure);
|
||||
init_checkbox(m_tip_val_pressure, "tip-val-pressure", &ui::Brush::m_tip_val_pressure);
|
||||
|
||||
m_preview->m_brush = ui::Canvas::I->m_current_brush;
|
||||
m_preview->draw_stroke();
|
||||
|
||||
@@ -19,6 +19,9 @@ public:
|
||||
NodeSliderH* m_tip_stencil;
|
||||
NodeSliderH* m_tip_wet;
|
||||
NodeSliderH* m_tip_noise;
|
||||
NodeSliderH* m_tip_hue;
|
||||
NodeSliderH* m_tip_sat;
|
||||
NodeSliderH* m_tip_val;
|
||||
NodeSliderH* m_jitter_scale;
|
||||
NodeSliderH* m_jitter_angle;
|
||||
NodeSliderH* m_jitter_spread;
|
||||
@@ -29,6 +32,9 @@ public:
|
||||
NodeCheckBox* m_tip_angle_follow;
|
||||
NodeCheckBox* m_tip_flow_pressure;
|
||||
NodeCheckBox* m_tip_size_pressure;
|
||||
NodeCheckBox* m_tip_hue_pressure;
|
||||
NodeCheckBox* m_tip_sat_pressure;
|
||||
NodeCheckBox* m_tip_val_pressure;
|
||||
std::function<void(Node* target)> on_stroke_change;
|
||||
std::map<NodeSliderH*, std::function<float(float)>> m_curves;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user