| 2891 | |
| 2892 | template <typename T> |
| 2893 | bool |
| 2894 | Knob<T>::dequeueValuesSet(bool disableEvaluation) |
| 2895 | { |
| 2896 | std::map<int, ValueChangedReasonEnum> dimensionChanged; |
| 2897 | bool ret = false; |
| 2898 | |
| 2899 | cloneGuiCurvesIfNeeded(dimensionChanged); |
| 2900 | { |
| 2901 | QMutexLocker kql(&_setValuesQueueMutex); |
| 2902 | QMutexLocker k(&_valueMutex); |
| 2903 | for (typename std::list<QueuedSetValuePtr>::const_iterator it = _setValuesQueue.begin(); it != _setValuesQueue.end(); ++it) { |
| 2904 | QueuedSetValueAtTime* isAtTime = dynamic_cast<QueuedSetValueAtTime*>( it->get() ); |
| 2905 | bool blockValueChanges = (*it)->valueChangesBlocked(); |
| 2906 | |
| 2907 | if (!isAtTime) { |
| 2908 | if ( (*it)->useKey() ) { |
| 2909 | CurvePtr curve = getCurve( (*it)->view(), (*it)->dimension() ); |
| 2910 | if (curve) { |
| 2911 | curve->addKeyFrame( (*it)->key() ); |
| 2912 | } |
| 2913 | |
| 2914 | if ( getHolder() ) { |
| 2915 | getHolder()->setHasAnimation(true); |
| 2916 | } |
| 2917 | } else { |
| 2918 | if ( _values[(*it)->dimension()] != (*it)->value() ) { |
| 2919 | _values[(*it)->dimension()] = (*it)->value(); |
| 2920 | _guiValues[(*it)->dimension()] = (*it)->value(); |
| 2921 | if (!blockValueChanges) { |
| 2922 | dimensionChanged.insert( std::make_pair( (*it)->dimension(), (*it)->reason() ) ); |
| 2923 | } |
| 2924 | } |
| 2925 | } |
| 2926 | } else { |
| 2927 | CurvePtr curve = getCurve( (*it)->view(), (*it)->dimension() ); |
| 2928 | if (curve) { |
| 2929 | KeyFrame existingKey; |
| 2930 | const KeyFrame& key = (*it)->key(); |
| 2931 | bool hasKey = curve->getKeyFrameWithTime( key.getTime(), &existingKey ); |
| 2932 | if ( !hasKey || ( existingKey.getTime() != key.getTime() ) || ( existingKey.getValue() != key.getValue() ) || |
| 2933 | ( existingKey.getLeftDerivative() != key.getLeftDerivative() ) || |
| 2934 | ( existingKey.getRightDerivative() != key.getRightDerivative() ) ) { |
| 2935 | if (!blockValueChanges) { |
| 2936 | dimensionChanged.insert( std::make_pair( (*it)->dimension(), (*it)->reason() ) ); |
| 2937 | } |
| 2938 | curve->addKeyFrame( key ); |
| 2939 | } |
| 2940 | } |
| 2941 | |
| 2942 | if ( getHolder() ) { |
| 2943 | getHolder()->setHasAnimation(true); |
| 2944 | } |
| 2945 | } |
| 2946 | } |
| 2947 | _setValuesQueue.clear(); |
| 2948 | } |
| 2949 | cloneInternalCurvesIfNeeded(dimensionChanged); |
| 2950 |
nothing calls this directly
no test coverage detected