Skip to content
Snippets Groups Projects
Commit b08a0d75 authored by interpretivechaos's avatar interpretivechaos
Browse files

Catches error with update on editors without parameterEditors

Fixes a bug with my previous change that would crash the program if you
tried to change the parameters of a processor without a parameterEditor.
parent a12568bd
No related branches found
No related tags found
No related merge requests found
...@@ -770,6 +770,12 @@ void TriangleButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDow ...@@ -770,6 +770,12 @@ void TriangleButton::paintButton(Graphics& g, bool isMouseOver, bool isButtonDow
} }
void GenericEditor::updateParameterButtons(int parameterIndex=-1){ void GenericEditor::updateParameterButtons(int parameterIndex=-1){
if (parameterEditors.size()==0)
{
//Checks if there is a parameter editor, and stops a bug if there isn't.
std::cout << "No parameterEditors" << std::endl;
}
else{
if (parameterIndex==-1){ if (parameterIndex==-1){
for (int i = 0; i < parameterEditors.size(); ++i) for (int i = 0; i < parameterEditors.size(); ++i)
{ {
...@@ -780,4 +786,5 @@ void GenericEditor::updateParameterButtons(int parameterIndex=-1){ ...@@ -780,4 +786,5 @@ void GenericEditor::updateParameterButtons(int parameterIndex=-1){
parameterEditors[parameterIndex]->channelSelectionUI(); parameterEditors[parameterIndex]->channelSelectionUI();
} }
std::cout << "updateParameterButtons" << std::endl; std::cout << "updateParameterButtons" << std::endl;
}
} }
...@@ -510,7 +510,6 @@ void ParameterEditor::channelSelectionUI() ...@@ -510,7 +510,6 @@ void ParameterEditor::channelSelectionUI()
{ {
int numChannels=channelSelector->getNumChannels(); int numChannels=channelSelector->getNumChannels();
Array<var> possibleValues=parameter->getPossibleValues();
if (parameter->isBoolean()) if (parameter->isBoolean())
{ {
...@@ -522,6 +521,7 @@ void ParameterEditor::channelSelectionUI() ...@@ -522,6 +521,7 @@ void ParameterEditor::channelSelectionUI()
else if (parameter->isDiscrete()) else if (parameter->isDiscrete())
{ {
std::cout << "Calculating colors for discrete buttons" << std::endl; std::cout << "Calculating colors for discrete buttons" << std::endl;
Array<var> possibleValues=parameter->getPossibleValues();
for (int i = 0; i < buttonArray.size(); i++) for (int i = 0; i < buttonArray.size(); i++)
{ {
......
...@@ -199,7 +199,6 @@ void SourceNode::enabledState(bool t) ...@@ -199,7 +199,6 @@ void SourceNode::enabledState(bool t)
void SourceNode::setParameter(int parameterIndex, float newValue) void SourceNode::setParameter(int parameterIndex, float newValue)
{ {
editor->updateParameterButtons(parameterIndex);
editor->updateParameterButtons(parameterIndex); editor->updateParameterButtons(parameterIndex);
//std::cout << "Got parameter change notification"; //std::cout << "Got parameter change notification";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment