comparison tools/editor/scripts/editor.py @ 579:b2feacaed53c

* Added the colorbuffer patch with a small change due to SDL. Performance boost between 20-30% under OpenGL. * Improved the most renderers with setColor() function. * Fixed the genericrenderer, is now tested whether the images are in the viewport. * Fixed the gridrenderer, the grid is now drawn only up to the viewport. * Changed the vertex functions in opengl/renderbackendopengl.cpp from vertex3f() to vertex2f(). * Improved the Editor, now you can use blocking, grid and coordinate renderer over gui or keys. Additionally, the colors can be changed with the settings.xml.
author helios2000@33b003aa-7bff-0310-803a-e67f0ece8222
date Sat, 31 Jul 2010 17:46:19 +0000
parents 90d369c788c0
children 5e04f6349894
comparison
equal deleted inserted replaced
578:54d83a0462ee 579:b2feacaed53c
187 187
188 test_action1 = Action(u"Cycle buttonstyles", "gui/icons/cycle_styles.png") 188 test_action1 = Action(u"Cycle buttonstyles", "gui/icons/cycle_styles.png")
189 test_action1.helptext = u"Cycles button styles. There are currently four button styles." 189 test_action1.helptext = u"Cycles button styles. There are currently four button styles."
190 action.activated.connect(self._actionActivated, sender=test_action1) 190 action.activated.connect(self._actionActivated, sender=test_action1)
191 self._view_menu.addAction(test_action1) 191 self._view_menu.addAction(test_action1)
192
193 test_action2 = Action(u"Toggle Blocking")
194 test_action2.helptext = u"Toggles the blocking infos for the instances."
195 action.activated.connect(self.toggleBlocking, sender=test_action2)
196 self._view_menu.addAction(test_action2)
197
198 test_action3 = Action(u"Toggle Grid")
199 test_action3.helptext = u"Toggles the grids of the map."
200 action.activated.connect(self.toggleGrid, sender=test_action3)
201 self._view_menu.addAction(test_action3)
202
203 test_action4 = Action(u"Toggle Coordinates")
204 test_action4.helptext = u"Toggles the coordinates of the map."
205 action.activated.connect(self.toggleCoordinates, sender=test_action4)
206 self._view_menu.addAction(test_action4)
192 207
193 self._mapgroup = ActionGroup(exclusive=True, name="Mapgroup") 208 self._mapgroup = ActionGroup(exclusive=True, name="Mapgroup")
194 self._mapbar.addAction(self._mapgroup) 209 self._mapbar.addAction(self._mapgroup)
195 self._window_menu.addAction(self._mapgroup) 210 self._window_menu.addAction(self._mapgroup)
196 211
265 toolbox.show() 280 toolbox.show()
266 toolbox.x = tx 281 toolbox.x = tx
267 toolbox.y = ty 282 toolbox.y = ty
268 self._action_show_toolbox.setChecked(True) 283 self._action_show_toolbox.setChecked(True)
269 toolbox.adaptLayout() 284 toolbox.adaptLayout()
270 285
286 def toggleBlocking(self, sender):
287 if self._mapview != None:
288 for cam in self._mapview.getMap().getCameras():
289 r = fife.BlockingInfoRenderer.getInstance(cam)
290 r.setEnabled(not r.isEnabled())
291
292 def toggleGrid(self, sender):
293 if self._mapview != None:
294 for cam in self._mapview.getMap().getCameras():
295 r = fife.GridRenderer.getInstance(cam)
296 r.setEnabled(not r.isEnabled())
297
298 def toggleCoordinates(self, sender):
299 if self._mapview != None:
300 for cam in self._mapview.getMap().getCameras():
301 r = fife.CoordinateRenderer.getInstance(cam)
302 if not r.isEnabled():
303 r.clearActiveLayers()
304 color = str(self._settings.get("Colors", "Coordinate", "255,255,255"))
305 r.setColor(*[int(c) for c in color.split(',')])
306 for layer in self._mapview.getMap().getLayers():
307 if layer.areInstancesVisible():
308 r.addActiveLayer(layer)
309 r.setEnabled(True)
310 else:
311 r.setEnabled(False)
312
271 def getToolbox(self): 313 def getToolbox(self):
272 return self._toolbox 314 return self._toolbox
273 315
274 def getPluginManager(self): 316 def getPluginManager(self):
275 return self._pluginmanager 317 return self._pluginmanager