diff options
author | Colin Noga <Tempus@chronometry.ca> | 2011-12-16 09:10:26 -0600 |
---|---|---|
committer | Colin Noga <Tempus@chronometry.ca> | 2011-12-16 09:10:26 -0600 |
commit | c9107b3d393a21b1f98761016a3f0a1ac2414140 (patch) | |
tree | 01cc93426083d548a1baeb3a69fbdc0ad034c471 /src/mapdata.py | |
parent | 8dd9e24d1dffac3404a7c900268cbe6d2ce1e63b (diff) | |
download | koopatlas-c9107b3d393a21b1f98761016a3f0a1ac2414140.tar.gz koopatlas-c9107b3d393a21b1f98761016a3f0a1ac2414140.zip |
Tileset swapping and bits and pieces of node associated layer code
Diffstat (limited to 'src/mapdata.py')
-rw-r--r-- | src/mapdata.py | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/src/mapdata.py b/src/mapdata.py index 23c6b83..b8ab263 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -147,6 +147,40 @@ class KPTileLayer(KPLayer): y += 1 +@mapfile.dumpable('tile_layer') +class KPPathTileLayer(KPTileLayer): + __dump_attribs__ = KPLayer.__dump_attribs__ + ('tileset', 'objects') + + def __repr__(self): + return "<KPPathTileLayer %r with %r connected to %r>" % (self.name, self.tileset, self.pathnode) + + def __init__(self, pathnode): + KPLayer.__init__(self) + self.tileset = KP.map.pathNodeTileset + self.objects = [] + self.doodads = [] + self.pathnode = pathnode + + self.cache = ['DUMMY_FLAG'] + self.updateCache() + + self.icon = KP.icon('LayerTile') + + def getPathNode(self): + return self.pathnode + + def _visibilityChanged(self, value): + for obj in self.objects: + item = obj.qtItem + if item: + item.setVisible(value) + + for obj in self.doodads: + item = obj.qtItem + if item: + item.setVisible(value) + + @mapfile.dumpable('doodad') class KPDoodad(object): __dump_attribs__ = ('position', 'size', 'angle', 'animations') @@ -274,7 +308,6 @@ class KPNode(object): return True if (self.level or self.mapChange or len(self.exits) != 2) else False - @mapfile.dumpable('path') class KPPath(object): __dump_attribs__ = ('unlocks', 'secret', 'animation', 'movementSpeed') @@ -413,9 +446,14 @@ class KPMap(object): self.loadTilesets() + try: + self.pathNodeTileset = self.tilesets[0] + except: + self.pathNodeTileset = '' + # LAYERS - class LayerModel(QtCore.QAbstractListModel): + class LayerModel(QtCore.QAbstractItemModel): def __init__(self, layerList): QtCore.QAbstractListModel.__init__(self) self.list = layerList |