Mercurial > fife-parpg
comparison tools/editor/scripts/mapcontroller.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 | 64738befdf3b |
children | 04029ebc5670 |
comparison
equal
deleted
inserted
replaced
421:293e812316c0 | 422:9d94f4676d17 |
---|---|
80 | 80 |
81 self._map = self._engine.getModel().getMap(mapid) | 81 self._map = self._engine.getModel().getMap(mapid) |
82 if not self._map.getLayers(): | 82 if not self._map.getLayers(): |
83 raise AttributeError('Editor error: map ' + self._map.getId() + ' has no layers. Cannot edit.') | 83 raise AttributeError('Editor error: map ' + self._map.getId() + ' has no layers. Cannot edit.') |
84 | 84 |
85 for cam in self._engine.getView().getCameras(): | 85 for cam in self._map.getCameras(): |
86 if cam.getLocationRef().getMap().getId() == self._map.getId(): | 86 if cam.getLocationRef().getMap().getId() == self._map.getId(): |
87 self._camera = cam | 87 self._camera = cam |
88 break | 88 break |
89 | 89 |
90 self._layer = self._map.getLayers()[0] | 90 self._layer = self._map.getLayers()[0] |
91 | 91 |
92 def getMap(self): | |
93 return self._map | |
94 | |
92 def selectLayer(self, layerid): | 95 def selectLayer(self, layerid): |
93 """ Select layer to be edited """ | 96 """ Select layer to be edited """ |
94 self.deselectSelection() | 97 self.deselectSelection() |
95 self._layer = None | 98 self._layer = None |
96 layers = [l for l in self._map.getLayers() if l.getId() == layerid] | 99 layers = [l for l in self._map.getLayers() if l.getId() == layerid] |