changeset 432:4f2752d45458

This changes the behavior of Camera::resetRenderers(). It will no longer activate all layers for every renderer. This is now up to the clients to do. It also adds some code to the map loader that will automatically activate the layers in the InstanceRenderer. Clients that use the any of the renderers will now have to activate the layer they want to use. Also updated rio_de_hola and the editor to reflect changes. fixes[t:457]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Wed, 24 Feb 2010 20:03:52 +0000
parents f44b149f63e7
children c75f9834f9d0
files demos/rio_de_hola/scripts/world.py engine/core/view/camera.cpp engine/python/fife/extensions/serializers/xmlmap.py tools/editor/scripts/mapcontroller.py
diffstat 4 files changed, 22 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/demos/rio_de_hola/scripts/world.py	Tue Feb 23 19:44:36 2010 +0000
+++ b/demos/rio_de_hola/scripts/world.py	Wed Feb 24 20:03:52 2010 +0000
@@ -212,11 +212,17 @@
 		renderer = fife.FloatingTextRenderer.getInstance(self.cameras['main'])
 		textfont = self.engine.getGuiManager().createFont('fonts/rpgfont.png', 0, str(TDS.readSetting("FontGlyphs", strip=False)));
 		renderer.changeDefaultFont(textfont)
-
+		renderer.activateAllLayers(self.map)
+		
+		# Activate the grid renderer on all layers
+		renderer = self.cameras['main'].getRenderer('GridRenderer')
+		renderer.activateAllLayers(self.map)
+		
 		# The small camera shouldn't be cluttered by the 'humm di dums' of our hero.
 		# So we disable the renderer simply by setting its font to None.
 		renderer = fife.FloatingTextRenderer.getInstance(self.cameras['small'])
 		renderer.changeDefaultFont(None)
+		
 
 		# The following renderers are used for debugging.
 		# Note that by default ( that is after calling View.resetRenderers or Camera.resetRenderers )
--- a/engine/core/view/camera.cpp	Tue Feb 23 19:44:36 2010 +0000
+++ b/engine/core/view/camera.cpp	Wed Feb 24 20:03:52 2010 +0000
@@ -468,7 +468,6 @@
 		for (; r_it != m_renderers.end(); ++r_it) {
 			Map* map = m_location.getMap();
 			r_it->second->reset();
-			r_it->second->activateAllLayers(map);
 		}
 	}
 
--- a/engine/python/fife/extensions/serializers/xmlmap.py	Tue Feb 23 19:44:36 2010 +0000
+++ b/engine/python/fife/extensions/serializers/xmlmap.py	Wed Feb 24 20:03:52 2010 +0000
@@ -104,7 +104,7 @@
 		self.parse_layers(mapelt, self.map)	
 		
 		self.parse_cameras(mapelt, self.map)
-
+		
 		return self.map
 
 	def parse_imports(self, mapelt, map):
@@ -328,10 +328,14 @@
 				cam.setRotation(float(rotation))
 				cam.setTilt(float(tilt))
 				cam.setZoom(float(zoom))
+				
+				renderer = fife.InstanceRenderer.getInstance(cam)
+				renderer.activateAllLayers(map)
+				
 			except fife.Exception, e:
 				print e.getMessage()
 				
 			if self.callback:
 				i += 1
 				self.callback('loaded camera: ' +  str(id), float( i / len(tmplist) * 0.25 + 0.75 ) )	
-			
+
--- a/tools/editor/scripts/mapcontroller.py	Tue Feb 23 19:44:36 2010 +0000
+++ b/tools/editor/scripts/mapcontroller.py	Wed Feb 24 20:03:52 2010 +0000
@@ -88,6 +88,15 @@
 				break
 
 		self._layer = self._map.getLayers()[0]
+		
+		gridrenderer = self._camera.getRenderer('GridRenderer')
+		gridrenderer.activateAllLayers(self._map)
+
+		blockrenderer = self._camera.getRenderer('BlockingInfoRenderer')
+		blockrenderer.activateAllLayers(self._map)
+
+		cellrenderer = self._camera.getRenderer('CellSelectionRenderer')
+		cellrenderer.activateAllLayers(self._map)
 
 	def getMap(self):
 		return self._map