diff tools/editor/scripts/editor.py @ 680:60621d858548

* Fixed the image/animation functions in GenericRenderer and LightRenderer. The functions now consider the camera zoom level. * Added the forgotten LightEdit plugin for the editor.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sun, 21 Nov 2010 15:58:14 +0000
parents 46258f467c8c
children
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py	Thu Nov 18 17:28:15 2010 +0000
+++ b/tools/editor/scripts/editor.py	Sun Nov 21 15:58:14 2010 +0000
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 
 # ####################################################################
-#  Copyright (C) 2005-2009 by the FIFE team
+#  Copyright (C) 2005-2010 by the FIFE team
 #  http://www.fifengine.de
 #  This file is part of FIFE.
 #
@@ -98,7 +98,8 @@
 		self._change_map = -1
 		
 		self._settings = TDS
-		
+
+		self._lighting_mode = int(TDS.get("FIFE", "Lighting"))		
 		self._help_dialog = None
 	
 		ApplicationBase.__init__(self, TDS, *args, **kwargs)
@@ -327,7 +328,10 @@
 		
 	def getSettings(self):
 		return self._settings;
-		
+
+	def getObject(self):
+		return self._mapeditor.getObject()
+
 	def showMapView(self, mapview):
 		""" Switches to mapview. """
 		if mapview is None or mapview == self._mapview:
@@ -340,6 +344,13 @@
 				for cam in self._mapview.getMap().getCameras():
 					cam.setEnabled(False)
 		
+		# if light model is set then enable LightRenderer for all layers
+		if self._lighting_mode is not 0:
+			for cam in mapview.getMap().getCameras():
+				renderer = fife.LightRenderer.getInstance(cam)
+				renderer.activateAllLayers(mapview.getMap())
+				renderer.setEnabled(not renderer.isEnabled())
+		
 		events.preMapShown.send(sender=self, mapview=mapview)
 		self._mapview = mapview
 		self._mapview.show()
@@ -397,7 +408,10 @@
 	def openFile(self, path):
 		""" Opens a file """
 		try:
-			map = loaders.loadMapFile(path, self.engine)
+			if self._lighting_mode == 0:
+				map = loaders.loadMapFile(path, self.engine)
+			else:
+				map = loaders.loadMapFile(path, self.engine, extensions = {'lights': True})
 			return self.newMapView(map)
 		except:
 			traceback.print_exc(sys.exc_info()[1])