Allow toggling envelope transform X axis wrap
This commit is contained in:
parent
cfe2a2b971
commit
71221b41a1
@ -230,6 +230,7 @@ void EnvelopeComponent::mouseDown(const MouseEvent & ev)
|
||||
PopupMenu menu;
|
||||
menu.addItem(1, "Reset");
|
||||
menu.addItem(2, "Invert");
|
||||
menu.addItem(3, "Wrap envelope X transform", true, m_envelope->m_transform_wrap_x);
|
||||
int r = menu.show();
|
||||
if (r == 1)
|
||||
{
|
||||
@ -245,6 +246,10 @@ void EnvelopeComponent::mouseDown(const MouseEvent & ev)
|
||||
m_envelope->GetNodeAtIndex(i).Value = val;
|
||||
}
|
||||
}
|
||||
if (r == 3)
|
||||
{
|
||||
toggleBool(m_envelope->m_transform_wrap_x);
|
||||
}
|
||||
repaint();
|
||||
return;
|
||||
}
|
||||
|
@ -220,12 +220,14 @@ public:
|
||||
"x", m_nodes[i].Time, "y", m_nodes[i].Value, "p1", m_nodes[i].ShapeParam1, "p2", m_nodes[i].ShapeParam2);
|
||||
result.addChild(pt_tree, -1, nullptr);
|
||||
}
|
||||
result.setProperty("wrapxtransform", m_transform_wrap_x, nullptr);
|
||||
return result;
|
||||
}
|
||||
void restoreState(ValueTree state)
|
||||
{
|
||||
if (state.isValid()==false)
|
||||
return;
|
||||
m_transform_wrap_x = state.getProperty("wrapxtransform", false);
|
||||
int numnodes = state.getNumChildren();
|
||||
if (numnodes > 0)
|
||||
{
|
||||
@ -565,15 +567,20 @@ public:
|
||||
double m_transform_y_sinus = 0.0;
|
||||
double m_transform_y_sinus_freq = 8.0;
|
||||
double m_transform_y_tilt = 0.0;
|
||||
bool m_transform_wrap_x = false;
|
||||
double m_min_pt_value = 0.0;
|
||||
double m_max_pt_value = 0.0;
|
||||
inline double getTransformedValue(double x)
|
||||
{
|
||||
if (isTransformed() == false)
|
||||
return GetInterpolatedNodeValue(x);
|
||||
double temp = fmod(x - m_transform_x_shift, 1.0);
|
||||
if (temp < 0.0)
|
||||
temp += 1.0;
|
||||
double temp = x-m_transform_x_shift;
|
||||
if (m_transform_wrap_x == true)
|
||||
{
|
||||
temp = fmod(x - m_transform_x_shift, 1.0);
|
||||
if (temp < 0.0)
|
||||
temp += 1.0;
|
||||
}
|
||||
double v = GetInterpolatedNodeValue(temp);
|
||||
double center_v = m_minvalue + (m_maxvalue - m_minvalue) / 2.0;
|
||||
double diff = center_v - v;
|
||||
|
Loading…
Reference in New Issue
Block a user