From d686ee1250bf148e600830642ed44f7d85357dd3 Mon Sep 17 00:00:00 2001 From: Colin Noga Date: Tue, 3 Jan 2012 02:39:26 -0600 Subject: Fixed up doodad animation saving and propagation --- src/editorui/doodads.py | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'src/editorui') diff --git a/src/editorui/doodads.py b/src/editorui/doodads.py index b916b27..07eca43 100644 --- a/src/editorui/doodads.py +++ b/src/editorui/doodads.py @@ -97,10 +97,11 @@ class KPEditorDoodad(KPEditorItem): editor.setGeometry(option.rect) - def __init__(self, doodadRef): + def __init__(self, doodadRef, parent): QtGui.QWidget.__init__(self) self._doodadRef = doodadRef + self.parent = parent # Setup Layout BottomLayout = QtGui.QGridLayout() @@ -158,6 +159,27 @@ class KPEditorDoodad(KPEditorItem): # loadbutton.released.connect(KP.mainWindow.loadAnimPresets) # clearbutton.released.connect(KP.mainWindow.clearAnimPresets) + self.setupAnms() + + + def setupAnms(self): + doodad = self._doodadRef() + + for row in doodad.animations: + + itemA = QtGui.QStandardItem() + itemB = QtGui.QStandardItem() + itemC = QtGui.QStandardItem() + + itemA.setData(row[2], QtCore.Qt.EditRole) + itemB.setData(row[4], QtCore.Qt.EditRole) + itemC.setData(row[5], QtCore.Qt.EditRole) + + self.model.appendRow([QtGui.QStandardItem(row[0]), QtGui.QStandardItem(row[1]), + itemA, QtGui.QStandardItem(row[3]), itemB, itemC]) + + self.update() + def sizeHint(self): return QtCore.QSize(591,300) @@ -212,6 +234,7 @@ class KPEditorDoodad(KPEditorItem): self.model.appendRow([a,b,c,d,e,f]) + self.parent.resolveAnmList() def addToPreset(self): from dialogs import getTextDialog @@ -263,7 +286,7 @@ class KPEditorDoodad(KPEditorItem): self.setText("Animate") self.menu = QtGui.QMenu(self) - self.menuWidget = self.AnmOptionsWidget(doodadRef) + self.menuWidget = self.AnmOptionsWidget(doodadRef, self) self.menuWidgetAction = QtGui.QWidgetAction(self) self.menuWidgetAction.setDefaultWidget(self.menuWidget) self.menu.addAction(self.menuWidgetAction) @@ -291,6 +314,8 @@ class KPEditorDoodad(KPEditorItem): model = self.menuWidget.model rows = model.rowCount() + print 'Resolving' + for x in xrange(rows): rowList = [] @@ -306,6 +331,7 @@ class KPEditorDoodad(KPEditorItem): anmList.append(rowList) + print anmList doodad.animations = anmList doodad.setupAnimations() -- cgit v1.2.3