summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/editorui/doodads.py6
-rw-r--r--src/editorui/editormain.py6
-rw-r--r--src/mapdata.py18
-rw-r--r--src/ui.py8
4 files changed, 33 insertions, 5 deletions
diff --git a/src/editorui/doodads.py b/src/editorui/doodads.py
index 7b9e222..b916b27 100644
--- a/src/editorui/doodads.py
+++ b/src/editorui/doodads.py
@@ -337,6 +337,7 @@ class KPEditorDoodad(KPEditorItem):
self._updatePixmap()
self._updatePosition()
self._updateSize()
+ self._updateTransform()
self.anmButton = self.DoodadAnmButton(self._doodadRef)
self.anmProxy = self.HiddenProxy(self.anmButton, self, self.boundingRect().right() - 101, self.boundingRect().bottom() - 25)
@@ -565,7 +566,10 @@ class KPEditorDoodad(KPEditorItem):
doodad = self._doodadRef()
layer = self._layerRef()
- layer.objects.remove(doodad)
+ if isinstance(layer, KPPathTileLayer):
+ layer.doodads.remove(doodad)
+ else:
+ layer.objects.remove(doodad)
doodad.cleanUpAnimations()
if withItem:
diff --git a/src/editorui/editormain.py b/src/editorui/editormain.py
index ba75b7f..1ba06bd 100644
--- a/src/editorui/editormain.py
+++ b/src/editorui/editormain.py
@@ -34,6 +34,12 @@ class KPMapScene(QtGui.QGraphicsScene):
for obj in layer.objects:
self.addItem(KPEditorDoodad(obj, layer))
elif isinstance(layer, KPPathLayer):
+ for inLayer in KP.map.associateLayers:
+ for obj in inLayer.objects:
+ self.addItem(KPEditorObject(obj, inLayer))
+ for obj in inLayer.doodads:
+ self.addItem(KPEditorDoodad(obj, inLayer))
+
for node in layer.nodes:
self.addItem(KPEditorNode(node))
diff --git a/src/mapdata.py b/src/mapdata.py
index 4ae87ae..b0d3f0f 100644
--- a/src/mapdata.py
+++ b/src/mapdata.py
@@ -149,11 +149,23 @@ class KPTileLayer(KPLayer):
@mapfile.dumpable('associate_layer')
class KPPathTileLayer(KPLayer):
- __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects', 'doodads', 'associate')
+ __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects', 'doodads')
+
+ def _dump(self, mapObj, dest):
+ if isinstance(self.associate, KPNode):
+ dest['associatedRef'] = ('node', mapObj.refNode(self.associate))
+ else:
+ dest['associatedRef'] = ('path', mapObj.refPath(self.associate))
def _load(self, mapObj, src):
+ assocType, assocID = src['associatedRef']
+
+ if assocType == 'path':
+ self.associate = mapObj.derefPath(assocID)
+ else:
+ self.associate = mapObj.derefNode(assocID)
+
self.updateCache()
- KP.mainWindow.pathNodeList.loadLayer(self)
def __repr__(self):
return "<KPPathTileLayer with %r connected to %r>" % (self.tileset, self.associate)
@@ -173,8 +185,6 @@ class KPPathTileLayer(KPLayer):
self.updateCache()
- self.icon = KP.icon('LayerTile')
-
def _visibilityChanged(self, value):
for obj in self.objects:
item = obj.qtItem
diff --git a/src/ui.py b/src/ui.py
index 9a0744c..0936957 100644
--- a/src/ui.py
+++ b/src/ui.py
@@ -107,6 +107,13 @@ class KPPathNodeList(QtGui.QWidget):
self.setupToolbar(self.toolbar)
self.setLayout(self.layout)
+
+
+ def reset(self):
+ self.tree.clear()
+
+ for layer in KP.map.associateLayers:
+ self.loadLayer(layer)
def setupToolbar(self, tb):
@@ -751,6 +758,7 @@ class KPMainWindow(QtGui.QMainWindow):
def refreshMapState(self):
self.layerList.updateModel()
self.doodadSelector.updateModel()
+ self.pathNodeList.reset()
self.scene = KPMapScene()
self.editor.assignNewScene(self.scene)