Browse Source

allow intervals with duration < 0

David Rose 22 years ago
parent
commit
dea5eaccfb
2 changed files with 2 additions and 5 deletions
  1. 1 3
      direct/src/interval/Interval.py
  2. 1 2
      direct/src/interval/cInterval.cxx

+ 1 - 3
direct/src/interval/Interval.py

@@ -19,7 +19,7 @@ class Interval(DirectObject):
         """__init__(name, duration, openEnded)
         """__init__(name, duration, openEnded)
         """
         """
         self.name = name
         self.name = name
-        self.duration = duration
+        self.duration = max(duration, 0.0)
         self.state = CInterval.SInitial
         self.state = CInterval.SInitial
         self.currT = 0.0
         self.currT = 0.0
         self.doneEvent = None
         self.doneEvent = None
@@ -37,8 +37,6 @@ class Interval(DirectObject):
         # if it should be ignored in this case.
         # if it should be ignored in this case.
         self.openEnded = openEnded
         self.openEnded = openEnded
 
 
-        assert(self.duration >= 0)
-
     def getName(self):
     def getName(self):
         return self.name
         return self.name
 
 

+ 1 - 2
direct/src/interval/cInterval.cxx

@@ -36,7 +36,7 @@ CInterval(const string &name, double duration, bool open_ended) :
   _state(S_initial),
   _state(S_initial),
   _curr_t(0.0),
   _curr_t(0.0),
   _name(name),
   _name(name),
-  _duration(duration),
+  _duration(max(duration, 0.0)),
   _open_ended(open_ended),
   _open_ended(open_ended),
   _dirty(false)
   _dirty(false)
 {
 {
@@ -53,7 +53,6 @@ CInterval(const string &name, double duration, bool open_ended) :
   _play_rate = 1.0;
   _play_rate = 1.0;
   _do_loop = false;
   _do_loop = false;
   _loop_count = 0;
   _loop_count = 0;
-  nassertv(_duration >= 0.0);
 }
 }
 
 
 ////////////////////////////////////////////////////////////////////
 ////////////////////////////////////////////////////////////////////