summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/editorui/editormain.py6
-rw-r--r--src/mapdata.py25
-rw-r--r--src/ui.py37
3 files changed, 51 insertions, 17 deletions
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py
index 263c547..3d2f17d 100644
--- a/src/editorui/editormain.py
+++ b/src/editorui/editormain.py
@@ -353,7 +353,11 @@ class KPMapScene(QtGui.QGraphicsScene):
posRect.setWidth(posRect.width()*modifier/100.0)
elif Type == "Y Scale":
- posRect.setHeight(posRect.height()*modifier/100.0)
+ h = posRect.height()
+ posRect.setHeight(h*modifier/100.0)
+
+ new = h - posRect.height()
+ posRect.adjust(0, new, 0, new)
elif Type == "Opacity":
painter.setOpacity(modifier/100.0)
diff --git a/src/mapdata.py b/src/mapdata.py
index 44656b7..4185a19 100644
--- a/src/mapdata.py
+++ b/src/mapdata.py
@@ -301,9 +301,13 @@ class KPDoodad(object):
QtCore.QTimeLine.__init__(self)
self.delayTimer = QtCore.QTimer()
- self.delayTimer.timeout.connect(self.start)
+ self.delayTimer.timeout.connect(self.startTimeline)
self.delayTimer.setSingleShot(True)
+ self.offsetTimer = QtCore.QTimer()
+ self.offsetTimer.timeout.connect(self.startTimeline)
+ self.offsetTimer.setSingleShot(True)
+
self.reversible = False
self.reversed = False
@@ -313,7 +317,7 @@ class KPDoodad(object):
if not self.reversed:
self.reversed = True
self.toggleDirection()
- self.start()
+ self.startTimeline()
return
else:
self.toggleDirection()
@@ -321,6 +325,14 @@ class KPDoodad(object):
self.delayTimer.start()
+ def start(self):
+
+ self.offsetTimer.start()
+
+ def startTimeline(self):
+
+ QtCore.QTimeLine.start(self)
+
def cleanUpAnimations(self):
myTimelines = self.timelines
if myTimelines is None: return
@@ -342,7 +354,13 @@ class KPDoodad(object):
myTimelines = []
for anim in self.animations:
- Loop, Curve, Frames, Type, StartVal, EndVal, Delay = anim
+ if len(anim) == 6:
+ anim.extend([0,0])
+
+ if len(anim) == 7:
+ anim.extend([0])
+
+ Loop, Curve, Frames, Type, StartVal, EndVal, Delay, DelayOffset = anim
Timeline = self.doodadTimeLine()
@@ -369,6 +387,7 @@ class KPDoodad(object):
# Setup the Delay Timer and Duration
# Wii goes at 60 frames per second
Timeline.delayTimer.setInterval(Delay/60.0*1000)
+ Timeline.offsetTimer.setInterval(DelayOffset/60.0*1000)
Timeline.setDuration(Frames/60.0*1000)
timelineList.append(Timeline)
diff --git a/src/ui.py b/src/ui.py
index a7d2524..74e1fdc 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -731,14 +731,14 @@ class KPAnmOptions(QtGui.QWidget):
# Time for the Table View, model and Delegate
- self.model = QtGui.QStandardItemModel(0, 7)
+ self.model = QtGui.QStandardItemModel(0, 8)
self.anmTable = QtGui.QTableView()
self.anmTable.setModel(self.model)
delegate = self.AnmDelegate()
self.anmTable.setItemDelegate(delegate)
- self.model.setHorizontalHeaderLabels(["Looping", "Interpolation", "Frame Len", "Type", "Start Value", "End Value", "Delay"])
+ self.model.setHorizontalHeaderLabels(["Looping", "Interpolation", "Frame Len", "Type", "Start Value", "End Value", "Delay", "Delay Offset"])
self.anmTable.setColumnWidth(0, 150)
self.anmTable.setColumnWidth(1, 100)
self.anmTable.setColumnWidth(2, 65)
@@ -746,11 +746,12 @@ class KPAnmOptions(QtGui.QWidget):
self.anmTable.setColumnWidth(4, 65)
self.anmTable.setColumnWidth(5, 65)
self.anmTable.setColumnWidth(6, 65)
+ self.anmTable.setColumnWidth(7, 80)
self.anmTable.horizontalHeader().setVisible(True)
self.anmTable.verticalHeader().setVisible(False)
- BottomLayout.addWidget(self.anmTable, 0, 0, 1, 6)
+ BottomLayout.addWidget(self.anmTable, 0, 0, 1, 8)
# Add/Remove Animation Buttons
@@ -764,8 +765,8 @@ class KPAnmOptions(QtGui.QWidget):
BottomLayout.addWidget(addbutton, 1, 0, 1, 1)
BottomLayout.addWidget(rembutton, 1, 1, 1, 1)
BottomLayout.addWidget(QtGui.QLabel(""), 1, 2, 1, 2)
- BottomLayout.addWidget(presetbutton, 1, 4, 1, 1)
- BottomLayout.addWidget(newpbutton, 1, 5, 1, 1)
+ BottomLayout.addWidget(presetbutton, 1, 6, 1, 1)
+ BottomLayout.addWidget(newpbutton, 1, 7, 1, 1)
# BottomLayout.addWidget(savebutton, 1, 6, 1, 1)
# BottomLayout.addWidget(loadbutton, 1, 7, 1, 1)
# BottomLayout.addWidget(clearbutton, 1, 8, 1, 1)
@@ -792,20 +793,25 @@ class KPAnmOptions(QtGui.QWidget):
# Fix for backwards compatibility
if len(row) == 6:
- row.append(0.0)
+ row.append(0)
+
+ if len(row) == 7:
+ row.append(0)
itemA = QtGui.QStandardItem()
itemB = QtGui.QStandardItem()
itemC = QtGui.QStandardItem()
itemD = QtGui.QStandardItem()
+ itemE = QtGui.QStandardItem()
itemA.setData(row[2], QtCore.Qt.EditRole)
itemB.setData(row[4], QtCore.Qt.EditRole)
itemC.setData(row[5], QtCore.Qt.EditRole)
itemD.setData(row[6], QtCore.Qt.EditRole)
+ itemE.setData(row[7], QtCore.Qt.EditRole)
self.model.appendRow([QtGui.QStandardItem(row[0]), QtGui.QStandardItem(row[1]),
- itemA, QtGui.QStandardItem(row[3]), itemB, itemC, itemD])
+ itemA, QtGui.QStandardItem(row[3]), itemB, itemC, itemD, itemE])
self.update()
@@ -818,15 +824,17 @@ class KPAnmOptions(QtGui.QWidget):
itemB = QtGui.QStandardItem()
itemC = QtGui.QStandardItem()
itemD = QtGui.QStandardItem()
+ itemE = QtGui.QStandardItem()
itemA.setData(1, QtCore.Qt.EditRole)
itemB.setData(0.0, QtCore.Qt.EditRole)
itemC.setData(0.0, QtCore.Qt.EditRole)
- itemD.setData(0.0, QtCore.Qt.EditRole)
+ itemD.setData(0, QtCore.Qt.EditRole)
+ itemE.setData(0, QtCore.Qt.EditRole)
self.model.appendRow([QtGui.QStandardItem("Contiguous"), QtGui.QStandardItem("Linear"),
itemA, QtGui.QStandardItem("X Position"),
- itemB, itemC, itemD])
+ itemB, itemC, itemD, itemE])
def remAnmItem(self):
@@ -860,8 +868,10 @@ class KPAnmOptions(QtGui.QWidget):
f.setData(row[5], Qt.EditRole)
g = q()
g.setData(row[6], Qt.EditRole)
+ h = q()
+ h.setData(row[6], Qt.EditRole)
- self.model.appendRow([a,b,c,d,e,f,g])
+ self.model.appendRow([a,b,c,d,e,f,g,h])
self.resolveAnmList()
@@ -877,7 +887,7 @@ class KPAnmOptions(QtGui.QWidget):
preset = []
for row in xrange(self.model.rowCount()):
listrow = []
- for column in xrange(7):
+ for column in xrange(8):
item = self.model.item(row, column)
if (column == 0) or (column == 1) or (column == 2):
data = str(item.data(Qt.EditRole).toString())
@@ -918,7 +928,7 @@ class KPAnmOptions(QtGui.QWidget):
for x in xrange(rows):
rowList = []
- for item in xrange(7):
+ for item in xrange(8):
index = model.index(x, item)
data = model.data(index, Qt.EditRole).toString()
if data.toFloat()[1]:
@@ -937,7 +947,7 @@ class KPAnmOptions(QtGui.QWidget):
d.setupAnimations()
model.clear()
- self.model.setHorizontalHeaderLabels(["Looping", "Interpolation", "Frame Len", "Type", "Start Value", "End Value", "Delay"])
+ self.model.setHorizontalHeaderLabels(["Looping", "Interpolation", "Frame Len", "Type", "Start Value", "End Value", "Delay", "Delay Offset"])
self._doodadRef = None
self.doodadList = None
@@ -1204,6 +1214,7 @@ class KPMainWindow(QtGui.QMainWindow):
self.anmOptsDock.setWindowTitle("Editing {0} Doodad{1}".format(len(doodadList), suffix))
self.anmOpts.setupAnms(doodadList)
+
########################
# Slots for Menu Items #
########################