diff --git a/Gui/KnobGuiChoice.cpp b/Gui/KnobGuiChoice.cpp index 45ff432ec4..eeb2dbc64a 100644 --- a/Gui/KnobGuiChoice.cpp +++ b/Gui/KnobGuiChoice.cpp @@ -358,6 +358,27 @@ KnobGuiChoice::updateToolTip() _comboBox->setToolTip( tt ); } +// The project only saves the choice ID that was selected and not the associated label. +// If the ID cannot be found in the menu upon loading the project, then the ID of the choice +// will be displayed in the menu. +// For a plane selector, if the plane is not present in the menu when loading the project it will display +// the raw ID of the plane which contains stuff that should not be displayed to the user. +static void ensureUnknownChocieIsNotInternalPlaneID(QString& label) +{ + if (label.contains(QLatin1String(kNatronColorPlaneID))) { + label.replace(QLatin1String(kNatronColorPlaneID), QLatin1String(kNatronColorPlaneLabel)); ; + } else if (label.contains(QLatin1String(kNatronBackwardMotionVectorsPlaneID))) { + label.replace(QLatin1String(kNatronBackwardMotionVectorsPlaneID), QLatin1String(kNatronBackwardMotionVectorsPlaneLabel)); ; + } else if (label.contains(QLatin1String(kNatronForwardMotionVectorsPlaneID))) { + label.replace(QLatin1String(kNatronForwardMotionVectorsPlaneID), QLatin1String(kNatronForwardMotionVectorsPlaneLabel)); ; + } else if (label.contains(QLatin1String(kNatronDisparityLeftPlaneID))) { + label.replace(QLatin1String(kNatronDisparityLeftPlaneID), QLatin1String(kNatronDisparityLeftPlaneLabel)); ; + } else if (label.contains(QLatin1String(kNatronDisparityRightPlaneID))) { + label.replace(QLatin1String(kNatronDisparityRightPlaneID), QLatin1String(kNatronDisparityRightPlaneLabel)); ; + } + +} + void KnobGuiChoice::updateGUI(int /*dimension*/) { @@ -386,6 +407,7 @@ KnobGuiChoice::updateGUI(int /*dimension*/) if ( _comboBox->isCascading() || activeEntry.id.empty() ) { _comboBox->setCurrentIndex_no_emit( knob->getValue() ); } else { + ensureUnknownChocieIsNotInternalPlaneID(activeEntryLabel); _comboBox->setCurrentText_no_emit( activeEntryLabel ); } }