From 64df3b0e7503b2da43d5448f788bb560e5a6881c Mon Sep 17 00:00:00 2001 From: Treeki Date: Wed, 26 Sep 2012 05:38:44 +0200 Subject: added world change nodes. I hope this works. --- src/editorui/paths.py | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'src/editorui') diff --git a/src/editorui/paths.py b/src/editorui/paths.py index 2ddea4c..69a08e6 100644 --- a/src/editorui/paths.py +++ b/src/editorui/paths.py @@ -16,9 +16,7 @@ class KPEditorNode(KPEditorItem): self.setIconSize(QtCore.QSize(24, 24)) self.setFixedSize(24, 24) - self.iconList = [QtGui.QIcon("Resources/Through.png"), - QtGui.QIcon("Resources/Level.png"), - QtGui.QIcon("Resources/Exit.png")] + self.iconList = [KP.icon('Through'), KP.icon('Level'), KP.icon('Exit'), KP.icon('WorldChange')] self.state = 0 @@ -32,7 +30,7 @@ class KPEditorNode(KPEditorItem): def toggle(self): self.state += 1 - if self.state == 3: + if self.state == 4: self.state = 0 self.stateToggled.emit(self.state) @@ -121,6 +119,7 @@ class KPEditorNode(KPEditorItem): self._boundingRect = QtCore.QRectF(-24, -24, 48, 48) self._levelRect = self._boundingRect self._stopRect = QtCore.QRectF(-12, -12, 24, 24) + self._worldChangeRect = QtCore.QRectF(-16, -16, 32, 32) self._tinyRect = QtCore.QRectF(-6, -6, 12, 12) self.isLayerSelected = False @@ -165,12 +164,20 @@ class KPEditorNode(KPEditorItem): self.transitionProxy = self.HiddenProxy(self.transition, self, -102, 24) self.transition.currentIndexChanged.connect(self.transitionChange) + self.worldDefID = self.LevelSlotSpinner() + self.worldDefID.setRange(0,255) + self.worldDefIDProxy = self.HiddenProxy(self.worldDefID, self, 60, 24) + self.worldDefID.valueChanged.connect(self.worldDefIDChange) + if node.foreignID != None: self.foreignID.setValue(node.foreignID) if node.mapChange != None: self.mapChange.setText(node.mapChange) + if node.worldDefID != None: + self.worldDefID.setValue(node.worldDefID) + self.transition.setCurrentIndex(node.transition) @@ -187,6 +194,7 @@ class KPEditorNode(KPEditorItem): node.mapID = None node.foreignID = None node.level = None + node.worldDefID = None if state == 1: node.level = [1, 1] @@ -212,6 +220,9 @@ class KPEditorNode(KPEditorItem): self.mapChange.setText('None.arc') self.transition.setCurrentIndex(0) + elif state == 3: + node.worldDefID = 0 + self.update() KP.mainWindow.pathNodeList.update() @@ -253,6 +264,12 @@ class KPEditorNode(KPEditorItem): KP.mainWindow.pathNodeList.update() + @QtCore.pyqtSlot(int) + def worldDefIDChange(self, ID): + node = self._nodeRef() + node.worldDefID = ID + + @QtCore.pyqtSlot(int) def transitionChange(self, index): @@ -326,6 +343,12 @@ class KPEditorNode(KPEditorItem): selectionRect = self._boundingRect.adjusted(1,5,-1,-5) + elif node.worldDefID != None: + painter.setBrush(QtGui.QColor(0, 0, 0, 0)) + painter.setPen(QtGui.QColor(0, 0, 0, 0)) + painter.drawPixmap(self._worldChangeRect.topLeft(), QtGui.QPixmap("Resources/WorldChange.png")) + selectionRect = self._worldChangeRect + elif len(node.exits) != 2: if self.isLayerSelected: brush = QtGui.QBrush(QtGui.QColor(255, 40, 40)) @@ -352,6 +375,8 @@ class KPEditorNode(KPEditorItem): painter.setBrush(QtGui.QColor(0,0,0,0)) painter.drawEllipse(selectionRect) + # WHAT THE FUCK SINCE WHEN DO YOU SHOW/HIDE WIDGETS IN A PAINT EVENT + # oh well, I don't feel like refactoring this self.buttonProxy.show() if node.level: @@ -374,6 +399,11 @@ class KPEditorNode(KPEditorItem): self.transition.hide() self.mapChange.hide() + if node.worldDefID != None: + self.worldDefID.show() + else: + self.worldDefID.hide() + else: self.buttonProxy.hide() self.worldProxy.hide() @@ -382,6 +412,7 @@ class KPEditorNode(KPEditorItem): self.foreignID.hide() self.transition.hide() self.mapChange.hide() + self.worldDefID.hide() def remove(self, withItem=False): -- cgit v1.2.3