MCPcopy Create free account
hub / github.com/MrKepzie/Natron / initializeKnobs

Method initializeKnobs

Engine/Project.cpp:715–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

713}
714
715void
716Project::initializeKnobs()
717{
718 boost::shared_ptr<KnobPage> page = AppManager::createKnob<KnobPage>( this, tr("Settings") );
719
720 _imp->envVars = AppManager::createKnob<KnobPath>( this, tr("Project Paths") );
721 _imp->envVars->setName("projectPaths");
722 _imp->envVars->setHintToolTip( tr("Specify here project paths. Any path can be used "
723 "in file paths and can be used between brackets, for example: \n"
724 "[%1]MyProject.ntp \n"
725 "You can add as many project paths as you want and can name them as you want. This way it "
726 "makes it easy to share your projects and move files around."
727 " You can chain up paths, like so:\n "
728 "[%1] = <PathToProject> \n"
729 "[Scene1] = [%1]/Rush/S_01 \n"
730 "[Shot1] = [Scene1]/Shot001 \n"
731 "By default if a file-path is NOT absolute (i.e: not starting with '/' "
732 " on Unix or a drive name on Windows) "
733 "then it will be expanded using the [%1] path. "
734 "Absolute paths are treated as normal."
735 " The [%1] path will be set automatically to "
736 " the location of the project file when saving and loading a project."
737 " The [%2] path will also be set automatically for better sharing of projects with reader nodes.").arg( QString::fromUtf8(NATRON_PROJECT_ENV_VAR_NAME) ).arg( QString::fromUtf8(NATRON_OCIO_ENV_VAR_NAME) ) );
738 _imp->envVars->setSecret(false);
739 _imp->envVars->setMultiPath(true);
740
741
742 ///Initialize the OCIO Config
743 onOCIOConfigPathChanged(appPTR->getOCIOConfigPath(), false);
744
745 page->addKnob(_imp->envVars);
746
747 _imp->formatKnob = AppManager::createKnob<KnobChoice>( this, tr("Output Format") );
748 _imp->formatKnob->setHintToolTip( tr("The project output format is what is used as canvas on the viewers.") );
749 _imp->formatKnob->setName("outputFormat");
750
751 const std::vector<Format> & appFormats = appPTR->getFormats();
752 std::vector<ChoiceOption> entries;
753 for (U32 i = 0; i < appFormats.size(); ++i) {
754 const Format& f = appFormats[i];
755 QString formatStr = ProjectPrivate::generateStringFromFormat(f);
756 if ( (f.width() == 1920) && (f.height() == 1080) && (f.getPixelAspectRatio() == 1) ) {
757 _imp->formatKnob->setDefaultValue(i, 0);
758 }
759 if ( !f.getName().empty() ) {
760 entries.push_back( ChoiceOption(f.getName(), formatStr.toStdString(), "") );
761 } else {
762 entries.push_back( ChoiceOption( formatStr.toStdString() ) );
763 }
764
765 _imp->builtinFormats.push_back(f);
766 }
767 _imp->formatKnob->setAddNewLine(false);
768
769 _imp->formatKnob->populateChoices(entries);
770 _imp->formatKnob->setAnimationEnabled(false);
771 page->addKnob(_imp->formatKnob);
772

Callers

nothing calls this directly

Calls 15

generateStringFromFormatFunction · 0.85
ChoiceOptionFunction · 0.85
generateGUIUserNameFunction · 0.85
setMultiPathMethod · 0.80
emptyMethod · 0.80
getNameMethod · 0.80
toStdStringMethod · 0.80
populateChoicesMethod · 0.80
getCurrentSettingsMethod · 0.80
setDimensionNameMethod · 0.80

Tested by

no test coverage detected