You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <eg...@us...> - 2009-02-28 15:22:27
|
Revision: 1076 http://opengate.svn.sourceforge.net/opengate/?rev=1076&view=rev Author: egore Date: 2009-02-28 14:58:07 +0000 (Sat, 28 Feb 2009) Log Message: ----------- Make 'make distcheck' pass again Modified Paths: -------------- trunk/src/Makefile.am trunk/src/OpcodeWrapper.cpp trunk/src/Sector.cpp Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-25 05:56:34 UTC (rev 1075) +++ trunk/src/Makefile.am 2009-02-28 14:58:07 UTC (rev 1076) @@ -98,6 +98,7 @@ SectorMissileObject.cpp \ SectorMovableObject.h \ SectorMovableObject.cpp \ + SectorObject.h \ SectorPadObject.h \ SectorPadObject.cpp \ SectorStationObject.h \ @@ -177,219 +178,6 @@ $(CEGUI_CFLAGS) \ $(ogreopcode_CFLAGS) - -# common.h \ -# common.cpp \ -# commonWithOgre.h \ -# commonWithOgre.cpp \ -# networkProtocol.h \ -# networkProtocol.cpp \ -# networkClient.h \ -# networkClient.cpp \ -# tinyxml/tinyxml.h \ -# tinyxml/tinyxml.cpp \ -# tinyxml/tinyxmlerror.cpp \ -# tinyxml/tinyxmlparser.cpp \ -# Avatar.h \ -# Avatar.cpp \ -# AiCommands.h \ -# AiCommands.cpp \ -# AiManager.h \ -# AiManager.cpp \ -# AiObject.h \ -# AiObject.cpp \ -# BaseDialog.h \ -# BaseDialog.cpp \ -# BaseObject.h \ -# BaseObject.cpp \ -# ConfigDialog.h \ -# ConfigDialog.cpp \ -# Console.h \ -# Console.cpp \ -# DockedState.h \ -# DockedState.cpp \ -# Entity.h \ -# Entity.cpp \ -# EntityManager.h \ -# EntityManager.cpp \ -# Equipment.h \ -# Equipment.cpp \ -# GameState.h \ -# GameState.cpp \ -# GameStateManager.h \ -# GameStateManager.cpp \ -# GunObject.h\ -# GunObject.cpp\ -# Hud.h\ -# Hud.cpp\ -# InputManager.h \ -# InputManager.cpp \ -# InitState.h \ -# InitState.cpp \ -# KeyMap.h \ -# KeyMap.cpp \ -# LogManager.h \ -# LogManager.cpp \ -# LogManagerBase.h \ -# LogManagerBase.cpp \ -# MarketDialog.h \ -# MarketDialog.cpp \ -# Missile.h \ -# Missile.cpp \ -# Moveable.h \ -# Moveable.cpp \ -# OpcodeWrapper.h \ -# OpcodeWrapper.cpp \ -# Opengate.h \ -# OpenALSoundManager.h \ -# OpenALSoundManager.cpp \ -# Projectile.h \ -# Projectile.cpp \ -# RadarObject.h \ -# RadarObject.cpp \ -# ResourceManager.h \ -# ResourceManager.cpp \ -# Sector.h \ -# Sector.cpp \ -# SectorAvatarObject.h \ -# SectorAvatarObject.cpp \ -# SectorBaseObject.h \ -# SectorBaseObject.cpp \ -# SectorBeaconObject.h \ -# SectorBeaconObject.cpp \ -# SectorBeaconPadObject.h \ -# SectorBeaconPadObject.cpp \ -# SectorChildObject.h \ -# SectorChildObject.cpp \ -# SectorCollisionObject.h \ -# SectorCollisionObject.cpp \ -# SectorEnvironmentObject.h \ -# SectorEnvironmentObject.cpp \ -# SectorExplosionObject.h \ -# SectorExplosionObject.cpp \ -# SectorMeshObject.h \ -# SectorMeshObject.cpp \ -# SectorMissileObject.h \ -# SectorMissileObject.cpp \ -# SectorMovableObject.h \ -# SectorMovableObject.cpp \ -# SectorPadObject.h \ -# SectorPadObject.cpp \ -# SectorStationObject.h \ -# SectorStationObject.cpp \ -# SectorStationPadObject.h \ -# SectorStationPadObject.cpp \ -# SectorVesselObject.h \ -# SectorVesselObject.cpp \ -# SectorProjectileObject.h \ -# SectorProjectileObject.cpp \ -# ShipConfigDialog.h \ -# ShipConfigDialog.cpp \ -# UnDockedState.cpp \ -# UnDockedState.h \ -# Vessel.h \ -# Vessel.cpp \ -# metaserver.h \ -# metaserver.cpp - -# opengateclient_LDFLAGS = \ -# $(OGRE_LIBS) \ -# $(CEGUI_LIBS) \ -# $(CEGUIOGRE_LIBS) \ -# $(freealut_LIBS) \ -# $(vorbisfile_LIBS) \ -# $(OIS_LIBS) \ -# $(ogreopcode_LIBS) -# -# opengateclient_CXXFLAGS = \ -# $(OGRE_CFLAGS) \ -# $(CEGUI_CFLAGS) \ -# $(ogreopcode_CFLAGS) - -# opengateserver_SOURCES = \ -# opengateserver.cpp \ -# common.h \ -# common.cpp \ -# LogManagerBase.h \ -# LogManagerBase.cpp \ -# networkProtocol.h \ -# networkProtocol.cpp \ -# networkServer.h \ -# networkServer.cpp \ -# networkServerUser.h \ -# networkServerUser.cpp \ -# metaserver.h \ -# metaserver.cpp -# -# opengateserver_LDFLAGS = \ -# $(ogreopcode_LIBS) - -# opengateserver_CXXFLAGS = \ -# $(ogreopcode_CFLAGS) - -# testaimanager_SOURCES = \ -# testaimanager.cpp \ -# AiManager.h \ -# AiManager.cpp \ -# AiObject.h \ -# AiObject.cpp \ -# AiCommands.h \ -# AiCommands.cpp -# -# testaimanager_LDFLAGS = $(OGRE_LIBS) \ -# $(CEGUI_LIBS) \ -# $(CEGUIOGRE_LIBS) \ -# $(freealut_LIBS) \ -# $(vorbisfile_LIBS) \ -# $(OIS_LIBS) \ -# $(ogreopcode_LIBS) -# -# testaimanager_CXXFLAGS = \ -# $(OGRE_CFLAGS) \ -# $(CEGUI_CFLAGS) \ -# $(ogreopcode_CFLAGS) - -#testopenalmanager_SOURCES = \ -# testopenalmanager.cpp \ -# common.h \ -# common.cpp \ -# tinyxml/tinyxml.h \ -# tinyxml/tinyxml.cpp \ -# tinyxml/tinyxmlerror.cpp \ -# tinyxml/tinyxmlparser.cpp \ -# networkProtocol.h \ -# networkProtocol.cpp \ -# networkClient.h \ -# networkClient.cpp \ -# Console.h \ -# Console.cpp \ -# Entity.h \ -# Entity.cpp \ -# LogManager.h \ -# LogManager.cpp \ -# LogManagerBase.h \ -# LogManagerBase.cpp \ -# KeyMap.h \ -# KeyMap.cpp \ -# InputManager.h \ -# InputManager.cpp \ -# OpenALSoundManager.h \ -# OpenALSoundManager.cpp \ -# ResourceManager.h \ -# ResourceManager.cpp - -#testopenalmanager_LDFLAGS = \ -# $(OGRE_LIBS) \ -# $(CEGUI_LIBS) \ -# $(CEGUIOGRE_LIBS) \ -# $(freealut_LIBS) \ -# $(vorbisfile_LIBS) \ -# $(OIS_LIBS) - -#testopenalmanager_CXXFLAGS = \ -# $(OGRE_CFLAGS) \ -# $(CEGUI_CFLAGS) - distclean: maintainer-clean rm -rf *~ \ Makefile.in Modified: trunk/src/OpcodeWrapper.cpp =================================================================== --- trunk/src/OpcodeWrapper.cpp 2009-02-25 05:56:34 UTC (rev 1075) +++ trunk/src/OpcodeWrapper.cpp 2009-02-28 14:58:07 UTC (rev 1076) @@ -24,7 +24,6 @@ #include "SectorCollisionObject.h" #include "SectorObject.h" #include "ResourceManager.h" -#include "Projectile.h" #include <OgreOpcode.h> #include <OgreSceneManager.h> Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-25 05:56:34 UTC (rev 1075) +++ trunk/src/Sector.cpp 2009-02-28 14:58:07 UTC (rev 1076) @@ -32,7 +32,6 @@ #include "Missile.h" #include "networkClient.h" #include "OpcodeWrapper.h" -#include "Projectile.h" #include "RadarObject.h" #include "ResourceManager.h" #include "SectorAvatarObject.h" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-25 05:56:44
|
Revision: 1075 http://opengate.svn.sourceforge.net/opengate/?rev=1075&view=rev Author: Ultrasick Date: 2009-02-25 05:56:34 +0000 (Wed, 25 Feb 2009) Log Message: ----------- adding the functionality to the rotation buttons Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-24 18:38:13 UTC (rev 1074) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-25 05:56:34 UTC (rev 1075) @@ -29,11 +29,14 @@ for color_name, color_content in colors.items(): self.preview.window.colors[color_name] = self.preview.window.new_gc(foreground = self.preview.window.get_colormap().alloc_color(color_content)) - def redraw(self, widget, event): + def redraw(self, widget = none, event = none): # add the drawing to the background processes background_processes.add('drawing the preview image', self.draw) def draw(self): + # clear the drawing area + self.preview.window.clear() + # select the right object as the drawing area drawing_area = self.preview.window @@ -130,8 +133,16 @@ drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) def rotate(self, widget, direction): - pass + model['faces'][window.face_number]['base line'] += 1 * direction + if model['faces'][window.face_number]['base line']<0: + model['faces'][window.face_number]['base line'] = len(model['faces'][window.face_number]['edges']) - 1 + elif model['faces'][window.face_number]['base line']>(len(model['faces'][window.face_number]['edges']) - 1): + model['faces'][window.face_number]['base line'] = 0 + + # redraw the face + self.redraw() + def exit_screen(self, widget): show_screen('project/canvas') @@ -181,14 +192,14 @@ image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_counterclockwise.png') # add the "rotate counterclockwise" button - self.bar.append_item('rotate', 'rotate the model counterclockwise', none, image, screen.preview.rotate, -1) + self.bar.append_item('rotate', 'rotate the model counterclockwise', none, image, screen.preview.rotate, 1) # create the "rotate clockwise" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_clockwise.png') # add the "rotate clockwise" button - self.bar.append_item('rotate', 'rotate the model clockwise', none, image, screen.preview.rotate, 1) + self.bar.append_item('rotate', 'rotate the model clockwise', none, image, screen.preview.rotate, -1) # create the "exit screen" icon image = gtk.Image() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-24 18:38:24
|
Revision: 1074 http://opengate.svn.sourceforge.net/opengate/?rev=1074&view=rev Author: Ultrasick Date: 2009-02-24 18:38:13 +0000 (Tue, 24 Feb 2009) Log Message: ----------- adding 2 buttons to rotate the face which you are editing at the moment this commit is only adding the graphics and showing them. there is no rotation function jet Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_clockwise.png branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_counterclockwise.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate.pspimage Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_clockwise.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_clockwise.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_counterclockwise.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate_counterclockwise.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 18:53:10 UTC (rev 1073) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-24 18:38:13 UTC (rev 1074) @@ -129,6 +129,9 @@ # draw the highlighted face drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) + def rotate(self, widget, direction): + pass + def exit_screen(self, widget): show_screen('project/canvas') @@ -173,6 +176,20 @@ parent.attach(self.bar, 0, 1, 0, 1) self.bar.show() + # create the "rotate counterclockwise" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_counterclockwise.png') + + # add the "rotate counterclockwise" button + self.bar.append_item('rotate', 'rotate the model counterclockwise', none, image, screen.preview.rotate, -1) + + # create the "rotate clockwise" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/rotate_clockwise.png') + + # add the "rotate clockwise" button + self.bar.append_item('rotate', 'rotate the model clockwise', none, image, screen.preview.rotate, 1) + # create the "exit screen" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/exit_screen.png') Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/rotate.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-22 18:53:16
|
Revision: 1073 http://opengate.svn.sourceforge.net/opengate/?rev=1073&view=rev Author: spom_spom Date: 2009-02-22 18:53:10 +0000 (Sun, 22 Feb 2009) Log Message: ----------- win compatibility commit (need network testing) Modified Paths: -------------- trunk/win32/ogsectorclient/ogsectorclient.cbp trunk/win32/ogsectorclient/ogsectorclient.exe Modified: trunk/win32/ogsectorclient/ogsectorclient.cbp =================================================================== --- trunk/win32/ogsectorclient/ogsectorclient.cbp 2009-02-22 18:00:16 UTC (rev 1072) +++ trunk/win32/ogsectorclient/ogsectorclient.cbp 2009-02-22 18:53:10 UTC (rev 1073) @@ -119,8 +119,6 @@ <Unit filename="..\..\src\OpenALSoundManager.cpp" /> <Unit filename="..\..\src\OpenALSoundManager.h" /> <Unit filename="..\..\src\Opengate.h" /> - <Unit filename="..\..\src\Projectile.cpp" /> - <Unit filename="..\..\src\Projectile.h" /> <Unit filename="..\..\src\RadarObject.cpp" /> <Unit filename="..\..\src\RadarObject.h" /> <Unit filename="..\..\src\ResourceManager.cpp" /> Modified: trunk/win32/ogsectorclient/ogsectorclient.exe =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 18:00:22
|
Revision: 1072 http://opengate.svn.sourceforge.net/opengate/?rev=1072&view=rev Author: Ultrasick Date: 2009-02-22 18:00:16 +0000 (Sun, 22 Feb 2009) Log Message: ----------- the selected face number is now saved while entering the edit screen and coming back to the main overview screen enougth for today Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-22 17:52:45 UTC (rev 1071) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-22 18:00:16 UTC (rev 1072) @@ -19,8 +19,16 @@ parent.attach(text, 0, 1, 1, 2, xpadding = 3) text.show() + try: + window.face_number + + if window.face_number>(len(model['faces']) - 1): + window.face_number = 0 + except: + window.face_number = 0 + # create adjustment - adjustment = gtk.Adjustment(0, 0, len(model['faces']) - 1, 1, 10, 0) + adjustment = gtk.Adjustment(window.face_number, 0, len(model['faces']) - 1, 1, 10, 0) # show face selector self.face_selector = gtk.SpinButton(adjustment, 0.0, 0) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 17:52:49
|
Revision: 1071 http://opengate.svn.sourceforge.net/opengate/?rev=1071&view=rev Author: Ultrasick Date: 2009-02-22 17:52:45 +0000 (Sun, 22 Feb 2009) Log Message: ----------- added a button to exit the editing screen + moving files around Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/ branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/ branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/decrease_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_dashed.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_full.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_hide.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/increase_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_offset.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_zoom.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/change_size.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/view/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/ Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/decrease_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/decrease_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_dashed.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_dashed.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_full.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_full.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_hide.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition_-_hide.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/increase_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/increase_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_offset.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_offset.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_zoom.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset_zoom.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 17:41:54 UTC (rev 1070) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 17:52:45 UTC (rev 1071) @@ -175,7 +175,7 @@ # create the "exit screen" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/exit_screen.png') + image.set_from_file(path[0] + '/graphic/buttons/edit_the_face/exit_screen.png') # add the "exit screen" button self.bar.append_item('exit screen', 'exit the editing screen', none, image, screen.preview.exit_screen) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 17:41:54 UTC (rev 1070) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 17:52:45 UTC (rev 1071) @@ -232,14 +232,14 @@ # create the "decrease view" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/decrease_size.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/decrease_size.png') # add the "decrease view" button self.bar.append_item('decrease view', 'decrease the size of the 3 views', none, image, screen.views.set_size, -1) # create the "increase view" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/increase_size.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/increase_size.png') # add the "increase view" button self.bar.append_item('increase view', 'increase the size of the 3 views', none, image, screen.views.set_size, 1) @@ -249,21 +249,21 @@ # create the "zoom out" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/zoom_out.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_out.png') # add the "zoom out" button self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', none, image, screen.views.set_zoom, -1) # create the "zoom in" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/zoom_in.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/zoom_in.png') # add the "zoom in" button self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', none, image, screen.views.set_zoom, 1) # create the "reset zoom" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_zoom.png') # add the "reset zoom" button self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', none, image, screen.views.reset_zoom) @@ -273,35 +273,35 @@ # create the "move left" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/move_left.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_left.png') # add the "move left" button self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', none, image, screen.views.set_x_position, -1) # create the "move right" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/move_right.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_right.png') # add the "move right" button self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', none, image, screen.views.set_x_position, 1) # create the "move down" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/move_down.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_down.png') # add the "move down" button self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', none, image, screen.views.set_y_position, 1) # create the "move up" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/move_up.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/move_up.png') # add the "move up" button self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', none, image, screen.views.set_y_position, -1) # create the "reset offset" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/reset_offset.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/reset_offset.png') # add the "reset offset" button self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', none, image, screen.views.reset_offset) @@ -311,21 +311,21 @@ # create the "full covered" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_full.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_full.png') # add the "full covered" button self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', none, image, screen.views.set_edge_rendition, 'full') # create the "dash covered" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_dashed.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_dashed.png') # add the "dash covered" button self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', none, image, screen.views.set_edge_rendition, 'dashed') # create the "hide covered" icon image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_hide.png') + image.set_from_file(path[0] + '/graphic/buttons/view_the_model/edge_rendition_-_hide.png') # add the "hide covered" button self.bar.append_item('hide covered', 'don\'t draw the covered edges', none, image, screen.views.set_edge_rendition, 'hide') Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/edit_the_face/exit_screen.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/change_size.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/change_size.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/edge_rendition.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/reset.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view_the_model/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 17:42:03
|
Revision: 1070 http://opengate.svn.sourceforge.net/opengate/?rev=1070&view=rev Author: Ultrasick Date: 2009-02-22 17:41:54 +0000 (Sun, 22 Feb 2009) Log Message: ----------- removed a bad idea Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 17:17:29 UTC (rev 1069) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 17:41:54 UTC (rev 1070) @@ -40,20 +40,12 @@ # grab the face face = model['faces'][window.face_number] - # replace the vertice numbers of the face with the real vertices - for i, vertice_number in enumerate(face['vertices']): - face['vertices'][i] = model['vertices'][vertice_number] - # create an array for the base line base_line = {} # grab the edge of the base line base_line['edge'] = face['edges'][face['base line']] - # replace vertice numbers of the edge with the real vertices - base_line['edge'][0] = model['vertices'][base_line['edge'][0]] - base_line['edge'][1] = model['vertices'][base_line['edge'][1]] - # calculate distance between the 2 vertices of the base line base_line['length'] = screen.geometry.get_distance(base_line['edge'][0], base_line['edge'][1]) @@ -137,6 +129,9 @@ # draw the highlighted face drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) + def exit_screen(self, widget): + show_screen('project/canvas') + screen.preview = preview(table) class geometry: @@ -169,4 +164,20 @@ return [x, y, z] -screen.geometry = geometry() \ No newline at end of file +screen.geometry = geometry() + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + parent.attach(self.bar, 0, 1, 0, 1) + self.bar.show() + + # create the "exit screen" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/exit_screen.png') + + # add the "exit screen" button + self.bar.append_item('exit screen', 'exit the editing screen', none, image, screen.preview.exit_screen) + +tools(table) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 17:17:29 UTC (rev 1069) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 17:41:54 UTC (rev 1070) @@ -119,17 +119,13 @@ # draw the edges for edge in model['edges']: - # grab the vertices - first_vertice = model['vertices'][edge[0]] - second_vertice = model['vertices'][edge[1]] - # calculate the x position - position_x_start = int(round((first_vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position - position_x_end = int(round((second_vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position # calculate the y position - position_y_start = int(round((((first_vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position - position_y_end = int(round((((second_vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) @@ -138,10 +134,7 @@ highlight = [] # grab the coordinates for the highlighted face - for vertice_number in model['faces'][screen.faces.face_selector.get_value_as_int()]['vertices']: - # grab the real vertice - vertice = model['vertices'][vertice_number] - + for vertice in model['faces'][screen.faces.face_selector.get_value_as_int()]['vertices']: x = int(round((vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position y = int(round((((vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-22 17:17:29 UTC (rev 1069) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-22 17:41:54 UTC (rev 1070) @@ -126,11 +126,8 @@ if vertice not in model['vertices']: model['vertices'].append(vertice) - # get vertice number - vertice_number = model['vertices'].index(vertice) - # add the vertice number to the new face array - face_new.append(vertice_number) + face_new.append(vertice) # save the edges of the face edges = self.save_edges(face_new) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 17:17:37
|
Revision: 1069 http://opengate.svn.sourceforge.net/opengate/?rev=1069&view=rev Author: Ultrasick Date: 2009-02-22 17:17:29 +0000 (Sun, 22 Feb 2009) Log Message: ----------- silenced deprecation warnings Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-22 16:10:33 UTC (rev 1068) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-22 17:17:29 UTC (rev 1069) @@ -9,6 +9,7 @@ #from string import join #from string import replace #import urllib +from warnings import simplefilter as ignore_warnings class background_processes: def __init__(self): @@ -57,6 +58,8 @@ background_processes = background_processes() +ignore_warnings('ignore', DeprecationWarning) + def isfloat(number): legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 16:10:33 UTC (rev 1068) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 17:17:29 UTC (rev 1069) @@ -40,45 +40,50 @@ # grab the face face = model['faces'][window.face_number] + # replace the vertice numbers of the face with the real vertices + for i, vertice_number in enumerate(face['vertices']): + face['vertices'][i] = model['vertices'][vertice_number] + # create an array for the base line base_line = {} # grab the edge of the base line base_line['edge'] = face['edges'][face['base line']] - # grab the vertices of the base line - base_line['vertices'] = [model['vertices'][base_line['edge'][0]], model['vertices'][base_line['edge'][1]]] + # replace vertice numbers of the edge with the real vertices + base_line['edge'][0] = model['vertices'][base_line['edge'][0]] + base_line['edge'][1] = model['vertices'][base_line['edge'][1]] # calculate distance between the 2 vertices of the base line - base_line['length'] = screen.geometry.get_distance(base_line['vertices'][0], base_line['vertices'][1]) + base_line['length'] = screen.geometry.get_distance(base_line['edge'][0], base_line['edge'][1]) # calculate the normal vector of the base line - base_line['vector'] = screen.geometry.get_vector(base_line['vertices'][0], base_line['vertices'][1]) + base_line['vector'] = screen.geometry.get_vector(base_line['edge'][0], base_line['edge'][1]) # create a temporary array for the planes planes = [] for vertice in face['vertices']: + # create/reset the array for the plane + plane = {} + # create a plane with the normal vector of the base line and the offset of the vertice - plane = screen.geometry.get_plane(model['vertices'][vertice], base_line['vector']) + plane['parameters'] = screen.geometry.get_plane(vertice, base_line['vector']) # store the vertice in the plane - plane.append(model['vertices'][vertice]) + plane['vertice'] = vertice # store the plane in the planes array planes.append(plane) for plane in planes: # calculate lambda with the plane and the offset of the first vertice of the base line - plane.append(screen.geometry.get_lambda(model['vertices'][base_line['edge'][0]], plane)) + plane['lambda'] = screen.geometry.get_lambda(base_line['edge'][0], plane['parameters']) for plane in planes: # calculate the point of intersection - intersection = screen.geometry.get_vertice(model['vertices'][base_line['edge'][0]], base_line['vector'], plane[5]) + plane['intersection'] = screen.geometry.get_vertice(base_line['edge'][0], base_line['vector'], plane['lambda']) - # add the point of intersection to the plane - plane.append(intersection) - # create an array for the real positions on the preview image positions = [] @@ -87,10 +92,10 @@ position = [] # store the x-coordinate in the position array - position.append(plane[5] * base_line['length']) + position.append(plane['lambda'] * base_line['length']) # store the y-coordinate in the position array - position.append(screen.geometry.get_distance(plane[4], plane[6])) + position.append(screen.geometry.get_distance(plane['vertice'], plane['intersection'])) # store the position in the positions array positions.append(position) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 16:10:33 UTC (rev 1068) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 17:17:29 UTC (rev 1069) @@ -242,14 +242,14 @@ image.set_from_file(path[0] + '/graphic/buttons/view/decrease_size.png') # add the "decrease view" button - self.bar.append_item('decrease view', 'decrease the size of the 3 views', '', image, screen.views.set_size, -1) + self.bar.append_item('decrease view', 'decrease the size of the 3 views', none, image, screen.views.set_size, -1) # create the "increase view" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/increase_size.png') # add the "increase view" button - self.bar.append_item('increase view', 'increase the size of the 3 views', '', image, screen.views.set_size, 1) + self.bar.append_item('increase view', 'increase the size of the 3 views', none, image, screen.views.set_size, 1) # insert a spacer self.bar.append_space() @@ -259,21 +259,21 @@ image.set_from_file(path[0] + '/graphic/buttons/view/zoom_out.png') # add the "zoom out" button - self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', '', image, screen.views.set_zoom, -1) + self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', none, image, screen.views.set_zoom, -1) # create the "zoom in" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/zoom_in.png') # add the "zoom in" button - self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', '', image, screen.views.set_zoom, 1) + self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', none, image, screen.views.set_zoom, 1) # create the "reset zoom" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') # add the "reset zoom" button - self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', '', image, screen.views.reset_zoom) + self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', none, image, screen.views.reset_zoom) # insert a spacer self.bar.append_space() @@ -283,35 +283,35 @@ image.set_from_file(path[0] + '/graphic/buttons/view/move_left.png') # add the "move left" button - self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', '', image, screen.views.set_x_position, -1) + self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', none, image, screen.views.set_x_position, -1) # create the "move right" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_right.png') # add the "move right" button - self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', '', image, screen.views.set_x_position, 1) + self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', none, image, screen.views.set_x_position, 1) # create the "move down" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_down.png') # add the "move down" button - self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', '', image, screen.views.set_y_position, 1) + self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', none, image, screen.views.set_y_position, 1) # create the "move up" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_up.png') # add the "move up" button - self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', '', image, screen.views.set_y_position, -1) + self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', none, image, screen.views.set_y_position, -1) # create the "reset offset" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/reset_offset.png') # add the "reset offset" button - self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', '', image, screen.views.reset_offset) + self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', none, image, screen.views.reset_offset) # insert a spacer self.bar.append_space() @@ -321,20 +321,20 @@ image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_full.png') # add the "full covered" button - self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', '', image, screen.views.set_edge_rendition, 'full') + self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', none, image, screen.views.set_edge_rendition, 'full') # create the "dash covered" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_dashed.png') # add the "dash covered" button - self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', '', image, screen.views.set_edge_rendition, 'dashed') + self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', none, image, screen.views.set_edge_rendition, 'dashed') # create the "hide covered" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_hide.png') # add the "hide covered" button - self.bar.append_item('hide covered', 'don\'t draw the covered edges', '', image, screen.views.set_edge_rendition, 'hide') + self.bar.append_item('hide covered', 'don\'t draw the covered edges', none, image, screen.views.set_edge_rendition, 'hide') tools(table) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-22 16:10:45
|
Revision: 1068 http://opengate.svn.sourceforge.net/opengate/?rev=1068&view=rev Author: spom_spom Date: 2009-02-22 16:10:33 +0000 (Sun, 22 Feb 2009) Log Message: ----------- refacture metaserver connection, add/del/list gameserver, and -M option for client and server are up again. Modified Paths: -------------- trunk/src/metaserver.cpp trunk/src/metaserver.h trunk/src/opengateclient.cpp trunk/src/opengateserver.cpp Modified: trunk/src/metaserver.cpp =================================================================== --- trunk/src/metaserver.cpp 2009-02-22 14:20:34 UTC (rev 1067) +++ trunk/src/metaserver.cpp 2009-02-22 16:10:33 UTC (rev 1068) @@ -30,32 +30,10 @@ namespace OpenGate{ MetaConnection::MetaConnection( boost::asio::io_service & io_service, LogManagerBase & log ) : - io_service_( io_service ), socket_( io_service ), resolver_( io_service ), log_( &log ) { + io_service_( io_service ), socket_( io_service ), resolver_( io_service ), log_( &log ), isConnected_( true ) { - isConnected_ = true; - hostname_ = std::string( "opacma.ontheserver.de" ); - log_->info( std::string( "Querying " ) + hostname_); - -// asio::error error = asio::error::host_not_found; -// try{ -// tcp::resolver::query query( hostname_, "http" ); -// tcp::resolver::iterator endpoint_iterator = resolver_.resolve( query ); -// tcp::resolver::iterator end; - -// while ( error && endpoint_iterator != end ) { -// socket_.close(); -// socket_.connect( *endpoint_iterator++, asio::assign_error( error ) ); -// } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "resolving meta server: asio::error: " ) + e.what() ); -// isConnected_ = false; -// } catch ( std::exception & e) { -// log_->fatal( std::string( "resolving meta server: std::exception: " ) + e.what() ); -// isConnected_ = false; -// } catch (...) { -// log_->fatal( "resolving meta server: unkown exception occured" ); -// isConnected_ = false; -// } + hostname_ = std::string( "opacma.ontheserver.de" ); + initErrorMap_( ); } MetaConnection::~MetaConnection() { @@ -65,396 +43,185 @@ // asio doesn't need a cleanup, right? } +void MetaConnection::initErrorMap_( ) { + errorMap_.clear( ); + errorMap_ [ -101 ] = "neither get_name nor set_name given"; + errorMap_ [ -102 ] = "set_name given but set_value not given"; + errorMap_ [ -103 ] = "get_name given but unknown"; + errorMap_ [ -104 ] = "set_name given but unknown"; + errorMap_ [ -105 ] = "set_value given but not in allowed range"; + errorMap_ [ -106 ] = "The database is not available. This is an server internal error and can happen when the database application crashed. Usually everything will work again in a minute or 2."; + errorMap_ [ -1 ] = "Could not identify the user. For example no user_ip is given and the IP adress of the requestor is not loged in."; + errorMap_ [ -2 ] = "no username given"; + errorMap_ [ -3 ] = "no password given"; + errorMap_ [ -4 ] = "username doesn't exist"; + errorMap_ [ -5 ] = "password incorrect"; + errorMap_ [ -6 ] = "version given but it isn't the newest (the same version as set in the admin interface of the project website)"; + errorMap_ [ -7 ] = "Opengate does not need another game server right now."; + errorMap_ [ -8 ] = "There are no game servers online."; + errorMap_ [ -9 ] = "no faction_id given"; + errorMap_ [ -10 ] = "faction_id given but not in allowed range"; +} + int MetaConnection::login( const std::string & userName, const std::string & passwd ) { - if ( isConnected_ ) { - try { - boost::asio::streambuf response; - std::string parameters( "login&username=" + userName + "&password=" + passwd); - int retval = request(parameters, response); - if (retval < 0) { - return retval; - } - - // We got a usefull body. The body is an int, lets use it. - if (response.size() > 0) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given") ); return -3; - case -102: log_->warn ( std::string ("action given but unknown") ); return -3; - case -103: log_->warn ( std::string ("database is not available") ); return -3; - case -8: log_->warn ( std::string ("no username given") ); return -3; - case -9: log_->warn ( std::string ("no password given") ); return -3; - case -10: log_->warn ( std::string ("username doesn't exist") ); return -3; - case -11: log_->warn ( std::string ("password incorrect") ); return -3; - default: - if (returncode > 0) { - return returncode; - } else { - log_->warn ( std::string ("unkown return code for") + parameters + toStr( returncode ) ); - return -4; - } - } - } else { - log_->fatal( std::string( "meta server login: we got no response " ) ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server login: asio::error: " ) + e.what() ); -// return -5; - } catch ( std::exception & e) { - log_->fatal( std::string( "meta server login: std::exception: " ) + e.what() ); - return -5; - } catch (...) { - log_->fatal( "meta server login: unkown exception occured" ); - return -5; - } - return 1; - } - return META_NOT_CONNECTED; + //!** not yet working + std::ostringstream stream; + int retval = getResponse_( "login&username=" + userName + "&password=" + passwd, stream ); + return retval; } int MetaConnection::check_version( Uint32 user_id ) { - if ( isConnected_ ) { - - try { - boost::asio::streambuf response; - std::string parameters("check_version&version=" + std::string(PACKAGE_VERSION) + "&user_id=" + toStr(user_id)); - int retval = request(parameters, response); - if (retval < 0) { - return retval; - } - - // We got a usefull body. The body is an int, lets use it. - if (response.size() > 0) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given") ); return -3; - case -102: log_->warn ( std::string ("action given but unknown") ); return -3; - case -103: log_->warn ( std::string ("database is not available") ); return -3; - case -1: log_->warn ( std::string ("no user_id given") ); return -3; - case -3: log_->warn ( std::string ("user_id doesn't exist") ); return -3; - case -6: log_->warn ( std::string ("no version given") ); return -3; - case -7: log_->warn ( std::string ("version given but it isn't the newest (the same version as set in the admin interface of the project website)") ); return -3; - default: - if (returncode > 0) { - return returncode; - } else { - log_->warn ( std::string ("unkown return code for") + parameters + toStr( returncode ) ); - return -4; - } - } - } else { - log_->fatal( std::string( "meta server check_version: we got no response " ) ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server check_version: asio::error: " ) + e.what() ); -// return -5; - } catch ( std::exception & e) { - log_->fatal( std::string( "meta server check_version: std::exception: " ) + e.what() ); - return -5; - } catch (...) { - log_->fatal( "meta server check_version: unkown exception occured" ); - return -5; - } - return 1; - } - return META_NOT_CONNECTED; + //!** not yet working + std::ostringstream stream; + int retval = getResponse_( "check_version&version=" + std::string(PACKAGE_VERSION) + "&user_id=" + toStr(user_id), stream ); + return retval; } int MetaConnection::logout( Uint32 user_id ) { - if ( isConnected_ ) { - - try { - - boost::asio::streambuf response; - std::string parameters( "logout&user_id=" + toStr(user_id) + "&user_ip=" + "123.123.123.123"); // FIXME: determine IP or think of other way to handle this - int retval = request(parameters, response); - if (retval < 0) { - return retval; - } - - // We got a usefull body. The body is an int, lets use it. - if (response.size() > 0) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given") ); return -3; - case -102: log_->warn ( std::string ("action given but unknown") ); return -3; - case -103: log_->warn ( std::string ("database is not available") ); return -3; - case -1: log_->warn ( std::string ("no user_id given") ); return -3; - case -2: log_->warn ( std::string ("no user_ip given") ); return -3; - case -3: log_->warn ( std::string ("user_id doesn't exist") ); return -3; - case -4: log_->warn ( std::string ("user_ip incorrect") ); return -3; - case -5: log_->warn ( std::string ("user was already offline") ); return 1; - default: - if (returncode > 0) { - return returncode; - } - log_->warn ( std::string ("unkown return code for") + parameters + toStr( returncode ) ); - return -4; - } - } else { - log_->fatal( std::string( "meta server logout: we got no response " ) ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server logout: asio::error: " ) + e.what() ); -// return -5; - } catch ( std::exception & e) { - log_->fatal( std::string( "meta server logout: std::exception: " ) + e.what() ); - return -5; - } catch (...) { - log_->fatal( "meta server logout: unkown exception occured" ); - return -5; - } - return 1; - } - return META_NOT_CONNECTED; + //!** not yet working + std::ostringstream stream; + int retval = getResponse_( "logout&user_id=" + toStr(user_id) + "&user_ip=" + "123.123.123.123", stream ); + return retval; } -int MetaConnection::add_game_server( const std::string & servername ) { - if ( isConnected_ ) { - - try { - boost::asio::streambuf response; - std::string parameters( "add_game_server" ); +int MetaConnection::add_game_server() { + std::ostringstream stream; + int retval = getResponse_( "set_name=game_server_session&set_value=1", stream ); + return retval; +} - if ( servername.length() > 0 ) parameters += "&comment="+strReplaceBlankWithUnderscore(servername); -// tempor\xE4r: Serverbeschreibung solange hin und wieder mehr als ein Server vom meta weitergereicht wird -// kay, max 256 zeichen, gameserver einf\xFCgen mit opacma.ontheserver.de/script/schnittstelle/?action=add_game_server&comment=blablabla -// http://opacma.ontheserver.de/script/schnittstelle/?action=list_game_servers -// ausgabeformat ist -// reset($IPs); -// while(current($IPs)){ -// $Output .= current($IPs) . ',' . $Kommentare[current($IPs)] . ';'; -// next($IPs); -// } +int MetaConnection::remove_game_server() { + std::ostringstream stream; + int retval = getResponse_( "set_name=game_server_session&set_value=0", stream ); + return retval; +} - int retval = request( parameters, response ); - if ( retval < 0 ) { - return retval; - } - - // We got a usefull body. The body is an int, lets use it. - if ( response.size() > 0 ) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given") ); return -3; - case -102: log_->warn ( std::string ("action given but unknown") ); return -3; - case -103: log_->warn ( std::string ("database is not available") ); return -3; - case -12: log_->warn ( std::string ("no additional server possible") ); return -3; - case -13: log_->warn ( std::string ("ip is already a server") ); return -3; - default: - if (returncode > 0) { - return returncode; - } else { - log_->warn ( std::string ("unkown return code for ") + parameters + toStr( returncode ) ); - return -4; - } - } - } else { - log_->fatal( std::string( "meta server add game server: we got no response " ) ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server add game server: asio::error: " ) + e.what() ); -// return -5; - } catch ( std::exception & e) { - log_->fatal( std::string( "meta server add game server: std::exception: " ) + e.what() ); - return -5; - } catch (...) { - log_->fatal( "meta server add game server: unkown exception occured" ); - return -5; +int MetaConnection::list_game_servers( std::vector< std::string > & serverList ) { + std::ostringstream stream; + int retval = getResponse_( "get_name=game_server_ips", stream ); + if ( retval > 0 ){ + split( stream.str(), ";", serverList ); } - return 1; - } - return 1; + return retval; } -std::list< std::pair < std::string, std::string > > MetaConnection::list_game_servers() { - std::list< std::pair < std::string, std::string > > mylist; - if ( isConnected_ ) { +int MetaConnection::getResponse_( const std::string & parameters, std::ostringstream & stream ) { try { - boost::asio::streambuf response; - std::string parameters( "list_game_servers" ); - int retval = request(parameters, response); - if ( retval < 0 ) { - return mylist; - } - - // We got a usefull body. The body is an int, lets use it. - if ( response.size() > 0 ) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given -101") ); return mylist; - case -102: log_->warn ( std::string ("action given but unknown -102") ); return mylist; - case -103: log_->warn ( std::string ("database is not available -103") ); return mylist; - case -15: log_->warn ( std::string ("no game server available -15") ); return mylist; - default: - if ( stream.str().length() > 5 ) { + boost::asio::streambuf response; + int retval = request_( parameters, response ); + if ( retval < 0 ) { + return retval; + } + //!** We got a usefull body. The body is an int, lets use it. + if ( response.size() > 0 ) { + stream << &response; + int returncode = toInt( stream.str() ); + if ( returncode > 0 ) { + return returncode; + } - std::vector < std::string > serverlist; - split( stream.str(), ";", serverlist ); - for ( size_t i = 0; i < serverlist.size(); i ++ ){ - std::vector < std::string > server; - split( serverlist[ i ], ",", server ); - if ( server.size() == 1 ) mylist.push_back( std::pair < std::string, std::string >( server[ 0 ], "" ) ); - if ( server.size() == 2 ) mylist.push_back( std::pair < std::string, std::string >( server[ 0 ], server[ 1 ] ) ); - } - - } else { - log_->warn ( std::string ("unkown return code for ") + parameters + toStr( returncode ) ); - return mylist; - } - } - } else { - log_->fatal( std::string( "meta server list game server: we got no response " ) ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server list game server: asio::error: " ) + e.what() ); -// return mylist; + if ( errorMap_.count( returncode ) ){ + log_->warn ( parameters + ": " + errorMap_[ returncode ] + toStr( returncode ) ); + return -3; + } else { + log_->warn ( parameters + ": unkown return code for " + toStr( returncode ) ); + return -4; + } + } else { + log_->fatal( std::string( "meta server add game server: we got no response " ) ); + } } catch ( std::exception & e) { log_->fatal( std::string( "meta server list game server: std::exception: " ) + e.what() ); - return mylist; + return -5; } catch (...) { log_->fatal( "meta server list game server: unkown exception occured" ); - return mylist; - } - return mylist; - } - return mylist; -} - -int MetaConnection::remove_game_server() { - if ( isConnected_ ) { - - try { - boost::asio::streambuf response; - std::string parameters( "remove_game_server" ); - int retval = request(parameters, response); - if (retval < 0) { - return retval; - } - - // We got a usefull body. The body is an int, lets use it. - if (response.size() > 0) { - std::ostringstream stream; - stream << &response; - int returncode = toInt( stream.str() ); - switch (returncode) { - case -101: log_->warn ( std::string ("no action given") ); return -3; - case -102: log_->warn ( std::string ("action given but unknown") ); return -3; - case -103: log_->warn ( std::string ("database is not available") ); return -3; - case -14: log_->warn ( std::string ("ip was not a server") ); return -3; - default: - if (returncode > 0) { - return returncode; - } else { - log_->warn ( std::string ("unkown return code for ") + parameters + toStr( returncode ) ); - return -4; - } - } - } else { - log_->fatal( std::string( "meta server remove game server: we got no response " ) ); - } - -// } catch ( asio::error & e) { -// log_->fatal( std::string( "meta server remove game server: asio::error: " ) + e.what() ); -// return -5; - } catch ( std::exception & e) { - log_->fatal( std::string( "meta server remove game server: std::exception: " ) + e.what() ); return -5; - } catch (...) { - log_->fatal( "meta server remove game server: unkown exception occured" ); - return -5; } return 1; - } - return 1; } + +int MetaConnection::request_( const std::string & parameters, boost::asio::streambuf & response ) { + // Form the request. We specify the "Connection: close" header so that the + // server will close the socket after transmitting the response. This will + // allow us to treat all data up until the EOF as the content. + if ( isConnected_ ){ + boost::system::error_code error = boost::asio::error::host_not_found; + try{ + tcp::resolver::query query( hostname_, "http" ); + tcp::resolver::iterator endpoint_iterator = resolver_.resolve( query ); + tcp::resolver::iterator end; -int MetaConnection::request( const std::string & parameters, boost::asio::streambuf & response ) { - // Form the request. We specify the "Connection: close" header so that the - // server will close the socket after transmitting the response. This will - // allow us to treat all data up until the EOF as the content. - boost::system::error_code error = boost::asio::error::host_not_found; - try{ - tcp::resolver::query query( hostname_, "http" ); - tcp::resolver::iterator endpoint_iterator = resolver_.resolve( query ); - tcp::resolver::iterator end; + while ( error && endpoint_iterator != end ) { + socket_.close(); + socket_.connect( *endpoint_iterator++, error ); + } +// } catch ( asio::error & e) { +// log_->fatal( std::string( "resolving meta server: asio::error: " ) + e.message() ); +// isConnected_ = false; +// return META_NOT_CONNECTED; + } catch ( std::exception & e) { + log_->fatal( std::string( "resolving meta server: std::exception: " ) + e.what() ); + log_->fatal( std::string( "resolving meta server: asie::eror: " ) + error.message() ); + isConnected_ = false; + return META_NOT_CONNECTED; + } catch (...) { + log_->fatal( "resolving meta server: unkown exception occured" ); + isConnected_ = false; + return META_NOT_CONNECTED; + } - while ( error && endpoint_iterator != end ) { - socket_.close(); - socket_.connect( *endpoint_iterator++, error ); - } -// } catch ( asio::error & e) { -// log_->fatal( std::string( "resolving meta server: asio::error: " ) + e.what() ); -// isConnected_ = false; - } catch ( std::exception & e) { - log_->fatal( std::string( "resolving meta server: std::exception: " ) + e.what() ); - isConnected_ = false; - } catch (...) { - log_->fatal( "resolving meta server: unkown exception occured" ); - isConnected_ = false; - } - - boost::asio::streambuf request; - std::ostream request_stream(&request); - request_stream << "GET " << "/script/schnittstelle/?action=" << parameters << " HTTP/1.0\r\n"; - request_stream << "Host: " << hostname_ << "\r\n"; - request_stream << "Accept: */*\r\n"; - request_stream << "Connection: close\r\n\r\n"; + boost::asio::streambuf request; + std::ostream request_stream(&request); + request_stream << "GET " << "/script/schnittstelle/?" << parameters << " HTTP/1.0\r\n"; + request_stream << "Host: " << hostname_ << "\r\n"; + request_stream << "Accept: */*\r\n"; + request_stream << "Connection: close\r\n\r\n"; - // Send the request. - boost::asio::write( socket_, request ); + // Send the request. + boost::asio::write( socket_, request ); - // Read the response status line. - boost::asio::read_until( socket_, response, boost::regex("\r\n") ); + // Read the response status line. + boost::asio::read_until( socket_, response, boost::regex("\r\n") ); - // Check that response is OK. - std::istream response_stream( &response ); - std::string http_version; - response_stream >> http_version; - unsigned int status_code; - response_stream >> status_code; - std::string status_message; + // Check that response is OK. + std::istream response_stream( &response ); + std::string http_version; + response_stream >> http_version; + unsigned int status_code; + response_stream >> status_code; + std::string status_message; - std::getline(response_stream, status_message); - if ( !response_stream || http_version.substr(0, 5) != "HTTP/" ) { - log_->fatal( "Metaserver: invalid response" ); - return -51; - } - if ( status_code != 200 ) { - log_->fatal( "Metaserver: response returned with status code " + toStr( status_code ) ); - return -52; - } + std::getline(response_stream, status_message); + if ( !response_stream || http_version.substr(0, 5) != "HTTP/" ) { + log_->fatal( "Metaserver: invalid response" ); + return -51; + } + if ( status_code != 200 ) { + log_->fatal( "Metaserver: response returned with status code " + toStr( status_code ) ); + return -52; + } - boost::asio::read_until( socket_, response, boost::regex( "\r\n\r\n" ) ); + boost::asio::read_until( socket_, response, boost::regex( "\r\n\r\n" ) ); - // Process the response headers. (to get the crap of the response before reading the body!) - std::string header; - // std::cout << "header: " << std::endl; - while ( std::getline(response_stream, header) && header != "\r"){ - // std::cout << header << std::endl; - } + // Process the response headers. (to get the crap of the response before reading the body!) + std::string header; + // std::cout << "header: " << std::endl; + while ( std::getline(response_stream, header) && header != "\r"){ + // std::cout << header << std::endl; + } - error = boost::asio::error::eof; - // Read until EOF, writing data to output as we go. - // std::cout << "response: " <<std::endl; - while ( boost::asio::read( socket_, response, boost::asio::transfer_at_least( 1 ), error ) ){ - // std::cout << &response << std::endl; - } + error = boost::asio::error::eof; + // Read until EOF, writing data to output as we go. + // std::cout << "response: " <<std::endl; + while ( boost::asio::read( socket_, response, boost::asio::transfer_at_least( 1 ), error ) ){ + // std::cout << &response << std::endl; + } - if ( error != boost::asio::error::eof ) throw error; - - socket_.close(); - return 1; + if ( error != boost::asio::error::eof ) throw error; + socket_.close(); + return 1; + } + return META_NOT_CONNECTED; } } // namespace OpenGate Modified: trunk/src/metaserver.h =================================================================== --- trunk/src/metaserver.h 2009-02-22 14:20:34 UTC (rev 1067) +++ trunk/src/metaserver.h 2009-02-22 16:10:33 UTC (rev 1068) @@ -34,25 +34,23 @@ class MetaConnection { public: - MetaConnection( boost::asio::io_service & io_service, LogManagerBase & log); - ~MetaConnection(); + MetaConnection( boost::asio::io_service & io_service, LogManagerBase & log); + ~MetaConnection(); - int login( const std::string & userName, const std::string & passwd = "" ); - int check_version( Uint32 user_id ); - int logout( Uint32 user_id ); + int login( const std::string & userName, const std::string & passwd = "" ); + int check_version( Uint32 user_id ); + int logout( Uint32 user_id ); + int add_game_server(); + int remove_game_server(); + int list_game_servers( std::vector< std::string > & serverList ); + + bool isConnected() const { return isConnected_; } - //** register the current ip to the metaserver, you can specify a symbolic name - int add_game_server( const std::string & servername = ""); - - std::list< std::pair < std::string, std::string > > list_game_servers(); - - int remove_game_server(); - - bool isConnected() const { return isConnected_; } - private: - int request( const std::string & parameters, boost::asio::streambuf & response ); - + int getResponse_( const std::string & parameters, std::ostringstream & stream ); + int request_( const std::string & parameters, boost::asio::streambuf & response ); + void initErrorMap_( ); + boost::asio::io_service & io_service_; tcp::socket socket_; tcp::resolver resolver_; @@ -61,6 +59,8 @@ std::string hostname_; std::string servername_; bool isConnected_; + + std::map < int, std::string > errorMap_; }; Modified: trunk/src/opengateclient.cpp =================================================================== --- trunk/src/opengateclient.cpp 2009-02-22 14:20:34 UTC (rev 1067) +++ trunk/src/opengateclient.cpp 2009-02-22 16:10:33 UTC (rev 1068) @@ -160,13 +160,14 @@ // }; log->info( std::string( "Request game servers from meta server: " ) ); - std::list< std::pair < std::string, std::string > > serverOnline( meta.list_game_servers() ); - for ( std::list< std::pair < std::string, std::string > >::iterator it = serverOnline.begin(); it != serverOnline.end(); it ++ ){ - log->info( it->second + ": " + it->first ); + std::vector< std::string > serverOnline; + meta.list_game_servers( serverOnline ); + for ( std::vector< std::string >::iterator it = serverOnline.begin(); it != serverOnline.end(); it ++ ){ + log->info( *it ); } if ( serverOnline.size() > 0 ){ log->info( std::string( "choosing the first for connection." ) ); - hostname = serverOnline.begin()->first; + hostname = *serverOnline.begin(); } } Modified: trunk/src/opengateserver.cpp =================================================================== --- trunk/src/opengateserver.cpp 2009-02-22 14:20:34 UTC (rev 1067) +++ trunk/src/opengateserver.cpp 2009-02-22 16:10:33 UTC (rev 1068) @@ -25,7 +25,7 @@ #include <iostream> #include <string> #include <signal.h> - +#include <getopt.h> #include "common.h" #include "networkServer.h" #include "LogManagerBase.h" @@ -61,32 +61,79 @@ } void signal_term( int singal ) { - logMgr->info("SIG_TERM received... exiting!"); - server_shutdown(); - exit( 0 ); + logMgr->info("SIG_TERM received... exiting!"); + server_shutdown(); + exit( 0 ); } void signal_interrupt( int singal ) { - logMgr->info("SIG_INT received... exiting!"); - server_shutdown(); - exit( 0 ); + logMgr->info("SIG_INT received... exiting!"); + server_shutdown(); + exit( 0 ); } int main( int argc, char *argv[] ) { - logMgr = new LogManagerBase( ); - logMgr->setLogFile( "OGserver.log" ); - logMgr->setChatLogFile( "OGserverChat.log" ); - logMgr->info( std::string("Starting up server ") + PACKAGE_STRING ); + logMgr = new LogManagerBase( ); + logMgr->setLogFile( "OGserver.log" ); + logMgr->setChatLogFile( "OGserverChat.log" ); + logMgr->info( std::string("Starting up server ") + PACKAGE_STRING ); - signal( SIGTERM, signal_term ); - signal( SIGINT, signal_interrupt ); + signal( SIGTERM, signal_term ); + signal( SIGINT, signal_interrupt ); - //** ein bissle mehr verbose output, kommt sp\xE4ter wieder weg.; - //** das k\xF6nnte mal vielleicht als option rausreichen, das man wie beim clienten die Wahl hat; - //** -M = (withMetaServer = true); - bool withMetaServer = false; - std::string servername( "testserver Sim 1" ); + int withMetaServer = 0; + while ( 1 ) { + static struct option long_options[] = { + //!** These options set a flag. + {"help", no_argument, 0, 'h'}, + {"verbose", no_argument, 0, 'v'}, + {"Metaserver", no_argument, &withMetaServer, 1}, + {0, 0, 0, 0} + }; + + //!* getopt_long stores the option index here. + int option_index = 0; + int c = getopt_long (argc, argv, "hvM", long_options, &option_index); + + if ( c == -1 ) break; + + switch ( c ) { + case 0: // If this option set a flag, do nothing else now + if ( long_options[option_index].flag != 0 ) break; + + printf ("option %s", long_options[option_index].name); + if ( optarg ) printf (" with arg %s", optarg); + printf ("\n"); + break; + case 'M': withMetaServer = true; break; + case 'h': +#ifdef PACKAGE_NAME + std::cout << PACKAGE_NAME << std::endl; +#endif + std::cout << std::endl << "Usage instructions" << std::endl; + std::cout << " -h --help Show this information" << std::endl; + std::cout << " -v --verbose Show more verbose output" << std::endl; + std::cout << " -M --with-metaserver Connect to metaserver" << std::endl; + delete logMgr; + return EXIT_SUCCESS; + case 'v': +#ifdef PACKAGE_STRING + logMgr->info ( std::string (PACKAGE_STRING) ); +#endif + case '?': + // getopt_long already printed an error message. + break; + default: + printf ("option %s", long_options[option_index].name); + if ( optarg ) printf (" with arg %s", optarg); + printf ("\n"); + break; + abort(); + } + } + + std::string servername( "testserver Sim 1" ); try { boost::asio::io_service io_service; io_servicePtr = &io_service; @@ -95,16 +142,17 @@ metaPtr = new OpenGate::MetaConnection( io_service, *logMgr ); int error = 0; - if ( ( error = metaPtr->add_game_server( servername ) ) < 0 ) { + if ( ( error = metaPtr->add_game_server( ) ) < 0 ) { logMgr->warn( std::string( "Could not add game server " + toStr ( error ) ) ); } else { logMgr->info( std::string( "server added to meta server " ) ); } logMgr->info( std::string( "Request game servers from meta server: " ) ); - std::list< std::pair < std::string, std::string > > serverOnline( metaPtr->list_game_servers() ); - for ( std::list< std::pair < std::string, std::string > >::iterator it = serverOnline.begin(); it != serverOnline.end(); it ++ ){ - logMgr->info( it->second + ": " + it->first ); + std::vector< std::string > serverOnline; + metaPtr->list_game_servers( serverOnline ); + for ( std::vector< std::string >::iterator it = serverOnline.begin(); it != serverOnline.end(); it ++ ){ + logMgr->info( *it ); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 14:20:45
|
Revision: 1067 http://opengate.svn.sourceforge.net/opengate/?rev=1067&view=rev Author: Ultrasick Date: 2009-02-22 14:20:34 +0000 (Sun, 22 Feb 2009) Log Message: ----------- adding status "done" and "to do", no changes in the content Modified Paths: -------------- doc/milestones.txt Modified: doc/milestones.txt =================================================================== --- doc/milestones.txt 2009-02-22 14:15:08 UTC (rev 1066) +++ doc/milestones.txt 2009-02-22 14:20:34 UTC (rev 1067) @@ -1,35 +1,35 @@ 0.0.1 (initiale alpha) ---------------------- -gui: - market dialog - equipment kaufen (ohne Metaserverkommunikation und ohne zu bezahlen) - config dialog - keymap - login dialog - inkl Metaserverkommunikation +gui: - - - - - - - - - - - - - - - - - - [TO DO] + market dialog - - - - - - - - - - - - - - - [TO DO] + equipment kaufen (ohne Metaserverkommunikation und ohne zu bezahlen) [TO DO] + config dialog - - - - - - - - - - - - - - - [TO DO] + keymap - - - - - - - - - - - - - - - - [TO DO] + login dialog - - - - - - - - - - - - - - - [TO DO] + inkl Metaserverkommunikation - - - - - - - - - - [TO DO] -undocked: - starten - docken - fliegen - schiessen - getroffen werden - kaputt gehen - Kollision - station - Sterne - funktionsf\xE4higes Radar +undocked: - - - - - - - - - - - - - - - - - [TO DO] + starten - - - - - - - - - - - - - - - - - [TO DO] + docken - - - - - - - - - - - - - - - - - [TO DO] + fliegen - - - - - - - - - - - - - - - - - [TO DO] + schiessen - - - - - - - - - - - - - - - - [TO DO] + getroffen werden - - - - - - - - - - - - - - [TO DO] + kaputt gehen - - - - - - - - - - - - - - - [TO DO] + Kollision - - - - - - - - - - - - - - - - [TO DO] + station - - - - - - - - - - - - - - - - - [TO DO] + Sterne - - - - - - - - - - - - - - - - - [TO DO] + funktionsf\xE4higes Radar - - - - - - - - - - - - - [TO DO] -Metaserver: - Login +Metaserver: - - - - - - - - - - - - - - - - - [done] + Login - - - - - - - -- - - - - - - - - [done] -Gameserver: - funktionsf\xE4higer/einfachster multiplayer +Gameserver: - - - - - - - - - - - - - - - - - [TO DO] + funktionsf\xE4higer/einfachster multiplayer - - - - - - - - [TO DO] -content: - Lady Kickstart als Startschiff - startequipment 1 Waffe + 1 Rakete - Texturen der Lady in eine Datei oder eine clevere Alternative +content: - - - - - - - - - - - - - - - - - [TO DO] + Lady Kickstart als Startschiff - - - - - - - - - - - [TO DO] + startequipment 1 Waffe + 1 Rakete - - - - - - - - - - [TO DO] + Texturen der Lady in eine Datei oder eine clevere Alternative - - - [TO DO] -tests: - mehr als 1 Spieler \xFCber einen etwas l\xE4ngeren Zeitraum ohne ctd im Flug \ No newline at end of file +tests: - - - - - - - - - - - - - - - - - - [TO DO] + mehr als 1 Spieler \xFCber einen etwas l\xE4ngeren Zeitraum ohne ctd im Flug - [TO DO] \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-22 14:15:12
|
Revision: 1066 http://opengate.svn.sourceforge.net/opengate/?rev=1066&view=rev Author: Ultrasick Date: 2009-02-22 14:15:08 +0000 (Sun, 22 Feb 2009) Log Message: ----------- the editor can now show a single face (which is meant to be painted later) there are still a few bugs which mirror faces on the axes Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -21,7 +21,7 @@ # show global widgets execfile(path[0] + '/scripts/screens/global/index.py') -def show_screen(screen_name, show_loading_screen = false): +def show_screen(screen_name, action = 'default'): # set screen container global global screen Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -1,6 +1,7 @@ # -*- coding: cp1252 -*- import gobject +from math import sqrt #from os import listdir #from os import path as check #from os import system Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -8,6 +8,7 @@ # define different colors colors = {} colors['black'] = gtk.gdk.color_parse('#000000') +colors['pink'] = gtk.gdk.color_parse('#FF00FF') colors['red'] = gtk.gdk.color_parse('#FF0000') colors['white'] = gtk.gdk.color_parse('#FFFFFF') Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -0,0 +1,167 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('edit the face:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class preview: + def __init__(self, parent): + # show preview image + self.preview = gtk.DrawingArea() + self.preview.set_size_request(view_size * 2, view_size * 2) + parent.attach(self.preview, 0, 1, 1, 2) + self.preview.show() + + # set autoredraw + self.preview.connect('expose_event', self.redraw) + + # define the colors + self.preview.window.colors = {} + + for color_name, color_content in colors.items(): + self.preview.window.colors[color_name] = self.preview.window.new_gc(foreground = self.preview.window.get_colormap().alloc_color(color_content)) + + def redraw(self, widget, event): + # add the drawing to the background processes + background_processes.add('drawing the preview image', self.draw) + + def draw(self): + # select the right object as the drawing area + drawing_area = self.preview.window + + # grab the face + face = model['faces'][window.face_number] + + # create an array for the base line + base_line = {} + + # grab the edge of the base line + base_line['edge'] = face['edges'][face['base line']] + + # grab the vertices of the base line + base_line['vertices'] = [model['vertices'][base_line['edge'][0]], model['vertices'][base_line['edge'][1]]] + + # calculate distance between the 2 vertices of the base line + base_line['length'] = screen.geometry.get_distance(base_line['vertices'][0], base_line['vertices'][1]) + + # calculate the normal vector of the base line + base_line['vector'] = screen.geometry.get_vector(base_line['vertices'][0], base_line['vertices'][1]) + + # create a temporary array for the planes + planes = [] + + for vertice in face['vertices']: + # create a plane with the normal vector of the base line and the offset of the vertice + plane = screen.geometry.get_plane(model['vertices'][vertice], base_line['vector']) + + # store the vertice in the plane + plane.append(model['vertices'][vertice]) + + # store the plane in the planes array + planes.append(plane) + + for plane in planes: + # calculate lambda with the plane and the offset of the first vertice of the base line + plane.append(screen.geometry.get_lambda(model['vertices'][base_line['edge'][0]], plane)) + + for plane in planes: + # calculate the point of intersection + intersection = screen.geometry.get_vertice(model['vertices'][base_line['edge'][0]], base_line['vector'], plane[5]) + + # add the point of intersection to the plane + plane.append(intersection) + + # create an array for the real positions on the preview image + positions = [] + + for plane in planes: + # create/reset the array for the real position of the vertice on the preview image + position = [] + + # store the x-coordinate in the position array + position.append(plane[5] * base_line['length']) + + # store the y-coordinate in the position array + position.append(screen.geometry.get_distance(plane[4], plane[6])) + + # store the position in the positions array + positions.append(position) + + # create arrays for the coordinates + x = [] + y = [] + + # get the coordinates + for position in positions: + x.append(position[0]) + y.append(position[1]) + + # calculate lengths + x_length = max(x) - min(x) + y_length = max(y) - min(y) + max_length = max(x_length, y_length) + + # calculate the center for the x-axis + axis_x_center = view_size * 2 + axis_x_center -= (x_length/max_length) * ((view_size * 2) - 10) + axis_x_center /= 2 + axis_x_center -= (min(x)/max_length) * ((view_size * 2) - 10) + + # calculate the center for the y-axis + axis_y_center = view_size * 2 + axis_y_center -= (y_length/max_length) * ((view_size * 2) - 10) + axis_y_center /= 2 + axis_y_center -= (min(y)/max_length) * ((view_size * 2) - 10) + + # calculate the real coordinates for the polygon + for i, position in enumerate(positions): + x = int(round((position[0]/max_length) * ((view_size * 2) - 10) + axis_x_center)) + y = int(round((position[1]/max_length) * ((view_size * 2) - 10) + axis_y_center)) + + # add the coordinates to the positions array + positions[i] = (x, y) + + # draw the highlighted face + drawing_area.draw_polygon(drawing_area.colors['pink'], false, positions) + +screen.preview = preview(table) + +class geometry: + def get_distance(self, vertice_1, vertice_2): + return sqrt((vertice_1[0] - vertice_2[0]) ** 2 + (vertice_1[1] - vertice_2[1]) ** 2 + (vertice_1[2] - vertice_2[2]) ** 2) + + def get_vector(self, vertice_1, vertice_2): + x = vertice_2[0] - vertice_1[0] + y = vertice_2[1] - vertice_1[1] + z = vertice_2[2] - vertice_1[2] + + return [x, y, z] + + def get_plane(self, vertice, vector): + a = vector[0] + b = vector[1] + c = vector[2] + + d = (vertice[0] * vector[0]) + (vertice[1] * vector[1]) + (vertice[2] * vector[2]) + + return [a, b, c, d] + + def get_lambda(self, vertice, plane): + return ((plane[3] - plane[0]*vertice[0] - plane[1]*vertice[1] - plane[2]*vertice[2])/(plane[0]**2 + plane[1]**2 + plane[2]**2)) + + def get_vertice(self, offset, vector, Lambda): + x = offset[0] + vector[0] * Lambda + y = offset[1] + vector[1] * Lambda + z = offset[2] + vector[2] * Lambda + + return [x, y, z] + +screen.geometry = geometry() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/edit_the_face.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -48,8 +48,12 @@ return edges def edit(self, widget): - pass + # store the face number + window.face_number = self.face_selector.get_value_as_int() + # load the editing screen + show_screen('project/canvas', 'edit the face') + screen.faces = faces(table) class tools: Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -119,13 +119,17 @@ # draw the edges for edge in model['edges']: + # grab the vertices + first_vertice = model['vertices'][edge[0]] + second_vertice = model['vertices'][edge[1]] + # calculate the x position - position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position - position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_start = int(round((first_vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_end = int(round((second_vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position # calculate the y position - position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position - position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_start = int(round((((first_vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_end = int(round((((second_vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) @@ -134,7 +138,10 @@ highlight = [] # grab the coordinates for the highlighted face - for vertice in model['faces'][screen.faces.face_selector.get_value_as_int()]: + for vertice_number in model['faces'][screen.faces.face_selector.get_value_as_int()]['vertices']: + # grab the real vertice + vertice = model['vertices'][vertice_number] + x = int(round((vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position y = int(round((((vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -5,8 +5,12 @@ screen.add(screen.frame_table) screen.frame_table.show() -# load frame: "view the model:" -execfile(path[0] + '/scripts/screens/project/canvas/frames/view_the_model.py') +if action=='default': + # load frame: "view the model:" + execfile(path[0] + '/scripts/screens/project/canvas/frames/view_the_model.py') -# load frame: "faces:" -execfile(path[0] + '/scripts/screens/project/canvas/frames/faces.py') \ No newline at end of file + # load frame: "faces:" + execfile(path[0] + '/scripts/screens/project/canvas/frames/faces.py') +elif action=='edit the face': + # load frame: "edit the face:" + execfile(path[0] + '/scripts/screens/project/canvas/frames/edit_the_face.py') \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-22 14:02:00 UTC (rev 1065) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-22 14:15:08 UTC (rev 1066) @@ -68,9 +68,6 @@ # create a new array for the model model = {} - # create a new array for the faces - model['faces'] = [] - # create new arrays for the dimensions model['dimensions'] = {} model['dimensions'][0] = {} # x @@ -92,6 +89,12 @@ # create a new array for the edges model['edges'] = [] + # create a new array for the faces + model['faces'] = [] + + # create a new array for the vertices + model['vertices'] = [] + for line in lines: # trim whitespaces line = line.strip() @@ -119,15 +122,22 @@ vertice.append(y) vertice.append(z) - # add the vertice to the new face array - face_new.append(vertice) + # save the vertice in the model array + if vertice not in model['vertices']: + model['vertices'].append(vertice) - # save the new face in the model['faces'] array - model['faces'].append(face_new) + # get vertice number + vertice_number = model['vertices'].index(vertice) + # add the vertice number to the new face array + face_new.append(vertice_number) + # save the edges of the face - self.save_edges(face_new) + edges = self.save_edges(face_new) + # save the new face in the model['faces'] array + model['faces'].append({'vertices' : face_new, 'edges' : edges, 'base line' : 0}) + # update length values model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] @@ -160,21 +170,26 @@ model['dimensions'][2]['max'] = z def save_edges(self, face): - for vertice_number, vertice_content in enumerate(face): - first_vertice = vertice_content + # create an array for the edges + edges = [] + for i, vertice in enumerate(face): + first_vertice = vertice + + # grab the second vertice try: - second_vertice = face[vertice_number + 1] + second_vertice = face[i + 1] except: second_vertice = face[0] - self.save_edge(first_vertice, second_vertice) + # store the edge in the edges array + edges.append([first_vertice, second_vertice]) - def save_edge(self, first_vertice, second_vertice): - for edge in model['edges']: - if edge==[first_vertice, second_vertice] or edge==[second_vertice, first_vertice]: - return false + # check if the edge is already stored + if [first_vertice, second_vertice] not in model['edges'] and [second_vertice, first_vertice] not in model['edges']: + # store the edge in the model array + model['edges'].append([first_vertice, second_vertice]) - model['edges'].append([first_vertice, second_vertice]) + return edges raw_file(table) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-22 14:02:05
|
Revision: 1065 http://opengate.svn.sourceforge.net/opengate/?rev=1065&view=rev Author: spom_spom Date: 2009-02-22 14:02:00 +0000 (Sun, 22 Feb 2009) Log Message: ----------- fix some network related bugs Modified Paths: -------------- trunk/src/GameStateManager.cpp trunk/src/Sector.cpp trunk/src/SectorProjectileObject.cpp trunk/src/networkClient.cpp trunk/src/networkClient.h trunk/src/networkProtocol.cpp trunk/src/networkProtocol.h trunk/src/networkServer.cpp trunk/src/networkServerUser.cpp trunk/src/networkServerUser.h Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/GameStateManager.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -484,6 +484,10 @@ } break; case PROTO_SHIP_PROJECTILEFIRED: if ( sector ) sector->receiveProjectile( &msgs[ i ][ 0 ] ); break; case PROTO_SHIP_AMMOHIT: if ( sector ) sector->receiveVesselAmmoHit( &msgs[ i ][ 0 ] ); break; + case PROTO_DISCONNECT: { + MessageBodyDisconnect msg( &msgs[ i ][ 0 ] ); + resources_.network->deleteUser( (int)msg.userID() ); + } break; default: std::cerr << "PROTO type unknown: " << msgs[ i ][ 0 ] << " " << msgs[ i ].size() << std::endl; break; Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/Sector.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -682,9 +682,9 @@ if ( obj ){ Gun * gun = dynamic_cast < Gun * >( ResourceManager::getSingleton().entityManager->entity( msg.gunID() ) ); SectorProjectileObject * ammo = new SectorProjectileObject( obj->name() + "/Ammo_" + toStr( msg.shotCount() ), this, gun ); - insertCollObject_( ammo ); ammo->mainNode()->setPosition( toOgreVec( msg.position() ) ); ammo->setVelocity( toOgreVec( msg.velocity() ) ); + insertCollObject_( ammo ); } else { log_->fatal( "no sectorObject for user: " + user->name() ) ; } Modified: trunk/src/SectorProjectileObject.cpp =================================================================== --- trunk/src/SectorProjectileObject.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/SectorProjectileObject.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -97,7 +97,9 @@ void SectorProjectileObject::activate_(){ reset(); - // mainNode_->setDirection( vel_.normalisedCopy() ); + //setDirection (const Vector3 &vec, TransformSpace relativeTo=TS_LOCAL, const Vector3 &localDirectionVector=Vector3::NEGATIVE_UNIT_Z) +// mainNode_->setDirection( vel_.normalisedCopy(), Ogre::SceneNode::TS_WORLD ); +// mainNode_->setDirection( -gunObject_->parent()->mainNode()->getOrientation().zAxis().normalisedCopy(), Ogre::SceneNode::TS_WORLD ); maxLifeTime_ *= 100.0; int maxBB = 20; @@ -108,12 +110,12 @@ // bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 1.0f, 1.0f, 1.0f) ); // bb->setDimensions( 1.0, 0.2 ); // bb->setRotation ( Ogre::Radian( 0 ) ); - for ( int i = 0; i < maxBB; i ++ ){ bb = bullet_->createBillboard( Ogre::Vector3::ZERO, Ogre::ColourValue( 0.5f, 0.5f, 0.5f) ); bb->setDimensions( 1.0 - i * 1.0/maxBB* 0.5 , 1.0 - i * 1.0/maxBB * 0.5 ); bb->setRotation ( Ogre::Radian( i*10.0 ) ); bb->setPosition( vel_.normalisedCopy() * i * 0.5 ); + //bb->setPosition( mainNode_->getOrientation().zAxis().normalisedCopy() * i * 0.5 ); } mainNode_->attachObject( bullet_ ); } Modified: trunk/src/networkClient.cpp =================================================================== --- trunk/src/networkClient.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkClient.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -79,6 +79,14 @@ } } +void NetworkClient::deleteUser( Uint32 userID ){ + ClientUserObject * obj = this->user( userID ); + if ( obj ){ + users_.erase( users_.find( userID ) ) ; + delete obj; + } +} + void NetworkClient::send( MessageBodyBase & msg ) { if ( online_ ){ msg.setSenderID( userID_ ); @@ -202,17 +210,7 @@ log_->fatal( std::string("Connection refused for unknown reason: " ) + toStr( msg.reason() ) ); } } break; - case PROTO_DISCONNECT: { - MessageBodyDisconnect msg( incomingMsg_.body() ); - log_->info( std::string( "Disconnect user = " ) + toStr( (int)msg.userID() ) + " " + userName( (int)msg.userID() ) ); - - ClientUserObject * obj = this->user( msg.userID() ); - if ( obj ){ - users_.erase( users_.find( (int)msg.userID() ) ) ; - delete obj; - } - - } break; + default: std::vector < char > vec( incomingMsg_.bodyLength() ); Modified: trunk/src/networkClient.h =================================================================== --- trunk/src/networkClient.h 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkClient.h 2009-02-22 14:02:00 UTC (rev 1065) @@ -93,17 +93,14 @@ void send( MessageBodyBase & msg ); ClientUserObject * user( Uint32 userID ); + + void deleteUser( Uint32 userID ); - void ping(){ - if ( online_ ) { - } else { - pingTime_ = -1; - } - } + void ping(){ if ( online_ ) { } else { pingTime_ = -1;} } - float pingTime(){ return pingTime_; } + float pingTime(){ return pingTime_; } - void pull( std::vector< std::vector< char > > & msg ); + void pull( std::vector< std::vector< char > > & msg ); private: void handleConnect_( const boost::system::error_code & e, boost::asio::ip::tcp::resolver::iterator endpoint_iterator ); Modified: trunk/src/networkProtocol.cpp =================================================================== --- trunk/src/networkProtocol.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkProtocol.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -42,7 +42,7 @@ std::ostream & operator << ( std::ostream & str, const MessageBodyShipRegister & msg ){ str << "MessageBodyShipRegister Type: " << (int)( msg.type() ) << " senderID: " << msg.senderID() << " child: " << (int)msg.childID() << std::endl; - str << "name: " << msg.name() << " pos: " << msg.position() << " vesselID: " << (int)msg.vesselID() << std::endl; + str << " pos: " << msg.position() << " vesselID: " << (int)msg.vesselID() << std::endl; str << "mass: " << msg.mass() << " maxShield: " << msg.maxShield() << " maxThrust: " << msg.maxThrust() << std::endl; return str; } Modified: trunk/src/networkProtocol.h =================================================================== --- trunk/src/networkProtocol.h 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkProtocol.h 2009-02-22 14:02:00 UTC (rev 1065) @@ -341,10 +341,10 @@ void createOutStream(); - inline const std::string & name() const { - std::cerr << "this should not be used" << std::endl; - return name_; - } +// inline const std::string & name() const { +// std::cerr << "this should not be used" << std::endl; +// return name_; +// } FVector3 position() const; inline Uint16 vesselID() const { return vesselID_; } Modified: trunk/src/networkServer.cpp =================================================================== --- trunk/src/networkServer.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkServer.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -160,7 +160,7 @@ } void Server::deRegisterServerUserObject( ServerUserObject * obj ){ - log_->info( std::string( "Deregister: " ) + obj->name() ); + log_->info( std::string( "Deregister: " ) + obj->name() ); if ( obj->status() == Registered ){ obj->setStatus( NotRegistered ); @@ -196,18 +196,17 @@ } void Server::receiveShipRegister( UserSession * user, const MessageBodyShipRegister & msgIn ){ - std::string name( msgIn.name() ); Uint32 userID = user->userID(); Uint8 childID = msgIn.childID(); Uint16 vesselID = msgIn.vesselID(); Uint32 senderID = msgIn.senderID(); FVector3 pos( msgIn.position() ); - log_->info( std::string( "receiveShipRegister from " ) + toStr( senderID ) + " " + name + " " + + log_->info( std::string( "receiveShipRegister from " ) + toStr( senderID ) + " " + user->userName() + " " + " " + toStr( vesselID ) + " at: " + toStr( pos ) ); ServerUserObject *obj; - obj = createServerUserObject( user, name, userID, childID, vesselID ); + obj = createServerUserObject( user, user->userName(), userID, childID, vesselID ); if ( obj != NULL ){ obj->setPosition( pos ); @@ -219,23 +218,24 @@ log_->info( std::string( "Register: " ) + obj->name() ); obj->setStatus( Registered ); - //** first register all userobjects to the new object; - for ( std::map < long, ServerUserObject * >::iterator it = userObjects_.begin(); it != userObjects_.end(); it ++ ){ + //!** first register all foreign userobjects to the new object; + for ( std::map < long, ServerUserObject * >::iterator it = userObjects_.begin(); it != userObjects_.end(); it ++ ){ + if ( it->second->status() == Registered ){ + //** atm all is global; + obj->joinRange( it->second ); - //** atm all is global; - obj->joinRange( it->second ); - - //** if the object is no child, register all objects to them; - if ( !obj->isChild() && ( obj->userID() != it->second->userID() ) ){ - log_->info( std::string( "\tSend register: " ) + obj->userName() + " <- " + it->second->name() ); + //** if the object is no child, register all objects to them; + if ( !obj->isChild() && ( obj->userID() != it->second->userID() ) ){ + log_->info( std::string( "\tSend register: " ) + obj->userName() + " <- " + it->second->name() ); - MessageBodyShipRegister msg( it->second->userID(), it->second->childID(), + MessageBodyShipRegister msg( it->second->userID(), it->second->childID(), it->second->name(), it->second->position().v, it->second->vesselID(), it->second->mass(), it->second->maxShield(), it->second->maxThrust() ); - obj->parent()->send( msg ); - } - } + obj->parent()->send( msg ); + } + } //! if target is registered + } //** second register the new object to all existing objects in range; MessageBodyShipRegister msg( obj->userID(), obj->childID(), obj->name(), obj->position().v, obj->vesselID(), @@ -244,15 +244,17 @@ for ( std::map < long, ServerUserObject * >::iterator it = userObjects_.begin(); it != userObjects_.end(); it ++ ){ if ( !it->second->isChild() && ( obj->parent() != it->second->parent() ) ){ - log_->info( std::string( "\tSend register: " ) + obj->name() + " -> " + it->second->userName() ); - it->second->parent()->send( msg ); + if ( it->second->status() == Registered ){ + log_->info( std::string( "\tSend register: " ) + obj->name() + " -> " + it->second->userName() ); + it->second->parent()->send( msg ); + } } } } else { - log_->warn( std::string( "object: " ) + name + " already registered. " ); + log_->warn( std::string( "object: " ) + user->userName() + " already registered. " ); } } else { - log_->fatal( std::string( "Cannot create object: " ) + name ); + log_->fatal( std::string( "Cannot create object: " ) + user->userName() ); } } Modified: trunk/src/networkServerUser.cpp =================================================================== --- trunk/src/networkServerUser.cpp 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkServerUser.cpp 2009-02-22 14:02:00 UTC (rev 1065) @@ -97,7 +97,7 @@ boost::asio::async_read( socket_, boost::asio::buffer( readMsg_.body(), readMsg_.bodyLength() ), boost::bind( & UserSession::handleReadBody, this, boost::asio::placeholders::error ) ); } else { - std::cerr << "UserSession::handleReadHeader: " + toStr( error ) << std::endl; + std::cerr<< "UserSession::handleReadHeader: " + error.message() << std::endl; connected_ = false; server_->disconnectUser( this ); } Modified: trunk/src/networkServerUser.h =================================================================== --- trunk/src/networkServerUser.h 2009-02-21 22:01:23 UTC (rev 1064) +++ trunk/src/networkServerUser.h 2009-02-22 14:02:00 UTC (rev 1065) @@ -49,7 +49,7 @@ Uint32 userID() const { return userID_; } - bool registered() const{ return registered_; } + bool registered() const { return registered_; } void setRegistered( bool reg ) { registered_ = reg; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-02-21 22:55:32
|
Revision: 1064 http://opengate.svn.sourceforge.net/opengate/?rev=1064&view=rev Author: spom_spom Date: 2009-02-21 22:01:23 +0000 (Sat, 21 Feb 2009) Log Message: ----------- Next steps of network reconstruction done. register/deregister/movement/ammohit Modified Paths: -------------- trunk/configure.ac trunk/src/Avatar.cpp trunk/src/Avatar.h trunk/src/GameStateManager.cpp trunk/src/GunObject.cpp trunk/src/GunObject.h trunk/src/Hud.cpp trunk/src/Makefile.am trunk/src/OpcodeWrapper.cpp trunk/src/OpcodeWrapper.h trunk/src/Opengate.h trunk/src/RadarObject.cpp trunk/src/Sector.cpp trunk/src/Sector.h trunk/src/SectorAvatarObject.cpp trunk/src/SectorAvatarObject.h trunk/src/SectorMovableObject.cpp trunk/src/SectorMovableObject.h trunk/src/SectorProjectileObject.cpp trunk/src/SectorProjectileObject.h trunk/src/SectorVesselObject.cpp trunk/src/SectorVesselObject.h trunk/src/UnDockedState.cpp trunk/src/UnDockedState.h trunk/src/networkClient.cpp trunk/src/networkClient.h trunk/src/networkServer.cpp trunk/src/networkServerUser.h Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/configure.ac 2009-02-21 22:01:23 UTC (rev 1064) @@ -22,7 +22,7 @@ AM_PROG_CC_STDC AC_PROG_LIBTOOL AC_HEADER_STDC -AM_PROG_CC_C_O +#AM_PROG_CC_C_O AC_C_CONST AC_C_INLINE AC_C_VOLATILE Modified: trunk/src/Avatar.cpp =================================================================== --- trunk/src/Avatar.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Avatar.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -25,7 +25,8 @@ namespace OpenGate{ Avatar::Avatar( const std::string & name, Uint32 ID ): name_( name ), id_( ID ) { - cargoHold_ = 0; + cargoHold_ = 0; + isRegistered_ = false; } Avatar::~Avatar( ){ Modified: trunk/src/Avatar.h =================================================================== --- trunk/src/Avatar.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Avatar.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -41,7 +41,7 @@ ~Avatar( ); - std::string name() const { return name_; } + const std::string & name() const { return name_; } Uint32 userID() const { return id_; } @@ -63,6 +63,10 @@ bool unLoadItem( Entity * item ); + void setRegistered( bool registered ) { isRegistered_ = registered; } + + bool isRegistered() const { return isRegistered_; } + protected: std::string name_; Uint32 id_; @@ -72,6 +76,8 @@ Uint16 maxCargoHold_; Uint16 cargoHold_; std::list< std::deque < Entity * > > floorCargo_; + + bool isRegistered_; }; } // namespace OpenGate{ Modified: trunk/src/GameStateManager.cpp =================================================================== --- trunk/src/GameStateManager.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/GameStateManager.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -448,7 +448,7 @@ bool GameStateManager::captureNetwork(){ //** start capture network; std::vector < std::vector < char > > msgs; - std::vector < MessageBodyShipMovement > movements; + std::vector < MessageBodyShipMovement * > movements; resources_.network->pull( msgs ); Sector * sector = NULL; @@ -475,22 +475,23 @@ case PROTO_SHIP_REGISTER: if ( sector ) sector->receiveVesselRegister( &msgs[ i ][ 0 ] ); break; case PROTO_SHIP_DEREGISTER: if ( sector ) sector->receiveVesselDeRegister( &msgs[ i ][ 0 ] ); break; // case PROTO_SHIP_DIED: if ( sector ) sector->receiveVesselDied( &msgs[ i ][ 0 ] ); break; -// case PROTO_SHIP_STATUS: if ( sector ) sector->receiveVesselStatus( &msgs[ i ][ 0 ] ); break; -// case PROTO_SHIP_MOVEMENT:{ + case PROTO_SHIP_STATUS: if ( sector ) sector->receiveVesselStatus( &msgs[ i ][ 0 ] ); break; + case PROTO_SHIP_MOVEMENT:{ // //** we handle that in sum, so we can ignore dups because of packet loss -// MessageBodyShipMovement *msg = new MessageBodyShipMovement( &msgs[ i ][ 0 ] ); -// movements.push_back( MessageBodyShipMovement( &msgs[ i ][ 0 ] ) ); -// } break; -// case PROTO_SHIP_PROJECTILEFIRED: if ( sector ) sector->receiveProjectile( &msgs[ i ][ 0 ] ); break; -// case PROTO_SHIP_AMMOHIT: if ( sector ) sector->receiveVesselAmmoHit( &msgs[ i ][ 0 ] ); break; - + MessageBodyShipMovement *msg = new MessageBodyShipMovement( &msgs[ i ][ 0 ] ); + movements.push_back( msg ); + //movements.push_back( MessageBodyShipMovement( &msgs[ i ][ 0 ] ) ); + } break; + case PROTO_SHIP_PROJECTILEFIRED: if ( sector ) sector->receiveProjectile( &msgs[ i ][ 0 ] ); break; + case PROTO_SHIP_AMMOHIT: if ( sector ) sector->receiveVesselAmmoHit( &msgs[ i ][ 0 ] ); break; default: std::cerr << "PROTO type unknown: " << msgs[ i ][ 0 ] << " " << msgs[ i ].size() << std::endl; break; } } - // if ( movements.size() > 0 && sector ) sector->receiveVesselMovement( movements ); - } + if ( movements.size() > 0 && sector ) sector->receiveVesselMovement( movements ); + for ( size_t i = 0; i < movements.size(); i ++ ) delete movements[ i ]; + } return true; } Modified: trunk/src/GunObject.cpp =================================================================== --- trunk/src/GunObject.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/GunObject.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -34,8 +34,8 @@ namespace OpenGate{ -GunObject::GunObject( Gun * gun ) - : gun_( gun ), parent_( NULL ), mountPoint_( NULL ), gunSound_( NULL ) { +GunObject::GunObject( Gun * gunBluePrint ) + : gunBluePrint_( gunBluePrint ), parent_( NULL ), mountPoint_( NULL ), gunSound_( NULL ) { delayTime_ = 0; } @@ -43,7 +43,7 @@ OpenALSoundManager::getSingleton().destroySoundSource( gunSound_ ); } -void GunObject::mount( SectorMovableObject * parent, Ogre::SceneNode * mountPoint ){ +void GunObject::mount( SectorVesselObject * parent, Ogre::SceneNode * mountPoint ){ parent_ = parent; mountPoint_ = mountPoint; gunSound_ = OpenALSoundManager::getSingleton().createSoundSourceFromRessource( "sounds/defaultLaser", @@ -53,28 +53,28 @@ } void GunObject::update( const Ogre::Real elapsedTime ){ - delayTime_ -= elapsedTime; + delayTime_ -= elapsedTime; } -Ogre::Vector3 GunObject::mountPosition() const { +const Ogre::Vector3 & GunObject::mountPosition() const { return mountPoint_->_getDerivedPosition(); } bool GunObject::fire( Uint32 & capacity ){ - if ( delayTime_ < 0 ){ - if ( capacity > gun_->powerConsumption() ){ - capacity -= gun_->powerConsumption(); - delayTime_ = gun_->fireDelay(); - if ( gunSound_ ){ - gunSound_->setPosition( mountPoint_->_getDerivedPosition() ); - //gunSound_->setVelocity( parent_->velocity() ); - // gunSound_->setDirection( parent_->mainNode()->getOrientation().zAxis() ); - gunSound_->play(); - } - return true; + if ( delayTime_ < 0 ){ + if ( capacity > gunBluePrint_->powerConsumption() ){ + capacity -= gunBluePrint_->powerConsumption(); + delayTime_ = gunBluePrint_->fireDelay(); + if ( gunSound_ ){ + gunSound_->setPosition( mountPoint_->_getDerivedPosition() ); + //gunSound_->setVelocity( parent_->velocity() ); + //gunSound_->setDirection( parent_->mainNode()->getOrientation().zAxis() ); + gunSound_->play(); + } + return true; + } } - } - return false; + return false; } EngineObject::EngineObject( Engine * engineBluePrint, const std::string & name, Ogre::SceneNode * mountNode, const Ogre::Vector3 & position ) Modified: trunk/src/GunObject.h =================================================================== --- trunk/src/GunObject.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/GunObject.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -33,33 +33,32 @@ ~GunObject( ); - void mount( SectorMovableObject * parent, Ogre::SceneNode * mountPoint ); + void mount( SectorVesselObject * parent, Ogre::SceneNode * mountPoint ); void update( const Ogre::Real elapsedTime ); bool fire( Uint32 & capacity ); - inline Gun * gun(){ return gun_;} + inline Gun * gunBluePrint(){ return gunBluePrint_;} - inline Gun * gun() const { return gun_;} + inline Gun & gunBluePrint() const { return *gunBluePrint_;} - inline SectorMovableObject * parent() { return parent_; } + inline SectorVesselObject * parent() { return parent_; } // void setMountPosition( const Ogre::Vector3 & mountPosition ) { mountPosition_ = mountPosition; } - Ogre::Vector3 mountPosition() const; + const Ogre::Vector3 & mountPosition() const; inline Ogre::SceneNode * sceneNode() { return mountPoint_; } inline Ogre::SceneNode & sceneNode() const { return *mountPoint_; } protected: - Gun * gun_; - SectorMovableObject * parent_; + Gun * gunBluePrint_; + SectorVesselObject * parent_; Ogre::SceneNode * mountPoint_; Ogre::Real delayTime_; Ogre::Vector3 mountPosition_; OpenALSoundSource * gunSound_; - }; /*! Construct an engine with a grafical representation i.e. thruster effects. */ Modified: trunk/src/Hud.cpp =================================================================== --- trunk/src/Hud.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Hud.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -59,6 +59,14 @@ } Hud::~Hud(){ + //!** reset sizes + velocityProgress_->setHeight( CEGUI::UDim( 0.0, velocityProgressHeight_ ) ); + thrustProgress_->setHeight( CEGUI::UDim( 0.0, thrustProgressHeight_ ) ); + fuelProgress_->setHeight( CEGUI::UDim( 0.0, fuelProgressHeight_ ) ); + capacitorProgress_->setHeight( CEGUI::UDim( 0.0, capacitorProgressHeight_ ) ); + armorProgress_->setHeight( CEGUI::UDim( 0.0, armorProgressHeight_ ) ); + shieldProgress_->setHeight( CEGUI::UDim( 0.0, shieldProgressHeight_ ) ); + hide(); avatar_->sector()->sceneManager()->destroyEntity( "FlightArrow/Entity" ); flightArrowNode_->removeAndDestroyChild( "FlightArrow/TransNode" ); @@ -100,7 +108,7 @@ targetArrowNode_->setPosition( 0.0, -0.08, -1.2 ); targetArrowNode_->setVisible( false ); - //** OGRE overlay based stuff + //!** OGRE overlay based stuff overlayName_ = "SimpleHUD"; hudOverlay_ = Ogre::OverlayManager::getSingleton().getByName( overlayName_ ); // mousePointer_ = hudOverlay_->getChild( overlayName_ + "/FlightCursor" ); @@ -110,7 +118,7 @@ hudOverlay_->show(); - //** CEGUI based stuff + //!** CEGUI based stuff targetCursor_ = CEGUI::WindowManager::getSingleton().getWindow( "HUDTargetCursor" ); targetCursorHalfWidth_ = targetCursor_->getWidth().asAbsolute( 0.0 ) / 2.0; targetCursorHalfHeight_ = targetCursor_->getHeight().asAbsolute( 0.0 ) / 2.0; @@ -274,9 +282,9 @@ target_->rtti() == SECTOR_MISSILE_OBJECT_RTTI ){ SectorMovableObject * targ = dynamic_cast< SectorMovableObject *>( target_ ); - targetVelocity_->setText( "V" + Ogre::StringConverter::toString( round((Ogre::Real)targ->speed(), 2 ), 4 ) ); - targetShieldText_->setText( "S" + Ogre::StringConverter::toString( round( (Ogre::Real)targ->shield() / targ->maxShield() * 100.0f, 1), 4 ) ); - targetArmorText_->setText( "A" + Ogre::StringConverter::toString( round( (Ogre::Real)targ->armor() / targ->maxArmor() * 100.0f, 1), 4 ) ); + targetVelocity_->setText( "V" + Ogre::StringConverter::toString( round((Ogre::Real)targ->speed(), 2 ), 4 ) ); + targetShieldText_->setText( "S" + Ogre::StringConverter::toString( round( targ->shieldRate() * 100.0f, 1), 4 ) ); + targetArmorText_->setText( "A" + Ogre::StringConverter::toString( round( targ->armorRate() * 100.0f, 1), 4 ) ); } else { targetVelocity_->setText( "" ); @@ -288,44 +296,43 @@ } Ogre::Real height = avatar_->speedRate() * velocityProgressHeight_; - velocityProgress_->setYPosition( CEGUI::UDim( 0.5, velocityProgressHeight_/2.0 - height ) ); + velocityProgress_->setYPosition( CEGUI::UDim( 0.5, velocityProgressHeight_ / 2.0 - height ) ); velocityProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); velocityProgressImg_->setYPosition( CEGUI::UDim( 0, -velocityProgressHeight_ + height ) ); height = avatar_->capacityRate() * capacitorProgressHeight_; - capacitorProgress_->setYPosition( CEGUI::UDim( 0.5, capacitorProgressHeight_/2.0 - height ) ); + capacitorProgress_->setYPosition( CEGUI::UDim( 0.5, capacitorProgressHeight_ / 2.0 - height ) ); capacitorProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); capacitorProgressImg_->setYPosition( CEGUI::UDim( 0, -capacitorProgressHeight_ + height ) ); height = avatar_->thrustRate() * thrustProgressHeight_; - thrustProgress_->setYPosition( CEGUI::UDim( 0.5, thrustProgressHeight_/2.0 - height ) ); + thrustProgress_->setYPosition( CEGUI::UDim( 0.5, thrustProgressHeight_ / 2.0 - height ) ); thrustProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); thrustProgressImg_->setYPosition( CEGUI::UDim( 0, -thrustProgressHeight_ + height ) ); - // -// height = avatar_->shieldRate() * shieldProgressHeight_; -// shieldProgress_->setYPosition( CEGUI::UDim( 0.5, - height + height/2.0 ) ); -// shieldProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); -// shieldProgressLeftImg_->setYPosition( CEGUI::UDim( 0.5, -shieldProgressHeight_/2.0 ) ); -// shieldProgressRightImg_->setYPosition( CEGUI::UDim( 0.5, -shieldProgressHeight_/2.0 ) ); - // -// height = avatar_->armorRate() * armorProgressHeight_; -// armorProgress_->setYPosition( CEGUI::UDim( 0.5, - height + height/2.0 ) ); -// armorProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); -// armorProgressLeftImg_->setYPosition( CEGUI::UDim( 0.5, -armorProgressHeight_/2.0 ) ); -// armorProgressRightImg_->setYPosition( CEGUI::UDim( 0.5, -armorProgressHeight_/2.0 ) ); - // - if ( avatar_->brakePressed() ){ - velocityText_->setProperty( "TextColours", "ffff0000" ); - } else if (avatar_->afterburnerPressed()){ - velocityText_->setProperty( "TextColours", "ff00ff00" ); - } else { - velocityText_->setProperty( "TextColours", "ffffffff" ); - } - velocityText_->setText( "V" + Ogre::StringConverter::toString( round( (Ogre::Real)avatar_->speed(), 2 ), 4 ) ); - -// shieldText_->setText( "S" + Ogre::StringConverter::toString( avatar_->shieldRate() * 100.0f, 4 ) ); -// armorText_->setText( "A" + Ogre::StringConverter::toString( avatar_->armorRate() * 100.0f, 4 ) ); + height = avatar_->shieldRate() * shieldProgressHeight_; + shieldProgress_->setYPosition( CEGUI::UDim( 0.5, height / 2.0 -height) ); + shieldProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); + shieldProgressLeftImg_->setYPosition( CEGUI::UDim( 0.5, -shieldProgressHeight_/2.0 ) ); + shieldProgressRightImg_->setYPosition( CEGUI::UDim( 0.5, -shieldProgressHeight_/2.0 ) ); + + height = avatar_->armorRate() * armorProgressHeight_; + armorProgress_->setYPosition( CEGUI::UDim( 0.5, height / 2.0 - height ) ); + armorProgress_->setHeight( CEGUI::UDim( 0.0, height ) ); + armorProgressLeftImg_->setYPosition( CEGUI::UDim( 0.5, -armorProgressHeight_/2.0 ) ); + armorProgressRightImg_->setYPosition( CEGUI::UDim( 0.5, -armorProgressHeight_/2.0 ) ); + + if ( avatar_->brakePressed() ){ + velocityText_->setProperty( "TextColours", "ffff0000" ); + } else if (avatar_->afterburnerPressed()){ + velocityText_->setProperty( "TextColours", "ff00ff00" ); + } else { + velocityText_->setProperty( "TextColours", "ffffffff" ); + } + + velocityText_->setText( "V" + Ogre::StringConverter::toString( round( (Ogre::Real)avatar_->speed(), 2 ), 4 ) ); + shieldText_->setText( "S" + Ogre::StringConverter::toString( round( avatar_->shieldRate() * 100.0f, 1), 4 ) ); + armorText_->setText( "A" + Ogre::StringConverter::toString( round( avatar_->armorRate() * 100.0f, 1), 4 ) ); // OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps"); Modified: trunk/src/Makefile.am =================================================================== --- trunk/src/Makefile.am 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Makefile.am 2009-02-21 22:01:23 UTC (rev 1064) @@ -1,9 +1,10 @@ bin_PROGRAMS = \ opengateclient \ opengateserver - -opengateclient_SOURCES = \ - opengateclient.cpp \ + +lib_LIBRARIES = libopengate.a + +libopengate_a_SOURCES = \ common.h \ common.cpp \ commonWithOgre.h \ @@ -69,8 +70,6 @@ Opengate.h \ OpenALSoundManager.h \ OpenALSoundManager.cpp \ - Projectile.h \ - Projectile.cpp \ RadarObject.h \ RadarObject.cpp \ ResourceManager.h \ @@ -118,7 +117,28 @@ metaserver.h \ metaserver.cpp +libopengate_a_LDFLAGS = \ + $(OGRE_LIBS) \ + $(CEGUI_LIBS) \ + $(CEGUIOGRE_LIBS) \ + $(freealut_LIBS) \ + $(vorbisfile_LIBS) \ + $(OIS_LIBS) \ + $(ogreopcode_LIBS) + +libopengate_a_CXXFLAGS = \ + $(OGRE_CFLAGS) \ + $(CEGUI_CFLAGS) \ + $(ogreopcode_CFLAGS) + +opengateclient_SOURCES = \ + opengateclient.cpp + +opengateclient_DEPENDENCIES = \ + libopengate.a + opengateclient_LDFLAGS = \ + libopengate.a \ $(OGRE_LIBS) \ $(CEGUI_LIBS) \ $(CEGUIOGRE_LIBS) \ @@ -131,25 +151,179 @@ $(OGRE_CFLAGS) \ $(CEGUI_CFLAGS) \ $(ogreopcode_CFLAGS) - + opengateserver_SOURCES = \ opengateserver.cpp \ - common.h \ - common.cpp \ - LogManagerBase.h \ - LogManagerBase.cpp \ - networkProtocol.h \ - networkProtocol.cpp \ - networkServer.h \ - networkServer.cpp \ - networkServerUser.h \ - networkServerUser.cpp \ - metaserver.h \ - metaserver.cpp + networkServer.h \ + networkServer.cpp \ + networkServerUser.h \ + networkServerUser.cpp +opengateserver_DEPENDENCIES = \ + libopengate.a + opengateserver_LDFLAGS = \ + libopengate.a \ + $(OGRE_LIBS) \ + $(CEGUI_LIBS) \ + $(CEGUIOGRE_LIBS) \ + $(freealut_LIBS) \ + $(vorbisfile_LIBS) \ + $(OIS_LIBS) \ $(ogreopcode_LIBS) +opengateserver_CXXFLAGS = \ + $(OGRE_CFLAGS) \ + $(CEGUI_CFLAGS) \ + $(ogreopcode_CFLAGS) + + +# common.h \ +# common.cpp \ +# commonWithOgre.h \ +# commonWithOgre.cpp \ +# networkProtocol.h \ +# networkProtocol.cpp \ +# networkClient.h \ +# networkClient.cpp \ +# tinyxml/tinyxml.h \ +# tinyxml/tinyxml.cpp \ +# tinyxml/tinyxmlerror.cpp \ +# tinyxml/tinyxmlparser.cpp \ +# Avatar.h \ +# Avatar.cpp \ +# AiCommands.h \ +# AiCommands.cpp \ +# AiManager.h \ +# AiManager.cpp \ +# AiObject.h \ +# AiObject.cpp \ +# BaseDialog.h \ +# BaseDialog.cpp \ +# BaseObject.h \ +# BaseObject.cpp \ +# ConfigDialog.h \ +# ConfigDialog.cpp \ +# Console.h \ +# Console.cpp \ +# DockedState.h \ +# DockedState.cpp \ +# Entity.h \ +# Entity.cpp \ +# EntityManager.h \ +# EntityManager.cpp \ +# Equipment.h \ +# Equipment.cpp \ +# GameState.h \ +# GameState.cpp \ +# GameStateManager.h \ +# GameStateManager.cpp \ +# GunObject.h\ +# GunObject.cpp\ +# Hud.h\ +# Hud.cpp\ +# InputManager.h \ +# InputManager.cpp \ +# InitState.h \ +# InitState.cpp \ +# KeyMap.h \ +# KeyMap.cpp \ +# LogManager.h \ +# LogManager.cpp \ +# LogManagerBase.h \ +# LogManagerBase.cpp \ +# MarketDialog.h \ +# MarketDialog.cpp \ +# Missile.h \ +# Missile.cpp \ +# Moveable.h \ +# Moveable.cpp \ +# OpcodeWrapper.h \ +# OpcodeWrapper.cpp \ +# Opengate.h \ +# OpenALSoundManager.h \ +# OpenALSoundManager.cpp \ +# Projectile.h \ +# Projectile.cpp \ +# RadarObject.h \ +# RadarObject.cpp \ +# ResourceManager.h \ +# ResourceManager.cpp \ +# Sector.h \ +# Sector.cpp \ +# SectorAvatarObject.h \ +# SectorAvatarObject.cpp \ +# SectorBaseObject.h \ +# SectorBaseObject.cpp \ +# SectorBeaconObject.h \ +# SectorBeaconObject.cpp \ +# SectorBeaconPadObject.h \ +# SectorBeaconPadObject.cpp \ +# SectorChildObject.h \ +# SectorChildObject.cpp \ +# SectorCollisionObject.h \ +# SectorCollisionObject.cpp \ +# SectorEnvironmentObject.h \ +# SectorEnvironmentObject.cpp \ +# SectorExplosionObject.h \ +# SectorExplosionObject.cpp \ +# SectorMeshObject.h \ +# SectorMeshObject.cpp \ +# SectorMissileObject.h \ +# SectorMissileObject.cpp \ +# SectorMovableObject.h \ +# SectorMovableObject.cpp \ +# SectorPadObject.h \ +# SectorPadObject.cpp \ +# SectorStationObject.h \ +# SectorStationObject.cpp \ +# SectorStationPadObject.h \ +# SectorStationPadObject.cpp \ +# SectorVesselObject.h \ +# SectorVesselObject.cpp \ +# SectorProjectileObject.h \ +# SectorProjectileObject.cpp \ +# ShipConfigDialog.h \ +# ShipConfigDialog.cpp \ +# UnDockedState.cpp \ +# UnDockedState.h \ +# Vessel.h \ +# Vessel.cpp \ +# metaserver.h \ +# metaserver.cpp + +# opengateclient_LDFLAGS = \ +# $(OGRE_LIBS) \ +# $(CEGUI_LIBS) \ +# $(CEGUIOGRE_LIBS) \ +# $(freealut_LIBS) \ +# $(vorbisfile_LIBS) \ +# $(OIS_LIBS) \ +# $(ogreopcode_LIBS) +# +# opengateclient_CXXFLAGS = \ +# $(OGRE_CFLAGS) \ +# $(CEGUI_CFLAGS) \ +# $(ogreopcode_CFLAGS) + +# opengateserver_SOURCES = \ +# opengateserver.cpp \ +# common.h \ +# common.cpp \ +# LogManagerBase.h \ +# LogManagerBase.cpp \ +# networkProtocol.h \ +# networkProtocol.cpp \ +# networkServer.h \ +# networkServer.cpp \ +# networkServerUser.h \ +# networkServerUser.cpp \ +# metaserver.h \ +# metaserver.cpp +# +# opengateserver_LDFLAGS = \ +# $(ogreopcode_LIBS) + # opengateserver_CXXFLAGS = \ # $(ogreopcode_CFLAGS) Modified: trunk/src/OpcodeWrapper.cpp =================================================================== --- trunk/src/OpcodeWrapper.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/OpcodeWrapper.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -190,90 +190,90 @@ -void OpcodeCollisionDetection::createObject( BaseObject * obj ){ - - if ( obj && active_ ){ - OgreOpcode::CollisionObject * collObj = obj->collisionObject(); +// void OpcodeCollisionDetection::createObject( BaseObject * obj ){ +// +// if ( obj && active_ ){ +// OgreOpcode::CollisionObject * collObj = obj->collisionObject(); +// +// if ( !collObj ){ +// +// OgreOpcode::EntityCollisionShape * collShape = collisionManager_->createEntityCollisionShape( obj->name() + "/CollShape" ); +// if ( obj->entity() ){ +// collShape->load( obj->entity() ); +// } else { +// std::cout << "OpcodeCollisionDetection::createObject( BaseObject * obj ), no entity defined for obj: " << obj->name(); +// } +// +// collObj = collideInSectorContext_->createObject( obj->name() + "/CollObj" ); +// collObj->setCollClass( collisionManager_->queryCollClass( obj->collisionClass() ) ); +// collObj->setShape( collShape ); +// +// collObj->setClientData( obj ); +// collideInSectorContext_->addObject( collObj ); +// +// obj->setCollisionObject( collObj ); +// } +// } +// } +// +// void OpcodeCollisionDetection::destroyObject( BaseObject * obj ){ +// +// if ( obj && active_ ){ +// destroy( obj->collisionObject() ); +// obj->setCollisionObject( NULL ); +// } +// } +// +// void OpcodeCollisionDetection::detach( BaseObject * obj ){ +// if ( obj && active_ ){ +// destroyObject( obj ); +// } +// } +// +// void OpcodeCollisionDetection::attach( BaseObject * obj ){ +// if ( obj && active_ ){ +// createObject( obj ); +// } +// } +// +// bool OpcodeCollisionDetection::checkCollideRay( BaseObject * obj, const Ogre::Ray & ray, double rayLength){ +// if ( active_ ){ +// if ( !obj->isSetDestroyRequest() ){ +// OgreOpcode::CollisionPair ** rayPickReport; +// +// uint nColl = collideInSectorContext_->rayCheck( ray, rayLength, OgreOpcode::COLLTYPE_EXACT, +// OgreOpcode::COLLTYPE_ALWAYS_EXACT, rayPickReport ); +// +// // std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl; +// +// for ( uint i = 0; i < nColl; i ++ ){ +// /* std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl;*/ +// +// OgreOpcode::CollisionObject* col1 = rayPickReport[ i ]->this_object; +// OgreOpcode::CollisionObject* col2 = rayPickReport[ i ]->other_object; +// +// // std::cout << "checkCollideRay: " << i << " " +// // << static_cast< BaseObject * >( col1->getClientData() )->name() << "<->" +// // << static_cast< BaseObject * >( col2->getClientData() )->name() << std::endl; +// +// if ( obj->rtti() == PROJECTILE_RTTI ){ +// if ( dynamic_cast< Projectile * >( obj )->parent() != +// static_cast< BaseObject * >( col1->getClientData() ) ){ +// obj->mainNode()->setPosition( rayPickReport[ i ]->contact ); +// obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); +// static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); +// return true; +// } +// } else if ( obj != col1->getClientData() ){ +// obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); +// static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); +// } +// } +// } +// } +// return false; +// } - if ( !collObj ){ - - OgreOpcode::EntityCollisionShape * collShape = collisionManager_->createEntityCollisionShape( obj->name() + "/CollShape" ); - if ( obj->entity() ){ - collShape->load( obj->entity() ); - } else { - std::cout << "OpcodeCollisionDetection::createObject( BaseObject * obj ), no entity defined for obj: " << obj->name(); - } - - collObj = collideInSectorContext_->createObject( obj->name() + "/CollObj" ); - collObj->setCollClass( collisionManager_->queryCollClass( obj->collisionClass() ) ); - collObj->setShape( collShape ); - - collObj->setClientData( obj ); - collideInSectorContext_->addObject( collObj ); - - obj->setCollisionObject( collObj ); - } - } -} - -void OpcodeCollisionDetection::destroyObject( BaseObject * obj ){ - - if ( obj && active_ ){ - destroy( obj->collisionObject() ); - obj->setCollisionObject( NULL ); - } -} - -void OpcodeCollisionDetection::detach( BaseObject * obj ){ - if ( obj && active_ ){ - destroyObject( obj ); - } -} - -void OpcodeCollisionDetection::attach( BaseObject * obj ){ - if ( obj && active_ ){ - createObject( obj ); - } -} - -bool OpcodeCollisionDetection::checkCollideRay( BaseObject * obj, const Ogre::Ray & ray, double rayLength){ - if ( active_ ){ - if ( !obj->isSetDestroyRequest() ){ - OgreOpcode::CollisionPair ** rayPickReport; - - uint nColl = collideInSectorContext_->rayCheck( ray, rayLength, OgreOpcode::COLLTYPE_EXACT, - OgreOpcode::COLLTYPE_ALWAYS_EXACT, rayPickReport ); - - // std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl; - - for ( uint i = 0; i < nColl; i ++ ){ -/* std::cout << "OpcodeCollisionDetection::checkCollideRay()" << " " << rayLength << " " << nColl <<std::endl;*/ - - OgreOpcode::CollisionObject* col1 = rayPickReport[ i ]->this_object; - OgreOpcode::CollisionObject* col2 = rayPickReport[ i ]->other_object; - - // std::cout << "checkCollideRay: " << i << " " - // << static_cast< BaseObject * >( col1->getClientData() )->name() << "<->" - // << static_cast< BaseObject * >( col2->getClientData() )->name() << std::endl; - - if ( obj->rtti() == PROJECTILE_RTTI ){ - if ( dynamic_cast< Projectile * >( obj )->parent() != - static_cast< BaseObject * >( col1->getClientData() ) ){ - obj->mainNode()->setPosition( rayPickReport[ i ]->contact ); - obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); - static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); - return true; - } - } else if ( obj != col1->getClientData() ){ - obj->collide( static_cast< BaseObject * >( col2->getClientData() ) ); - static_cast< BaseObject * >( col1->getClientData() )->collide( obj ); - } - } - } - } - return false; -} - void OpcodeCollisionDetection::info( ){ std::cout << "OpcodeCollisionDetection::info( )" << std::endl; Modified: trunk/src/OpcodeWrapper.h =================================================================== --- trunk/src/OpcodeWrapper.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/OpcodeWrapper.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -55,22 +55,6 @@ /*! Write some debug infos about all collision objects to stdout*/ void info( ); - - /*! DEPRECATED */ - void createObject( BaseObject * obj ); - - /*! DEPRECATED */ - void destroyObject( BaseObject * obj ); - - /*! DEPRECATED */ - void detach( BaseObject * obj ); - - /*! DEPRECATED */ - void attach( BaseObject * obj ); - - /*! DEPRECATED */ - bool checkCollideRay( BaseObject * obj, const Ogre::Ray & ray, double rayLength ); - protected: OgreOpcode::CollisionContext * collideInSectorContext_; OgreOpcode::CollisionManager * collisionManager_; Modified: trunk/src/Opengate.h =================================================================== --- trunk/src/Opengate.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Opengate.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -74,8 +74,9 @@ class AiManager; class Avatar; -class BaseObject; +class ClientUserObject; class Console; + class DockedState; class UnDockedState; @@ -104,7 +105,6 @@ class ResourceManager; - class Sector; class SectorAvatarObject; class SectorBaseObject; Modified: trunk/src/RadarObject.cpp =================================================================== --- trunk/src/RadarObject.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/RadarObject.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -145,7 +145,6 @@ std::map< SectorMeshObject *, RadarViewable * >::iterator itTarget = objects_.find( obj ); if ( itTarget != objects_.end() ) delete itTarget->second; objects_.erase( obj ); - if ( target_ == obj ) findNextTarget(); } Modified: trunk/src/Sector.cpp =================================================================== --- trunk/src/Sector.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Sector.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -26,11 +26,13 @@ #include "Avatar.h" #include "EntityManager.h" +#include "Equipment.h" #include "GunObject.h" #include "LogManager.h" #include "Missile.h" #include "networkClient.h" #include "OpcodeWrapper.h" +#include "Projectile.h" #include "RadarObject.h" #include "ResourceManager.h" #include "SectorAvatarObject.h" @@ -59,16 +61,25 @@ log_ = LogManager::getSingletonPtr(); name_ = "unknown"; listener_ = NULL; + avatarObject_ = NULL; avatar_ = NULL; childIDCounter_ = 0; + timeSinceLastNetworkUpdate_ = 0.0; + timeSinceLastStatusUpdate_ = 0.0; ecliptic_ = new SectorEclipticObject( this ); sectorEnvironment_.insert( ecliptic_ ); showEcliptic( false ); createKoordAxis( ); + avatarDeathSequenceTime_ = 0.0; } Sector::~Sector( ){ + if ( avatar_->isRegistered() ) { + sendVesselDeRegister( avatarObject_ ); + avatar_->setRegistered( false ); + } + for_each( sectorEnvironment_.begin(), sectorEnvironment_.end(), deletePtr() ); for_each( sectorCollObjects_.begin(), sectorCollObjects_.end(), deletePtr() ); for_each( sectorMeshObjects_.begin(), sectorMeshObjects_.end(), deletePtr() ); @@ -103,6 +114,21 @@ destructMeshObject_( (*it++) ); } else ++it; } + + //** send movement data, max 10 net-updates/second + timeSinceLastNetworkUpdate_ += elapsedTime; + timeSinceLastStatusUpdate_ += elapsedTime; + + if ( timeSinceLastNetworkUpdate_ > 0.1 ){ + sendAllVesselMovements( ); + timeSinceLastNetworkUpdate_ = 0.0; + } + + if ( avatarDeathSequenceTime_ > 0.0 ){ + avatarDeathSequenceTime_ -= elapsedTime; + } else if ( avatarDeathSequenceTime_ < 0.0 ){ + listener_->avatarDeathSequence( false ); + } return true; } @@ -137,8 +163,11 @@ objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); break; case SECTOR_AVATAR_OBJECT_RTTI: - objectHeap_[ dynamic_cast< SectorMissileObject * >( obj )->missile()->name() ].push_back( obj ); - sendVesselDeRegister( dynamic_cast< SectorAvatarObject * >( obj ) ); + objectHeap_[ dynamic_cast< SectorVesselObject * >( obj )->vessel()->name() ].push_back( obj ); + if ( avatar_->isRegistered() ) sendVesselDeRegister( dynamic_cast< SectorAvatarObject * >( obj ) ); + avatar_->setRegistered( false ); + listener_->avatarDeathSequence( true ); + avatarDeathSequenceTime_ = 2.0; break; default: delete( obj ); @@ -204,18 +233,19 @@ } SectorAvatarObject * Sector::createAvatarObject( Avatar * avatar ){ + avatar_ = avatar; log_->info( std::string( "Sector::createAvatarObject: " ) + avatar->name() ); - avatar_ = new SectorAvatarObject( avatar->name(), this, avatar->vessel() ); - avatar_->reset(); + avatarObject_ = new SectorAvatarObject( avatar->name(), this, avatar->vessel() ); + avatarObject_->reset(); bool hasStation = false; if ( !sectorStations_.empty() ){ SectorStationObject *station = dynamic_cast< SectorStationObject* >( *sectorStations_.begin() ); log_->info( std::string( "launch avatar from station " ) ); if ( station->launchPad() ){ - avatar_->mainNode()->setPosition( station->launchPad()->position( true ) + station->launchPad()->direction( true ) * 5.0); - avatar_->mainNode()->setDirection( station->launchPad()->direction( true ) ); - avatar_->setVelocity( station->launchPad()->direction( true ) * 20.0 ); + avatarObject_->mainNode()->setPosition( station->launchPad()->position( true ) + station->launchPad()->direction( true ) * 5.0); + avatarObject_->mainNode()->setDirection( station->launchPad()->direction( true ) ); + avatarObject_->setVelocity( station->launchPad()->direction( true ) * 20.0 ); hasStation = true; } else { log_->warn( std::string( "Station " + station->name() + " has no launch pad" ) ); @@ -223,15 +253,16 @@ } if ( !hasStation ) { log_->info( std::string( "launch avatar from free position " ) ); - avatar_->mainNode()->setPosition( 0.0, 0.0, 0.0 ); - avatar_->mainNode()->setDirection( Ogre::Vector3( 0.0, 0.0, -1.0 ) ); - avatar_->setVelocity( Ogre::Vector3( 0.0, 0.0, 0.0 ) ); + avatarObject_->mainNode()->setPosition( 0.0, 0.0, 0.0 ); + avatarObject_->mainNode()->setDirection( Ogre::Vector3( 0.0, 0.0, -1.0 ) ); + avatarObject_->setVelocity( Ogre::Vector3( 0.0, 0.0, 0.0 ) ); } - insertMeshObject_( avatar_ ); + insertMeshObject_( avatarObject_ ); - sendVesselRegister( avatar_ ); + sendVesselRegister( avatarObject_ ); + avatar_->setRegistered( true ); - return avatar_; + return avatarObject_; } SectorVesselObject * Sector::createVesselObject( Vessel * vessel ){ @@ -283,9 +314,15 @@ insertCollObject_( obj ); } -void Sector::createProjectile( GunObject * obj, int shots ){ +SectorProjectileObject * Sector::createProjectile( GunObject * obj, int shots ){ SectorProjectileObject * ammo = new SectorProjectileObject( obj->parent()->name() + "Ammo_" + toStr( shots ), this, obj ); insertCollObject_( ammo ); + + if ( obj->parent() == avatarObject_ ){ + sendProjectile( ammo ); + } + + return ammo; } void Sector::objectDocked( SectorMovableObject * obj, SectorStationObject * station ){ @@ -440,6 +477,25 @@ koordAxisNode_->scale( length, length, length ); } +void Sector::sendAllVesselMovements( ){ + if ( avatarObject_ ) { + sendVesselMovement( avatarObject_ ); + } +} + +void Sector::sendAllVesselInfos( ){ + if ( avatarObject_ ){ + sendVesselStatus( avatarObject_ ); + } + +// for ( std::map< long, SectorObjectMoveableAi * >::iterator it = localAiObjects_.begin(); it != localAiObjects_.end(); it ++ ){ +// if ( it->second->target() == avatar_ ){ +// sendVesselMovement( it->second ); +// sendVesselStatus( it->second ); +// } +// } +} + void Sector::sendVesselRegister( SectorVesselObject * obj ){ if ( obj ) { log_->info( std::string( "Send register " ) + obj->name() + " id:" + toStr( obj->vessel()->id() ) ); @@ -461,12 +517,17 @@ user->setSectorObject( obj ); obj->mainNode()->setPosition( toOgreVec( msg.position() ) ); - -// obj->setMass( msg.mass() ); -// obj->setMaxShield( msg.maxShield() ); -// obj->setMaxThrust( msg.maxThrust() ); -// obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); - } + + obj->setMass( msg.mass() ); + obj->setMaxShield( msg.maxShield() ); + obj->setMaxThrust( msg.maxThrust() ); + obj->setMaxSpeed( std::sqrt( msg.maxThrust() / obj->movable()->dragFactor() ) ); + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; + } + + sendAllVesselInfos( ); + // if ( !movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ // if ( msg.childID() == 0 ){ // log_->info( "Create player object " + msg.name()+ " " + toStr( msg.senderID() ) + " VesselID: " + toStr( msg.vesselID() ) ); @@ -511,30 +572,167 @@ } void Sector::receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ){ -// if ( movableObjects_.count( createGlobalID( msg.senderID(), msg.childID() ) ) ){ -// log_->info( std::string( "Receive deregister " ) -// + movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]->name() ); -// -// SectorObjectMovable *obj = movableObjects_[ createGlobalID( msg.senderID(), msg.childID() ) ]; -// obj->destroy(); -// -// } else { -// log_->warn( std::string( "Deregistering request for unknown object: " ) + -// toStr( msg.senderID() ) + ": " + toStr( (int)msg.childID() ) ); -// } + log_->info( std::string( "Receive vessel deregister: " ) + toStr( msg.senderID() ) ) ; + + ClientUserObject * user( network_->user( msg.senderID() ) ); + if ( user ){ + SectorMovableObject * obj = user->sectorObject(); + if ( obj ){ + user->setSectorObject( NULL ); + destructMeshObject_( obj ); + } else { + log_->fatal( "no sectorObject for user: " + user->name() ) ; + } + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; + } } +void Sector::sendVesselMovement( SectorVesselObject * obj ){ + if ( obj ){ + MessageBodyShipMovement msg( 0, + obj->mainNode()->getPosition().ptr(), + obj->velocity().ptr(), + obj->mainNode()->getOrientation().ptr(), + obj->thrustRate(), + obj->thrust(), + obj->scaledYaw(), + obj->scaledPitch(), + obj->scaledRoll(), + 0 ); + network_->send( msg ); + } +} +void Sector::receiveVesselMovement( const std::vector < MessageBodyShipMovement * > & movements ){ + std::map < long, const MessageBodyShipMovement * > singleMsg; + //!** we sort the movement messages + for ( size_t i = 0; i < movements.size(); i ++ ){ +// LogManager::getSingleton().debug( std::string( "Movement: " ) + +// movableObjects_[ createGlobalID( movements[ i ]->senderID(), movements[ i ]->childID() )]->name() + " " + toStr( movements[ i ]->senderID() ) + " " + toStr( (int)movements[ i ]->childID() ) + +// " " + toStr( movements[ i ]->position() ) ); + if ( movements[ i ]->senderID() != network_->localUserID() ){ + //** apply only foreign movements, and take just the actual movement + singleMsg[ movements[ i ]->senderID() ] = movements[ i ]; + } else { + log_->debug( "check servercode, local movements shoulded send back" ); + } + } + for ( std::map < long, const MessageBodyShipMovement * >::iterator i = singleMsg.begin(); i != singleMsg.end(); i++ ){ + ClientUserObject * user( network_->user( i->first ) ); + if ( user ){ + SectorMovableObject * obj = user->sectorObject(); + if ( obj ){ + obj->setFlightProperties( (*i->second) ); + } else { + log_->fatal( "no sectorObject for user: " + user->name() ) ; + } + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( i->second->senderID() ) ); + } + } +} +void Sector::sendVesselStatus( SectorVesselObject * obj ){ + if ( obj ){ + //!** send max 10 status per second + if ( timeSinceLastStatusUpdate_ > 0.1 ){ + std::cout << "sendVesselStatus:" << obj->name() << std::endl; + MessageBodyShipStatus msg( 0, obj->shield(), obj->armor(), 0, 0, 0 ); + network_->send( msg ); + timeSinceLastStatusUpdate_ = 0.0; + } + } +} +void Sector::receiveVesselStatus( const MessageBodyShipStatus & msg ){ + log_->info( std::string( "Receive vessel status: " ) + toStr( msg.senderID() ) ) ; + + ClientUserObject * user( network_->user( msg.senderID() ) ); + if ( user ){ + SectorMovableObject * obj = user->sectorObject(); + if ( obj ){ + obj->setStatus( msg ); + } else { + log_->fatal( "no sectorObject for user: " + user->name() ) ; + } + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; + } +} +void Sector::sendProjectile( SectorProjectileObject * ammo ){ + MessageBodyShipProjectileFired msg( 0, + ammo->gunObject()->parent()->shotsFired(), + Ogre::Vector3( ammo->mainNode()->getPosition() ).ptr(), + ammo->velocity().ptr(), + ammo->gunObject()->gunBluePrint()->id(), 0, 0.0 ); + network_->send( msg ); +} +void Sector::receiveProjectile( const MessageBodyShipProjectileFired & msg ){ + log_->info( std::string( "Receive projectile from: " ) + toStr( msg.senderID() ) ) ; + ClientUserObject * user( network_->user( msg.senderID() ) ); + if ( user ){ + SectorMovableObject * obj = user->sectorObject(); + if ( obj ){ + Gun * gun = dynamic_cast < Gun * >( ResourceManager::getSingleton().entityManager->entity( msg.gunID() ) ); + SectorProjectileObject * ammo = new SectorProjectileObject( obj->name() + "/Ammo_" + toStr( msg.shotCount() ), this, gun ); + insertCollObject_( ammo ); + ammo->mainNode()->setPosition( toOgreVec( msg.position() ) ); + ammo->setVelocity( toOgreVec( msg.velocity() ) ); + } else { + log_->fatal( "no sectorObject for user: " + user->name() ) ; + } + } else { + log_->fatal( std::string( " no user for id: " ) + toStr( msg.senderID() ) ) ; + } +} +void Sector::sendVesselAmmoHit( SectorProjectileObject * ammo, SectorMovableObject * victim ){ +// if ( projectile.parent().userID() == network_->userID() ){ + MessageBodyShipAmmoHit msg( 0, victim->user()->userID(), 0, ammo->gunObject()->gunBluePrint()->damage() ); + network_->send( msg ); +// // std::cout << " Send: " << msg << endl; +// victim->hitByAmmo( projectile.damage() ); +// } +} +void Sector::receiveVesselAmmoHit( const MessageBodyShipAmmoHit & msg ){ + log_->info( std::string( "Receive ammo hit from: " ) + toStr( msg.senderID() ) ); + if ( msg.targetID() == network_->localUserID() ){ + avatarObject_->hitByAmmo( msg.damage() ); + } else { + log_->fatal( std::string( " target is not the avatar: " ) + toStr( msg.targetID() ) ); + } + // if ( msg.senderID() != network_->userID() ){ +// +// std::map< long, SectorObjectMovable * >::iterator it; +// +// if ( ( it = movableObjects_.find( createGlobalID( msg.targetID(), msg.targetChildID() ) ) ) != movableObjects_.end() ){ +// // log_->cout( "ReceiveVesselAmmoHit for " + network_->userName( msg.targetID() ) + " " + toStr( msg.damage() ) ); +// +// it->second->hitByAmmo( msg.damage() ); +// } else { +// log_->fatal( std::string( "Requested non existant object for VesselAmmoHit " ) + +// " shooter: " + network_->userName( msg.senderID() ) + +// " shooter id: " + toStr( msg.senderID() ) + +// " gloabel id: " + toStr( createGlobalID( msg.targetID(), msg.targetChildID() ) ) + +// " victim: " + network_->userName( msg.targetID() ) + +// " child: " + toStr( (int)msg.targetChildID() ) + +// " damage: " + toStr( msg.damage() ) + " this should not happen." ) ; +// +// std::cerr << "Available objects: " << std::endl; +// for ( std::map< long, SectorObjectMovable * >::iterator i = movableObjects_.begin(); i != movableObjects_.end(); i++){ +// std::cerr << "\t" << i->first << " " << i->second->name() << " " << std::endl; +// } +// } +// } +} @@ -553,6 +751,11 @@ + + + + + #else #include "Sector.h" @@ -1228,6 +1431,7 @@ void Sector::sendVesselStatus( SectorObjectVessel * obj ){ if ( obj ){ + std::cout << "sendVesselStatus:" << obj->name() << std::endl; MessageBodyShipStatus msg( obj->childID(), obj->shield(), obj->armor(), 0, 0, 0 ); network_->send( msg ); } Modified: trunk/src/Sector.h =================================================================== --- trunk/src/Sector.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/Sector.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -61,7 +61,7 @@ const std::set< SectorEnvironmentObject * > & sectorEnvironment() const { return sectorEnvironment_; } /*! Return handle to the avatarObject */ - inline SectorAvatarObject * avatarObject() { return avatar_; } + inline SectorAvatarObject * avatarObject() { return avatarObject_; } /*! Create a mesh within the sector, without any specialization */ SectorMeshObject * createMeshObject( const std::string & name, const std::string & meshname ); @@ -85,7 +85,7 @@ void createExplosion( SectorMeshObject * obj ); /*! Create an explosion related to a given SectorMeshObject */ - void createProjectile( GunObject * obj, int shots ); + SectorProjectileObject * createProjectile( GunObject * obj, int shots ); /*! Someone has docked */ void objectDocked( SectorMovableObject * obj, SectorStationObject * station ); @@ -102,11 +102,30 @@ void flipShowEcliptic( ); + /*!Called from Undockedstate frame event to send the movement from all local vessles */ + void sendAllVesselMovements( ); + + void sendAllVesselInfos( ); + void sendVesselRegister( SectorVesselObject * obj ); void receiveVesselRegister( const MessageBodyShipRegister & msg ); void sendVesselDeRegister( SectorVesselObject * obj ); void receiveVesselDeRegister( const MessageBodyShipDeRegister & msg ); + + void sendVesselMovement( SectorVesselObject * obj ); + void receiveVesselMovement( const std::vector < MessageBodyShipMovement * > & movements ); + + void sendVesselStatus( SectorVesselObject * obj ); + void receiveVesselStatus( const MessageBodyShipStatus & msg ); + + void sendProjectile( SectorProjectileObject * ammo ); + void receiveProjectile( const MessageBodyShipProjectileFired & msg ); + + void sendVesselAmmoHit( SectorProjectileObject * ammo, SectorMovableObject * victim ); + void receiveVesselAmmoHit( const MessageBodyShipAmmoHit & msg ); + + protected: /*! do not destruct objects manualy, let them send false during update loop */ void destructCollObject_( SectorCollisionObject * obj ); @@ -130,7 +149,8 @@ std::string name_; - SectorAvatarObject * avatar_; + Avatar * avatar_; + SectorAvatarObject * avatarObject_; /*! Hold all stuff you can collide or can be seen on radar */ std::set< SectorMeshObject * > sectorMeshObjects_; @@ -147,11 +167,14 @@ std::map< std::string, std::deque< SectorCollisionObject * > > objectHeap_; uint childIDCounter_; - + double timeSinceLastNetworkUpdate_; + double timeSinceLastStatusUpdate_; + Ogre::SceneNode * koordAxisNode_; Ogre::ManualObject * koordAxisMO_; SectorEclipticObject * ecliptic_; + double avatarDeathSequenceTime_; }; #else Modified: trunk/src/SectorAvatarObject.cpp =================================================================== --- trunk/src/SectorAvatarObject.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/SectorAvatarObject.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -53,12 +53,13 @@ } bool SectorAvatarObject::update( Ogre::Real elapsedTime ){ - - //** just for key autorepeat - thrustRate_ += ( thrustChange_ * 0.8 * elapsedTime ); - thrustRate_ = max( thrustRate_, 0.0 ); - thrustRate_ = min( 1.0, thrustRate_ ); - setThrustRate( thrustRate_ ); + //** just for key autorepeat + if ( thrustChange_ != 0.0 ){ + thrustRate_ += ( thrustChange_ * 0.8 * elapsedTime ); + thrustRate_ = max( thrustRate_, 0.0 ); + thrustRate_ = min( 1.0, thrustRate_ ); + setThrustRate( thrustRate_ ); + } return SectorVesselObject::update( elapsedTime ); } Modified: trunk/src/SectorAvatarObject.h =================================================================== --- trunk/src/SectorAvatarObject.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/SectorAvatarObject.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -63,7 +63,6 @@ void fireMissile( Missile * missile, SectorMeshObject * target = NULL ); protected: - Ogre::Real thrustChange_; }; Modified: trunk/src/SectorMovableObject.cpp =================================================================== --- trunk/src/SectorMovableObject.cpp 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/SectorMovableObject.cpp 2009-02-21 22:01:23 UTC (rev 1064) @@ -20,11 +20,13 @@ #include "SectorMovableObject.h" +#include "commonWithOgre.h" #include "Equipment.h" #include "GunObject.h" #include "LogManager.h" #include "Missile.h" #include "Moveable.h" +#include "networkProtocol.h" #include "OpcodeWrapper.h" #include "ResourceManager.h" #include "SectorMissileObject.h" @@ -36,9 +38,8 @@ namespace OpenGate{ SectorMovableObject::SectorMovableObject( const std::string & name, Sector * sector, Movable * movable ) - : SectorMeshObject( name, sector, NULL ), movable_( movable ){ + : SectorMeshObject( name, sector, NULL ), movable_( movable ), user_( NULL ){ - setMesh( movable_->meshPtr()->getName() ); setBaseRot( movable_->baseYaw(), movable_->basePitch(), movable_->baseRoll() ); @@ -51,6 +52,9 @@ void SectorMovableObject::reset( ){ SectorMeshObject::reset(); + + user_ = NULL; + yaw_ = 0.0; pitch_ = 0.0; roll_ = 0.0; @@ -63,6 +67,7 @@ interpolateRot_ = Ogre::Quaternion::ZERO; interpolateVel_ = Ogre::Vector3::ZERO; + forceMovement_ = true; brakePressed_ = false; afterburnerPressed_ = false; lifeTime_ = 0.0; @@ -77,6 +82,8 @@ maxShield_ = 1; shield_ = 0; + lastFrameCount_ = 0; + setDestroyRequest_( false ); } @@ -86,7 +93,6 @@ case SECTOR_AVATAR_OBJECT_RTTI: case SECTOR_BEACON_OBJECT_RTTI: case SECTOR_MESH_OBJECT_RTTI: - case SECTOR_MOVABLE_OBJECT_RTTI: case SECTOR_STATION_OBJECT_RTTI: case SECTOR_VESSEL_OBJECT_RTTI: vel_ *= -1.0; @@ -97,7 +103,9 @@ hitByAmmo( dynamic_cast < SectorMissileObject *>( obj )->missile()->damage() ); break; case SECTOR_PROJECTILE_OBJECT_RTTI: - hitByAmmo( dynamic_cast < SectorProjectileObject *>( obj )->gun()->gun()->damage() ); + if ( dynamic_cast < SectorProjectileObject *>( obj )->gunObject() ){ + hitByAmmo( dynamic_cast < SectorProjectileObject *>( obj )->gunObject()->gunBluePrint()->damage() ); + } break; default: std::cout << "SectorMovableObject: " << this->name() << " collide with " @@ -111,6 +119,7 @@ if ( elapsedTime < 0.001 ) return true; lifeTime_ += elapsedTime; + lastFrameCount_ ++; Ogre::Real rotFric = rotFriction(); mainNode_->yaw( Ogre::Degree( yaw_ * ( elapsedTime * rotFric * movable_->yaw() ) ), rotRelativeTo_ ); @@ -170,6 +179,102 @@ return true; } +void SectorMovableObject::setFlightProperties( const MessageBodyShipMovement & msg ){ + setThrustRate( msg.thrustRate() ); + thrust_ = msg.thrust(); + + // updateThruster(); + + //std::cout << name_ << " " << msg << std::endl; + if ( forceMovement_ ){ + mainNode_->setPosition( toOgreVec( msg.position() ) ); + mainNode_->setOrientation( toOgreQuat( msg.orientation() ) ); + vel_ = toOgreVec( msg.velocity() ); + setScaledYaw( msg.yaw() ); + setScaledPitch( msg.pitch() ); + setScaledRoll( msg.roll() ); + forceMovement_ = false; + } else { + +// if ( ( fabs( msg.yaw() ) -1.0f ) < 1e-4 ) { +// setScaledYaw( msg.yaw() ); +// } else { +// setScaledYaw( 0.0 ); +// } +// if ( ( fabs( msg.pitch() ) -1.0f ) < 1e-4 ) { +// setScaledPitch( msg.pitch() ); +// } else { +// setScaledPitch( 0.0 ); +// } +// if ( ( fabs( msg.roll() ) -1.0f ) < 1e-4 ) { +// setScaledRoll( msg.roll() ); +// } else { +// setScaledRoll( 0.0 ); +// } + + setScaledYaw( msg.yaw() ); + setScaledRoll( msg.roll() ); + setScaledPitch( msg.pitch() ); + + vel_ = toOgreVec( msg.velocity() ); + + Ogre::Vector3 srcP( mainNode_->getPosition( ) ); + Ogre::Quaternion srcQ( mainNode_->getOrientation( ) ); + Ogre::Vector3 destP( toOgreVec( msg.position( ) ) ); + + //** try Slerp + Ogre::Quaternion diff = Ogre::Quaternion::nlerp( 1, srcQ, toOgreQuat( msg.orientation() ) ); + interpolateRot_ = diff * srcQ.Inverse(); + + // if ( msg.childID() > 0 ){ + if ( !1 ){ + + // std::cout << std::endl; +// std::cout << msg.sequenceNr() << "LastFrameCount: " << lastFrameCount_ +// << " life: " << lifeTime_ << " last: " << lastLifeTime_ +// << " diff: "<< lifeTime_ - lastLifeTime_ << std::endl; + + // std::cout << "Ist: " << mainNode_->getOrientation( ) + // << " " << mainNode_->getOrientation( ).getYaw().valueDegrees() << std::endl; + + // std::cout << "Soll: " << msg.orientation() << " " << msg.orientation().getYaw().valueDegrees() << std::endl; + + std::cout << "Diff: send: " << msg.yaw() << " " << msg.pitch() << " " << msg.roll() << std::endl; + + std::cout << "Diff: Pos: " << (srcP-destP).length() + << " Y:" << interpolateRot_.getYaw().valueDegrees() + << " P:" << interpolateRot_.getPitch().valueDegrees() + << " R:" << interpolateRot_.getRoll().valueDegrees() << std::endl; + + } // else !forceMovement_ + + Ogre::Degree yawTo( interpolateRot_.getYaw() ); + Ogre::Degree pitchTo( interpolateRot_.getPitch() ); + Ogre::Degree rollTo( interpolateRot_.getRoll() ); + + mainNode_->yaw( yawTo / 5.0 , Ogre::Node::TS_PARENT ); + mainNode_->pitch( pitchTo / 5.0, Ogre::Node::TS_PARENT ); + mainNode_->roll( rollTo / 5.0, Ogre::Node::TS_PARENT ); + + if ( lastFrameCount_ > 0 ){ + interpolateVel_ = ( destP - srcP ) / lastFrameCount_ / 1.0; + } + + if ( ( srcP - destP ).length() > 100 ) forceMovement_ = true; + } + + lastFrameCount_ = 0; + // lastLifeTime_ = lifeTime_; +} + +void SectorMovableObject::setStatus( const MessageBodyShipStatus & msg ){ + setShield( msg.shield() ); + setArmor( msg.armor() ); +//setBreakPressed( msg.breakPressed() ); +// setAfterburnerPressed( msg.afterburnerPressed() ); + // statusChanged_ = false; +} + Ogre::Real SectorMovableObject::transFriction_(){ return movable_->dragFactor() * speed_ * speed_; } Modified: trunk/src/SectorMovableObject.h =================================================================== --- trunk/src/SectorMovableObject.h 2009-02-21 20:01:10 UTC (rev 1063) +++ trunk/src/SectorMovableObject.h 2009-02-21 22:01:23 UTC (rev 1064) @@ -41,6 +41,12 @@ /*! Abstract method for runtime identification */ virtual int rtti( ) const { return SECTOR_MOVABLE_OBJECT_RTTI; } + /*! Set ClientUserObject if this movable is controled by network. */ + void setUser( ClientUserObject * user ) { user_ = user; } + + /*! Return ClientUserObject if this movable is controled by network. */ + ClientUserObject * user() { return user_; } + virtual bool update( Ogre::Real elapsedTime ); /*! Decide what happen if this object collide with another. */ @@ -58,12 +64,17 @@ /*! Return the relative thrust values from 0 to 1*/ inline Ogre::Real thrustRate() const { return thrustRate_; } + inline void setMaxThrust( Uint32 thrust ) { maxThrust_ = thrust; } /*! Return the maximum thrust*/ inline Uint32 maxThrust() const { return maxThrust_; } + + /*! Return the actual thrust*/ + inline Uint32 thrust() const { return thrust_; } /*! Returns the speed of the object, will be recalculated in every update loop */ inline double speed() const { return speed_; } + inline void setMaxSpeed( double speed ) { maxSpeed_ = speed; } /*! Returns the maximum speed depend on vessel and mounted engine */ inline double maxSpeed() const { return maxSpeed_; } @@ -73,17 +84,26 @@ /*! Return the velocity vector */ inline Ogre::Vector3 velocity( ) const { return vel_; }... [truncated message content] |
From: <Ult...@us...> - 2009-02-21 20:01:20
|
Revision: 1063 http://opengate.svn.sourceforge.net/opengate/?rev=1063&view=rev Author: Ultrasick Date: 2009-02-21 20:01:10 +0000 (Sat, 21 Feb 2009) Log Message: ----------- fixed some problems with the key bindings + added a button to edit a face (the button has no function jet) Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/ branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 19:43:37 UTC (rev 1062) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 20:01:10 UTC (rev 1063) @@ -47,21 +47,45 @@ keyname = gtk.gdk.keyval_name(event.keyval) if keyname=='minus' or keyname=='KP_Subtract': - screen.views.set_zoom(none, -1) + try: + screen.views.set_zoom(none, -1) + except: + pass elif keyname=='plus' or keyname=='KP_Add': - screen.views.set_zoom(none, 1) - elif keyname=='End' or keyname=='Return': - screen.views.reset_zoom() + try: + screen.views.set_zoom(none, 1) + except: + pass + elif keyname=='End' or keyname=='KP_Multiply': + try: + screen.views.reset_zoom() + except: + pass elif keyname=='Left' or keyname=='KP_4': - screen.views.set_x_position(none, -1) + try: + screen.views.set_x_position(none, -1) + except: + pass elif keyname=='Right' or keyname=='KP_6': - screen.views.set_x_position(none, 1) + try: + screen.views.set_x_position(none, 1) + except: + pass elif keyname=='Down' or keyname=='KP_2': - screen.views.set_y_position(none, 1) + try: + screen.views.set_y_position(none, 1) + except: + pass elif keyname=='Up' or keyname=='KP_8': - screen.views.set_y_position(none, -1) + try: + screen.views.set_y_position(none, -1) + except: + pass elif keyname=='Home' or keyname=='KP_5': - screen.views.reset_offset() + try: + screen.views.reset_offset() + except: + pass # connect keyboard to the functions window.connect('key_press_event', handle_keyboard) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-21 19:43:37 UTC (rev 1062) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-21 20:01:10 UTC (rev 1063) @@ -16,7 +16,7 @@ def __init__(self, parent): # show "select a face:" text = gtk.Label('select a face:') - parent.attach(text, 0, 1, 0, 1) + parent.attach(text, 0, 1, 1, 2, xpadding = 3) text.show() # create adjustment @@ -26,7 +26,7 @@ self.face_selector = gtk.SpinButton(adjustment, 0.0, 0) self.face_selector.set_numeric(true) self.face_selector.set_wrap(true) - parent.attach(self.face_selector, 1, 2, 0, 1) + parent.attach(self.face_selector, 1, 2, 1, 2, xpadding = 3) self.face_selector.show() # set function to adjustment @@ -47,4 +47,31 @@ return edges -screen.faces = faces(table) \ No newline at end of file + def edit(self, widget): + pass + +screen.faces = faces(table) + +class tools: + def __init__(self, parent): + # create an container to limit the height of the toolbar + container = gtk.Alignment(xscale = 1) + parent.attach(container, 0, 2, 0, 1) + container.show() + + # create an empty toolbar + self.bar = gtk.Toolbar() + container.add(self.bar) + self.bar.show() + + # create the "edit" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/faces/edit.png') + + # add the "edit" button + self.bar.append_item('edit', 'edit the selected face', '', image, screen.faces.edit) + + # insert a spacer + #self.bar.append_space() + +tools(table) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 19:43:37 UTC (rev 1062) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 20:01:10 UTC (rev 1063) @@ -227,7 +227,6 @@ def __init__(self, parent): # create an empty toolbar self.bar = gtk.Toolbar() - #self.bar.append_space(3) parent.attach(self.bar, 0, 2, 0, 1) self.bar.show() @@ -267,7 +266,7 @@ image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') # add the "reset zoom" button - self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad return)', '', image, screen.views.reset_zoom) + self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad *)', '', image, screen.views.reset_zoom) # insert a spacer self.bar.append_space() Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/faces/edit.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-02-21 19:43:46
|
Revision: 1062 http://opengate.svn.sourceforge.net/opengate/?rev=1062&view=rev Author: egore Date: 2009-02-21 19:43:37 +0000 (Sat, 21 Feb 2009) Log Message: ----------- Dummy texture for intensity Modified Paths: -------------- templates/data/ships/tauseti/intensity/intensity.blend Added Paths: ----------- templates/data/ships/tauseti/intensity/intensity_intensity.png Removed Paths: ------------- templates/data/ships/tauseti/intensity/intensity.wings Modified: templates/data/ships/tauseti/intensity/intensity.blend =================================================================== (Binary files differ) Deleted: templates/data/ships/tauseti/intensity/intensity.wings =================================================================== (Binary files differ) Added: templates/data/ships/tauseti/intensity/intensity_intensity.png =================================================================== (Binary files differ) Property changes on: templates/data/ships/tauseti/intensity/intensity_intensity.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 19:15:52
|
Revision: 1061 http://opengate.svn.sourceforge.net/opengate/?rev=1061&view=rev Author: Ultrasick Date: 2009-02-21 19:15:43 +0000 (Sat, 21 Feb 2009) Log Message: ----------- added some key bindings for the keyboard Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 18:56:29 UTC (rev 1060) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 19:15:43 UTC (rev 1061) @@ -41,4 +41,27 @@ window.content.show() # load frame: "background processes:" -execfile(path[0] + '/scripts/screens/global/frames/background_processes.py') \ No newline at end of file +execfile(path[0] + '/scripts/screens/global/frames/background_processes.py') + +def handle_keyboard(widget, event): + keyname = gtk.gdk.keyval_name(event.keyval) + + if keyname=='minus' or keyname=='KP_Subtract': + screen.views.set_zoom(none, -1) + elif keyname=='plus' or keyname=='KP_Add': + screen.views.set_zoom(none, 1) + elif keyname=='End' or keyname=='Return': + screen.views.reset_zoom() + elif keyname=='Left' or keyname=='KP_4': + screen.views.set_x_position(none, -1) + elif keyname=='Right' or keyname=='KP_6': + screen.views.set_x_position(none, 1) + elif keyname=='Down' or keyname=='KP_2': + screen.views.set_y_position(none, 1) + elif keyname=='Up' or keyname=='KP_8': + screen.views.set_y_position(none, -1) + elif keyname=='Home' or keyname=='KP_5': + screen.views.reset_offset() + +# connect keyboard to the functions +window.connect('key_press_event', handle_keyboard) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 18:56:29 UTC (rev 1060) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 19:15:43 UTC (rev 1061) @@ -177,7 +177,7 @@ # redraw all views self.redraw_all() - def reset_zoom(self, widget): + def reset_zoom(self, widget = none): global view_zoom # reset the zoom factor @@ -208,7 +208,7 @@ # redraw all views self.redraw_all() - def reset_offset(self, widget): + def reset_offset(self, widget = none): global view_x_position, view_y_position # reset x- and y-position @@ -253,21 +253,21 @@ image.set_from_file(path[0] + '/graphic/buttons/view/zoom_out.png') # add the "zoom out" button - self.bar.append_item('zoom out', 'zoom out', '', image, screen.views.set_zoom, -1) + self.bar.append_item('zoom out', 'zoom out (keyboard: numeric pad -)', '', image, screen.views.set_zoom, -1) # create the "zoom in" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/zoom_in.png') # add the "zoom in" button - self.bar.append_item('zoom in', 'zoom in', '', image, screen.views.set_zoom, 1) + self.bar.append_item('zoom in', 'zoom in (keyboard: numeric pad +)', '', image, screen.views.set_zoom, 1) # create the "reset zoom" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') # add the "reset zoom" button - self.bar.append_item('reset zoom', 'reset the zoom factor for the model', '', image, screen.views.reset_zoom) + self.bar.append_item('reset zoom', 'reset the zoom factor for the model (keyboard: numeric pad return)', '', image, screen.views.reset_zoom) # insert a spacer self.bar.append_space() @@ -277,35 +277,35 @@ image.set_from_file(path[0] + '/graphic/buttons/view/move_left.png') # add the "move left" button - self.bar.append_item('move left', 'move the model to the left', '', image, screen.views.set_x_position, -1) + self.bar.append_item('move left', 'move the model to the left (keyboard: numeric pad 4)', '', image, screen.views.set_x_position, -1) # create the "move right" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_right.png') # add the "move right" button - self.bar.append_item('move right', 'move the model to the right', '', image, screen.views.set_x_position, 1) + self.bar.append_item('move right', 'move the model to the right (keyboard: numeric pad 6)', '', image, screen.views.set_x_position, 1) # create the "move down" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_down.png') # add the "move down" button - self.bar.append_item('move down', 'move the model downwards', '', image, screen.views.set_y_position, 1) + self.bar.append_item('move down', 'move the model downwards (keyboard: numeric pad 2)', '', image, screen.views.set_y_position, 1) # create the "move up" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/move_up.png') # add the "move up" button - self.bar.append_item('move up', 'move the model upwards', '', image, screen.views.set_y_position, -1) + self.bar.append_item('move up', 'move the model upwards (keyboard: numeric pad 8)', '', image, screen.views.set_y_position, -1) # create the "reset offset" icon image = gtk.Image() image.set_from_file(path[0] + '/graphic/buttons/view/reset_offset.png') # add the "reset offset" button - self.bar.append_item('reset offset', 'reset the offset of the model', '', image, screen.views.reset_offset) + self.bar.append_item('reset offset', 'reset the offset of the model (keyboard: numeric pad 5)', '', image, screen.views.reset_offset) # insert a spacer self.bar.append_space() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 18:56:47
|
Revision: 1060 http://opengate.svn.sourceforge.net/opengate/?rev=1060&view=rev Author: Ultrasick Date: 2009-02-21 18:56:29 +0000 (Sat, 21 Feb 2009) Log Message: ----------- removing some unnecessary code Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 18:54:49 UTC (rev 1059) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 18:56:29 UTC (rev 1060) @@ -17,9 +17,9 @@ # store none run id self.run_id = none - def add(self, caption, function, function_parameter1 = none, function_parameter2 = none, function_parameter3 = none): + def add(self, caption, function, function_parameter1 = none, function_parameter2 = none): # add process to the queue - self.processes.append({'caption' : caption, 'function' : function, 'function_parameter1' : function_parameter1, 'function_parameter2' : function_parameter2, 'function_parameter3' : function_parameter3}) + self.processes.append({'caption' : caption, 'function' : function, 'function_parameter1' : function_parameter1, 'function_parameter2' : function_parameter2}) if self.run_id==none: # add the run function to the idle functions @@ -39,11 +39,8 @@ # update the GUI update_ui() - if process['function_parameter3']!=none: + if process['function_parameter2']!=none: # run the function - process['function'](process['function_parameter1'], process['function_parameter2'], process['function_parameter3']) - elif process['function_parameter2']!=none: - # run the function process['function'](process['function_parameter1'], process['function_parameter2']) elif process['function_parameter1']!=none: # run the function @@ -59,72 +56,6 @@ background_processes = background_processes() -'''class config_file: - def __init__(self): - # define user array - global user - user = {} - - # define the display array - global display - display = {} - - # open the config file - file = open(path[0] + '/config.ini', 'r') - - for line in file.readlines(): - # trim whitespaces - line = line.strip() - - # split at the ":" - data = line.split(':') - - try: - # trim whitespaces - data[0] = data[0].strip() - data[1] = data[1].strip() - except: - # failed because there was a line like "username:" in the config file, define data[1] - data.append('') - - if data[0]=='[user]': - # select current array - current_array = user - elif data[0]=='[display]': - # select current array - current_array = display - elif data[0]=='': - # it's an empty line, just pass it - continue - else: - # save the read data into the current array - current_array[data[0]] = data[1] - - # close the config file - file.close() - - def write(self, username, password): - # define output array - output = [] - - # define output - output.append('[user]') - output.append('username: ' + username) - output.append('password: ' + password) - output.append('[display]') - output.append('show startup video: false') - - # open the config file - file = open(path[0] + '/config.ini', 'w') - - # write the output to the file - file.write(join(output, '\n')) - - # close the config file - file.close() - -config_file = config_file()''' - def isfloat(number): legal = ['-', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 18:55:02
|
Revision: 1059 http://opengate.svn.sourceforge.net/opengate/?rev=1059&view=rev Author: Ultrasick Date: 2009-02-21 18:54:49 +0000 (Sat, 21 Feb 2009) Log Message: ----------- forgot this file Added Paths: ----------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py 2009-02-21 18:54:49 UTC (rev 1059) @@ -0,0 +1,50 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('faces:') +screen.frame_table.attach(frame, 1, 2, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class faces: + def __init__(self, parent): + # show "select a face:" + text = gtk.Label('select a face:') + parent.attach(text, 0, 1, 0, 1) + text.show() + + # create adjustment + adjustment = gtk.Adjustment(0, 0, len(model['faces']) - 1, 1, 10, 0) + + # show face selector + self.face_selector = gtk.SpinButton(adjustment, 0.0, 0) + self.face_selector.set_numeric(true) + self.face_selector.set_wrap(true) + parent.attach(self.face_selector, 1, 2, 0, 1) + self.face_selector.show() + + # set function to adjustment + adjustment.connect('value_changed', screen.views.redraw_all) + + def get_edges(self, face): + edges = [] + + for vertice_number, vertice_content in enumerate(face): + first_vertice = vertice_content + + try: + second_vertice = face[vertice_number + 1] + except: + second_vertice = face[0] + + edges.append([first_vertice, second_vertice]) + + return edges + +screen.faces = faces(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/faces.py ___________________________________________________________________ Added: svn:eol-style + native This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 18:44:07
|
Revision: 1058 http://opengate.svn.sourceforge.net/opengate/?rev=1058&view=rev Author: Ultrasick Date: 2009-02-21 18:43:54 +0000 (Sat, 21 Feb 2009) Log Message: ----------- adding a function to select a face Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -12,7 +12,6 @@ # show window window = gtk.Window() -#window.set_border_width(3) window.set_title('ogEditor - texturizer') window.show() Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -17,9 +17,9 @@ # store none run id self.run_id = none - def add(self, caption, function, function_parameter = none): + def add(self, caption, function, function_parameter1 = none, function_parameter2 = none, function_parameter3 = none): # add process to the queue - self.processes.append({'caption' : caption, 'function' : function, 'function_parameter' : function_parameter}) + self.processes.append({'caption' : caption, 'function' : function, 'function_parameter1' : function_parameter1, 'function_parameter2' : function_parameter2, 'function_parameter3' : function_parameter3}) if self.run_id==none: # add the run function to the idle functions @@ -39,12 +39,18 @@ # update the GUI update_ui() - if process['function_parameter']==none: + if process['function_parameter3']!=none: # run the function - process['function']() + process['function'](process['function_parameter1'], process['function_parameter2'], process['function_parameter3']) + elif process['function_parameter2']!=none: + # run the function + process['function'](process['function_parameter1'], process['function_parameter2']) + elif process['function_parameter1']!=none: + # run the function + process['function'](process['function_parameter1']) else: # run the function - process['function'](process['function_parameter']) + process['function']() # reset the status bar window.status_bar.set_text('(there is no background process running)') Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -1,13 +1,9 @@ # -*- coding: cp1252 -*- -# show a table -table = gtk.Table() -window.vbox.add(table) -table.show() - # show the frame frame = gtk.Frame('background processes:') -table.attach(frame, 0, 1, 0, 1, xpadding = 3, ypadding = 3) +frame.set_border_width(3) +window.vbox.add(frame) frame.show() # show caption Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -70,7 +70,7 @@ # add the drawing of the side view to the background processes background_processes.add('drawing the side view', self.draw, 'side_view') - def redraw_all(self): + def redraw_all(self, widget = none): old_size = self.top_view.get_size_request()[0] if old_size==view_size: @@ -130,6 +130,20 @@ # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + # create an array for the highlighted face + highlight = [] + + # grab the coordinates for the highlighted face + for vertice in model['faces'][screen.faces.face_selector.get_value_as_int()]: + x = int(round((vertice[axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + y = int(round((((vertice[axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + + # add the coordinates to the highlight array + highlight.append((x, y)) + + # draw the highlighted face + drawing_area.draw_polygon(drawing_area.colors['red'], true, highlight) + def set_size(self, widget, direction): global view_size Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -6,4 +6,7 @@ screen.frame_table.show() # load frame: "view the model:" -execfile(path[0] + '/scripts/screens/project/canvas/frames/view_the_model.py') \ No newline at end of file +execfile(path[0] + '/scripts/screens/project/canvas/frames/view_the_model.py') + +# load frame: "faces:" +execfile(path[0] + '/scripts/screens/project/canvas/frames/faces.py') \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-21 17:11:10 UTC (rev 1057) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-21 18:43:54 UTC (rev 1058) @@ -41,8 +41,8 @@ # save the file name self.name = self.file_selection_window.get_filename() - # add the loading process to the background processes - background_processes.add('loading raw faces file', self.load) + # load the file + self.load() # destroy the window self.destroy_file_selection_window() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-02-21 17:11:23
|
Revision: 1057 http://opengate.svn.sourceforge.net/opengate/?rev=1057&view=rev Author: egore Date: 2009-02-21 17:11:10 +0000 (Sat, 21 Feb 2009) Log Message: ----------- Start porting the background image from Wings3D to Blender Modified Paths: -------------- templates/data/stations/interior/solrain/floor_auv.png templates/data/stations/interior/solrain/floor_auv.svg Added Paths: ----------- templates/data/stations/interior/solrain/barrel_auv.png templates/data/stations/interior/solrain/box_auv.png templates/data/stations/interior/solrain/solrain.blend Added: templates/data/stations/interior/solrain/barrel_auv.png =================================================================== (Binary files differ) Property changes on: templates/data/stations/interior/solrain/barrel_auv.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/data/stations/interior/solrain/box_auv.png =================================================================== (Binary files differ) Property changes on: templates/data/stations/interior/solrain/box_auv.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: templates/data/stations/interior/solrain/floor_auv.png =================================================================== (Binary files differ) Modified: templates/data/stations/interior/solrain/floor_auv.svg =================================================================== (Binary files differ) Added: templates/data/stations/interior/solrain/solrain.blend =================================================================== (Binary files differ) Property changes on: templates/data/stations/interior/solrain/solrain.blend ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 14:52:17
|
Revision: 1056 http://opengate.svn.sourceforge.net/opengate/?rev=1056&view=rev Author: Ultrasick Date: 2009-02-21 14:52:09 +0000 (Sat, 21 Feb 2009) Log Message: ----------- fixed formating + added 3 buttons to hide or show covered edges and one to show covered edges dashed Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/view/decrease_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/increase_size.png branches/ogEditor/data/modules/texturizer/index.py branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/change_size.pspimage Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_dashed.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_full.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_hide.png branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition.pspimage Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/ Modified: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/decrease_size.png =================================================================== (Binary files differ) Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_dashed.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_dashed.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_full.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_full.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_hide.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition_-_hide.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/increase_size.png =================================================================== (Binary files differ) Modified: branches/ogEditor/data/modules/texturizer/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/index.py 2009-02-21 12:43:55 UTC (rev 1055) +++ branches/ogEditor/data/modules/texturizer/index.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -12,7 +12,7 @@ # show window window = gtk.Window() -window.set_border_width(3) +#window.set_border_width(3) window.set_title('ogEditor - texturizer') window.show() Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 12:43:55 UTC (rev 1055) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -34,7 +34,7 @@ return false # set caption - window.status_bar.caption.set_text(process['caption'] + ' ...') + window.status_bar.set_text(process['caption'] + ' ...') # update the GUI update_ui() @@ -47,7 +47,7 @@ process['function'](process['function_parameter']) # reset the status bar - window.status_bar.caption.set_text('(there is no background process running)') + window.status_bar.set_text('(there is no background process running)') return true Added: branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -0,0 +1,16 @@ +# -*- coding: cp1252 -*- + +# show a table +table = gtk.Table() +window.vbox.add(table) +table.show() + +# show the frame +frame = gtk.Frame('background processes:') +table.attach(frame, 0, 1, 0, 1, xpadding = 3, ypadding = 3) +frame.show() + +# show caption +window.status_bar = gtk.Label('(there is no background process running)') +frame.add(window.status_bar) +window.status_bar.show() \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/global/frames/background_processes.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 12:43:55 UTC (rev 1055) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -40,16 +40,5 @@ window.vbox.pack_start(window.content, false, true) window.content.show() -class status_bar: - def __init__(self): - # show horizontal line - self.separator = gtk.HSeparator() - window.vbox.add(self.separator) - self.separator.show() - - # show caption - self.caption = gtk.Label('(there is no background process running)') - window.vbox.add(self.caption) - self.caption.show() - -window.status_bar = status_bar() \ No newline at end of file +# load frame: "background processes:" +execfile(path[0] + '/scripts/screens/global/frames/background_processes.py') \ No newline at end of file Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -0,0 +1,320 @@ +# -*- coding: cp1252 -*- + +# show the frame +frame = gtk.Frame('view the model:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +table.set_col_spacings(3) +table.set_row_spacings(3) +frame.add(table) +table.show() + +class views: + def __init__(self, parent): + # show top view + self.top_view = gtk.DrawingArea() + self.top_view.set_size_request(view_size, view_size) + parent.attach(self.top_view, 0, 1, 1, 2) + self.top_view.show() + + # set autoredraw + self.top_view.connect('expose_event', self.redraw, 'top_view') + + # show front view + self.front_view = gtk.DrawingArea() + self.front_view.set_size_request(view_size, view_size) + parent.attach(self.front_view, 0, 1, 2, 3) + self.front_view.show() + + # set autoredraw + self.front_view.connect('expose_event', self.redraw, 'front_view') + + # show side view + self.side_view = gtk.DrawingArea() + self.side_view.set_size_request(view_size, view_size) + parent.attach(self.side_view, 1, 2, 2, 3) + self.side_view.show() + + # set autoredraw + self.side_view.connect('expose_event', self.redraw, 'side_view') + + # define the colors for the top view + self.top_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.top_view.window.colors[color_name] = self.top_view.window.new_gc(foreground = self.top_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the front view + self.front_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.front_view.window.colors[color_name] = self.front_view.window.new_gc(foreground = self.front_view.window.get_colormap().alloc_color(color_content)) + + # define the colors for the side view + self.side_view.window.colors = {} + + for color_name, color_content in colors.items(): + self.side_view.window.colors[color_name] = self.side_view.window.new_gc(foreground = self.side_view.window.get_colormap().alloc_color(color_content)) + + def redraw(self, widget, event, drawing_area): + if drawing_area=='top_view': + # add the drawing of the top view to the background processes + background_processes.add('drawing the top view', self.draw, 'top_view') + elif drawing_area=='front_view': + # add the drawing of the front view to the background processes + background_processes.add('drawing the front view', self.draw, 'front_view') + elif drawing_area=='side_view': + # add the drawing of the side view to the background processes + background_processes.add('drawing the side view', self.draw, 'side_view') + + def redraw_all(self): + old_size = self.top_view.get_size_request()[0] + + if old_size==view_size: + # redraw the views + self.redraw(none, none, 'top_view') + self.redraw(none, none, 'front_view') + self.redraw(none, none, 'side_view') + else: + # update the sizes (which redraws the views automatically) + self.top_view.set_size_request(view_size, view_size) + self.front_view.set_size_request(view_size, view_size) + self.side_view.set_size_request(view_size, view_size) + + def draw(self, drawing_area): + # choose the right drawing area and axes + if drawing_area=='top_view': + drawing_area = self.top_view.window + + axis_0 = 0 # x + axis_1 = 1 # y + elif drawing_area=='front_view': + drawing_area = self.front_view.window + + axis_0 = 0 # x + axis_1 = 2 # z + elif drawing_area=='side_view': + drawing_area = self.side_view.window + + axis_0 = 1 # y + axis_1 = 2 # z + + # calculate the center for the first axis + axis_0_center = view_size + axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center /= 2 + axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + + # calculate the center for the second axis + axis_1_center = view_size + axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_1_center /= 2 + axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + + # fill the background of the drawing area with white color + drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (view_size, 0), (view_size, view_size), (0, view_size)]) + + # draw the edges + for edge in model['edges']: + # calculate the x position + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + + # calculate the y position + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + + # draw the edge + drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + + def set_size(self, widget, direction): + global view_size + + step = 50 + + if direction<0 and view_size<=step: + # cancle, because decreasing the view size would lead to a width of 0 + return + elif direction>0 and (((view_size + step)*2) + 223)>=window.get_screen().get_height(): + # cancle, because increasing the view size would lead to a heigth which is bigger than the screen hight (crash) + return + + # calculate new view size + view_size += step * direction + + # redraw all views + self.redraw_all() + + def set_zoom(self, widget, direction): + global view_zoom + + step = 0.25 + + # check if zooming out the view size would lead to a zoom factor of 0 + if direction<0 and view_zoom<=step: + return + + # calculate new zoom factor + view_zoom += step * direction + + # redraw all views + self.redraw_all() + + def reset_zoom(self, widget): + global view_zoom + + # reset the zoom factor + view_zoom = 1 + + # redraw all views + self.redraw_all() + + def set_x_position(self, widget, direction): + global view_x_position + + step = 50 + + # calculate new x position + view_x_position += step * direction + + # redraw all views + self.redraw_all() + + def set_y_position(self, widget, direction): + global view_y_position + + step = 50 + + # calculate new y position + view_y_position += step * direction + + # redraw all views + self.redraw_all() + + def reset_offset(self, widget): + global view_x_position, view_y_position + + # reset x- and y-position + view_x_position = 0 + view_y_position = 0 + + # redraw all views + self.redraw_all() + + def set_edge_rendition(self, widget, rendition): + pass + +screen.views = views(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + #self.bar.append_space(3) + parent.attach(self.bar, 0, 2, 0, 1) + self.bar.show() + + # create the "decrease view" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/decrease_size.png') + + # add the "decrease view" button + self.bar.append_item('decrease view', 'decrease the size of the 3 views', '', image, screen.views.set_size, -1) + + # create the "increase view" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/increase_size.png') + + # add the "increase view" button + self.bar.append_item('increase view', 'increase the size of the 3 views', '', image, screen.views.set_size, 1) + + # insert a spacer + self.bar.append_space() + + # create the "zoom out" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/zoom_out.png') + + # add the "zoom out" button + self.bar.append_item('zoom out', 'zoom out', '', image, screen.views.set_zoom, -1) + + # create the "zoom in" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/zoom_in.png') + + # add the "zoom in" button + self.bar.append_item('zoom in', 'zoom in', '', image, screen.views.set_zoom, 1) + + # create the "reset zoom" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') + + # add the "reset zoom" button + self.bar.append_item('reset zoom', 'reset the zoom factor for the model', '', image, screen.views.reset_zoom) + + # insert a spacer + self.bar.append_space() + + # create the "move left" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_left.png') + + # add the "move left" button + self.bar.append_item('move left', 'move the model to the left', '', image, screen.views.set_x_position, -1) + + # create the "move right" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_right.png') + + # add the "move right" button + self.bar.append_item('move right', 'move the model to the right', '', image, screen.views.set_x_position, 1) + + # create the "move down" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_down.png') + + # add the "move down" button + self.bar.append_item('move down', 'move the model downwards', '', image, screen.views.set_y_position, 1) + + # create the "move up" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_up.png') + + # add the "move up" button + self.bar.append_item('move up', 'move the model upwards', '', image, screen.views.set_y_position, -1) + + # create the "reset offset" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/reset_offset.png') + + # add the "reset offset" button + self.bar.append_item('reset offset', 'reset the offset of the model', '', image, screen.views.reset_offset) + + # insert a spacer + self.bar.append_space() + + # create the "full covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_full.png') + + # add the "full covered" button + self.bar.append_item('full covered', 'draw the covered edges like the uncovered edges', '', image, screen.views.set_edge_rendition, 'full') + + # create the "dash covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_dashed.png') + + # add the "dash covered" button + self.bar.append_item('dash covered', 'draw the covered edges with a dashed line', '', image, screen.views.set_edge_rendition, 'dashed') + + # create the "hide covered" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/edge_rendition_-_hide.png') + + # add the "hide covered" button + self.bar.append_item('hide covered', 'don\'t draw the covered edges', '', image, screen.views.set_edge_rendition, 'hide') + +tools(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/frames/view_the_model.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -0,0 +1,9 @@ +# -*- coding: cp1252 -*- + +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() + +# load frame: "view the model:" +execfile(path[0] + '/scripts/screens/project/canvas/frames/view_the_model.py') \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/canvas/index.py ___________________________________________________________________ Added: svn:eol-style + native Added: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py (rev 0) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -0,0 +1,180 @@ +# show the frame +frame = gtk.Frame('start a new project:') +screen.frame_table.attach(frame, 0, 1, 0, 1, xpadding = 3) +frame.show() + +# show a table +table = gtk.Table() +frame.add(table) +table.show() + +class raw_file: + def __init__(self, parent): + # show "select a *.raw file containing the raw faces of the model (use the export function in blender):" + text = gtk.Label('select a *.raw file containing the raw faces of the model (use the export function in blender):') + parent.attach(text, 0, 1, 0, 1, xpadding = 2) + text.show() + + # show button to open the file selection window + button = gtk.Button('select') + parent.attach(button, 1, 2, 0, 1, xpadding = 2, ypadding = 2) + button.show() + + # add function to show the file selection window + button.connect('clicked', lambda x: self.show_file_selection_window()) + + def show_file_selection_window(self): + # show file selection window + self.file_selection_window = gtk.FileSelection() + self.file_selection_window.set_border_width(2) + self.file_selection_window.show() + + # add functions to the buttons of the file selection window + self.file_selection_window.ok_button.connect('clicked', lambda x: self.save_file_name()) + self.file_selection_window.cancel_button.connect('clicked', lambda x: self.destroy_file_selection_window()) + + def destroy_file_selection_window(self): + # destroy the window + self.file_selection_window.destroy() + + def save_file_name(self): + # save the file name + self.name = self.file_selection_window.get_filename() + + # add the loading process to the background processes + background_processes.add('loading raw faces file', self.load) + + # destroy the window + self.destroy_file_selection_window() + + # show next screen + show_screen('project/canvas') + + def load(self): + # open the file + file = open(self.name, 'r') + + # read the lines + lines = file.readlines() + + # close the file + file.close() + + try: + global model + except: + pass + + # create a new array for the model + model = {} + + # create a new array for the faces + model['faces'] = [] + + # create new arrays for the dimensions + model['dimensions'] = {} + model['dimensions'][0] = {} # x + model['dimensions'][1] = {} # x + model['dimensions'][2] = {} # z + + # define min and max coordinates for the x-axis + model['dimensions'][0]['min'] = 999999 + model['dimensions'][0]['max'] = -999999 + + # define min and max coordinates for the y-axis + model['dimensions'][1]['min'] = 999999 + model['dimensions'][1]['max'] = -999999 + + # define min and max coordinates for the z-axis + model['dimensions'][2]['min'] = 999999 + model['dimensions'][2]['max'] = -999999 + + # create a new array for the edges + model['edges'] = [] + + for line in lines: + # trim whitespaces + line = line.strip() + + # split at the " " + face = line.split(' ') + + # reset/create an array for the new face + face_new = [] + + while face: + # reset/create an array for a vertice + vertice = [] + + # grab x, y and z coordinate + x = float(face.pop(0)) + y = float(face.pop(0)) + z = float(face.pop(0)) + + # save the new min and max values + self.save_min_and_max(x, y, z) + + # save the coordinates as a vertice + vertice.append(x) + vertice.append(y) + vertice.append(z) + + # add the vertice to the new face array + face_new.append(vertice) + + # save the new face in the model['faces'] array + model['faces'].append(face_new) + + # save the edges of the face + self.save_edges(face_new) + + # update length values + model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] + model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] + model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] + model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) + + def save_min_and_max(self, x, y, z): + # update min coorinate for the x-axis + if x<model['dimensions'][0]['min']: + model['dimensions'][0]['min'] = x + + # update max coorinate for the x-axis + if x>model['dimensions'][0]['max']: + model['dimensions'][0]['max'] = x + + # update min coorinate for the y-axis + if y<model['dimensions'][1]['min']: + model['dimensions'][1]['min'] = y + + # update max coorinate for the y-axis + if y>model['dimensions'][1]['max']: + model['dimensions'][1]['max'] = y + + # update min coorinate for the z-axis + if z<model['dimensions'][2]['min']: + model['dimensions'][2]['min'] = z + + # update max coorinate for the z-axis + if z>model['dimensions'][2]['max']: + model['dimensions'][2]['max'] = z + + def save_edges(self, face): + for vertice_number, vertice_content in enumerate(face): + first_vertice = vertice_content + + try: + second_vertice = face[vertice_number + 1] + except: + second_vertice = face[0] + + self.save_edge(first_vertice, second_vertice) + + def save_edge(self, first_vertice, second_vertice): + for edge in model['edges']: + if edge==[first_vertice, second_vertice] or edge==[second_vertice, first_vertice]: + return false + + model['edges'].append([first_vertice, second_vertice]) + +raw_file(table) \ No newline at end of file Property changes on: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/frames/start_a_new_project.py ___________________________________________________________________ Added: svn:eol-style + native Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-21 12:43:55 UTC (rev 1055) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/new/index.py 2009-02-21 14:52:09 UTC (rev 1056) @@ -1,183 +1,9 @@ # -*- coding: cp1252 -*- -# show frame -screen.frame = gtk.Frame('start a new project:') -screen.put(screen.frame, 0, 2) -screen.frame.show() +# show a table for the frames +screen.frame_table = gtk.Table() +screen.add(screen.frame_table) +screen.frame_table.show() -# show a table -table = gtk.Table() -table.set_row_spacings(2) -screen.frame.add(table) -table.show() - -class raw_file: - def __init__(self, parent): - # show "select a *.raw file containing the raw faces of the model (use the export function in blender):" - text = gtk.Label('select a *.raw file containing the raw faces of the model (use the export function in blender):') - parent.attach(text, 0, 1, 0, 1, xpadding = 2) - text.show() - - # show button to open the file selection window - button = gtk.Button('select') - parent.attach(button, 1, 2, 0, 1, xpadding = 2, ypadding = 2) - button.show() - - # add function to show the file selection window - button.connect('clicked', lambda x: self.show_file_selection_window()) - - def show_file_selection_window(self): - # show file selection window - self.file_selection_window = gtk.FileSelection() - self.file_selection_window.set_border_width(2) - self.file_selection_window.show() - - # add functions to the buttons of the file selection window - self.file_selection_window.ok_button.connect('clicked', lambda x: self.save_file_name()) - self.file_selection_window.cancel_button.connect('clicked', lambda x: self.destroy_file_selection_window()) - - def destroy_file_selection_window(self): - # destroy the window - self.file_selection_window.destroy() - - def save_file_name(self): - # save the file name - self.name = self.file_selection_window.get_filename() - - # add the loading process to the background processes - background_processes.add('loading raw faces file', self.load) - - # destroy the window - self.destroy_file_selection_window() - - # show next screen - show_screen('project/view_model') - - def load(self): - # open the file - file = open(self.name, 'r') - - # read the lines - lines = file.readlines() - - # close the file - file.close() - - try: - global model - except: - pass - - # create a new array for the model - model = {} - - # create a new array for the faces - model['faces'] = [] - - # create new arrays for the dimensions - model['dimensions'] = {} - model['dimensions'][0] = {} # x - model['dimensions'][1] = {} # x - model['dimensions'][2] = {} # z - - # define min and max coordinates for the x-axis - model['dimensions'][0]['min'] = 999999 - model['dimensions'][0]['max'] = -999999 - - # define min and max coordinates for the y-axis - model['dimensions'][1]['min'] = 999999 - model['dimensions'][1]['max'] = -999999 - - # define min and max coordinates for the z-axis - model['dimensions'][2]['min'] = 999999 - model['dimensions'][2]['max'] = -999999 - - # create a new array for the edges - model['edges'] = [] - - for line in lines: - # trim whitespaces - line = line.strip() - - # split at the " " - face = line.split(' ') - - # reset/create an array for the new face - face_new = [] - - while face: - # reset/create an array for a vertice - vertice = [] - - # grab x, y and z coordinate - x = float(face.pop(0)) - y = float(face.pop(0)) - z = float(face.pop(0)) - - # save the new min and max values - self.save_min_and_max(x, y, z) - - # save the coordinates as a vertice - vertice.append(x) - vertice.append(y) - vertice.append(z) - - # add the vertice to the new face array - face_new.append(vertice) - - # save the new face in the model['faces'] array - model['faces'].append(face_new) - - # save the edges of the face - self.save_edges(face_new) - - # update length values - model['dimensions'][0]['length'] = model['dimensions'][0]['max'] - model['dimensions'][0]['min'] - model['dimensions'][1]['length'] = model['dimensions'][1]['max'] - model['dimensions'][1]['min'] - model['dimensions'][2]['length'] = model['dimensions'][2]['max'] - model['dimensions'][2]['min'] - model['dimensions']['maximum_length'] = max(model['dimensions'][0]['length'], model['dimensions'][1]['length'], model['dimensions'][2]['length']) - - def save_min_and_max(self, x, y, z): - # update min coorinate for the x-axis - if x<model['dimensions'][0]['min']: - model['dimensions'][0]['min'] = x - - # update max coorinate for the x-axis - if x>model['dimensions'][0]['max']: - model['dimensions'][0]['max'] = x - - # update min coorinate for the y-axis - if y<model['dimensions'][1]['min']: - model['dimensions'][1]['min'] = y - - # update max coorinate for the y-axis - if y>model['dimensions'][1]['max']: - model['dimensions'][1]['max'] = y - - # update min coorinate for the z-axis - if z<model['dimensions'][2]['min']: - model['dimensions'][2]['min'] = z - - # update max coorinate for the z-axis - if z>model['dimensions'][2]['max']: - model['dimensions'][2]['max'] = z - - def save_edges(self, face): - for vertice_number, vertice_content in enumerate(face): - first_vertice = vertice_content - - try: - second_vertice = face[vertice_number + 1] - except: - second_vertice = face[0] - - self.save_edge(first_vertice, second_vertice) - - def save_edge(self, first_vertice, second_vertice): - for edge in model['edges']: - if edge==[first_vertice, second_vertice] or edge==[second_vertice, first_vertice]: - return false - - model['edges'].append([first_vertice, second_vertice]) - -screen.raw_file = raw_file(table) \ No newline at end of file +# load frame: "start a new project:" +execfile(path[0] + '/scripts/screens/project/new/frames/start_a_new_project.py') \ No newline at end of file Modified: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/change_size.pspimage =================================================================== (Binary files differ) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/edge_rendition.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 12:44:08
|
Revision: 1055 http://opengate.svn.sourceforge.net/opengate/?rev=1055&view=rev Author: Ultrasick Date: 2009-02-21 12:43:55 +0000 (Sat, 21 Feb 2009) Log Message: ----------- + adding buttons to reset the zoom factor and the offset + fixing a bug regarding automatical redrawing of the 3 views + moving button images around Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/view/ branches/ogEditor/data/modules/texturizer/graphic/buttons/view/decrease_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/increase_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_offset.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_zoom.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/ templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/change_size.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png Removed Paths: ------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png =================================================================== (Binary files differ) Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/decrease_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/decrease_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/increase_size.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/increase_size.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_offset.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_offset.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_zoom.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset_zoom.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png =================================================================== (Binary files differ) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 10:49:38 UTC (rev 1054) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 12:43:55 UTC (rev 1055) @@ -12,141 +12,35 @@ screen.frame.add(table) table.show() -class tools: - def __init__(self, parent): - # create an empty toolbar - self.bar = gtk.Toolbar() - #self.bar.append_space(3) - parent.attach(self.bar, 0, 2, 0, 1) - self.bar.show() - - # create the "decrease view size" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/decrease_view_size.png') - - # add the "decrease view size" button - self.bar.append_item('decrease view size', 'decrease the view size', '', image, self.change_view_size, -1) - - # create the "increase view size" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/increase_view_size.png') - - # add the "increase view size" button - self.bar.append_item('increase view size', 'increase the view size', '', image, self.change_view_size, 1) - - # create the "zoom out" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/zoom_out.png') - - # add the "zoom out" button - self.bar.append_item('zoom out', 'zoom out', '', image, self.change_view_zoom, -1) - - # create the "zoom in" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/zoom_in.png') - - # add the "zoom in" button - self.bar.append_item('zoom in', 'zoom in', '', image, self.change_view_zoom, 1) - - # create the "move left" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/move_left.png') - - # add the "move left" button - self.bar.append_item('move left', 'move the model left', '', image, self.change_view_x_position, -1) - - # create the "move right" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/move_right.png') - - # add the "move right" button - self.bar.append_item('move right', 'move the model right', '', image, self.change_view_x_position, 1) - - # create the "move down" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/move_down.png') - - # add the "move down" button - self.bar.append_item('move down', 'move the model down', '', image, self.change_view_y_position, 1) - - # create the "move up" icon - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/buttons/move_up.png') - - # add the "move up" button - self.bar.append_item('move up', 'move the model up', '', image, self.change_view_y_position, -1) - - def change_view_size(self, widget, direction): - global view_size - - step = 50 - - # check if the decreasing the view size would lead to a width of 0 - if direction<1 and view_size<=step: - return - - # calculate new view size - view_size += step * direction - - # redraw all views - screen.views.draw_all() - - def change_view_zoom(self, widget, direction): - global view_zoom - - step = 0.25 - - # check if zooming out the view size would lead to a zoom factor of 0 - if direction<1 and view_zoom<=step: - return - - # calculate new zoom factor - view_zoom += step * direction - - # redraw all views - screen.views.draw_all() - - def change_view_x_position(self, widget, direction): - global view_x_position - - step = 50 - - # calculate new x position - view_x_position += step * direction - - # redraw all views - screen.views.draw_all() - - def change_view_y_position(self, widget, direction): - global view_y_position - - step = 50 - - # calculate new y position - view_y_position += step * direction - - # redraw all views - screen.views.draw_all() - -tools(table) - class views: def __init__(self, parent): # show top view self.top_view = gtk.DrawingArea() + self.top_view.set_size_request(view_size, view_size) parent.attach(self.top_view, 0, 1, 1, 2) self.top_view.show() + # set autoredraw + self.top_view.connect('expose_event', self.redraw, 'top_view') + # show front view self.front_view = gtk.DrawingArea() + self.front_view.set_size_request(view_size, view_size) parent.attach(self.front_view, 0, 1, 2, 3) self.front_view.show() + # set autoredraw + self.front_view.connect('expose_event', self.redraw, 'front_view') + # show side view self.side_view = gtk.DrawingArea() + self.side_view.set_size_request(view_size, view_size) parent.attach(self.side_view, 1, 2, 2, 3) self.side_view.show() + # set autoredraw + self.side_view.connect('expose_event', self.redraw, 'side_view') + # define the colors for the top view self.top_view.window.colors = {} @@ -165,24 +59,31 @@ for color_name, color_content in colors.items(): self.side_view.window.colors[color_name] = self.side_view.window.new_gc(foreground = self.side_view.window.get_colormap().alloc_color(color_content)) - # add to draw all views to the background processes - self.draw_all() + def redraw(self, widget, event, drawing_area): + if drawing_area=='top_view': + # add the drawing of the top view to the background processes + background_processes.add('drawing the top view', self.draw, 'top_view') + elif drawing_area=='front_view': + # add the drawing of the front view to the background processes + background_processes.add('drawing the front view', self.draw, 'front_view') + elif drawing_area=='side_view': + # add the drawing of the side view to the background processes + background_processes.add('drawing the side view', self.draw, 'side_view') - def draw_all(self): - # update sizes - self.top_view.set_size_request(view_size, view_size) - self.front_view.set_size_request(view_size, view_size) - self.side_view.set_size_request(view_size, view_size) + def redraw_all(self): + old_size = self.top_view.get_size_request()[0] - # add the drawing of the top view to the background processes - background_processes.add('drawing the top view', self.draw, 'top_view') + if old_size==view_size: + # redraw the views + self.redraw(none, none, 'top_view') + self.redraw(none, none, 'front_view') + self.redraw(none, none, 'side_view') + else: + # update the sizes (which redraws the views automatically) + self.top_view.set_size_request(view_size, view_size) + self.front_view.set_size_request(view_size, view_size) + self.side_view.set_size_request(view_size, view_size) - # add the drawing of the front view to the background processes - background_processes.add('drawing the front view', self.draw, 'front_view') - - # add the drawing of the side view to the background processes - background_processes.add('drawing the side view', self.draw, 'side_view') - def draw(self, drawing_area): # choose the right drawing area and axes if drawing_area=='top_view': @@ -229,5 +130,158 @@ # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + def change_size(self, widget, direction): + global view_size -screen.views = views(table) \ No newline at end of file + step = 50 + + if direction<0 and view_size<=step: + # cancle, because decreasing the view size would lead to a width of 0 + return + elif direction>0 and (((view_size + step)*2) + 195)>=window.get_screen().get_height(): + # cancle, because increasing the view size would lead to a heigth which is bigger than the screen hight (crash) + return + + # calculate new view size + view_size += step * direction + + # redraw all views + self.redraw_all() + + def change_zoom(self, widget, direction): + global view_zoom + + step = 0.25 + + # check if zooming out the view size would lead to a zoom factor of 0 + if direction<0 and view_zoom<=step: + return + + # calculate new zoom factor + view_zoom += step * direction + + # redraw all views + self.redraw_all() + + def reset_zoom(self, widget): + global view_zoom + + # reset the zoom factor + view_zoom = 1 + + # redraw all views + self.redraw_all() + + def change_x_position(self, widget, direction): + global view_x_position + + step = 50 + + # calculate new x position + view_x_position += step * direction + + # redraw all views + self.redraw_all() + + def change_y_position(self, widget, direction): + global view_y_position + + step = 50 + + # calculate new y position + view_y_position += step * direction + + # redraw all views + self.redraw_all() + + def reset_offset(self, widget): + global view_x_position, view_y_position + + # reset x- and y-position + view_x_position = 0 + view_y_position = 0 + + # redraw all views + self.redraw_all() + +screen.views = views(table) + +class tools: + def __init__(self, parent): + # create an empty toolbar + self.bar = gtk.Toolbar() + #self.bar.append_space(3) + parent.attach(self.bar, 0, 2, 0, 1) + self.bar.show() + + # create the "decrease view_size" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/decrease_size.png') + + # add the "decrease view size" button + self.bar.append_item('decrease view size', 'decrease size of the 3 views', '', image, screen.views.change_size, -1) + + # create the "increase view size" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/increase_size.png') + + # add the "increase view size" button + self.bar.append_item('increase view size', 'increase size of the 3 views', '', image, screen.views.change_size, 1) + + # create the "zoom out" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/zoom_out.png') + + # add the "zoom out" button + self.bar.append_item('zoom out', 'zoom out', '', image, screen.views.change_zoom, -1) + + # create the "zoom in" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/zoom_in.png') + + # add the "zoom in" button + self.bar.append_item('zoom in', 'zoom in', '', image, screen.views.change_zoom, 1) + + # create the "reset zoom" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/reset_zoom.png') + + # add the "reset zoom" button + self.bar.append_item('reset zoom', 'reset the zoom factor for the model', '', image, screen.views.reset_zoom) + + # create the "move left" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_left.png') + + # add the "move left" button + self.bar.append_item('move left', 'move the model to the left', '', image, screen.views.change_x_position, -1) + + # create the "move right" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_right.png') + + # add the "move right" button + self.bar.append_item('move right', 'move the model to the right', '', image, screen.views.change_x_position, 1) + + # create the "move down" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_down.png') + + # add the "move down" button + self.bar.append_item('move down', 'move the model downwards', '', image, screen.views.change_y_position, 1) + + # create the "move up" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/move_up.png') + + # add the "move up" button + self.bar.append_item('move up', 'move the model upwards', '', image, screen.views.change_y_position, -1) + + # create the "reset offset" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/view/reset_offset.png') + + # add the "reset offset" button + self.bar.append_item('reset offset', 'reset the offset of the model', '', image, screen.views.reset_offset) + +tools(table) \ No newline at end of file Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png =================================================================== (Binary files differ) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/change_size.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/change_size.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset.pspimage =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/reset.pspimage ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/view/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png =================================================================== (Binary files differ) Deleted: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 10:49:48
|
Revision: 1054 http://opengate.svn.sourceforge.net/opengate/?rev=1054&view=rev Author: Ultrasick Date: 2009-02-21 10:49:38 +0000 (Sat, 21 Feb 2009) Log Message: ----------- adding functionality to move the model left, right, up and down Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-21 10:08:10 UTC (rev 1053) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-21 10:49:38 UTC (rev 1054) @@ -13,4 +13,6 @@ # define some variables about the views view_size = 250 +view_x_position = 0 +view_y_position = 0 view_zoom = 1 \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 10:08:10 UTC (rev 1053) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 10:49:38 UTC (rev 1054) @@ -48,6 +48,34 @@ # add the "zoom in" button self.bar.append_item('zoom in', 'zoom in', '', image, self.change_view_zoom, 1) + # create the "move left" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/move_left.png') + + # add the "move left" button + self.bar.append_item('move left', 'move the model left', '', image, self.change_view_x_position, -1) + + # create the "move right" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/move_right.png') + + # add the "move right" button + self.bar.append_item('move right', 'move the model right', '', image, self.change_view_x_position, 1) + + # create the "move down" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/move_down.png') + + # add the "move down" button + self.bar.append_item('move down', 'move the model down', '', image, self.change_view_y_position, 1) + + # create the "move up" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/move_up.png') + + # add the "move up" button + self.bar.append_item('move up', 'move the model up', '', image, self.change_view_y_position, -1) + def change_view_size(self, widget, direction): global view_size @@ -78,6 +106,28 @@ # redraw all views screen.views.draw_all() + def change_view_x_position(self, widget, direction): + global view_x_position + + step = 50 + + # calculate new x position + view_x_position += step * direction + + # redraw all views + screen.views.draw_all() + + def change_view_y_position(self, widget, direction): + global view_y_position + + step = 50 + + # calculate new y position + view_y_position += step * direction + + # redraw all views + screen.views.draw_all() + tools(table) class views: @@ -169,14 +219,15 @@ # draw the edges for edge in model['edges']: # calculate the x position - position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) - position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + view_x_position # calculate the y position - position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) - position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + view_y_position # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) + screen.views = views(table) \ No newline at end of file Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_down.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_left.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_right.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/move_up.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 10:08:20
|
Revision: 1053 http://opengate.svn.sourceforge.net/opengate/?rev=1053&view=rev Author: Ultrasick Date: 2009-02-21 10:08:10 +0000 (Sat, 21 Feb 2009) Log Message: ----------- changeing button appearance a little for easier recognition Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage Modified: branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.png =================================================================== (Binary files differ) Modified: branches/ogEditor/data/modules/texturizer/graphic/buttons/increase_view_size.png =================================================================== (Binary files differ) Modified: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/decrease_view_size.pspimage =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-02-21 10:02:35
|
Revision: 1052 http://opengate.svn.sourceforge.net/opengate/?rev=1052&view=rev Author: Ultrasick Date: 2009-02-21 10:02:23 +0000 (Sat, 21 Feb 2009) Log Message: ----------- adding zooming functionality Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py Added Paths: ----------- branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png =================================================================== (Binary files differ) Property changes on: branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: branches/ogEditor/data/modules/texturizer/scripts/main/variables.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-21 08:34:45 UTC (rev 1051) +++ branches/ogEditor/data/modules/texturizer/scripts/main/variables.py 2009-02-21 10:02:23 UTC (rev 1052) @@ -11,5 +11,6 @@ colors['red'] = gtk.gdk.color_parse('#FF0000') colors['white'] = gtk.gdk.color_parse('#FFFFFF') -# define view size -view_size = 250 \ No newline at end of file +# define some variables about the views +view_size = 250 +view_zoom = 1 \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 08:34:45 UTC (rev 1051) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/view_model/index.py 2009-02-21 10:02:23 UTC (rev 1052) @@ -34,12 +34,26 @@ # add the "increase view size" button self.bar.append_item('increase view size', 'increase the view size', '', image, self.change_view_size, 1) + # create the "zoom out" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/zoom_out.png') + + # add the "zoom out" button + self.bar.append_item('zoom out', 'zoom out', '', image, self.change_view_zoom, -1) + + # create the "zoom in" icon + image = gtk.Image() + image.set_from_file(path[0] + '/graphic/buttons/zoom_in.png') + + # add the "zoom in" button + self.bar.append_item('zoom in', 'zoom in', '', image, self.change_view_zoom, 1) + def change_view_size(self, widget, direction): global view_size step = 50 - # check if the decreasing the view size would lead into 0 width + # check if the decreasing the view size would lead to a width of 0 if direction<1 and view_size<=step: return @@ -49,6 +63,21 @@ # redraw all views screen.views.draw_all() + def change_view_zoom(self, widget, direction): + global view_zoom + + step = 0.25 + + # check if zooming out the view size would lead to a zoom factor of 0 + if direction<1 and view_zoom<=step: + return + + # calculate new zoom factor + view_zoom += step * direction + + # redraw all views + screen.views.draw_all() + tools(table) class views: @@ -124,15 +153,15 @@ # calculate the center for the first axis axis_0_center = view_size - axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center -= (model['dimensions'][axis_0]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) axis_0_center /= 2 - axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center -= (model['dimensions'][axis_0]['min']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) # calculate the center for the second axis axis_1_center = view_size - axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * (view_size - 10) + axis_1_center -= (model['dimensions'][axis_1]['length']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) axis_1_center /= 2 - axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * (view_size - 10) + axis_1_center += (model['dimensions'][axis_1]['max']/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) # fill the background of the drawing area with white color drawing_area.draw_polygon(drawing_area.colors['white'], true, [(0, 0), (view_size, 0), (view_size, view_size), (0, view_size)]) @@ -140,12 +169,12 @@ # draw the edges for edge in model['edges']: # calculate the x position - position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center)) - position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * (view_size - 10) + axis_0_center)) + position_x_start = int(round((edge[0][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) + position_x_end = int(round((edge[1][axis_0]/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10) + axis_0_center)) # calculate the y position - position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * (view_size - 10)) + axis_1_center)) - position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * (view_size - 10)) + axis_1_center)) + position_y_start = int(round((((edge[0][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) + position_y_end = int(round((((edge[1][axis_1] * (-1))/model['dimensions']['maximum_length']) * ((view_size * view_zoom) - 10)) + axis_1_center)) # draw the edge drawing_area.draw_line(drawing_area.colors['black'], position_x_start, position_y_start, position_x_end, position_y_end) Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_in.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png =================================================================== (Binary files differ) Property changes on: templates/branches/ogEditor/data/modules/texturizer/graphic/buttons/zoom_out.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |