diff options
author | Treeki <treeki@gmail.com> | 2011-11-14 21:50:00 +0100 |
---|---|---|
committer | Treeki <treeki@gmail.com> | 2011-11-14 21:50:00 +0100 |
commit | 9026e559b01dc908e838775dd76e45c4a379bd66 (patch) | |
tree | f0623af1d881047ff21706eb12203d0e7f2c4969 /src | |
parent | dde51e148b09644ed70241832186b845aed071ec (diff) | |
download | koopatlas-9026e559b01dc908e838775dd76e45c4a379bd66.tar.gz koopatlas-9026e559b01dc908e838775dd76e45c4a379bd66.zip |
layers can now be shown/hidden
Diffstat (limited to '')
-rw-r--r-- | src/editorui.py | 3 | ||||
-rw-r--r-- | src/mapdata.py | 17 |
2 files changed, 19 insertions, 1 deletions
diff --git a/src/editorui.py b/src/editorui.py index 48164a0..05cb77f 100644 --- a/src/editorui.py +++ b/src/editorui.py @@ -260,6 +260,8 @@ class KPMapScene(QtGui.QGraphicsScene): areaBottomT = ceil(areaBottom / 24) for layer in reversed(KP.map.layers): + if not layer.visible: continue + left, top = layer.cacheBasePos width, height = layer.cacheSize right, bottom = left+width, top+height @@ -365,6 +367,7 @@ class KPEditorWidget(QtGui.QGraphicsView): y = int(y / 24) layer = self.scene().currentLayer + if not layer.visible: return obj = KPObject() obj.position = (x,y) diff --git a/src/mapdata.py b/src/mapdata.py index 67103d9..3ce63a6 100644 --- a/src/mapdata.py +++ b/src/mapdata.py @@ -25,10 +25,25 @@ class KPLayer(object): self.name = '' self.tileset = '' self.objects = [] - self.visible = True + self._visible = True self.cache = ['DUMMY_FLAG'] self.updateCache() + @property + def visible(self): + return self._visible + + @visible.setter + def visible(self, value): + if self._visible == value: + return + self._visible = value + + for obj in self.objects: + item = obj.qtItem + if item: + item.setVisible(value) + def updateCache(self): if len(self.objects) == 0: if len(self.cache) != 0: |