本文整理汇总了C++中ofx::ChoiceParamDescriptor::setCascading方法的典型用法代码示例。如果您正苦于以下问题:C++ ChoiceParamDescriptor::setCascading方法的具体用法?C++ ChoiceParamDescriptor::setCascading怎么用?C++ ChoiceParamDescriptor::setCascading使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofx::ChoiceParamDescriptor
的用法示例。
在下文中一共展示了ChoiceParamDescriptor::setCascading方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: catch
void
GenericOCIO::describeInContextOutput(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum /*context*/, OFX::PageParamDescriptor *page, const char* outputSpaceNameDefault, const char* outputSpaceLabel)
{
#ifdef OFX_IO_USING_OCIO
gHostIsNatron = (OFX::getImageEffectHostDescription()->isNatron);
char* file = std::getenv("OCIO");
OCIO::ConstConfigRcPtr config;
if (file != NULL) {
//Add choices
try {
config = OCIO::Config::CreateFromFile(file);
gWasOCIOEnvVarFound = true;
} catch (OCIO::Exception &e) {
}
}
std::string outputSpaceName;
if (config) {
outputSpaceName = canonicalizeColorSpace(config, colorSpaceName(config, outputSpaceNameDefault));
}
///////////Output Color-space
{
OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamOutputSpace);
param->setLabel(outputSpaceLabel);
param->setHint(kOCIOParamOutputSpaceHint);
param->setAnimates(true);
if (config) {
param->setDefault(outputSpaceName);
} else {
param->setEnabled(false);
}
page->addChild(*param);
}
#ifdef OFX_OCIO_CHOICE
{
OFX::ChoiceParamDescriptor* param = desc.defineChoiceParam(kOCIOParamOutputSpaceChoice);
param->setLabel(outputSpaceLabel);
param->setHint(kOCIOParamOutputSpaceHint);
param->setCascading(OFX::getImageEffectHostDescription()->supportsCascadingChoices);
if (config) {
buildChoiceMenu(config, param, OFX::getImageEffectHostDescription()->supportsCascadingChoices, outputSpaceName);
} else {
param->setEnabled(false);
//param->setIsSecret(true); // done in the plugin constructor
}
param->setAnimates(true);
param->setEvaluateOnChange(false); // evaluate only when the StringParam is changed
param->setIsPersistant(false); // don't save/serialize
page->addChild(*param);
}
#endif
#endif
}
示例2: s
void
GenericOCIO::describeInContextInput(OFX::ImageEffectDescriptor &desc, OFX::ContextEnum /*context*/, OFX::PageParamDescriptor *page, const char* inputSpaceNameDefault, const char* inputSpaceLabel)
{
#ifdef OFX_IO_USING_OCIO
gHostIsNatron = (OFX::getImageEffectHostDescription()->isNatron);
char* file = std::getenv("OCIO");
OCIO::ConstConfigRcPtr config;
if (file != NULL) {
//Add choices
try {
config = OCIO::Config::CreateFromFile(file);
gWasOCIOEnvVarFound = true;
} catch (OCIO::Exception &e) {
}
}
std::string inputSpaceName, outputSpaceName;
if (config) {
inputSpaceName = canonicalizeColorSpace(config, colorSpaceName(config, inputSpaceNameDefault));
}
////////// OCIO config file
{
OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamConfigFile);
param->setLabel(kOCIOParamConfigFileLabel);
param->setHint(kOCIOParamConfigFileHint);
param->setStringType(OFX::eStringTypeFilePath);
param->setFilePathExists(true);
param->setAnimates(false);
desc.addClipPreferencesSlaveParam(*param);
// the OCIO config can only be set in a portable fashion using the environment variable.
// Nuke, for example, doesn't support changing the entries in a ChoiceParam outside of describeInContext.
// disable it, and set the default from the env variable.
assert(OFX::getImageEffectHostDescription());
param->setEnabled(true);
if (file == NULL) {
param->setDefault("WARNING: Open an OCIO config file, or set the OCIO environnement variable");
} else if (config) {
param->setDefault(file);
} else {
std::string s("ERROR: Invalid OCIO configuration '");
s += file;
s += '\'';
param->setDefault(s);
}
page->addChild(*param);
}
///////////Input Color-space
{
OFX::StringParamDescriptor* param = desc.defineStringParam(kOCIOParamInputSpace);
param->setLabel(inputSpaceLabel);
param->setHint(kOCIOParamInputSpaceHint);
param->setAnimates(true);
if (config) {
param->setDefault(inputSpaceName);
} else {
param->setEnabled(false);
}
page->addChild(*param);
}
#ifdef OFX_OCIO_CHOICE
{
OFX::ChoiceParamDescriptor* param = desc.defineChoiceParam(kOCIOParamInputSpaceChoice);
param->setLabel(inputSpaceLabel);
param->setHint(kOCIOParamInputSpaceHint);
param->setCascading(OFX::getImageEffectHostDescription()->supportsCascadingChoices);
if (config) {
buildChoiceMenu(config, param, OFX::getImageEffectHostDescription()->supportsCascadingChoices, inputSpaceName);
} else {
param->setEnabled(false);
//param->setIsSecret(true); // done in the plugin constructor
}
param->setAnimates(true);
param->setEvaluateOnChange(false); // evaluate only when the StringParam is changed
param->setIsPersistant(false); // don't save/serialize
page->addChild(*param);
}
#endif
#endif
}