fix initial direction

This commit is contained in:
2019-02-27 11:59:44 +01:00
parent d6501293e9
commit c33fcdf932
3 changed files with 13 additions and 9 deletions

View File

@@ -210,7 +210,11 @@ std::vector<StrokeSample> Stroke::compute_samples()
}
m_dir_kp = m_last_kp;
m_dir_dist = 0;
m_dir_valid = true;
if (!m_dir_valid)
{
m_dir_init = m_dir_angle + m_dir_ref_angle;
m_dir_valid = true;
}
}
bool need_dir = false;
@@ -225,20 +229,18 @@ std::vector<StrokeSample> Stroke::compute_samples()
auto s = randomize_sample(pos, pressure, m_dir_angle + m_dir_ref_angle);
if (s.valid())
{
if (m_brush->m_tip_angle_follow || (!m_dir_valid && m_brush->m_tip_angle_init))
if (m_brush->m_tip_angle_follow)
{
m_direction.add(m_dir_angle);
s.angle += m_direction.average() + m_dir_ref_angle;
m_prev_sample = s;
samples.push_back(s);
}
else
else if (m_brush->m_tip_angle_init)
{
if (m_brush->m_tip_angle_init)
s.angle += m_direction.average() + m_dir_ref_angle;
m_prev_sample = s;
samples.push_back(s);
s.angle = m_dir_init;
}
m_prev_sample = s;
samples.push_back(s);
}
else
{

View File

@@ -160,6 +160,7 @@ public:
float m_dir_dist = 0;
float m_dir_step = 10;
float m_dir_angle = 0;
float m_dir_init = 0;
float m_curve = 0;
float m_dist = 0;
float m_step = 0;

View File

@@ -166,6 +166,7 @@ void NodePanelStroke::update_controls()
m_jitter_val->m_value.x = b->m_jitter_val;
m_jitter_aspect->m_value.x = b->m_jitter_aspect;
m_tip_angle_follow->checked = b->m_tip_angle_follow;
m_tip_angle_init->checked = b->m_tip_angle_init;
m_tip_flow_pressure->checked = b->m_tip_flow_pressure;
m_tip_size_pressure->checked = b->m_tip_size_pressure;
m_jitter_aspect_bothaxis->checked = b->m_jitter_aspect_bothaxis;