summaryrefslogtreecommitdiff
path: root/src/mapdata.py
diff options
context:
space:
mode:
authorColin Noga <Tempus@chronometry.ca>2012-05-12 18:49:08 -0500
committerColin Noga <Tempus@chronometry.ca>2012-05-12 18:49:08 -0500
commite037c2d4256e2975e50d00517526794dff444f0d (patch)
tree866248cb5f6e2a66e708f89c5c574c683281233d /src/mapdata.py
parent225b688b188d22fe00976b2febc03f78ca3b2d7e (diff)
downloadkoopatlas-e037c2d4256e2975e50d00517526794dff444f0d.tar.gz
koopatlas-e037c2d4256e2975e50d00517526794dff444f0d.zip
Fixed up some formatting, made the animation panel into a dock widget, added a delay value to doodad animations and implemented it editor-side
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)