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

Method initializeKnobs

Engine/Project.cpp:813–1184  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

811}
812
813void
814Project::initializeKnobs()
815{
816 KnobPagePtr page = AppManager::createKnob<KnobPage>( this, tr("Settings") );
817
818 _imp->envVars = AppManager::createKnob<KnobPath>( this, tr("Project Paths") );
819 _imp->envVars->setName("projectPaths");
820 _imp->envVars->setHintToolTip( tr("Specify here project paths. Any path can be used "
821 "in file paths and can be used between brackets, for example: \n"
822 "[%1]MyProject.ntp \n"
823 "You can add as many project paths as you want and can name them as you want. This way it "
824 "makes it easy to share your projects and move files around."
825 " You can chain up paths, like so:\n "
826 "[%1] = <PathToProject> \n"
827 "[Scene1] = [%1]/Rush/S_01 \n"
828 "[Shot1] = [Scene1]/Shot001 \n"
829 "By default if a file-path is NOT absolute (i.e: not starting with '/' "
830 " on Unix or a drive name on Windows) "
831 "then it will be expanded using the [%1] path. "
832 "Absolute paths are treated as normal."
833 " The [%1] path will be set automatically to "
834 " the location of the project file when saving and loading a project."
835 " 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) ) );
836 _imp->envVars->setSecret(false);
837 _imp->envVars->setMultiPath(true);
838
839
840 ///Initialize the OCIO Config
841 onOCIOConfigPathChanged(appPTR->getOCIOConfigPath(), false);
842
843 page->addKnob(_imp->envVars);
844
845 _imp->formatKnob = AppManager::createKnob<KnobChoice>( this, tr("Project Format") );
846 _imp->formatKnob->setHintToolTip( tr("The project format is used as the default workspace size for viewers, the default format for generators, and the default output format for writers. In most cases this should match your plate resolution.") );
847 _imp->formatKnob->setName("outputFormat");
848
849 const std::vector<Format> & appFormats = appPTR->getFormats();
850 std::vector<ChoiceOption> entries;
851 for (U32 i = 0; i < appFormats.size(); ++i) {
852 const Format& f = appFormats[i];
853 QString formatStr = ProjectPrivate::generateStringFromFormat(f);
854 if ( (f.width() == 1920) && (f.height() == 1080) && (f.getPixelAspectRatio() == 1) ) {
855 _imp->formatKnob->setDefaultValue(i, 0);
856 }
857 if ( !f.getName().empty() ) {
858 entries.push_back( ChoiceOption(f.getName(), formatStr.toStdString(), "") );
859 } else {
860 entries.push_back( ChoiceOption( formatStr.toStdString() ) );
861 }
862
863 _imp->builtinFormats.push_back(f);
864 }
865 _imp->formatKnob->setAddNewLine(false);
866
867 _imp->formatKnob->populateChoices(entries);
868 _imp->formatKnob->setAnimationEnabled(false);
869 page->addKnob(_imp->formatKnob);
870

Callers

nothing calls this directly

Calls 15

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

Tested by

no test coverage detected