[pitivi] interpolator: clamp keyframe values between lower and upper. don't do clamping in UI



commit 429f88cddd5b20d1761b0a1361d3164d26100549
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date:   Fri May 29 12:04:07 2009 -0700

    interpolator: clamp keyframe values between lower and upper. don't do clamping in UI

 pitivi/timeline/track.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/pitivi/timeline/track.py b/pitivi/timeline/track.py
index 911d0f7..9726d0e 100644
--- a/pitivi/timeline/track.py
+++ b/pitivi/timeline/track.py
@@ -140,6 +140,10 @@ class Interpolator(Signallable):
         self._default = 0
         self._property = property
         self._keyframes = []
+        # FIXME: get this from the property's param spec
+        # NOTE: keyframes necessarily work only on a closed range
+        self.lower = 0
+        self.upper = 1
 
         # FIXME: don't create separate controllers for each Interpolator
         # FIXME: uncomment this when back-end support works
@@ -197,10 +201,12 @@ class Interpolator(Signallable):
         self._controller.set_interpolation_mode(mode)
 
     def setKeyframeTime(self, kf, time):
+        time = max(self.start.time, min(self.end.time, time))
         self._keyframeTimeValueChanged(kf, time, kf.value)
         kf.setObjectTime(time)
 
     def setKeyframeValue(self, kf, value):
+        value = max(self.lower, min(self.upper, value))
         self._keyframeTimeValueChanged(kf, kf.time, value)
         kf.setObjectValue(value)
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]