diff options
Diffstat (limited to '')
-rw-r--r-- | src/mapdata.py | 18 |
1 files changed, 14 insertions, 4 deletions
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 |