Mercurial > fife-parpg
changeset 402:bc6730a27820
* Fixed a bug where the editor would not activate the new mapview after closing a map
* Fixed a crash caused by not all cameras belonging to a map being removed
author | cheesesucker@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 29 Jan 2010 10:55:21 +0000 |
parents | ac7806c46b94 |
children | ba2d683ccee3 |
files | tools/editor/scripts/editor.py tools/editor/scripts/mapview.py |
diffstat | 2 files changed, 17 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py Thu Jan 28 22:47:20 2010 +0000 +++ b/tools/editor/scripts/editor.py Fri Jan 29 10:55:21 2010 +0000 @@ -86,6 +86,8 @@ self._tools_menu = None self._help_menu = None + self._change_map = -1 + self._settings = None self._help_dialog = None @@ -317,7 +319,7 @@ """ Switches to mapview. """ if mapview is None or mapview == self._mapview: return - + events.preMapShown.send(sender=self, mapview=mapview) self._mapview = mapview self._mapview.show() @@ -364,7 +366,7 @@ if len(self._mapviewlist) > 0: if index < 0: index = 0 - self.showMapView(self._mapviewlist[index]) + self._change_map = index else: self._mapview = None self.getEngine().getView().clearCameras() @@ -405,6 +407,16 @@ self._initTools() if self._params: self.openFile(self._params) self._inited = True + + # FIXME: This isn't very nice, but it is needed to change the map + # outside the callback. + if self._change_map >= 0 and len(self._mapviewlist) > 0: + if self._change_map >= len(self._mapviewlist): + self._change_map = len(self._mapviewlist)-1 + mapview = self._mapviewlist[self._change_map] + + self.showMapView(mapview) + self._change_map = -1 events.onPump.send(sender=self)
--- a/tools/editor/scripts/mapview.py Thu Jan 28 22:47:20 2010 +0000 +++ b/tools/editor/scripts/mapview.py Fri Jan 29 10:55:21 2010 +0000 @@ -80,6 +80,7 @@ engine = self._editor.getEngine() engine.getView().resetRenderers() + for cam in engine.getView().getCameras(): cam.setEnabled(False) @@ -146,10 +147,11 @@ # Remove cameras view = self._editor.getEngine().getView() - for cam in view.getCameras(): + for cam in view.getCameras()[:]: if cam.getLocationRef().getMap().getId() == self._map.getId(): cam.setEnabled(False) view.removeCamera(cam) + view.resetRenderers() # Unload the map from FIFE @@ -158,5 +160,4 @@ self._cleanUp() events.postMapClosed.send(sender=self, mapview=self) - \ No newline at end of file