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

Method onOCIOConfigPathChanged

Engine/Project.cpp:2444–2488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2442}
2443
2444void
2445Project::onOCIOConfigPathChanged(const std::string& path,
2446 bool block)
2447{
2448 beginChanges();
2449
2450 try {
2451 std::string oldEnv;
2452 try {
2453 oldEnv = _imp->envVars->getValue();
2454 } catch (...) {
2455 // ignore
2456 }
2457 std::list<std::vector<std::string> > table;
2458 _imp->envVars->decodeFromKnobTableFormat(oldEnv, &table);
2459
2460 ///If there was already a OCIO variable, update it, otherwise create it
2461 bool found = false;
2462 for (std::list<std::vector<std::string> >::iterator it = table.begin(); it != table.end(); ++it) {
2463 if ( (*it)[0] == NATRON_OCIO_ENV_VAR_NAME ) {
2464 (*it)[1] = path;
2465 found = true;
2466 break;
2467 }
2468 }
2469 if (!found) {
2470 std::vector<std::string> vec(2);
2471 vec[0] = NATRON_OCIO_ENV_VAR_NAME;
2472 vec[1] = path;
2473 table.push_back(vec);
2474 }
2475
2476 std::string newEnv = _imp->envVars->encodeToKnobTableFormat(table);
2477
2478 if (oldEnv != newEnv) {
2479 if ( appPTR->getCurrentSettings()->isAutoFixRelativeFilePathEnabled() ) {
2480 fixRelativeFilePaths(NATRON_OCIO_ENV_VAR_NAME, path, block);
2481 }
2482 _imp->envVars->setValue(newEnv);
2483 }
2484 endChanges(block);
2485 } catch (std::logic_error) {
2486 // ignore
2487 }
2488}
2489
2490double
2491Project::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