diff options
author | Treeki <treeki@gmail.com> | 2012-09-26 05:38:44 +0200 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2012-09-26 05:38:44 +0200 |
commit | 64df3b0e7503b2da43d5448f788bb560e5a6881c (patch) | |
tree | 878c5caaebfa82e938158651c86daaa4834fd022 /src/editorui | |
parent | 04d6d49eed7b952f3ba61f1364e538c6e5c8d5a2 (diff) | |
download | koopatlas-64df3b0e7503b2da43d5448f788bb560e5a6881c.tar.gz koopatlas-64df3b0e7503b2da43d5448f788bb560e5a6881c.zip |
added world change nodes. I hope this works.
Diffstat (limited to '')
-rw-r--r-- | src/editorui/paths.py | 39 |
1 files changed, 35 insertions, 4 deletions
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() @@ -254,6 +265,12 @@ class KPEditorNode(KPEditorItem): @QtCore.pyqtSlot(int) + def worldDefIDChange(self, ID): + node = self._nodeRef() + node.worldDefID = ID + + + @QtCore.pyqtSlot(int) def transitionChange(self, index): node = self._nodeRef() @@ -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): |