Skip to content

Commit

Permalink
Bug fix: Set default coordinates system for kOfxParamDoubleTypeNormal…
Browse files Browse the repository at this point in the history
…isedXY and kOfxParamDoubleTypeNormalisedXYAbsolute to kOfxParamCoordinatesNormalised otherwise their default value will get normalised twice when reseting to default
  • Loading branch information
MrKepzie committed Nov 6, 2015
1 parent c49491e commit 12a1a29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 24 deletions.
5 changes: 3 additions & 2 deletions Engine/OfxParamInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1664,7 +1664,6 @@ OfxDouble2DInstance::OfxDouble2DInstance(OfxEffectInstance* node,
// Only create native overlays if there is no interact or kOfxParamPropUseHostOverlayHandle is set
// see https://github.com/MrKepzie/Natron/issues/932
// only create automatic overlay for kOfxParamDoubleTypeXYAbsolute and kOfxParamDoubleTypeNormalisedXYAbsolute
#pragma message WARN("TODO: check that kOfxParamDoubleTypeNormalisedXYAbsolute overlays are OK")
if ((!_node->effectInstance()->getOverlayInteractMainEntry() &&
(getDoubleType() == kOfxParamDoubleTypeXYAbsolute ||
getDoubleType() == kOfxParamDoubleTypeNormalisedXYAbsolute)) ||
Expand All @@ -1681,7 +1680,9 @@ OfxDouble2DInstance::OfxDouble2DInstance(OfxEffectInstance* node,
dblKnob->setValueIsNormalized(0, KnobDouble::eValueIsNormalizedX);
dblKnob->setValueIsNormalized(1, KnobDouble::eValueIsNormalizedY);
}
dblKnob->setDefaultValuesAreNormalized(coordSystem == kOfxParamCoordinatesNormalised);
dblKnob->setDefaultValuesAreNormalized(coordSystem == kOfxParamCoordinatesNormalised ||
doubleType == kOfxParamDoubleTypeNormalisedXY ||
doubleType == kOfxParamDoubleTypeNormalisedXYAbsolute);
for (int i = 0; i < dims; ++i) {
dblKnob->setDefaultValue(def[i], i);
}
Expand Down
22 changes: 0 additions & 22 deletions Gui/KnobGuiDouble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ KnobGuiDouble::valueAccordingToType(bool normalize,
}

KnobDouble::ValueIsNormalizedEnum state = _knob.lock()->getValueIsNormalized(dimension);
#if 1
#pragma message WARN("Alex please check that the following is right")
boost::shared_ptr<KnobDouble> knob = _knob.lock();
SequenceTime time = knob->getHolder()->getApp()->getTimeLine()->currentFrame();
if (state != KnobDouble::eValueIsNormalizedNone) {
Expand All @@ -120,26 +118,6 @@ KnobGuiDouble::valueAccordingToType(bool normalize,
knob->denormalize(dimension, time, value);
}
}
#else
// this code is duplicated from KnobDouble::normalize and KnobDouble::denormalize
if (state == KnobDouble::eValueIsNormalizedX) {
Format f;
getKnob()->getHolder()->getApp()->getProject()->getProjectDefaultFormat(&f);
if (normalize) {
*value /= f.width();
} else {
*value *= f.width();
}
} else if (state == KnobDouble::eValueIsNormalizedY) {
Format f;
getKnob()->getHolder()->getApp()->getProject()->getProjectDefaultFormat(&f);
if (normalize) {
*value /= f.height();
} else {
*value *= f.height();
}
}
#endif
}

bool
Expand Down

0 comments on commit 12a1a29

Please sign in to comment.