Skip to content

Commit

Permalink
Int_KnobGui: fix bug when using the spinbox and the dimension switch …
Browse files Browse the repository at this point in the history
…is not checked

also comment and replicate the code into Double_KnobGui
  • Loading branch information
devernay committed Aug 25, 2015
1 parent c1a8b2b commit 7b2e57c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 13 deletions.
29 changes: 18 additions & 11 deletions Gui/Double_KnobGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -571,19 +571,26 @@ Double_KnobGui::onSpinBoxValueChanged()
{
std::list<double> newValues;

double v0 = _spinBoxes[0].first->value();

for (U32 i = 0; i < _spinBoxes.size(); ++i) {
double v;
if (_dimensionSwitchButton && !_dimensionSwitchButton->isChecked()) {
v = v0;
_spinBoxes[i].first->setValue(v);
} else {
v = _spinBoxes[i].first->value();
if (!_dimensionSwitchButton || _dimensionSwitchButton->isChecked() ) {
// each spinbox has a different value
for (U32 i = 0; i < _spinBoxes.size(); ++i) {
double v = _spinBoxes[i].first->value();
valueAccordingToType(true, 0, &v);
newValues.push_back(v);
}
} else {
// use the value of the first dimension only, and set all spinboxes
if (_spinBoxes.size() > 1) {
double v = _spinBoxes[0].first->value();
valueAccordingToType(true, 0, &v);
newValues.push_back(v);
for (U32 i = 1; i < _spinBoxes.size(); ++i) {
newValues.push_back(v);
_spinBoxes[i].first->setValue(v);
}
}
valueAccordingToType(true, 0, &v);
newValues.push_back(v);
}

if (_slider) {
_slider->seekScalePosition( newValues.front() );
}
Expand Down
18 changes: 16 additions & 2 deletions Gui/Int_KnobGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,23 @@ Int_KnobGui::onSpinBoxValueChanged()
{
std::list<int> newValues;

for (U32 i = 0; i < _spinBoxes.size(); ++i) {
newValues.push_back( _spinBoxes[i].first->value() );
if (!_dimensionSwitchButton || _dimensionSwitchButton->isChecked() ) {
// each spinbox has a different value
for (U32 i = 0; i < _spinBoxes.size(); ++i) {
newValues.push_back( _spinBoxes[i].first->value() );
}
} else {
// use the value of the first dimension only, and set all spinboxes
if (_spinBoxes.size() > 1) {
int v = _spinBoxes[0].first->value();
newValues.push_back(v);
for (U32 i = 1; i < _spinBoxes.size(); ++i) {
newValues.push_back(v);
_spinBoxes[i].first->setValue(v);
}
}
}

if (_slider) {
_slider->seekScalePosition( newValues.front() );
}
Expand Down

0 comments on commit 7b2e57c

Please sign in to comment.