summaryrefslogtreecommitdiff
path: root/src/mapdata.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mapdata.py41
1 files changed, 35 insertions, 6 deletions
diff --git a/src/mapdata.py b/src/mapdata.py
index 8469ad4..44656b7 100644
--- a/src/mapdata.py
+++ b/src/mapdata.py
@@ -296,6 +296,31 @@ class KPDoodad(object):
pixmap = self.source[1]
self.size = [pixmap.width(), pixmap.height()]
+ class doodadTimeLine(QtCore.QTimeLine):
+ def __init__(self):
+ QtCore.QTimeLine.__init__(self)
+
+ self.delayTimer = QtCore.QTimer()
+ self.delayTimer.timeout.connect(self.start)
+ self.delayTimer.setSingleShot(True)
+
+ self.reversible = False
+ self.reversed = False
+
+ def restartDelay(self):
+
+ if self.reversible:
+ if not self.reversed:
+ self.reversed = True
+ self.toggleDirection()
+ self.start()
+ return
+ else:
+ self.toggleDirection()
+ self.reversed = False
+
+ self.delayTimer.start()
+
def cleanUpAnimations(self):
myTimelines = self.timelines
if myTimelines is None: return
@@ -317,9 +342,9 @@ class KPDoodad(object):
myTimelines = []
for anim in self.animations:
- Loop, Curve, Frames, Type, StartVal, EndVal = anim
+ Loop, Curve, Frames, Type, StartVal, EndVal, Delay = anim
- Timeline = QtCore.QTimeLine()
+ Timeline = self.doodadTimeLine()
# Interpolate the correct modifier
if Curve == "Linear":
@@ -334,13 +359,17 @@ class KPDoodad(object):
if Loop == "Contiguous":
Timeline.setLoopCount(1)
elif Loop == "Loop":
- Timeline.setLoopCount(0) # Dollars *holds pinky to corner of mouth*
+ Timeline.setLoopCount(1)
+ Timeline.finished.connect(Timeline.restartDelay)
elif Loop == "Reversible Loop":
Timeline.setLoopCount(1)
- Timeline.finished.connect(Timeline.toggleDirection)
- Timeline.finished.connect(Timeline.start)
+ Timeline.reversible = True
+ Timeline.finished.connect(Timeline.restartDelay)
- Timeline.setDuration(Frames/60.0*1000) # Wii goes at 60 frames per second
+ # Setup the Delay Timer and Duration
+ # Wii goes at 60 frames per second
+ Timeline.delayTimer.setInterval(Delay/60.0*1000)
+ Timeline.setDuration(Frames/60.0*1000)
timelineList.append(Timeline)
myTimelines.append(Timeline)