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

Method onOCIOConfigPathChanged

Engine/Project.cpp:2588–2632  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2586}
2587
2588void
2589Project::onOCIOConfigPathChanged(const std::string& path,
2590 bool block)
2591{
2592 beginChanges();
2593
2594 try {
2595 std::string oldEnv;
2596 try {
2597 oldEnv = _imp->envVars->getValue();
2598 } catch (...) {
2599 // ignore
2600 }
2601 std::list<std::vector<std::string> > table;
2602 _imp->envVars->decodeFromKnobTableFormat(oldEnv, &table);
2603
2604 ///If there was already a OCIO variable, update it, otherwise create it
2605 bool found = false;
2606 for (std::list<std::vector<std::string> >::iterator it = table.begin(); it != table.end(); ++it) {
2607 if ( (*it)[0] == NATRON_OCIO_ENV_VAR_NAME ) {
2608 (*it)[1] = path;
2609 found = true;
2610 break;
2611 }
2612 }
2613 if (!found) {
2614 std::vector<std::string> vec(2);
2615 vec[0] = NATRON_OCIO_ENV_VAR_NAME;
2616 vec[1] = path;
2617 table.push_back(vec);
2618 }
2619
2620 std::string newEnv = _imp->envVars->encodeToKnobTableFormat(table);
2621
2622 if (oldEnv != newEnv) {
2623 if ( appPTR->getCurrentSettings()->isAutoFixRelativeFilePathEnabled() ) {
2624 fixRelativeFilePaths(NATRON_OCIO_ENV_VAR_NAME, path, block);
2625 }
2626 _imp->envVars->setValue(newEnv);
2627 }
2628 endChanges(block);
2629 } catch (std::logic_error&) {
2630 // ignore
2631 }
2632}
2633
2634double
2635Project::getProjectFrameRate() const

Callers 2

Calls 9

getCurrentSettingsMethod · 0.80
getValueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45
setValueMethod · 0.45

Tested by

no test coverage detected