diff options
-rw-r--r-- | src/editorui/paths.py | 31 | ||||
-rw-r--r-- | src/mapdata.py | 13 | ||||
-rw-r--r-- | src/ui.py | 3 |
3 files changed, 38 insertions, 9 deletions
diff --git a/src/editorui/paths.py b/src/editorui/paths.py index b240b22..e402eb8 100644 --- a/src/editorui/paths.py +++ b/src/editorui/paths.py @@ -129,6 +129,10 @@ class KPEditorNode(KPEditorItem): self.stageProxy = self.HiddenProxy(self.stage, self, 6, 24) self.stage.valueChanged.connect(self.stageChange) + if node.level != None: + self.world.setValue(node.level[0]) + self.stage.setValue(node.level[1]) + self.foreignID = self.LevelSlotSpinner() self.foreignIDProxy = self.HiddenProxy(self.foreignID, self, 60, 24) @@ -142,6 +146,15 @@ class KPEditorNode(KPEditorItem): self.transitionProxy = self.HiddenProxy(self.transition, self, -102, 24) self.transition.currentIndexChanged.connect(self.transitionChange) + if node.foreignID != None: + self.foreignID.setValue(node.foreignID) + + if node.mapChange != None: + self.mapChange.setText(node.mapChange) + + self.transition.setCurrentIndex(node.transition) + + self._updatePosition() @@ -439,10 +452,10 @@ class KPEditorPath(QtGui.QGraphicsLineItem): # Layer Combo Box - self.linkedLayer = QtGui.QComboBox(self) - self.linkedLayer.setModel(KP.map.layerModel) + # self.linkedLayer = QtGui.QComboBox(self) + # self.linkedLayer.setModel(KP.map.layerModel) - TopLayout.addWidget(self.linkedLayer, 1, 1, 1, 3) + # TopLayout.addWidget(self.linkedLayer, 1, 1, 1, 3) # Connections @@ -455,7 +468,7 @@ class KPEditorPath(QtGui.QGraphicsLineItem): self.updatePathAnim) self.moveSpeedSpinner.valueChanged.connect(self.updateMoveSpeed) - self.linkedLayer.currentIndexChanged.connect(self.updateLinkLayer) + # self.linkedLayer.currentIndexChanged.connect(self.updateLinkLayer) # Layout TopLayout.addWidget(QtGui.QLabel("Speed:"), 0, 0) @@ -494,7 +507,8 @@ class KPEditorPath(QtGui.QGraphicsLineItem): self.menu = QtGui.QMenu(self) layout = QtGui.QVBoxLayout() - layout.addWidget(self.PathOptionsWidget(pathRef)) + self.bgroupWidget = self.PathOptionsWidget(pathRef) + layout.addWidget(self.bgroupWidget) self.menu.setLayout(layout) @@ -640,9 +654,15 @@ class KPEditorPath(QtGui.QGraphicsLineItem): self.unlock = self.UnlockButton(self._pathRef) self.unlockProxy = self.HiddenProxy(self.unlock, self, -24, -24) + self.unlock.secret = path.secret + self.unlock.path = path.unlocks + self.options = self.PathOptionsMenuButton(self._pathRef) self.optionsProxy = self.HiddenProxy(self.options, self, -54, +24) + self.options.bgroupWidget.ExclusiveButtons.button(path.animation).setChecked(True) + self.options.bgroupWidget.moveSpeedSpinner.setValue(path.movementSpeed) + self.updatePosition() @@ -709,3 +729,4 @@ class KPEditorPath(QtGui.QGraphicsLineItem): self.scene().removeItem(self) +
\ No newline at end of file diff --git a/src/mapdata.py b/src/mapdata.py index 6f71daf..c270bec 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -153,6 +153,8 @@ class KPPathTileLayer(KPLayer): def _load(self, mapObj, src): self.updateCache() + KP.mainWindow.pathNodeList.loadLayer(self) + print self, mapObj, src def __repr__(self): return "<KPPathTileLayer with %r connected to %r>" % (self.tileset, self.associate) @@ -378,12 +380,12 @@ class KPPath(object): def _dump(self, mapObj, dest): dest['startNodeLink'] = mapObj.refNode(self._startNodeRef()) dest['endNodeLink'] = mapObj.refNode(self._endNodeRef()) - dest['linkedLayer'] = mapObj.refLayer(self.linkedLayer) + # dest['linkedLayer'] = mapObj.refLayer(self.linkedLayer) def _load(self, mapObj, src): self._startNodeRef = weakref.ref(mapObj.derefNode(src['startNodeLink'])) self._endNodeRef = weakref.ref(mapObj.derefNode(src['endNodeLink'])) - self.linkedLayer = mapObj.derefLayer(src['linkedLayer']) + # self.linkedLayer = mapObj.derefLayer(src['linkedLayer']) def __init__(self, startNode=None, endNode=None, cloneFrom=None): if startNode is None and endNode is None: @@ -407,7 +409,7 @@ class KPPath(object): self.animation = cloneFrom.animation self.movementSpeed = 1.0 - self.linkedLayer = None + # self.linkedLayer = None def setStart(self, newStart): @@ -465,7 +467,7 @@ class KPPathLayer(KPLayer): @mapfile.dumpable('map_root') class KPMap(object): - __dump_attribs__ = ('layers', 'nextLayerNumber', 'doodadDefinitions', 'pathNodeTileset') + __dump_attribs__ = ('layers', 'associateLayers', 'nextLayerNumber', 'doodadDefinitions', 'pathNodeTileset') def _preload(self, src): # we need this early so we can use the deref methods! @@ -482,6 +484,8 @@ class KPMap(object): if path is None: raise "no path specified for this map" + self.associateLayers = KP.mainWindow.pathNodeList.getLayers() + import mapfile dumped = mapfile.dump(self) open(path, 'wb').write(dumped) @@ -499,6 +503,7 @@ class KPMap(object): self.pathLayer = self._createPathLayer() self.layers = [self.pathLayer] + self.associateLayers = [] self.layerModel = KPMap.LayerModel(self.layers) self.doodadDefinitions = [] @@ -155,6 +155,9 @@ class KPPathNodeList(QtGui.QWidget): layer = KPPathTileLayer(associate) item = self.KPPathNodeItem(self.tree, layer, associate) + def loadLayer(self, layer): + item = self.KPPathNodeItem(self.tree, layer, layer.associate) + def removeLayer(self, associate): trash = None |