Mercurial > fife-parpg
changeset 376:22222a900751
Editor:
* New event signal: layerSelected
* Grid and blocking info will only be rendered for the active layer
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Mon, 23 Nov 2009 01:11:49 +0000 |
parents | 91e352f81f63 |
children | fe6fb0e0ed23 |
files | clients/editor/scripts/events/events.py clients/editor/scripts/gui/mapeditor.py clients/editor/scripts/mapcontroller.py |
diffstat | 3 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/clients/editor/scripts/events/events.py Sat Nov 21 15:15:55 2009 +0000 +++ b/clients/editor/scripts/events/events.py Mon Nov 23 01:11:49 2009 +0000 @@ -37,6 +37,7 @@ onInstancesSelected = Signal(providing_args=["instances"]) onObjectSelected = Signal(providing_args=["object"]) onObjectsImported = Signal(providing_args=[]) +layerSelected = Signal(providing_args=["mapcontroller", "layer"]) # Signals emitted by EventListener onQuit = Signal(providing_args=[])
--- a/clients/editor/scripts/gui/mapeditor.py Sat Nov 21 15:15:55 2009 +0000 +++ b/clients/editor/scripts/gui/mapeditor.py Mon Nov 23 01:11:49 2009 +0000 @@ -93,6 +93,7 @@ events.mouseWheelMovedUp.connect(self.mouseWheelMovedUp) events.mouseWheelMovedDown.connect(self.mouseWheelMovedDown) events.onPump.connect(self.pump) + events.layerSelected.connect(self._layerSelected) def _clear(self): self._clearToolbarButtons() @@ -109,6 +110,7 @@ events.mouseWheelMovedUp.disconnect(self.mouseWheelMovedUp) events.mouseWheelMovedDown.disconnect(self.mouseWheelMovedDown) events.onPump.disconnect(self.pump) + events.layerSelected.disconnect(self._layerSelected) def _mapChanged(self, sender, mapview): self.setController(mapview.getController()) @@ -156,6 +158,18 @@ cursor = self._editor.getEngine().getCursor() cursor.set(fife.CURSOR_NATIVE, fife.NC_ARROW) + def _layerSelected(self, sender, mapcontroller, layer): + gridrenderer = self._controller._camera.getRenderer('GridRenderer') + gridrenderer.clearActiveLayers() + if layer is not None: + gridrenderer.addActiveLayer(self._controller.getLayer()) + + blockrenderer = self._controller._camera.getRenderer('BlockingInfoRenderer') + blockrenderer.clearActiveLayers() + if layer is not None: + blockrenderer.addActiveLayer(self._controller.getLayer()) + + def setObject(self, object): self._object = object @@ -512,6 +526,9 @@ elif keystr == 't': gridrenderer = self._controller._camera.getRenderer('GridRenderer') gridrenderer.setEnabled(not gridrenderer.isEnabled()) + gridrenderer.clearActiveLayers() + if self._controller.getLayer() is not None: + gridrenderer.addActiveLayer(self._controller.getLayer()) elif keystr == 'b': blockrenderer = self._controller._camera.getRenderer('BlockingInfoRenderer')
--- a/clients/editor/scripts/mapcontroller.py Sat Nov 21 15:15:55 2009 +0000 +++ b/clients/editor/scripts/mapcontroller.py Mon Nov 23 01:11:49 2009 +0000 @@ -96,6 +96,11 @@ layers = [l for l in self._map.getLayers() if l.getId() == layerid] if len(layers) == 1: self._layer = layers[0] + events.layerSelected.send(sender=self, layer=layers[0], mapcontroller=self) + + def getLayer(self): + """ Returns active layer """ + return self._layer def deselectSelection(self): """ Deselects all selected cells """