Skip to content

Commit

Permalink
tuttlePlugin: put ChoiceLabel into the Hint as a fallback
Browse files Browse the repository at this point in the history
Choice label is an ofx extension. If the host doesn't support it,
we put this information into the parameter hint.
  • Loading branch information
fabiencastan committed Nov 22, 2013
1 parent 31d9d55 commit ae6e14e
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion libraries/openfxHack/Support/Library/ofxsParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,28 @@ void ChoiceParamDescriptor::appendOption( const std::string& shortName, const st
const int nCurrentValues = getProps().propGetDimension( kOfxParamPropChoiceOption );

getProps().propSetString( kOfxParamPropChoiceOption, shortName, nCurrentValues );
getProps().propSetString( kOfxParamPropChoiceLabelOption, label, nCurrentValues, false ); // this option is optional extension, don't throw if not present.

if( ! label.empty() )
{
try
{
// this property is an optional extension.
getProps().propSetString( kOfxParamPropChoiceLabelOption, label, nCurrentValues );
} catch( std::exception& )
{
// If the kOfxParamPropChoiceLabelOption doesn't exist, we put that information into the Hint.
// It's better than nothing...
std::string hint = getProps().propGetString( kOfxParamPropHint );
if( ! hint.empty() )
{
hint += "\n";
if( nCurrentValues == 0 )
hint += "\n";
}
hint += shortName + ": " + label;
getProps().propSetString( kOfxParamPropHint, hint );
}
}
}

/** @brief set the default value */
Expand Down

0 comments on commit ae6e14e

Please sign in to comment.