Changeset 3513
- Timestamp:
- 11/21/10 15:58:14 (3 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 edited
-
engine/core/view/renderers/genericrenderer.cpp (modified) (3 diffs)
-
engine/core/view/renderers/lightrenderer.cpp (modified) (4 diffs)
-
tools/editor/gui/lightedit.xml (modified) (1 diff)
-
tools/editor/plugins/LightEdit.py (added)
-
tools/editor/scripts/editor.py (modified) (5 diffs)
-
tools/editor/scripts/gui/filemanager.py (modified) (4 diffs)
-
tools/editor/scripts/gui/mapeditor.py (modified) (1 diff)
-
tools/editor/settings-dist.xml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/engine/core/view/renderers/genericrenderer.cpp
r3491 r3513 329 329 Rect r; 330 330 Rect viewport = cam->getViewPort(); 331 r.x = p.x-img->getWidth()/2; 332 r.y = p.y-img->getHeight()/2; 333 r.w = img->getWidth(); 334 r.h = img->getHeight(); 331 unsigned int widtht = round(img->getWidth() * cam->getZoom()); 332 unsigned int height = round(img->getHeight() * cam->getZoom()); 333 r.x = p.x-widtht/2; 334 r.y = p.y-height/2; 335 r.w = widtht; 336 r.h = height; 335 337 if(r.intersects(viewport)) 336 338 img->render(r); … … 353 355 Rect r; 354 356 Rect viewport = cam->getViewPort(); 355 r.x = p.x-img->getWidth()/2; 356 r.y = p.y-img->getHeight()/2; 357 r.w = img->getWidth(); 358 r.h = img->getHeight(); 357 unsigned int widtht = round(img->getWidth() * cam->getZoom()); 358 unsigned int height = round(img->getHeight() * cam->getZoom()); 359 r.x = p.x-widtht/2; 360 r.y = p.y-height/2; 361 r.w = widtht; 362 r.h = height; 359 363 if(r.intersects(viewport)) 360 364 img->render(r); … … 398 402 Image* img = &imagepool->getImage(m_image); 399 403 Rect r; 400 r.x = p.x-m_width/2; 401 r.y = p.y-m_height/2; 402 r.w = m_width; 403 r.h = m_height; 404 renderbackend->disableLighting(); 405 img->render(r); 406 renderbackend->enableLighting(); 404 Rect viewport = cam->getViewPort(); 405 unsigned int widtht = round(m_width * cam->getZoom()); 406 unsigned int height = round(m_height * cam->getZoom()); 407 r.x = p.x-widtht/2; 408 r.y = p.y-height/2; 409 r.w = widtht; 410 r.h = height; 411 if(r.intersects(viewport)) { 412 img->render(r); 413 } 407 414 } 408 415 } -
trunk/engine/core/view/renderers/lightrenderer.cpp
r3491 r3513 248 248 Rect r; 249 249 Rect viewport = cam->getViewPort(); 250 r.x = p.x-img->getWidth()/2; 251 r.y = p.y-img->getHeight()/2; 252 r.w = img->getWidth(); 253 r.h = img->getHeight(); 250 unsigned int widtht = round(img->getWidth() * cam->getZoom()); 251 unsigned int height = round(img->getHeight() * cam->getZoom()); 252 r.x = p.x-widtht/2; 253 r.y = p.y-height/2; 254 r.w = widtht; 255 r.h = height; 254 256 renderbackend->changeBlending(m_src, m_dst); 255 257 if(r.intersects(viewport)) … … 297 299 Rect r; 298 300 Rect viewport = cam->getViewPort(); 299 r.x = p.x-img->getWidth()/2; 300 r.y = p.y-img->getHeight()/2; 301 r.w = img->getWidth(); 302 r.h = img->getHeight(); 301 unsigned int widtht = round(img->getWidth() * cam->getZoom()); 302 unsigned int height = round(img->getHeight() * cam->getZoom()); 303 r.x = p.x-widtht/2; 304 r.y = p.y-height/2; 305 r.w = widtht; 306 r.h = height; 303 307 renderbackend->changeBlending(m_src, m_dst); 304 308 if(r.intersects(viewport)) … … 344 348 Rect r; 345 349 Rect viewport = cam->getViewPort(); 346 r.x = p.x-m_width/2; 347 r.y = p.y-m_height/2; 348 r.w = m_width; 349 r.h = m_height; 350 unsigned int widtht = round(m_width * cam->getZoom()); 351 unsigned int height = round(m_height * cam->getZoom()); 352 r.x = p.x-widtht/2; 353 r.y = p.y-height/2; 354 r.w = widtht; 355 r.h = height; 350 356 renderbackend->changeBlending(m_src, m_dst); 351 357 if(r.intersects(viewport)) … … 393 399 Point p = m_anchor.getCalculatedPoint(cam, layer); 394 400 if(m_anchor.getLayer() == layer) { 401 double zoom = cam->getZoom(); 395 402 renderbackend->changeBlending(m_src, m_dst); 396 renderbackend->drawLightPrimitive(p, m_intensity, m_radius, m_subdivisions, m_xstretch , m_ystretch, m_red, m_green, m_blue);403 renderbackend->drawLightPrimitive(p, m_intensity, m_radius, m_subdivisions, m_xstretch * zoom, m_ystretch * zoom, m_red, m_green, m_blue); 397 404 } 398 405 } -
trunk/tools/editor/gui/lightedit.xml
r3158 r3513 1 <Panel title="Light editor" position="10,700"> 2 <Label text="RGB values (float)" /> 3 <HBox> 4 <Label text="R" /> 5 <TextBox text="1.0" name="value_R" min_size="20,20"/> 6 <Button text="+" name="increase_R" /> 7 <Button text="-" name="decrease_R" /> 8 </HBox> 9 <HBox> 10 <Label text="G" /> 11 <TextBox text="1.0" name="value_G" min_size="20,20"/> 12 <Button text="+" name="increase_G" /> 13 <Button text="-" name="decrease_G" /> 14 </HBox> 15 <HBox> 16 <Label text="B" /> 17 <TextBox text="1.0" name="value_B" min_size="20,20"/> 18 <Button text="+" name="increase_B" /> 19 <Button text="-" name="decrease_B" /> 20 </HBox> 21 <HBox> 22 <Label text="A" /> 23 <TextBox text="1.0" name="value_A" min_size="20,20"/> 24 <Button text="+" name="increase_A" /> 25 <Button text="-" name="decrease_A" /> 26 </HBox> 27 <VBox> 28 <ToggleButton text="Enable" name="enable_global_light" /> 29 <Button text="Random" name="random_global_light" /> 30 <Button text="Reset" name="reset_global_light" /> 31 </VBox> 1 <Panel title="Light Editor" position="10,700" min_size="200,250"> 2 3 <VBox> 4 <Label text="General Options" min_size="45,20"/> 5 <HBox> 6 <Label text="Group: " min_size="100,20"/> 7 <TextField name="group" text="" min_size="100, 20" /> 8 </HBox> 9 10 <HBox> 11 <Label text="Instance Id: " min_size="100,20"/> 12 <TextField name="ins_id" text="" min_size="100, 20" /> 13 </HBox> 14 15 <HBox> 16 <Label text="Object Id: " min_size="100,20"/> 17 <TextField name="obj_id" text="" min_size="100, 20" /> 18 </HBox> 19 20 <HBox> 21 <Label text="Stencil Test: " min_size="25,20"/> 22 <TextBox text="-1" name="stencil" size="30,20" min_size="30,20" max_size="30,20" /> 23 <Button name="stencil_up" text="+" max_size="20,20"/> 24 <Button name="stencil_dn" text="-" max_size="20,20"/> 25 </HBox> 26 27 <HBox> 28 <Label text="Alpha Test: " min_size="25,20"/> 29 <TextBox text="0.0" name="alpha" size="30,20" min_size="30,20" max_size="30,20" /> 30 <Button name="alpha_up" text="+" max_size="20,20"/> 31 <Button name="alpha_dn" text="-" max_size="20,20"/> 32 </HBox> 33 34 <HBox> 35 <Label text="Src Blend Mode: " min_size="25,20"/> 36 <TextBox text="-1" name="src" size="30,20" min_size="30,20" max_size="30,20"/> 37 <Button name="src_up" text="+" max_size="20,20"/> 38 <Button name="src_dn" text="-" max_size="20,20"/> 39 </HBox> 40 41 <HBox> 42 <Label text="Dst Blend Mode: " min_size="25,20"/> 43 <TextBox text="-1" name="dst" size="30,20" min_size="30,20" max_size="30,20"/> 44 <Button name="dst_up" text="+" max_size="20,20"/> 45 <Button name="dst_dn" text="-" max_size="20,20"/> 46 </HBox> 47 48 <HBox> 49 <Button text="Simple" name="simple_but" /> 50 <Button text="Image" name="image_but" /> 51 <Button text="Animation" name="animation_but" /> 52 <Button text="Global" name="global_but" /> 53 </HBox> 54 55 <HBox> 56 <Button text="Reset" name="reset" /> 57 <Button text="Use" name="use" /> 58 </HBox> 59 </VBox> 60 61 <VBox name="simple_panel_wrapper"> 62 <VBox name="simple_panel"> 63 <Label text="Simple Light" min_size="45,20"/> 64 <HBox> 65 <Label text="Intensity: " min_size="25,20"/> 66 <TextBox text="0" name="intensity" size="30,20" min_size="30,20" max_size="30,20" /> 67 <Button name="intensity_up" text="+" max_size="20,20"/> 68 <Button name="intensity_dn" text="-" max_size="20,20"/> 69 </HBox> 70 71 <HBox> 72 <Label text="R: " min_size="25,20"/> 73 <TextBox text="0" name="red" size="30,20" min_size="30,20" max_size="30,20"/> 74 <Button name="red_up" text="+" max_size="20,20"/> 75 <Button name="red_dn" text="-" max_size="20,20"/> 76 </HBox> 77 78 <HBox> 79 <Label text="G: " min_size="25,20"/> 80 <TextBox text="0" name="green" size="30,20" min_size="30,20" max_size="30,20"/> 81 <Button name="green_up" text="+" max_size="20,20"/> 82 <Button name="green_dn" text="-" max_size="20,20"/> 83 </HBox> 84 85 <HBox> 86 <Label text="B: " min_size="25,20"/> 87 <TextBox text="0" name="blue" size="30,20" min_size="30,20" max_size="30,20"/> 88 <Button name="blue_up" text="+" max_size="20,20"/> 89 <Button name="blue_dn" text="-" max_size="20,20"/> 90 </HBox> 91 92 <HBox> 93 <Label text="Radius: " min_size="25,20"/> 94 <TextBox text="0" name="radius" size="30,20" min_size="30,20" max_size="30,20"/> 95 <Button name="radius_up" text="+" max_size="20,20"/> 96 <Button name="radius_dn" text="-" max_size="20,20"/> 97 </HBox> 98 99 <HBox> 100 <Label text="Subdivisions: " min_size="25,20"/> 101 <TextBox text="32" name="subdivisions" size="30,20" min_size="30,20" max_size="30,20"/> 102 <Button name="subdivisions_up" text="+" max_size="20,20"/> 103 <Button name="subdivisions_dn" text="-" max_size="20,20"/> 104 </HBox> 105 106 <HBox> 107 <Label text="X-Stretch: " min_size="25,20"/> 108 <TextBox text="1" name="xstretch" size="30,20" min_size="30,20" max_size="30,20"/> 109 <Button name="xstretch_up" text="+" max_size="20,20"/> 110 <Button name="xstretch_dn" text="-" max_size="20,20"/> 111 </HBox> 112 113 <HBox> 114 <Label text="Y-Stretch: " min_size="25,20"/> 115 <TextBox text="1" name="ystretch" size="30,20" min_size="30,20" max_size="30,20"/> 116 <Button name="ystretch_up" text="+" max_size="20,20"/> 117 <Button name="ystretch_dn" text="-" max_size="20,20"/> 118 </HBox> 119 </VBox> 120 </VBox> 121 122 <VBox name="image_panel_wrapper"> 123 <VBox name="image_panel"> 124 <Label text="Light Image" min_size="45,20"/> 125 <HBox> 126 <Label text="Image: " min_size="30,20"/> 127 <TextField text="" name="image" size="60,20" min_size="40,20" max_size="300,20"/> 128 </HBox> 129 <HBox> 130 <Button name="selec_image" text="last selected"/> 131 </HBox> 132 </VBox> 133 </VBox> 134 135 <VBox name="animation_panel_wrapper"> 136 <VBox name="animation_panel"> 137 <Label text="Light Animation" min_size="45,20"/> 138 <HBox> 139 <Label text="Animation: " min_size="30,20"/> 140 <TextField text="" name="animation" size="60,20" min_size="40,20" max_size="300,20"/> 141 </HBox> 142 <HBox> 143 <Button name="selec_animation" text="last selected"/> 144 </HBox> 145 </VBox> 146 </VBox> 147 148 <VBox name="global_panel_wrapper"> 149 <VBox name="global_panel"> 150 <Label text="RGB values for Global Light" /> 151 <HBox> 152 <Label text="R" /> 153 <TextBox text="1.0" name="value_R" min_size="30,20"/> 154 <Button text="+" name="increase_R" /> 155 <Button text="-" name="decrease_R" /> 156 </HBox> 157 <HBox> 158 <Label text="G" /> 159 <TextBox text="1.0" name="value_G" min_size="30,20"/> 160 <Button text="+" name="increase_G" /> 161 <Button text="-" name="decrease_G" /> 162 </HBox> 163 <HBox> 164 <Label text="B" /> 165 <TextBox text="1.0" name="value_B" min_size="30,20"/> 166 <Button text="+" name="increase_B" /> 167 <Button text="-" name="decrease_B" /> 168 </HBox> 169 <HBox> 170 <Label text="A" /> 171 <TextBox text="1.0" name="value_A" min_size="30,20"/> 172 <Button text="+" name="increase_A" /> 173 <Button text="-" name="decrease_A" /> 174 </HBox> 175 <VBox> 176 <Button text="Random" name="random_global_light" /> 177 <Button text="Reset" name="reset_global_light" /> 178 </VBox> 179 </VBox> 180 </VBox> 181 32 182 </Panel> -
trunk/tools/editor/scripts/editor.py
r3499 r3513 2 2 3 3 # #################################################################### 4 # Copyright (C) 2005-20 09by the FIFE team4 # Copyright (C) 2005-2010 by the FIFE team 5 5 # http://www.fifengine.de 6 6 # This file is part of FIFE. … … 99 99 100 100 self._settings = TDS 101 101 102 self._lighting_mode = int(TDS.get("FIFE", "Lighting")) 102 103 self._help_dialog = None 103 104 … … 328 329 def getSettings(self): 329 330 return self._settings; 330 331 332 def getObject(self): 333 return self._mapeditor.getObject() 334 331 335 def showMapView(self, mapview): 332 336 """ Switches to mapview. """ … … 340 344 for cam in self._mapview.getMap().getCameras(): 341 345 cam.setEnabled(False) 346 347 # if light model is set then enable LightRenderer for all layers 348 if self._lighting_mode is not 0: 349 for cam in mapview.getMap().getCameras(): 350 renderer = fife.LightRenderer.getInstance(cam) 351 renderer.activateAllLayers(mapview.getMap()) 352 renderer.setEnabled(not renderer.isEnabled()) 342 353 343 354 events.preMapShown.send(sender=self, mapview=mapview) … … 398 409 """ Opens a file """ 399 410 try: 400 map = loaders.loadMapFile(path, self.engine) 411 if self._lighting_mode == 0: 412 map = loaders.loadMapFile(path, self.engine) 413 else: 414 map = loaders.loadMapFile(path, self.engine, extensions = {'lights': True}) 401 415 return self.newMapView(map) 402 416 except: -
trunk/tools/editor/scripts/gui/filemanager.py
r3158 r3513 27 27 from fife.extensions import filebrowser 28 28 from fife.extensions import loaders, savers 29 from fife.extensions.serializers.xmlobject import XMLObjectLoader 30 from fife.extensions.serializers.xml_loader_tools import loadImportFile, loadImportDir, loadImportDirRec 29 31 import action 30 32 import scripts.editor … … 53 55 self._importbrowser = None 54 56 self._savebrowser = None 57 58 self.obj_loader = XMLObjectLoader( 59 self.engine.getImagePool(), 60 self.engine.getAnimationPool(), 61 self.engine.getModel(), 62 self.engine.getVFS() 63 ) 55 64 56 65 newAction = Action(u"New map", "gui/icons/new_map.png") … … 215 224 try: 216 225 if os.path.isfile(file): 217 load ers.loadImportFile(file, self.engine)226 loadImportFile(self.obj_loader, file, self.engine) 218 227 else: 219 228 raise file+ " is not a file!" … … 240 249 try: 241 250 if os.path.isdir(path): 242 load ers.loadImportDirRec(path, self.engine)251 loadImportDirRec(self.obj_loader, path, self.engine) 243 252 else: 244 253 raise file+ " is not a directory!" -
trunk/tools/editor/scripts/gui/mapeditor.py
r3503 r3513 104 104 """ Set the object type to be paint onto map """ 105 105 self._object = object 106 106 107 def getObject(self): 108 """ Return the current object """ 109 return self._object 110 107 111 def setController(self, controller): 108 112 """ Set the controller to use. """ -
trunk/tools/editor/settings-dist.xml
r3493 r3513 26 26 <Setting name="ObjectEdit" type="bool">True</Setting> 27 27 <Setting name="ObjectSelector" type="bool">True</Setting> 28 <Setting name="LightEdit" type="bool">True</Setting> 28 29 </Module> 29 30 <Module name="Colors">
Note: See TracChangeset
for help on using the changeset viewer.
