MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / initializeKnobsColorManagement

Method initializeKnobsColorManagement

Engine/Settings.cpp:643–701  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

641} // Settings::initializeKnobsUserInterface
642
643void
644Settings::initializeKnobsColorManagement()
645{
646 _ocioTab = AppManager::createKnob<KnobPage>( this, tr("Color Management") );
647 _ocioConfigKnob = AppManager::createKnob<KnobChoice>( this, tr("OpenColorIO configuration") );
648 _ocioConfigKnob->setName("ocioConfig");
649
650 std::vector<ChoiceOption> configs;
651 int defaultIndex = 0;
652 QStringList defaultOcioConfigsPaths = getDefaultOcioConfigPaths();
653 Q_FOREACH(const QString &defaultOcioConfigsDir, defaultOcioConfigsPaths) {
654 QDir ocioConfigsDir(defaultOcioConfigsDir);
655
656 if ( ocioConfigsDir.exists() ) {
657 QStringList entries = ocioConfigsDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
658 for (int j = 0; j < entries.size(); ++j) {
659 if ( entries[j] == QString::fromUtf8(NATRON_DEFAULT_OCIO_CONFIG_NAME) ) {
660 defaultIndex = j;
661 }
662 configs.push_back(ChoiceOption( entries[j].toStdString() ));
663 }
664
665 break; //if we found 1 OpenColorIO-Configs directory, skip the next
666 }
667 }
668 configs.push_back(ChoiceOption(NATRON_CUSTOM_OCIO_CONFIG_NAME));
669 _ocioConfigKnob->populateChoices(configs);
670 _ocioConfigKnob->setDefaultValue(defaultIndex, 0);
671 _ocioConfigKnob->setHintToolTip( tr("Select the OpenColorIO configuration you would like to use globally for all "
672 "operators and plugins that use OpenColorIO, by setting the \"OCIO\" "
673 "environment variable. Only nodes created after changing this parameter will take "
674 "it into account, and it is better to restart the application after changing it. "
675 "When \"%1\" is selected, the "
676 "\"Custom OpenColorIO config file\" parameter is used.").arg( QString::fromUtf8(NATRON_CUSTOM_OCIO_CONFIG_NAME) ) );
677
678 _ocioTab->addKnob(_ocioConfigKnob);
679
680 _customOcioConfigFile = AppManager::createKnob<KnobFile>( this, tr("Custom OpenColorIO configuration file") );
681 _customOcioConfigFile->setName("ocioCustomConfigFile");
682
683 if (_ocioConfigKnob->getNumEntries() == 1) {
684 _customOcioConfigFile->setDefaultAllDimensionsEnabled(true);
685 } else {
686 _customOcioConfigFile->setDefaultAllDimensionsEnabled(false);
687 }
688
689 _customOcioConfigFile->setHintToolTip( tr("OpenColorIO configuration file (config.ocio) to use when \"%1\" "
690 "is selected as the OpenColorIO config.").arg( QString::fromUtf8(NATRON_CUSTOM_OCIO_CONFIG_NAME) ) );
691 _ocioTab->addKnob(_customOcioConfigFile);
692
693 _warnOcioConfigKnobChanged = AppManager::createKnob<KnobBool>( this, tr("Warn on OpenColorIO config change") );
694 _warnOcioConfigKnobChanged->setName("warnOCIOChanged");
695 _warnOcioConfigKnobChanged->setHintToolTip( tr("Show a warning dialog when changing the OpenColorIO config to remember that a restart is required.") );
696 _ocioTab->addKnob(_warnOcioConfigKnobChanged);
697
698 _ocioStartupCheck = AppManager::createKnob<KnobBool>( this, tr("Warn on startup if OpenColorIO config is not the default") );
699 _ocioStartupCheck->setName("startupCheckOCIO");
700 _ocioTab->addKnob(_ocioStartupCheck);

Callers

nothing calls this directly

Calls 10

ChoiceOptionFunction · 0.85
populateChoicesMethod · 0.80
getNumEntriesMethod · 0.80
setNameMethod · 0.45
push_backMethod · 0.45
setDefaultValueMethod · 0.45
setHintToolTipMethod · 0.45
addKnobMethod · 0.45

Tested by

no test coverage detected