this function is only called on the main thread
| 1634 | |
| 1635 | ///this function is only called on the main thread |
| 1636 | bool |
| 1637 | Project::onKnobValueChanged(KnobI* knob, |
| 1638 | ValueChangedReasonEnum reason, |
| 1639 | double /*time*/, |
| 1640 | ViewSpec /*view*/, |
| 1641 | bool /*originatedFromMainThread*/) |
| 1642 | { |
| 1643 | bool ret = true; |
| 1644 | bool shouldAutoSave = false; |
| 1645 | |
| 1646 | if ( knob == _imp->viewsList.get() ) { |
| 1647 | /** |
| 1648 | * All cache entries are linked to a view index which may no longer be correct since the user changed the project settings. |
| 1649 | * The only way to overcome this is to wipe the cache. |
| 1650 | **/ |
| 1651 | appPTR->clearAllCaches(); |
| 1652 | |
| 1653 | std::vector<std::string> viewNames = getProjectViewNames(); |
| 1654 | getApp()->setupViewersForViews(viewNames); |
| 1655 | if (reason == eValueChangedReasonUserEdited) { |
| 1656 | ///views change, notify all OneView nodes via getClipPreferences |
| 1657 | forceComputeInputDependentDataOnAllTrees(); |
| 1658 | } |
| 1659 | Q_EMIT projectViewsChanged(); |
| 1660 | shouldAutoSave = true; |
| 1661 | } else if ( knob == _imp->defaultLayersList.get() ) { |
| 1662 | if (reason == eValueChangedReasonUserEdited) { |
| 1663 | ///default layers change, notify all nodes so they rebuild their layers menus |
| 1664 | forceComputeInputDependentDataOnAllTrees(); |
| 1665 | } |
| 1666 | shouldAutoSave = true; |
| 1667 | } else if ( knob == _imp->setupForStereoButton.get() ) { |
| 1668 | setupProjectForStereo(); |
| 1669 | shouldAutoSave = true; |
| 1670 | } else if ( knob == _imp->formatKnob.get() ) { |
| 1671 | int index = _imp->formatKnob->getValue(); |
| 1672 | Format frmt; |
| 1673 | bool found = _imp->findFormat(index, &frmt); |
| 1674 | NodesList nodes; |
| 1675 | getNodes_recursive(nodes, true); |
| 1676 | |
| 1677 | // Refresh nodes with a format parameter |
| 1678 | std::vector<ChoiceOption> entries = _imp->formatKnob->getEntries_mt_safe(); |
| 1679 | for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 1680 | (*it)->refreshFormatParamChoice(entries, index, false); |
| 1681 | } |
| 1682 | if (found) { |
| 1683 | if (reason == eValueChangedReasonUserEdited) { |
| 1684 | ///Increase all nodes age in the project so all cache is invalidated: some effects images might rely on the project format |
| 1685 | for (NodesList::iterator it = nodes.begin(); it != nodes.end(); ++it) { |
| 1686 | (*it)->incrementKnobsAge(); |
| 1687 | } |
| 1688 | |
| 1689 | |
| 1690 | } |
| 1691 | ///Format change, hence probably the PAR so run getClipPreferences again |
| 1692 | forceComputeInputDependentDataOnAllTrees(); |
| 1693 | Q_EMIT formatChanged(frmt); |
nothing calls this directly
no test coverage detected