| 2586 | } |
| 2587 | |
| 2588 | void |
| 2589 | Project::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 | |
| 2634 | double |
| 2635 | Project::getProjectFrameRate() const |
no test coverage detected