| 2442 | } |
| 2443 | |
| 2444 | void |
| 2445 | Project::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 | |
| 2490 | double |
| 2491 | Project::getProjectFrameRate() const |
no test coverage detected