Mercurial > fife-parpg
diff 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 |
line wrap: on
line diff
--- a/tools/editor/scripts/editor.py Fri Jul 30 23:48:26 2010 +0000 +++ b/tools/editor/scripts/editor.py Sat Jul 31 17:46:19 2010 +0000 @@ -189,6 +189,21 @@ test_action1.helptext = u"Cycles button styles. There are currently four button styles." action.activated.connect(self._actionActivated, sender=test_action1) self._view_menu.addAction(test_action1) + + test_action2 = Action(u"Toggle Blocking") + test_action2.helptext = u"Toggles the blocking infos for the instances." + action.activated.connect(self.toggleBlocking, sender=test_action2) + self._view_menu.addAction(test_action2) + + test_action3 = Action(u"Toggle Grid") + test_action3.helptext = u"Toggles the grids of the map." + action.activated.connect(self.toggleGrid, sender=test_action3) + self._view_menu.addAction(test_action3) + + test_action4 = Action(u"Toggle Coordinates") + test_action4.helptext = u"Toggles the coordinates of the map." + action.activated.connect(self.toggleCoordinates, sender=test_action4) + self._view_menu.addAction(test_action4) self._mapgroup = ActionGroup(exclusive=True, name="Mapgroup") self._mapbar.addAction(self._mapgroup) @@ -267,7 +282,34 @@ toolbox.y = ty self._action_show_toolbox.setChecked(True) toolbox.adaptLayout() - + + def toggleBlocking(self, sender): + if self._mapview != None: + for cam in self._mapview.getMap().getCameras(): + r = fife.BlockingInfoRenderer.getInstance(cam) + r.setEnabled(not r.isEnabled()) + + def toggleGrid(self, sender): + if self._mapview != None: + for cam in self._mapview.getMap().getCameras(): + r = fife.GridRenderer.getInstance(cam) + r.setEnabled(not r.isEnabled()) + + def toggleCoordinates(self, sender): + if self._mapview != None: + for cam in self._mapview.getMap().getCameras(): + r = fife.CoordinateRenderer.getInstance(cam) + if not r.isEnabled(): + r.clearActiveLayers() + color = str(self._settings.get("Colors", "Coordinate", "255,255,255")) + r.setColor(*[int(c) for c in color.split(',')]) + for layer in self._mapview.getMap().getLayers(): + if layer.areInstancesVisible(): + r.addActiveLayer(layer) + r.setEnabled(True) + else: + r.setEnabled(False) + def getToolbox(self): return self._toolbox