diff clients/editor/scripts/gui/layerdialog.py @ 356:ab41334e8a57

Added or1andov's code with a few adjustments to fix instance transparencies fixed[t:378] Added layer transparency support Added layer transparency to map editor
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 24 Sep 2009 18:24:47 +0000
parents 8b125ec749d7
children
line wrap: on
line diff
--- a/clients/editor/scripts/gui/layerdialog.py	Tue Sep 22 19:03:53 2009 +0000
+++ b/clients/editor/scripts/gui/layerdialog.py	Thu Sep 24 18:24:47 2009 +0000
@@ -58,7 +58,8 @@
 				"yScaleBox" : unicode(cg.getYScale()),
 				"rotBox" : unicode(cg.getRotation()),
 				"xOffsetBox" : unicode(cg.getXShift()),
-				"yOffsetBox" : unicode(cg.getYShift())
+				"yOffsetBox" : unicode(cg.getYShift()),
+				"transBox" : unicode(layer.getLayerTransparency())
 			})
 			
 			self._widget.findChild(name="pathingBox").selected = int(layer.getPathingStrategy())
@@ -108,6 +109,19 @@
 			print 'Please enter integer or decimal value for rotation.'
 			return
 			
+		try:
+			transparency = int(self._widget.collectData('transBox'))
+		except ValueError:
+			print 'Please enter an integer value in the range of 0-255 for transparency.'
+			return
+			
+		
+		#Clamp the transparency value between 0 and 255
+		if transparency < 0:
+			transparency = 0
+		if transparency > 255:
+			transparency = 255
+		
 		grid_type = int(self._widget.collectData('gridBox'))
 		pathing = int(self._widget.collectData('pathingBox'))
 
@@ -147,6 +161,7 @@
 				return
 		
 		layer.setPathingStrategy(pathing)
+		layer.setLayerTransparency(transparency)
 		
 		self.engine.getView().resetRenderers()