Mercurial > fife-parpg
diff tools/editor/scripts/editor.py @ 422:9d94f4676d17
Moved the management of cameras into the Map class. The View class no longer exists since it now serves no purpose. The engine class itself holds the renderers and these get passed to each map that is loaded and then passed to each camera on each map. This change makes it possible for multiple maps to be loaded at the same time with the same camera id without a name clash. fixes[t:342]
author | vtchill@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 12 Feb 2010 06:34:50 +0000 |
parents | bc6730a27820 |
children | 3a6441d9e01c |
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py Thu Feb 11 04:18:42 2010 +0000 +++ b/tools/editor/scripts/editor.py Fri Feb 12 06:34:50 2010 +0000 @@ -319,6 +319,13 @@ """ Switches to mapview. """ if mapview is None or mapview == self._mapview: return + + if self._mapview != None and mapview != self._mapview: + # need to disable the cameras from the previous map + # if it exists before switching + if self._mapview.getMap() != None: + for cam in self._mapview.getMap().getCameras(): + cam.setEnabled(False) events.preMapShown.send(sender=self, mapview=mapview) self._mapview = mapview @@ -354,6 +361,10 @@ def _mapRemoved(self, mapview): index = self._mapviewlist.index(mapview)-1 + + for cam in mapview.getMap().getCameras(): + cam.setEnabled(False) + self._mapviewlist.remove(mapview) # Remove tab @@ -369,7 +380,6 @@ self._change_map = index else: self._mapview = None - self.getEngine().getView().clearCameras() def openFile(self, path): """ Opens a file """