You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(47) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(140) |
Feb
(98) |
Mar
(152) |
Apr
(104) |
May
(71) |
Jun
(94) |
Jul
(169) |
Aug
(83) |
Sep
(47) |
Oct
(134) |
Nov
(7) |
Dec
(20) |
2004 |
Jan
(41) |
Feb
(14) |
Mar
(42) |
Apr
(47) |
May
(68) |
Jun
(143) |
Jul
(65) |
Aug
(29) |
Sep
(40) |
Oct
(34) |
Nov
(33) |
Dec
(97) |
2005 |
Jan
(29) |
Feb
(30) |
Mar
(9) |
Apr
(37) |
May
(13) |
Jun
(31) |
Jul
(22) |
Aug
(23) |
Sep
|
Oct
(37) |
Nov
(34) |
Dec
(117) |
2006 |
Jan
(48) |
Feb
(6) |
Mar
(2) |
Apr
(71) |
May
(10) |
Jun
(16) |
Jul
(7) |
Aug
(1) |
Sep
(14) |
Oct
(17) |
Nov
(25) |
Dec
(26) |
2007 |
Jan
(8) |
Feb
(2) |
Mar
(7) |
Apr
(26) |
May
|
Jun
(12) |
Jul
(30) |
Aug
(14) |
Sep
(9) |
Oct
(4) |
Nov
(7) |
Dec
(6) |
2008 |
Jan
(10) |
Feb
(10) |
Mar
(6) |
Apr
(8) |
May
|
Jun
(10) |
Jul
(18) |
Aug
(15) |
Sep
(16) |
Oct
(5) |
Nov
(3) |
Dec
(10) |
2009 |
Jan
(11) |
Feb
(2) |
Mar
|
Apr
(15) |
May
(31) |
Jun
(18) |
Jul
(11) |
Aug
(26) |
Sep
(52) |
Oct
(17) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <sv...@ww...> - 2008-03-26 05:41:41
|
Author: mkrose Date: 2008-03-25 22:41:33 -0700 (Tue, 25 Mar 2008) New Revision: 2226 Modified: trunk/csp/csplib/xml/XmlParser.cpp Log: Fix a couple warnings under gcc 4.2.3 Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2226 Modified: trunk/csp/csplib/xml/XmlParser.cpp =================================================================== --- trunk/csp/csplib/xml/XmlParser.cpp 2008-03-26 05:25:31 UTC (rev 2225) +++ trunk/csp/csplib/xml/XmlParser.cpp 2008-03-26 05:41:33 UTC (rev 2226) @@ -368,7 +368,10 @@ if (pResults.error != eXMLErrorNone) { // create message - char message[2000],*s1="",*s3=""; CSP_XMLCSTR s2=CSP_XMLSTRP(""); + char message[2000]; + const char *s1=""; + const char *s3=""; + CSP_XMLCSTR s2=CSP_XMLSTRP(""); if (pResults.error==eXMLErrorFirstTagNotFound) { s1="First Tag should be '"; s2=tag; s3="'.\n"; } sprintf(message, #ifdef _XMLUNICODE |
From: <sv...@ww...> - 2008-03-26 05:25:41
|
Author: mkrose Date: 2008-03-25 22:25:31 -0700 (Tue, 25 Mar 2008) New Revision: 2225 Modified: trunk/csp/tools/build/scons.py trunk/csp/tools/build/setup.py Log: Hack scons options hook to work with scons 0.97.0.r2680. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2225 Modified: trunk/csp/tools/build/scons.py =================================================================== --- trunk/csp/tools/build/scons.py 2008-03-11 15:42:52 UTC (rev 2224) +++ trunk/csp/tools/build/scons.py 2008-03-26 05:25:31 UTC (rev 2225) @@ -58,16 +58,26 @@ def GetOptions(): try: - return SCons.Script.Main.options + return SCons.Script.Main.OptionsParser.values except: - return SCons.Script.options # version 0.96.1 + # TODO remove these older accessors; hopefully OptionsParser + # is stable going forward. + try: + return SCons.Script.Main.options + except: + return SCons.Script.options # version 0.96.1 +# Remove this method. The only option that we access through it is num_jobs, +# which is available via GetOptions in scons 0.97. def GetSettableOptions(): try: return SCons.Script.Main.ssoptions except: - return SCons.Script.ssoptions # version 0.96.1 + try: + return SCons.Script.ssoptions # version 0.96.1 + except: + return GetOptions() def GetCommandlineTargets(): Modified: trunk/csp/tools/build/setup.py =================================================================== --- trunk/csp/tools/build/setup.py 2008-03-11 15:42:52 UTC (rev 2224) +++ trunk/csp/tools/build/setup.py 2008-03-26 05:25:31 UTC (rev 2225) @@ -192,7 +192,13 @@ def GlobalSetup(env, distributed=1, short_messages=None, default_message=None, config=None, with_swig=1, timer=1): options = scons.GetOptions() - ssoptions = scons.GetSettableOptions() + # TODO remove ssoptions altogether; options.num_jobs should work in 0.97 and newer + # versions of scons. + try: + ssoptions = scons.GetSettableOptions() + num_jobs = ssoptions.get('num_jobs') + except AttributeError: + num_jobs = options.num_jobs if default_message is not None: util.SetDefaultMessage(env, default_message) @@ -204,7 +210,7 @@ buildlog.InitializeLogging(env) if short_messages: buildlog.SetShortMessages(env) - if distributed and ssoptions.get('num_jobs') > 1: + if distributed and num_jobs > 1: scons.SetDistributed(env) util.AddPhonyTarget(env, 'config') SConsEnvironment.CopyEnvironment = util.CopyEnvironment |
From: <sv...@ww...> - 2008-03-11 15:43:01
|
Author: nsmoooose Date: 2008-03-11 08:42:52 -0700 (Tue, 11 Mar 2008) New Revision: 2224 Removed: branches/layout_tool_improvements/ Log: Removed folder since it has been merged to the trunk. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2224 |
Author: nsmoooose Date: 2008-03-11 08:15:56 -0700 (Tue, 11 Mar 2008) New Revision: 2223 Added: trunk/csp/tools/layout2/images/generic.png trunk/csp/tools/layout2/images/generic.svg trunk/csp/tools/layout2/scripts/ui/controls/DocumentNotebook.py Modified: trunk/csp/base/signals.py trunk/csp/tools/layout2/ trunk/csp/tools/layout2/scripts/document/Document.py trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc trunk/csp/tools/layout2/scripts/ui/LayoutApplication.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/commands/CloseCurrentDocumentCommand.py trunk/csp/tools/layout2/scripts/ui/commands/ReCompileDataArchiveCommand.py trunk/csp/tools/layout2/scripts/ui/controls/OutputWindow.py trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: Added better handling of documents in layout editor. No visible changes. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2223 Diff omitted (33333 bytes). |
From: <sv...@ww...> - 2008-02-26 19:59:58
|
Author: nsmoooose Date: 2008-02-26 11:59:49 -0800 (Tue, 26 Feb 2008) New Revision: 2222 Modified: trunk/csp/tools/layout/FeatureGraph.h trunk/csp/tools/layout/LayoutNodes.h trunk/csp/tools/layout/View.h trunk/csp/tools/layout2/cpp/FeatureGraph.h trunk/csp/tools/layout2/cpp/LayoutNodes.h trunk/csp/tools/layout2/cpp/Scene.cpp Log: Fixes for 64 bit compilation. Contributed by alexr Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2222 Modified: trunk/csp/tools/layout/FeatureGraph.h =================================================================== --- trunk/csp/tools/layout/FeatureGraph.h 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout/FeatureGraph.h 2008-02-26 19:59:49 UTC (rev 2222) @@ -39,7 +39,7 @@ virtual void onRefresh(); }; -typedef int CallbackId; +typedef size_t CallbackId; /** Class representing the entire layout node graph. Manages node selection, Modified: trunk/csp/tools/layout/LayoutNodes.h =================================================================== --- trunk/csp/tools/layout/LayoutNodes.h 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout/LayoutNodes.h 2008-02-26 19:59:49 UTC (rev 2222) @@ -89,7 +89,7 @@ virtual void accept(LayoutNodeVisitor &v)=0; virtual void traverse(LayoutNodeVisitor &v)=0; - unsigned int id() { return reinterpret_cast<unsigned int>(this); } + size_t id() { return reinterpret_cast<size_t>(this); } virtual void transform(osg::Matrix const &t) { osg::Matrix m = _move->getMatrix(); Modified: trunk/csp/tools/layout/View.h =================================================================== --- trunk/csp/tools/layout/View.h 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout/View.h 2008-02-26 19:59:49 UTC (rev 2222) @@ -52,7 +52,7 @@ virtual void onKey(std::string const &) {} }; -typedef int CallbackId; +typedef size_t CallbackId; /** View class for the 3D layout. Contains and provides access to the FeatureGraph Modified: trunk/csp/tools/layout2/cpp/FeatureGraph.h =================================================================== --- trunk/csp/tools/layout2/cpp/FeatureGraph.h 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout2/cpp/FeatureGraph.h 2008-02-26 19:59:49 UTC (rev 2222) @@ -41,7 +41,7 @@ virtual void onRefresh(); }; -typedef int CallbackId; +typedef size_t CallbackId; /** Class representing the entire layout node graph. Manages node selection, Modified: trunk/csp/tools/layout2/cpp/LayoutNodes.h =================================================================== --- trunk/csp/tools/layout2/cpp/LayoutNodes.h 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout2/cpp/LayoutNodes.h 2008-02-26 19:59:49 UTC (rev 2222) @@ -89,7 +89,7 @@ virtual void accept(LayoutNodeVisitor &v)=0; virtual void traverse(LayoutNodeVisitor &v)=0; - unsigned int id() { return reinterpret_cast<unsigned int>(this); } + size_t id() { return reinterpret_cast<size_t>(this); } virtual void transform(osg::Matrix const &t) { osg::Matrix m = _move->getMatrix(); Modified: trunk/csp/tools/layout2/cpp/Scene.cpp =================================================================== --- trunk/csp/tools/layout2/cpp/Scene.cpp 2008-02-26 19:41:06 UTC (rev 2221) +++ trunk/csp/tools/layout2/cpp/Scene.cpp 2008-02-26 19:59:49 UTC (rev 2222) @@ -74,4 +74,4 @@ csp::layout::FeatureGraph* csp::layout::Scene::graph() { return m_Implementation->m_FeatureGraph; -} \ No newline at end of file +} |
From: <sv...@ww...> - 2008-02-26 19:41:22
|
Author: nsmoooose Date: 2008-02-26 11:41:06 -0800 (Tue, 26 Feb 2008) New Revision: 2221 Added: trunk/csp/tools/layout2/scripts/document/SceneDocument.py Modified: trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: It is now possible to start the layout2 editor from linux without a crasch. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2221 Modified: trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp =================================================================== --- trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp 2008-02-20 18:26:56 UTC (rev 2220) +++ trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp 2008-02-26 19:41:06 UTC (rev 2221) @@ -18,6 +18,7 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US +#include <iostream> #include <strstream> #include <osgViewer/ViewerEventHandlers> #include <osgGA/TrackballManipulator> @@ -32,6 +33,7 @@ Ref<Scene> m_Scene; void init(OsgGraphicsWindow* window, Scene* scene) { + m_Window = window; m_Scene = scene; @@ -43,7 +45,7 @@ setState( new osg::State ); getState()->setGraphicsContext(this); - + if (_traits.valid() && _traits->sharedContext) { getState()->setContextID( _traits->sharedContext->getState()->getContextID() ); @@ -161,6 +163,7 @@ stream << " Distance: " << manipulator->getDistance(); stream << " Rotation: " << rotation._v[0] << ", " << rotation._v[1] << ", " << rotation._v[2] << ", " << rotation._v[3]; stream << std::ends; + return stream.str(); } @@ -172,4 +175,4 @@ csp::layout::FeatureGraph* csp::layout::OsgGraphicsWindow::graph() { return m_Implementation->m_Scene->graph(); -} \ No newline at end of file +} Modified: trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py =================================================================== --- trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py 2008-02-20 18:26:56 UTC (rev 2220) +++ trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py 2008-02-26 19:41:06 UTC (rev 2221) @@ -1,3 +1,4 @@ +from csp.base.signals import Signal class DocumentRegistry: """This class represents all opened documents. It can be @@ -6,9 +7,14 @@ def __init__(self): self.documents = [] + self.documentAddedSignal = Signal() + def GetDocumentAddedSignal(self): + return self.documentAddedSignal + def Add(self, document): self.documents.append(document) + self.documentAddedSignal.Emit(document) def GetByName(self, name): for document in self.documents: Added: trunk/csp/tools/layout2/scripts/document/SceneDocument.py =================================================================== --- trunk/csp/tools/layout2/scripts/document/SceneDocument.py (rev 0) +++ trunk/csp/tools/layout2/scripts/document/SceneDocument.py 2008-02-26 19:41:06 UTC (rev 2221) @@ -0,0 +1,19 @@ +from Document import Document + +class SceneDocument(Document): + """This document represents a scene of 3D objects.""" + + def __init__(self, name): + Document.__init__(self, name) + self.node = None + + def SetRootNode(self, node): + self.node = node + self.GetChangedSignal().Emit(self) + + def GetRootNode(self): + return self.node + + def Clear(self): + self.node = None + self.GetChangedSignal().Emit(self) Modified: trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc =================================================================== (Binary files differ) Modified: trunk/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-20 18:26:56 UTC (rev 2220) +++ trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-26 19:41:06 UTC (rev 2221) @@ -2,6 +2,8 @@ import wx import wx.richtext +from csp.tools.layout2.scripts.document.SceneDocument import SceneDocument + from ControlIdGenerator import ControlIdGenerator from CommandControlFactory import CommandControlFactory from controls.OutputWindow import OutputWindow @@ -28,7 +30,9 @@ # configuration object. application = wx.GetApp() - + documentRegistry = application.GetDocumentRegistry() + documentRegistry.GetDocumentAddedSignal().Connect(self.documentAdded_Signal) + # Create a control id generator. This is used by all helper classes # to actualy define an unique id for each control (menu, toolbar button) # etc. @@ -65,11 +69,11 @@ # To the left we have a project, properties and that type # of controls. To the right we have all opened documents. # And at the bottom we have the output panel. - splitter1 = wx.SplitterWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_NOBORDER) - propertyNotebook = wx.Notebook(splitter1, wx.ID_ANY, style=wx.NB_LEFT) - splitter2 = wx.SplitterWindow(splitter1, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_NOBORDER) - outputNotebook = wx.Notebook(splitter2, wx.ID_ANY) - documentNotebook = wx.Notebook(splitter2, wx.ID_ANY) + splitter1 = wx.SplitterWindow(self, wx.ID_ANY) + propertyNotebook = wx.Notebook(splitter1, wx.ID_ANY, style=wx.NB_TOP) + splitter2 = wx.SplitterWindow(splitter1, wx.ID_ANY) + outputNotebook = wx.Notebook(splitter2, wx.ID_ANY, style=wx.NB_TOP) + documentNotebook = wx.Notebook(splitter2, wx.ID_ANY, style=wx.NB_TOP) splitter1.SplitVertically(propertyNotebook, splitter2, 200) splitter2.SetSashGravity(1.0) splitter2.SplitHorizontally(documentNotebook, outputNotebook, -100) @@ -86,12 +90,6 @@ startPage.SetEditable(False) documentNotebook.AddPage(startPage, "Start") - # Add the scene control that is responsible for the 3D - # scene. - scenePage = SceneWindow(documentNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.BORDER_NONE, "GLCanvas", 0, wx.NullPalette) - documentNotebook.AddPage(scenePage, "Scene") - self.scene = scenePage - # Display the tree control with all files in this project. Also # register this instance so all command object can use it to # access the selected file or directory. @@ -101,15 +99,28 @@ ProjectTree.Instance = projectTreePage propertyNotebook.AddPage(projectTreePage, "Project") + + # Store some variables for later use + self.documentNotebook = documentNotebook + self.scene = None # Connect idle event. wx.EVT_IDLE(self, self.on_Idle) def on_Idle(self, event): # Only render when the scene is visible on screen. - if self.scene.IsShownOnScreen(): + if self.scene is not None and self.scene.IsShownOnScreen(): self.scene.Frame() event.RequestMore() + + def documentAdded_Signal(self, document): + # Add the scene control that is responsible for the 3D + # scene. + if isinstance(document, SceneDocument): + scenePage = SceneWindow(self.documentNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.BORDER_NONE, "GLCanvas", 0, wx.NullPalette) + scenePage.SetDocument(document) + self.documentNotebook.AddPage(scenePage, "Scene") + self.scene = scenePage def GetSceneWindow(self): return self.scene \ No newline at end of file Modified: trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py 2008-02-20 18:26:56 UTC (rev 2220) +++ trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py 2008-02-26 19:41:06 UTC (rev 2221) @@ -2,6 +2,7 @@ import os.path import wx from csp.tools.layout2.scripts.data import DataTree +from csp.tools.layout2.scripts.document.SceneDocument import SceneDocument from FileCommand import FileCommand class OpenCustomLayoutModelFileCommand(FileCommand): @@ -63,11 +64,14 @@ self._node_map = node_map node = node_map.getRoot() assert(node is not None and node.isGroup()) + + # Create a document and add the root node to it. This will in + # turn signal the document added signal that is caught in the gui. + # This will create a 3D view. + document = SceneDocument('Scene') + document.SetRootNode(node) + application.GetDocumentRegistry().Add(document) - sceneWindow = topWindow.GetSceneWindow() - sceneWindow.graphicsWindow.graph().setRoot(node) - node.thisown = 0 - self.UpdateTree(node) return 1 Modified: trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py 2008-02-20 18:26:56 UTC (rev 2220) +++ trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py 2008-02-26 19:41:06 UTC (rev 2221) @@ -24,7 +24,10 @@ self.graphicsWindow.connectToSetCurrent(self.on_SetCurrent) self.graphicsWindow.connectToSwapBuffers(self.on_SwapBuffers) - + + def SetDocument(self, document): + self.graphicsWindow.graph().setRoot(document.GetRootNode()) + def MoveCameraToHome(self): self.graphicsWindow.moveCameraToHome() |
From: <sv...@ww...> - 2008-02-20 18:27:05
|
Author: nsmoooose Date: 2008-02-20 10:26:56 -0800 (Wed, 20 Feb 2008) New Revision: 2220 Modified: trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py Log: Some small fixes related to layout tool. * fixed compiler warning in OsgGraphicsWindow * files and folders in the project tree is now sorted. * bitmap used in SelectDataDirectory.py is now aligned at center. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2220 Modified: trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h =================================================================== --- trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h 2008-02-19 20:53:02 UTC (rev 2219) +++ trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h 2008-02-20 18:26:56 UTC (rev 2220) @@ -48,7 +48,7 @@ VoidSignal SwapBuffers; OsgGraphicsWindow(); - ~OsgGraphicsWindow(); + virtual ~OsgGraphicsWindow(); /* Render a new frame. This method is used from the OnIdle event in wxPython. */ Modified: trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-19 20:53:02 UTC (rev 2219) +++ trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-20 18:26:56 UTC (rev 2220) @@ -16,7 +16,7 @@ bitmap = wx.Bitmap(os.path.join('images', 'splash.png')) bitmapControl = wx.StaticBitmap(self, wx.ID_ANY, bitmap) - horizontalSizer.Add(bitmapControl, flag=wx.RIGHT, border=10) + horizontalSizer.Add(bitmapControl, flag=wx.RIGHT|wx.ALIGN_CENTER, border=10) rightPanel = wx.Panel(self, wx.ID_ANY) horizontalSizer.Add(rightPanel, flag=wx.TOP|wx.BOTTOM|wx.RIGHT|wx.EXPAND, border=10, proportion=1) Modified: trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py 2008-02-19 20:53:02 UTC (rev 2219) +++ trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py 2008-02-20 18:26:56 UTC (rev 2220) @@ -29,12 +29,14 @@ self.nodeDictionary[self.baseDirectory] = self.AddRoot('CSP') for root, dirs, files in os.walk(directory): - # print(root) parentNode = self.nodeDictionary[root] if '.svn' in dirs: dirs.remove('.svn') if '_svn' in dirs: dirs.remove('_svn') + + dirs.sort() + files.sort() for subDirectory in dirs: newNode = self.AppendItem(parentNode, subDirectory) self.nodeDictionary[os.path.join(root, subDirectory)] = newNode |
From: <sv...@ww...> - 2008-02-19 20:53:12
|
Author: nsmoooose Date: 2008-02-19 12:53:02 -0800 (Tue, 19 Feb 2008) New Revision: 2219 Modified: trunk/csp/tools/layout2/scripts/ui/MainFrame.py Log: Small fix for displaying the start.txt file in the layout editor. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2219 Modified: trunk/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-17 14:58:09 UTC (rev 2218) +++ trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-19 20:53:02 UTC (rev 2219) @@ -82,7 +82,7 @@ # Add the first document to this window. startPage = wx.richtext.RichTextCtrl(documentNotebook) - startPage.GetBuffer().LoadFile("start.txt") + startPage.LoadFile("start.txt") startPage.SetEditable(False) documentNotebook.AddPage(startPage, "Start") |
From: <sv...@ww...> - 2008-02-17 14:58:16
|
Author: nsmoooose Date: 2008-02-17 06:58:09 -0800 (Sun, 17 Feb 2008) New Revision: 2218 Modified: trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py trunk/csp/tools/layout2/scripts/ui/commands/Command.py trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py Log: All command objects in the layout editor now has a output document set. This means that every command can print output very easily to the output window. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2218 Modified: trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py 2008-02-17 13:26:20 UTC (rev 2217) +++ trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py 2008-02-17 14:58:09 UTC (rev 2218) @@ -50,6 +50,18 @@ def Execute(self, event): """Bind this method to a wx event. When the event is fired the command will be executed.""" - print("Executing: " + self.command.__class__.__name__) + + # If possible we will print the command execution to the output document. + # We will also assign the output document to the command so the command can + # be able the print messages to the console. + application = wx.GetApp() + if application is not None: + documents = application.GetDocumentRegistry() + outputDocument = documents.GetByName('output') + if outputDocument is not None: + self.command.SetOutputDocument(outputDocument) + outputDocument.WriteLine("Executing: " + self.command.__class__.__name__) + + # Execute the command. self.command.Execute() event.Skip() \ No newline at end of file Modified: trunk/csp/tools/layout2/scripts/ui/commands/Command.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/commands/Command.py 2008-02-17 13:26:20 UTC (rev 2217) +++ trunk/csp/tools/layout2/scripts/ui/commands/Command.py 2008-02-17 14:58:09 UTC (rev 2218) @@ -4,6 +4,9 @@ """Base class for all command objects. Implement apropriate methods in your derived class to execute this command.""" + + def __init__(self): + self.outputDocument = None def GetCaption(self): """The name of the command to be displayed in a menu @@ -24,3 +27,8 @@ def Execute(self): pass + def SetOutputDocument(self, outputDocument): + self.outputDocument = outputDocument + + def GetOutputDocument(self): + return self.outputDocument \ No newline at end of file Modified: trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py 2008-02-17 13:26:20 UTC (rev 2217) +++ trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py 2008-02-17 14:58:09 UTC (rev 2218) @@ -3,9 +3,10 @@ import wx from csp.tools.layout2.scripts.data import DataTree from csp.tools.layout2.scripts.ui.controls.ProjectTree import ProjectTree +from Command import Command from FileCommandRegistry import FileCommandRegistry -class OpenSelectedFileCommand: +class OpenSelectedFileCommand(Command): """Opens the selected file in the project tree of this application. When this command is executed we are trying to identify the type of file we are loading and then |
From: <sv...@ww...> - 2008-02-17 13:26:29
|
Author: nsmoooose Date: 2008-02-17 05:26:20 -0800 (Sun, 17 Feb 2008) New Revision: 2217 Modified: trunk/csp/dist/win/demo/ trunk/csp/dist/win/devpack/ trunk/csp/dist/win/layout/ trunk/csp/dist/win/layout/demo.nsi Log: Modified the nullsoft installer package for the layout editor. This change makes it possible to redistribute the layout editor without having the development environment installed. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2217 Property changes on: trunk/csp/dist/win/demo ___________________________________________________________________ Name: svn:ignore + makedemo.log Thumbs.db Property changes on: trunk/csp/dist/win/devpack ___________________________________________________________________ Name: svn:ignore + Thumbs.db Property changes on: trunk/csp/dist/win/layout ___________________________________________________________________ Name: svn:ignore + build makedemo.log Thumbs.db *.exe Modified: trunk/csp/dist/win/layout/demo.nsi =================================================================== --- trunk/csp/dist/win/layout/demo.nsi 2008-02-17 10:20:31 UTC (rev 2216) +++ trunk/csp/dist/win/layout/demo.nsi 2008-02-17 13:26:20 UTC (rev 2217) @@ -1,20 +1,20 @@ ; Combat Simulator Project -; Windows demo installer script. +; Windows layout installer script. ; Requires one externally defined variable: -; VERSION - the demo version (e.g. "0.6"). The demo directory -; is expected to be csp-demo-${VERSION}. +; VERSION - the layout version (e.g. "0.6"). The layout directory +; is expected to be csp-layout-${VERSION}. ; Modern UI !include "MUI.nsh" !define WriteEnvStr_RegKey 'HKCU "Environment"' - Name "CSP Demo ${VERSION}" - OutFile "csp-demo-${VERSION}-installer.exe" + Name "CSP Layout ${VERSION}" + OutFile "csp-layout-${VERSION}-installer.exe" - InstallDir "$PROGRAMFILES\csp-demo-${VERSION}" - InstallDirRegKey HKCU "Software\csp-demo-${VERSION}" "" + InstallDir "$PROGRAMFILES\csp-layout-${VERSION}" + InstallDirRegKey HKCU "Software\csp-layout-${VERSION}" "" Var MUI_TEMP Var STARTMENU_FOLDER @@ -24,7 +24,7 @@ !define MUI_ABORTWARNING !define MUI_FINISHPAGE_RUN - !define MUI_FINISHPAGE_RUN_TEXT "Run demo" + !define MUI_FINISHPAGE_RUN_TEXT "Run layout editor" !define MUI_FINISHPAGE_RUN_FUNCTION LaunchLink !define MUI_FINISHPAGE_RUN_NOTCHECKED !define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README.txt" @@ -34,7 +34,7 @@ !define MUI_FINISHPAGE_LINK_LOCATION "http://csp.sf.net/wiki/Windows_Demo_0.6" !define MUI_FINISHPAGE_NOREBOOTSUPPORT - !insertmacro MUI_PAGE_LICENSE "csp-demo-${VERSION}\COPYING.txt" + !insertmacro MUI_PAGE_LICENSE "csp-layout-${VERSION}\COPYING.txt" !insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_STARTMENU Application $STARTMENU_FOLDER !insertmacro MUI_PAGE_INSTFILES @@ -46,19 +46,19 @@ !insertmacro MUI_LANGUAGE "English" VIProductVersion "${VERSION}.0.0" - VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Combat Simulator Project Demo" + VIAddVersionKey /LANG=${LANG_ENGLISH} "ProductName" "Combat Simulator Project Layout Editor" VIAddVersionKey /LANG=${LANG_ENGLISH} "Comments" "Visit http://csp.sf.net/wiki/Demo for more information." - VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "CSP Demo Installer" + VIAddVersionKey /LANG=${LANG_ENGLISH} "FileDescription" "CSP Layout Installer" VIAddVersionKey /LANG=${LANG_ENGLISH} "FileVersion" "${VERSION}" -Section "Demo" SecDemo +Section "Layout" SecLayout SetOutPath "$INSTDIR" - File /r "csp-demo-${VERSION}\*" + File /r "csp-layout-${VERSION}\*" ;Store installation folder - WriteRegStr HKCU "Software\csp-demo-${VERSION}" "" $INSTDIR + WriteRegStr HKCU "Software\csp-layout-${VERSION}" "" $INSTDIR ;Create uninstaller WriteUninstaller "$INSTDIR\Uninstall.exe" @@ -68,8 +68,8 @@ CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\Uninstall.lnk" "$INSTDIR\Uninstall.exe" CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\readme.lnk" "$INSTDIR\README.txt" SetOutPath "$INSTDIR\bin" - CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\sim.lnk" "$INSTDIR\bin\sim.exe" "" "" "" "" "" "Run demo" - CreateShortCut "$INSTDIR\sim.lnk" "$INSTDIR\bin\sim.exe" "" "" "" "" "" "Run demo" + CreateShortCut "$SMPROGRAMS\$STARTMENU_FOLDER\layout.lnk" "$INSTDIR\bin\layout.exe" "" "" "" "" "" "Run layout editor" + CreateShortCut "$INSTDIR\layout.lnk" "$INSTDIR\bin\layout.exe" "" "" "" "" "" "Run layout editor" SetOutPath "$INSTDIR" !insertmacro MUI_STARTMENU_WRITE_END @@ -81,7 +81,7 @@ !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP Delete "$SMPROGRAMS\$MUI_TEMP\Uninstall.lnk" - Delete "$SMPROGRAMS\$MUI_TEMP\sim.lnk" + Delete "$SMPROGRAMS\$MUI_TEMP\layout.lnk" Delete "$SMPROGRAMS\$MUI_TEMP\readme.lnk" StrCpy $MUI_TEMP "$SMPROGRAMS\$MUI_TEMP" startMenuDeleteLoop: @@ -92,11 +92,11 @@ StrCmp $MUI_TEMP $SMPROGRAMS startMenuDeleteLoopDone startMenuDeleteLoop startMenuDeleteLoopDone: - DeleteRegKey /ifempty HKCU "Software\csp-demo-${VERSION}" + DeleteRegKey /ifempty HKCU "Software\csp-layout-${VERSION}" SectionEnd Function LaunchLink - ExecShell "" "$INSTDIR\sim.lnk" + ExecShell "" "$INSTDIR\layout.lnk" FunctionEnd |
Author: nsmoooose Date: 2008-02-17 02:20:31 -0800 (Sun, 17 Feb 2008) New Revision: 2216 Added: trunk/csp/base/signals.py trunk/csp/tools/layout2/images/package-x-generic.png trunk/csp/tools/layout2/images/package-x-generic.svg trunk/csp/tools/layout2/scripts/document/ trunk/csp/tools/layout2/scripts/document/Document.py trunk/csp/tools/layout2/scripts/document/DocumentRegistry.py trunk/csp/tools/layout2/scripts/document/OutputDocument.py trunk/csp/tools/layout2/scripts/document/__init__.py trunk/csp/tools/layout2/scripts/ui/commands/CloseCurrentDocumentCommand.py trunk/csp/tools/layout2/scripts/ui/commands/ReCompileDataArchiveCommand.py trunk/csp/tools/layout2/scripts/ui/controls/OutputWindow.py Removed: trunk/csp/tools/data/debug.py Modified: trunk/csp/bin/sim.py trunk/csp/tools/data/compile.py trunk/csp/tools/data/parse.py trunk/csp/tools/layout2/cpp/ModelLoader.cpp trunk/csp/tools/layout2/images/ trunk/csp/tools/layout2/scripts/ui/LayoutApplication.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: Layout editor: * It is now possible to recompile the sim.dar file directly from the editor. * The editor has now an output window. Compilation of sim.dar is displayed here. Archive compiler: * Re factored to not write to the console window. Every compiler message is signaled using a observer listener pattern. * Simplified the compiler a little. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2216 Diff omitted (52156 bytes). |
From: <sv...@ww...> - 2008-02-03 19:17:27
|
Author: nsmoooose Date: 2008-02-03 11:17:18 -0800 (Sun, 03 Feb 2008) New Revision: 2215 Modified: trunk/csp/tools/data/parse.py trunk/csp/tools/layout2/__init__.py trunk/csp/tools/layout2/layout.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py Log: Some layout tool related changes: * It is now possible to recompile the sim.dar file from the layout tool. * Fixed missing inheritance in FileCommand class. * Removed check for a single instance of ObjectXMLArchive. Didn't find any reason for this check. * Path must be converted to utf8 in order for swig to handle it correctly. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2215 Modified: trunk/csp/tools/data/parse.py =================================================================== --- trunk/csp/tools/data/parse.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/data/parse.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -629,12 +629,7 @@ class ObjectXMLArchive: - MASTER = None - def __init__(self, prefix, path): - if ObjectXMLArchive.MASTER is not None: - raise "Can only create one ObjectXMLArchive object" - ObjectXMLArchive.MASTER = self self._basepath = path self._objects = {} self._paths = {} Modified: trunk/csp/tools/layout2/__init__.py =================================================================== --- trunk/csp/tools/layout2/__init__.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/__init__.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,5 +1,5 @@ import os -# this path hack allows the csplib extension module to be loaded +# this path hack allows the layout extension module to be loaded # transparently from the .bin directory. extending rather than # replacing __path__ is necessary for py2exe imports to work. bin = os.path.join(os.path.dirname(__file__), '.bin') Modified: trunk/csp/tools/layout2/layout.py =================================================================== --- trunk/csp/tools/layout2/layout.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/layout.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,8 +1,29 @@ #!/usr/bin/env python +import os +import csp.csplib +import csp.cspsim + from csp.tools.layout2 import layout_module from csp.tools.layout2.scripts.ui.LayoutApplication import LayoutApplication +def loadModules(): + modules = ('chunklod', 'demeter') + extension = { + 'posix' : '.so', + 'nt' : '.dll', + }.get(os.name, '') + for module in modules: + module_path = os.path.join('..', '..', 'modules', module, '.bin', module) + extension + # for windows demos, the modules are instead placed in the current directory. + # TODO move them to ../modules/*.dll? + if not os.path.exists(module_path): + module_path = os.path.join(module) + extension + if not csp.csplib.ModuleLoader.load(module_path): + print('Unable to load required extension module "%s"' % module) + +loadModules() + # Create the application object and run the main loop. app = LayoutApplication(0) app.MainLoop() Modified: trunk/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/MainFrame.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -10,6 +10,7 @@ from commands.MoveCameraToHomeCommand import MoveCameraToHomeCommand from commands.OpenSelectedFileCommand import OpenSelectedFileCommand from commands.QuitCommand import QuitCommand +from commands.ReCompileDataArchiveCommand import ReCompileDataArchiveCommand class MainFrame(wx.Frame): """This is the top window that contains all controls used by the layout editor. @@ -39,15 +40,15 @@ fileMenuCommands = [QuitCommand] viewMenuCommands = [MoveCameraToHomeCommand] - toolbarCommands = [OpenSelectedFileCommand, MoveCameraToHomeCommand] + toolsMenuCommands = [ReCompileDataArchiveCommand] + toolbarCommands = [OpenSelectedFileCommand, MoveCameraToHomeCommand, ReCompileDataArchiveCommand] # Menu items. menuBar = wx.MenuBar() - fileMenu = controlFactory.GenerateMenuItems(self, fileMenuCommands) - menuBar.Append(fileMenu, "File") - viewMenu = controlFactory.GenerateMenuItems(self, viewMenuCommands) - menuBar.Append(viewMenu, "View") + menuBar.Append(controlFactory.GenerateMenuItems(self, fileMenuCommands), "File") + menuBar.Append(controlFactory.GenerateMenuItems(self, viewMenuCommands), "View") + menuBar.Append(controlFactory.GenerateMenuItems(self, toolsMenuCommands), "Tools") self.SetMenuBar(menuBar) Modified: trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -88,7 +88,7 @@ self.directoryText.SetValue(directoryBrowser.GetPath()) def okButton_Click(self, event): - dataDirectory = self.directoryText.GetValue() + dataDirectory = self.directoryText.GetValue().encode('utf8') application = wx.GetApp() application.Configuration['LayoutApplication.DataDirectory'] = dataDirectory application.Configuration['LayoutApplication.XmlPath'] = os.path.join(dataDirectory, 'xml') Modified: trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py =================================================================== --- trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py 2008-02-03 10:17:39 UTC (rev 2214) +++ trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py 2008-02-03 19:17:18 UTC (rev 2215) @@ -1,6 +1,8 @@ #!/usr/bin/env python -class FileCommand: +from Command import Command + +class FileCommand(Command): """Base class for all command objects that involves files.""" def SetFileName(self, fileName): |
Author: nsmoooose Date: 2008-02-03 02:17:39 -0800 (Sun, 03 Feb 2008) New Revision: 2214 Added: trunk/csp/csplib/util/PythonCasts.h trunk/csp/csplib/util/PythonSignals.h trunk/csp/csplib/util/PythonSwig.h trunk/csp/csplib/util/swig/PythonSignals.i trunk/csp/data/xml/theater/balkan/vasi01.xml trunk/csp/data/xml/theater/balkan/vasi02.xml trunk/csp/dist/win/layout/ trunk/csp/dist/win/layout/README.makedemo trunk/csp/dist/win/layout/demo.nsi trunk/csp/dist/win/layout/logo.bmp trunk/csp/dist/win/layout/logo.ico trunk/csp/dist/win/layout/logo.xcf trunk/csp/dist/win/layout/makedemo.py trunk/csp/dist/win/layout/template/ trunk/csp/dist/win/layout/template/COPYING.txt trunk/csp/dist/win/layout/template/LICENSES/ trunk/csp/dist/win/layout/template/LICENSES/GPL-2.txt trunk/csp/dist/win/layout/template/LICENSES/GPL.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL-2.1.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL-2.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL.txt trunk/csp/dist/win/layout/template/LICENSES/libjpeg.txt trunk/csp/dist/win/layout/template/LICENSES/libpng.txt trunk/csp/dist/win/layout/template/LICENSES/openal.txt trunk/csp/dist/win/layout/template/LICENSES/osg.txt trunk/csp/dist/win/layout/template/LICENSES/python.txt trunk/csp/dist/win/layout/template/LICENSES/xiph.txt trunk/csp/dist/win/layout/template/LICENSES/zlib.txt trunk/csp/dist/win/layout/template/README.txt trunk/csp/tools/layout2/ trunk/csp/tools/layout2/SConscript trunk/csp/tools/layout2/__init__.py trunk/csp/tools/layout2/axes.osg trunk/csp/tools/layout2/cpp/ trunk/csp/tools/layout2/cpp/CspLayoutApplication.cpp trunk/csp/tools/layout2/cpp/CspLayoutApplication.h trunk/csp/tools/layout2/cpp/DynamicGrid.cpp trunk/csp/tools/layout2/cpp/DynamicGrid.h trunk/csp/tools/layout2/cpp/FeatureGraph.cpp trunk/csp/tools/layout2/cpp/FeatureGraph.h trunk/csp/tools/layout2/cpp/Handle.cpp trunk/csp/tools/layout2/cpp/Handle.h trunk/csp/tools/layout2/cpp/LayoutNodes.cpp trunk/csp/tools/layout2/cpp/LayoutNodes.h trunk/csp/tools/layout2/cpp/ModelLoader.cpp trunk/csp/tools/layout2/cpp/ModelLoader.h trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h trunk/csp/tools/layout2/cpp/Scene.cpp trunk/csp/tools/layout2/cpp/Scene.h trunk/csp/tools/layout2/images/ trunk/csp/tools/layout2/images/document-new.png trunk/csp/tools/layout2/images/document-new.svg trunk/csp/tools/layout2/images/document-open.png trunk/csp/tools/layout2/images/document-open.svg trunk/csp/tools/layout2/images/document-save.png trunk/csp/tools/layout2/images/document-save.svg trunk/csp/tools/layout2/images/edit-delete.png trunk/csp/tools/layout2/images/edit-delete.svg trunk/csp/tools/layout2/images/edit-redo.png trunk/csp/tools/layout2/images/edit-redo.svg trunk/csp/tools/layout2/images/edit-undo.png trunk/csp/tools/layout2/images/edit-undo.svg trunk/csp/tools/layout2/images/go-home.png trunk/csp/tools/layout2/images/go-home.svg trunk/csp/tools/layout2/images/quit.png trunk/csp/tools/layout2/images/quit.svg trunk/csp/tools/layout2/images/splash.png trunk/csp/tools/layout2/layout.i trunk/csp/tools/layout2/layout.py trunk/csp/tools/layout2/readme.txt trunk/csp/tools/layout2/scripts/ trunk/csp/tools/layout2/scripts/__init__.py trunk/csp/tools/layout2/scripts/data/ trunk/csp/tools/layout2/scripts/data/DataPath.py trunk/csp/tools/layout2/scripts/data/DataTree.py trunk/csp/tools/layout2/scripts/data/Object.py trunk/csp/tools/layout2/scripts/data/ObjectInterface.py trunk/csp/tools/layout2/scripts/data/__init__.py trunk/csp/tools/layout2/scripts/data/domtree.py trunk/csp/tools/layout2/scripts/ui/ trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc trunk/csp/tools/layout2/scripts/ui/LayoutApplication.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py trunk/csp/tools/layout2/scripts/ui/__init__.py trunk/csp/tools/layout2/scripts/ui/commands/ trunk/csp/tools/layout2/scripts/ui/commands/Command.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py trunk/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/QuitCommand.py trunk/csp/tools/layout2/scripts/ui/commands/__init__.py trunk/csp/tools/layout2/scripts/ui/controls/ trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py trunk/csp/tools/layout2/scripts/ui/controls/__init__.py trunk/csp/tools/layout2/start.txt trunk/csp/tools/python_signals/ trunk/csp/tools/python_signals/pysiggen.py trunk/csp/tools/python_signals/readme.txt Removed: trunk/csp/dist/win/layout/README.makedemo trunk/csp/dist/win/layout/demo.nsi trunk/csp/dist/win/layout/logo.bmp trunk/csp/dist/win/layout/logo.ico trunk/csp/dist/win/layout/logo.xcf trunk/csp/dist/win/layout/makedemo.py trunk/csp/dist/win/layout/template/ trunk/csp/dist/win/layout/template/COPYING.txt trunk/csp/dist/win/layout/template/LICENSES/ trunk/csp/dist/win/layout/template/LICENSES/GPL-2.txt trunk/csp/dist/win/layout/template/LICENSES/GPL.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL-2.1.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL-2.txt trunk/csp/dist/win/layout/template/LICENSES/LGPL.txt trunk/csp/dist/win/layout/template/LICENSES/libjpeg.txt trunk/csp/dist/win/layout/template/LICENSES/libpng.txt trunk/csp/dist/win/layout/template/LICENSES/openal.txt trunk/csp/dist/win/layout/template/LICENSES/osg.txt trunk/csp/dist/win/layout/template/LICENSES/python.txt trunk/csp/dist/win/layout/template/LICENSES/xiph.txt trunk/csp/dist/win/layout/template/LICENSES/zlib.txt trunk/csp/dist/win/layout/template/README.txt trunk/csp/tools/layout2/SConscript trunk/csp/tools/layout2/__init__.py trunk/csp/tools/layout2/axes.osg trunk/csp/tools/layout2/cpp/ trunk/csp/tools/layout2/cpp/CspLayoutApplication.cpp trunk/csp/tools/layout2/cpp/CspLayoutApplication.h trunk/csp/tools/layout2/cpp/DynamicGrid.cpp trunk/csp/tools/layout2/cpp/DynamicGrid.h trunk/csp/tools/layout2/cpp/FeatureGraph.cpp trunk/csp/tools/layout2/cpp/FeatureGraph.h trunk/csp/tools/layout2/cpp/Handle.cpp trunk/csp/tools/layout2/cpp/Handle.h trunk/csp/tools/layout2/cpp/LayoutNodes.cpp trunk/csp/tools/layout2/cpp/LayoutNodes.h trunk/csp/tools/layout2/cpp/ModelLoader.cpp trunk/csp/tools/layout2/cpp/ModelLoader.h trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp trunk/csp/tools/layout2/cpp/OsgGraphicsWindow.h trunk/csp/tools/layout2/cpp/Scene.cpp trunk/csp/tools/layout2/cpp/Scene.h trunk/csp/tools/layout2/images/ trunk/csp/tools/layout2/images/document-new.png trunk/csp/tools/layout2/images/document-new.svg trunk/csp/tools/layout2/images/document-open.png trunk/csp/tools/layout2/images/document-open.svg trunk/csp/tools/layout2/images/document-save.png trunk/csp/tools/layout2/images/document-save.svg trunk/csp/tools/layout2/images/edit-delete.png trunk/csp/tools/layout2/images/edit-delete.svg trunk/csp/tools/layout2/images/edit-redo.png trunk/csp/tools/layout2/images/edit-redo.svg trunk/csp/tools/layout2/images/edit-undo.png trunk/csp/tools/layout2/images/edit-undo.svg trunk/csp/tools/layout2/images/go-home.png trunk/csp/tools/layout2/images/go-home.svg trunk/csp/tools/layout2/images/quit.png trunk/csp/tools/layout2/images/quit.svg trunk/csp/tools/layout2/images/splash.png trunk/csp/tools/layout2/layout.i trunk/csp/tools/layout2/layout.py trunk/csp/tools/layout2/readme.txt trunk/csp/tools/layout2/scripts/ trunk/csp/tools/layout2/scripts/__init__.py trunk/csp/tools/layout2/scripts/data/ trunk/csp/tools/layout2/scripts/data/DataPath.py trunk/csp/tools/layout2/scripts/data/DataTree.py trunk/csp/tools/layout2/scripts/data/Object.py trunk/csp/tools/layout2/scripts/data/ObjectInterface.py trunk/csp/tools/layout2/scripts/data/__init__.py trunk/csp/tools/layout2/scripts/data/domtree.py trunk/csp/tools/layout2/scripts/ui/ trunk/csp/tools/layout2/scripts/ui/CommandControlFactory.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.py trunk/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc trunk/csp/tools/layout2/scripts/ui/LayoutApplication.py trunk/csp/tools/layout2/scripts/ui/MainFrame.py trunk/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py trunk/csp/tools/layout2/scripts/ui/__init__.py trunk/csp/tools/layout2/scripts/ui/commands/ trunk/csp/tools/layout2/scripts/ui/commands/Command.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py trunk/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py trunk/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py trunk/csp/tools/layout2/scripts/ui/commands/QuitCommand.py trunk/csp/tools/layout2/scripts/ui/commands/__init__.py trunk/csp/tools/layout2/scripts/ui/controls/ trunk/csp/tools/layout2/scripts/ui/controls/ProjectTree.py trunk/csp/tools/layout2/scripts/ui/controls/SceneWindow.py trunk/csp/tools/layout2/scripts/ui/controls/__init__.py trunk/csp/tools/layout2/start.txt trunk/csp/tools/python_signals/pysiggen.py trunk/csp/tools/python_signals/readme.txt Modified: trunk/csp/SConstruct trunk/csp/csplib/SConscript trunk/csp/cspsim/CSPSim.cpp trunk/csp/cspsim/Shader.cpp trunk/csp/cspsim/Shader.h trunk/csp/data/ui/scripts/ trunk/csp/data/ui/tutorials/ trunk/csp/data/ui/tutorials/takeoff/ trunk/csp/data/xml/theater/balkan/vasi.xml Log: Merged the layout2 tool to the trunk (tools/layout2 directory). It is not yet finished but new development will continue in the trunk. It is located in a separate directory and will not disturb the rest of the project. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2214 Diff omitted (1182397 bytes). |
From: <sv...@ww...> - 2008-02-03 09:22:44
|
Author: nsmoooose Date: 2008-02-03 01:22:36 -0800 (Sun, 03 Feb 2008) New Revision: 2213 Added: branches/layout_tool_improvements/csp/tools/layout2/images/splash.png branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py Log: Added a splash window to the layout tool. The splash window will also force you to select a valid data directory. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2213 Added: branches/layout_tool_improvements/csp/tools/layout2/images/splash.png =================================================================== (Binary files differ) Property changes on: branches/layout_tool_improvements/csp/tools/layout2/images/splash.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py 2008-01-31 07:44:18 UTC (rev 2212) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py 2008-02-03 09:22:36 UTC (rev 2213) @@ -6,6 +6,7 @@ from csp.tools.layout2.layout_module import * from MainFrame import MainFrame +from SelectDataDirectoryDialog import SelectDataDirectoryDialog class LayoutApplication(wx.App): # wxWindows calls this method to initialize the application @@ -25,28 +26,26 @@ self.Configuration = shelve.open('.csplayout') - defaultDataDirectory = self.Configuration.get('LayoutApplication.DataDirectory', '.') - directoryBrowser = wx.DirDialog(None, 'Select the data directory for your csp application', defaultDataDirectory) - if directoryBrowser.ShowModal() != wx.ID_OK: - return False - dataDirectory = directoryBrowser.GetPath() - self.Configuration['LayoutApplication.DataDirectory'] = dataDirectory - self.Configuration['LayoutApplication.XmlPath'] = os.path.join(dataDirectory, 'xml') + dlg = SelectDataDirectoryDialog(None, wx.ID_ANY, "CSP Theater Layout Tool") + if dlg.ShowModal() == wx.ID_OK: - datadirs = ('images', 'models', 'fonts', 'sounds') - pathlist = os.pathsep.join([os.path.join(dataDirectory, subdir) for subdir in datadirs]) - CspLayoutApplication.setOpenSceneGraphPathList(pathlist.encode('utf8')) - shaderPath = os.path.join(dataDirectory, 'shaders').encode('utf8') - CspLayoutApplication.setShaderPath(shaderPath) + dataDirectory = self.Configuration.get('LayoutApplication.DataDirectory', '.') + datadirs = ('images', 'models', 'fonts', 'sounds') + pathlist = os.pathsep.join([os.path.join(dataDirectory, subdir) for subdir in datadirs]) + CspLayoutApplication.setOpenSceneGraphPathList(pathlist.encode('utf8')) + shaderPath = os.path.join(dataDirectory, 'shaders').encode('utf8') + CspLayoutApplication.setShaderPath(shaderPath) - # Create an instance of our customized Frame class - frame = MainFrame(None, wx.ID_ANY, "CSP Theater Layout Tool") - frame.SetSize(wx.Size(800, 600)) - frame.Show(True) + # Create an instance of our customized Frame class + frame = MainFrame(None, wx.ID_ANY, "CSP Theater Layout Tool") + frame.SetSize(wx.Size(800, 600)) + frame.Show(True) - # Tell wxWindows that this is our main window - self.SetTopWindow(frame) + # Tell wxWindows that this is our main window + self.SetTopWindow(frame) - # Return a success flag - return True + # Return a success flag + return True + else: + return False Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/SelectDataDirectoryDialog.py 2008-02-03 09:22:36 UTC (rev 2213) @@ -0,0 +1,95 @@ +#!/usr/bin/env python +import wx +import os + +class SelectDataDirectoryDialog(wx.Dialog): + """A dialog to be used to display a splash window for + this layout tool. You must also select a valid data + directory for this application to work with. After + you press OK the main frame is loaded and you can begin + to edit your layout of CSP.""" + + def __init__(self, parent, id, title): + wx.Dialog.__init__(self, parent, id, title, style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER) + + horizontalSizer = wx.BoxSizer(wx.HORIZONTAL) + + bitmap = wx.Bitmap(os.path.join('images', 'splash.png')) + bitmapControl = wx.StaticBitmap(self, wx.ID_ANY, bitmap) + horizontalSizer.Add(bitmapControl, flag=wx.RIGHT, border=10) + + rightPanel = wx.Panel(self, wx.ID_ANY) + horizontalSizer.Add(rightPanel, flag=wx.TOP|wx.BOTTOM|wx.RIGHT|wx.EXPAND, border=10, proportion=1) + + verticalSizer = wx.BoxSizer(wx.VERTICAL) + cspLabel = wx.StaticText(rightPanel, wx.ID_ANY, 'Combat Simulator Project') + verticalSizer.Add(cspLabel) + + infoLabel = wx.StaticText(rightPanel, wx.ID_ANY, 'Select the data directory of your CSP installation.') + verticalSizer.Add(infoLabel) + + + directoryLabel = wx.StaticText(rightPanel, wx.ID_ANY, 'Directory:') + verticalSizer.Add(directoryLabel, border=5, flag=wx.TOP) + + directoryPanel = wx.Panel(rightPanel, wx.ID_ANY) + directoryText = wx.TextCtrl(directoryPanel, wx.ID_ANY, '') + directoryText.SetMinSize(wx.Size(300, directoryText.GetSize().GetHeight())) + browseDirectoryButton = wx.Button(directoryPanel, 6666, '...', size=wx.Size(20,20)) + directorySizer = wx.BoxSizer(wx.HORIZONTAL) + directorySizer.Add(directoryText, flag=wx.RIGHT, border=5) + directorySizer.Add(browseDirectoryButton, flag=wx.ALIGN_RIGHT) + directoryPanel.SetSizer(directorySizer) + verticalSizer.Add(directoryPanel, flag=wx.EXPAND, proportion=1) + + verticalSizer.AddStretchSpacer() + + buttonPanel = wx.Panel(rightPanel, wx.ID_ANY) + okButton = wx.Button(buttonPanel, wx.ID_OK, 'OK') + cancelButton = wx.Button(buttonPanel, wx.ID_CANCEL, 'Cancel') + buttonSizer = wx.BoxSizer(wx.HORIZONTAL) + buttonSizer.Add(okButton, border=5, flag=wx.RIGHT) + buttonSizer.Add(cancelButton) + buttonPanel.SetSizer(buttonSizer) + verticalSizer.Add(buttonPanel, border=5, flag=wx.TOP) + + rightPanel.SetSizer(verticalSizer) + + # Force the window to resize itself according to its content. + horizontalSizer.SetSizeHints(self) + + self.SetSizer(horizontalSizer) + + # Store a reference to the text control containing + # the selected directory. + self.directoryText = directoryText + application = wx.GetApp() + self.directoryText.SetValue(application.Configuration.get('LayoutApplication.DataDirectory', '.')) + + # Bind events to buttons + wx.EVT_BUTTON(self, wx.ID_OK, self.okButton_Click) + wx.EVT_BUTTON(self, 6666, self.browseDirectoryButton_Click) + + okButton.SetFocus() + + self.SetWindowStyle(wx.DEFAULT_DIALOG_STYLE) + + def browseDirectoryButton_Click(self, event): + # Use the current value in the text box. This will + # be the default directory in the directory browser. + defaultDataDirectory = self.directoryText.GetValue() + + # Show the directory browser. + directoryBrowser = wx.DirDialog(None, 'Select the data directory for your csp application', defaultDataDirectory) + if directoryBrowser.ShowModal() != wx.ID_OK: + return False + + # Set the choosen directory into the text box. + self.directoryText.SetValue(directoryBrowser.GetPath()) + + def okButton_Click(self, event): + dataDirectory = self.directoryText.GetValue() + application = wx.GetApp() + application.Configuration['LayoutApplication.DataDirectory'] = dataDirectory + application.Configuration['LayoutApplication.XmlPath'] = os.path.join(dataDirectory, 'xml') + self.EndModal(wx.ID_OK) \ No newline at end of file |
From: <sv...@ww...> - 2008-01-31 07:44:25
|
Author: nsmoooose Date: 2008-01-30 23:44:18 -0800 (Wed, 30 Jan 2008) New Revision: 2212 Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py Log: Added very basic file identification when you click on a file in the project tree. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2212 Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommandRegistry.py 2008-01-31 07:44:18 UTC (rev 2212) @@ -0,0 +1,30 @@ +#!/usr/bin/env python +import os + +from OpenCustomLayoutModelFileCommand import OpenCustomLayoutModelFileCommand + +class FileCommandRegistry: + """This is responsible for knowing what Command to execute + on different files. It is also responsible for identification + of files in order to choose the correct Command.""" + + def GetCommandForFile(self, fileName): + """Returns a Command to use for the file. If no command + can be found for that file type we return None.""" + if os.path.isfile(fileName) == False: + return None + + # Get the file name extension in lowercase. + command = None + extension = os.path.splitext(fileName)[1].lower() + if extension == '.xml': + command = OpenCustomLayoutModelFileCommand() + + # If we have found a command we set the fileName on it + # and returns it. + if command is not None: + command.SetFileName(fileName) + return command + + return None + Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py 2008-01-23 15:39:46 UTC (rev 2211) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py 2008-01-31 07:44:18 UTC (rev 2212) @@ -3,7 +3,7 @@ import wx from csp.tools.layout2.scripts.data import DataTree from csp.tools.layout2.scripts.ui.controls.ProjectTree import ProjectTree -from OpenCustomLayoutModelFileCommand import OpenCustomLayoutModelFileCommand +from FileCommandRegistry import FileCommandRegistry class OpenSelectedFileCommand: """Opens the selected file in the project tree of this @@ -21,10 +21,7 @@ return "document-open.png" def Execute(self): - """Load a feature group or feature model from the specified file. The existing - graph, if any, will be discarded. If file represents a feature model, a - default feature group is created at the root of the new graph. - """ + """Loads a document from the project tree.""" # Get the application object. This object is used to retreive the # configuration object and the top window for this application. @@ -44,8 +41,16 @@ if fileName is None: return - # Now it is time to identify the filetype of the selected file. - command = OpenCustomLayoutModelFileCommand() - command.SetFileName(fileName) - command.Execute() + # Now we have a file name and all apropriate data to identify + # the file selected. This is the responsibility of the + # FileCommandRegistry. Get a command and execute it. + fileRegistry = FileCommandRegistry() + command = fileRegistry.GetCommandForFile(fileName) + if command is not None: + command.Execute() + else: + messageDialog = wx.MessageDialog(topWindow, + 'Cannot find a FileCommand to execute on that file type.', + 'Error loading file', style = wx.OK|wx.ICON_ERROR) + messageDialog.ShowModal() |
Author: nsmoooose Date: 2008-01-23 07:39:46 -0800 (Wed, 23 Jan 2008) New Revision: 2211 Added: branches/layout_tool_improvements/csp/dist/win/layout/ branches/layout_tool_improvements/csp/tools/layout2/scripts/data/DataPath.py Modified: branches/layout_tool_improvements/csp/cspsim/CSPSim.cpp branches/layout_tool_improvements/csp/cspsim/Shader.cpp branches/layout_tool_improvements/csp/cspsim/Shader.h branches/layout_tool_improvements/csp/dist/win/layout/makedemo.py branches/layout_tool_improvements/csp/dist/win/layout/template/README.txt branches/layout_tool_improvements/csp/tools/layout/SConscript branches/layout_tool_improvements/csp/tools/layout2/scripts/data/DataTree.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py Log: Added python script to be able to package the theater layout application on windows. The package can be installed on a machine without the development environment installed. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2211 Diff omitted (17582 bytes). |
From: <sv...@ww...> - 2008-01-21 19:48:32
|
Author: nsmoooose Date: 2008-01-21 11:48:24 -0800 (Mon, 21 Jan 2008) New Revision: 2210 Added: branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.h Modified: branches/layout_tool_improvements/csp/tools/layout2/SConscript branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.h branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp branches/layout_tool_improvements/csp/tools/layout2/layout.i branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py Log: Added CspLayoutApplication. It works like a facade to all C++ setup operations for the layout application. These setup operations is needed in order for CSP to find models, shaders and textures etc. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2210 Modified: branches/layout_tool_improvements/csp/tools/layout2/SConscript =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/SConscript 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/SConscript 2008-01-21 19:48:24 UTC (rev 2210) @@ -22,6 +22,8 @@ name = 'layout_module', sources = [ 'layout.i', + 'cpp/CspLayoutApplication.cpp', + 'cpp/CspLayoutApplication.h', 'cpp/DynamicGrid.cpp', 'cpp/DynamicGrid.h', 'cpp/FeatureGraph.cpp', Added: branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.cpp =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.cpp (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.cpp 2008-01-21 19:48:24 UTC (rev 2210) @@ -0,0 +1,31 @@ +// CSPLayout +// Copyright 2003-2005 Mark Rose <mk...@us...> +// +// Based in part on osgpick sample code +// OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US + +#include <csp/cspsim/ObjectModel.h> +#include <csp/cspsim/Shader.h> +#include <csp/tools/layout2/cpp/CspLayoutApplication.h> + +void csp::layout::CspLayoutApplication::setOpenSceneGraphPathList(const std::string &pathlist) { + csp::ObjectModel::setDataFilePathList(pathlist); +} + +void csp::layout::CspLayoutApplication::setShaderPath(const std::string &path) { + Shader::instance()->setShaderPath(path); +} \ No newline at end of file Added: branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.h =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.h (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/CspLayoutApplication.h 2008-01-21 19:48:24 UTC (rev 2210) @@ -0,0 +1,43 @@ +// CSPLayout +// Copyright 2003-2005 Mark Rose <mk...@us...> +// +// Based in part on osgpick sample code +// OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, US + + +#ifndef __CSP_LAYOUT_CSPLAYOUTAPPLICATION_H__ +#define __CSP_LAYOUT_CSPLAYOUTAPPLICATION_H__ + +#include <csp/csplib/util/Referenced.h> + +namespace csp { +namespace layout { + +class CspLayoutApplication { +public: + // Set the pathlist (':' separated) for loading images, models, and fonts + // when creating ObjectModels. + static void setOpenSceneGraphPathList(const std::string &pathlist); + + static void setShaderPath(const std::string &path); +}; + +} // namespace layout +} // namespace csp + + +#endif // __CSP_LAYOUT_CSPLAYOUTAPPLICATION_H__ Modified: branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.cpp =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.cpp 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.cpp 2008-01-21 19:48:24 UTC (rev 2210) @@ -58,8 +58,3 @@ assert(model.valid()); return model->getModel(); } - -void csp::layout::setOpenSceneGraphPathList(std::string const &pathlist) { - csp::ObjectModel::setDataFilePathList(pathlist); -} - Modified: branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.h =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.h 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.h 2008-01-21 19:48:24 UTC (rev 2210) @@ -37,10 +37,6 @@ // Retrieve the scene graph for an FeatureModel osg::ref_ptr<osg::Node> getFeatureModel(csp::Object *object); -// Set the pathlist (':' separated) for loading images, models, and fonts -// when creating ObjectModels. -void setOpenSceneGraphPathList(std::string const &pathlist); - } // End namespace layout } // End namespace csp Modified: branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp 2008-01-21 19:48:24 UTC (rev 2210) @@ -22,6 +22,7 @@ #include <csp/tools/layout2/cpp/FeatureGraph.h> #include <csp/tools/layout2/cpp/Scene.h> #include <osg/Group> +// #include <osg/LightSource> class csp::layout::Scene::Implementation { public: @@ -31,8 +32,21 @@ Implementation() : m_FeatureGraph(new FeatureGraph) { m_RootNode = new osg::Group; + + /* + osg::ref_ptr<osg::LightSource> light = new osg::LightSource(); + light->setLight(new osg::Light()); + light->getLight()->setDiffuse(osg::Vec4(1,1,1,1)); + light->getLight()->setPosition(osg::Vec4(0,0,1,0)); + light->getLight()->setDirection(osg::Vec3(0,0,-1)); + light->getLight()->setLightNum(3); + light->setLocalStateSetModes(osg::StateAttribute::ON); + m_RootNode->addChild(light.get()); + */ + m_RootNode->addChild(m_FeatureGraph->getScene().get()); + m_DynamicGrid = new DynamicGrid; m_RootNode->addChild(m_DynamicGrid.get()); } Modified: branches/layout_tool_improvements/csp/tools/layout2/layout.i =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/layout.i 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/layout.i 2008-01-21 19:48:24 UTC (rev 2210) @@ -20,6 +20,7 @@ %{ #include <csp/csplib/data/Object.h> #include <csp/csplib/util/PythonSignals.h> +#include "csp/tools/layout2/cpp/CspLayoutApplication.h" #include <csp/tools/layout2/cpp/FeatureGraph.h> #include <csp/tools/layout2/cpp/LayoutNodes.h> #include <csp/tools/layout2/cpp/ModelLoader.h> @@ -93,6 +94,7 @@ TYPEMAP_PYSLOT_IN(void) +%include "csp/tools/layout2/cpp/CspLayoutApplication.h" %include "csp/tools/layout2/cpp/LayoutNodes.h" %include "csp/tools/layout2/cpp/FeatureGraph.h" %include "csp/tools/layout2/cpp/ModelLoader.h" Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py 2008-01-21 18:23:23 UTC (rev 2209) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py 2008-01-21 19:48:24 UTC (rev 2210) @@ -21,7 +21,11 @@ datadirs = ('images', 'models', 'fonts', 'sounds') pathlist = os.pathsep.join([os.path.join(dataDirectory, subdir) for subdir in datadirs]) - setOpenSceneGraphPathList(pathlist.encode('utf8')) + CspLayoutApplication.setOpenSceneGraphPathList(pathlist.encode('utf8')) + shaderPath = os.path.join(dataDirectory, 'shaders').encode('utf8') + print(shaderPath) + print(dir(shaderPath)) + CspLayoutApplication.setShaderPath(shaderPath) # Create an instance of our customized Frame class |
From: <sv...@ww...> - 2008-01-21 18:23:37
|
Author: nsmoooose Date: 2008-01-21 10:23:23 -0800 (Mon, 21 Jan 2008) New Revision: 2209 Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py Log: It is now possible to open files directly from the project tree. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2209 Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py 2008-01-20 17:16:39 UTC (rev 2208) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -14,6 +14,9 @@ def GenerateMenuItems(self, parent, commands): menu = wx.Menu() for command in commands: + if command == None: + menu.AppendSeparator() + continue instance = command() controlId = self.controlIdGenerator.Generate() Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-20 17:16:39 UTC (rev 2208) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -8,7 +8,7 @@ from controls.SceneWindow import SceneWindow from commands.MoveCameraToHomeCommand import MoveCameraToHomeCommand -from commands.OpenCustomLayoutModelFileCommand import OpenCustomLayoutModelFileCommand +from commands.OpenSelectedFileCommand import OpenSelectedFileCommand from commands.QuitCommand import QuitCommand class MainFrame(wx.Frame): @@ -37,9 +37,9 @@ # objects. controlFactory = CommandControlFactory(self.controlIdGenerator) - fileMenuCommands = [OpenCustomLayoutModelFileCommand, QuitCommand] + fileMenuCommands = [QuitCommand] viewMenuCommands = [MoveCameraToHomeCommand] - toolbarCommands = [OpenCustomLayoutModelFileCommand, MoveCameraToHomeCommand] + toolbarCommands = [OpenSelectedFileCommand, MoveCameraToHomeCommand] # Menu items. menuBar = wx.MenuBar() @@ -75,14 +75,19 @@ startPage.SetEditable(False) documentNotebook.AddPage(startPage, "Start") - # Add the tree control that displays all files in the project. + # Add the scene control that is responsible for the 3D + # scene. scenePage = SceneWindow(documentNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.BORDER_NONE, "GLCanvas", 0, wx.NullPalette) documentNotebook.AddPage(scenePage, "Scene") self.scene = scenePage - # Display the tree control with all files in this project. + # Display the tree control with all files in this project. Also + # register this instance so all command object can use it to + # access the selected file or directory. projectTreePage = ProjectTree(propertyNotebook) projectTreePage.SetRootDirectory(application.Configuration['LayoutApplication.DataDirectory']) + projectTreePage.SetOpenCommand(OpenSelectedFileCommand) + ProjectTree.Instance = projectTreePage propertyNotebook.AddPage(projectTreePage, "Project") Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommand.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/FileCommand.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -0,0 +1,10 @@ +#!/usr/bin/env python + +class FileCommand: + """Base class for all command objects that involves files.""" + + def SetFileName(self, fileName): + self.fileName = fileName + + def GetFileName(self): + return self.fileName Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py 2008-01-20 17:16:39 UTC (rev 2208) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -2,8 +2,9 @@ import os.path import wx from csp.tools.layout2.scripts.data import DataTree +from FileCommand import FileCommand -class OpenCustomLayoutModelFileCommand: +class OpenCustomLayoutModelFileCommand(FileCommand): def GetCaption(self): return "Open CustomLayoutModel file" @@ -30,18 +31,8 @@ if topWindow == None: return - # Show the open file dialog. - # retreive the last directory used by this function. - lastDirectoryUsedkey = 'OpenCustomLayoutModelFileCommand.LastDirectory' - lastDirectoryUsed = application.Configuration.get(lastDirectoryUsedkey, '.') - openFileDialog = wx.FileDialog(topWindow, 'Open feature', lastDirectoryUsed, - '', 'XML files (*.xml)|*.xml|All files|*.*', wx.OPEN) - result = openFileDialog.ShowModal() - if result != wx.ID_OK: - return - fileName = openFileDialog.GetPath() - # Store the last directory used. - application.Configuration[lastDirectoryUsedkey] = os.path.dirname(fileName) + # Retreive the filename. It is set by the parent class. + fileName = self.GetFileName() # Get the current xml path settings. We must check that the file we # are loading is actually below this directory. Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenSelectedFileCommand.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -0,0 +1,51 @@ +#!/usr/bin/env python +import os.path +import wx +from csp.tools.layout2.scripts.data import DataTree +from csp.tools.layout2.scripts.ui.controls.ProjectTree import ProjectTree +from OpenCustomLayoutModelFileCommand import OpenCustomLayoutModelFileCommand + +class OpenSelectedFileCommand: + """Opens the selected file in the project tree of this + application. When this command is executed we are trying + to identify the type of file we are loading and then + executing the correct FileCommand.""" + + def GetCaption(self): + return "Open selected file in project" + + def GetToolTipText(self): + return "Open selected file in project" + + def GetToolBarImageName(self): + return "document-open.png" + + def Execute(self): + """Load a feature group or feature model from the specified file. The existing + graph, if any, will be discarded. If file represents a feature model, a + default feature group is created at the root of the new graph. + """ + + # Get the application object. This object is used to retreive the + # configuration object and the top window for this application. + application = wx.GetApp() + + # Get the top window for this application. The top window shall be the + # parent for the open file dialog. + topWindow = application.GetTopWindow() + if topWindow == None: + return + + if ProjectTree.Instance is None: + print('No project tree instance has been set') + return + + fileName = ProjectTree.Instance.GetSelectedFile() + if fileName is None: + return + + # Now it is time to identify the filetype of the selected file. + command = OpenCustomLayoutModelFileCommand() + command.SetFileName(fileName) + command.Execute() + Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py 2008-01-20 17:16:39 UTC (rev 2208) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py 2008-01-21 18:23:23 UTC (rev 2209) @@ -2,19 +2,27 @@ import os import wx -from csp.tools.layout2.layout_module import * +class ProjectTree(wx.TreeCtrl): + """A tree control that provides information about all files + within the project directory. All folders and files above + the root directory will be hidden.""" -class ProjectTree(wx.TreeCtrl): + Instance = None + def __init__(self, parent): wx.TreeCtrl.__init__(self, parent, style=wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS|wx.TR_LINES_AT_ROOT) + + self.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.on_ItemActivated) def SetRootDirectory(self, directory): + """ Sets the root directory that the tree should display. All subfolders + and files of this directory will be displayed within the tree.""" self.DeleteAllItems() # Remember the base directory so we can return # the selected file or folder. self.baseDirectory = directory - + self.nodeDictionary = {} # Add the base node that is the parent to all # nodes. @@ -30,10 +38,32 @@ for subDirectory in dirs: newNode = self.AppendItem(parentNode, subDirectory) self.nodeDictionary[os.path.join(root, subDirectory)] = newNode - for file in files: - if file.lower().endswith('.pyc'): - continue - self.AppendItem(newNode, file) + for file in files: + if file.lower().endswith('.pyc'): + continue + self.AppendItem(parentNode, file) def GetSelectedFile(self): - return None \ No newline at end of file + node = self.GetSelection() + if node.IsOk(): + items = [] + while node != self.GetRootItem(): + items.insert(0, self.GetItemText(node)) + node = self.GetItemParent(node) + + selection = self.baseDirectory + for item in items: + selection = os.path.join(selection, item) + return selection + + def SetOpenCommand(self, command): + self.openCommand = command + + def on_ItemActivated(self, event): + if self.openCommand is None: + print('No open command object set') + return + + if os.path.isfile(self.GetSelectedFile()): + command = self.openCommand() + command.Execute() |
From: <sv...@ww...> - 2008-01-20 17:16:48
|
Author: nsmoooose Date: 2008-01-20 09:16:39 -0800 (Sun, 20 Jan 2008) New Revision: 2208 Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py Log: All project files is now display in a tree control within the layout tool. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2208 Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-14 21:38:24 UTC (rev 2207) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-20 17:16:39 UTC (rev 2208) @@ -2,9 +2,10 @@ import wx import wx.richtext -from csp.tools.layout2.scripts.ui.ControlIdGenerator import ControlIdGenerator -from csp.tools.layout2.scripts.ui.CommandControlFactory import CommandControlFactory -from csp.tools.layout2.scripts.ui.controls.SceneWindow import SceneWindow +from ControlIdGenerator import ControlIdGenerator +from CommandControlFactory import CommandControlFactory +from controls.ProjectTree import ProjectTree +from controls.SceneWindow import SceneWindow from commands.MoveCameraToHomeCommand import MoveCameraToHomeCommand from commands.OpenCustomLayoutModelFileCommand import OpenCustomLayoutModelFileCommand @@ -21,6 +22,11 @@ # First, call the base class' __init__ method to create the frame wx.Frame.__init__(self, parent, id, title) + # Get the application object. This object is used to retreive the + # configuration object. + application = wx.GetApp() + + # Create a control id generator. This is used by all helper classes # to actualy define an unique id for each control (menu, toolbar button) # etc. @@ -75,7 +81,9 @@ self.scene = scenePage # Display the tree control with all files in this project. - projectTreePage = wx.TreeCtrl(propertyNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS | wx.BORDER_NONE) + projectTreePage = ProjectTree(propertyNotebook) + projectTreePage.SetRootDirectory(application.Configuration['LayoutApplication.DataDirectory']) + propertyNotebook.AddPage(projectTreePage, "Project") # Connect idle event. Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/ProjectTree.py 2008-01-20 17:16:39 UTC (rev 2208) @@ -0,0 +1,39 @@ +#!/usr/bin/env python +import os +import wx + +from csp.tools.layout2.layout_module import * + +class ProjectTree(wx.TreeCtrl): + def __init__(self, parent): + wx.TreeCtrl.__init__(self, parent, style=wx.TR_HIDE_ROOT|wx.TR_HAS_BUTTONS|wx.TR_LINES_AT_ROOT) + + def SetRootDirectory(self, directory): + self.DeleteAllItems() + + # Remember the base directory so we can return + # the selected file or folder. + self.baseDirectory = directory + + self.nodeDictionary = {} + # Add the base node that is the parent to all + # nodes. + self.nodeDictionary[self.baseDirectory] = self.AddRoot('CSP') + + for root, dirs, files in os.walk(directory): + # print(root) + parentNode = self.nodeDictionary[root] + if '.svn' in dirs: + dirs.remove('.svn') + if '_svn' in dirs: + dirs.remove('_svn') + for subDirectory in dirs: + newNode = self.AppendItem(parentNode, subDirectory) + self.nodeDictionary[os.path.join(root, subDirectory)] = newNode + for file in files: + if file.lower().endswith('.pyc'): + continue + self.AppendItem(newNode, file) + + def GetSelectedFile(self): + return None \ No newline at end of file |
From: <sv...@ww...> - 2008-01-14 21:38:35
|
Author: nsmoooose Date: 2008-01-14 13:38:24 -0800 (Mon, 14 Jan 2008) New Revision: 2207 Modified: branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py Log: Reorganized the ui a little. This makes it possible to display several tool windows to the left. Removed a strange inheritance that wasn't in use. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2207 Modified: branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h 2008-01-12 23:10:52 UTC (rev 2206) +++ branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h 2008-01-14 21:38:24 UTC (rev 2207) @@ -36,7 +36,7 @@ /* This is a graphical window that we can draw 3D into. It is called from a wxPython window (wx.glcanvas.GLCanvas inherited class). This makes it possible to integrate wxPython and open scene graph. */ -class OsgGraphicsWindow : public osgViewer::GraphicsWindow { +class OsgGraphicsWindow { public: typedef sigc::signal<void> VoidSignal; Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-12 23:10:52 UTC (rev 2206) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-14 21:38:24 UTC (rev 2207) @@ -54,32 +54,38 @@ # Status bar control at the bottom of the screen. statusBar = wx.StatusBar(self) self.SetStatusBar(statusBar) + + # Divides the document area from the properties control. + # To the left we have a project, properties and that type + # of controls. To the right we have all opened documents. + splitter1 = wx.SplitterWindow(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_NOBORDER) + propertyNotebook = wx.Notebook(splitter1, wx.ID_ANY, style=wx.NB_LEFT) + documentNotebook = wx.Notebook(splitter1, wx.ID_ANY) + splitter1.SplitVertically(propertyNotebook, documentNotebook, 200) - notebook = wx.Notebook(self, wx.ID_ANY) - startPage = wx.richtext.RichTextCtrl(notebook) + # Add the first document to this window. + startPage = wx.richtext.RichTextCtrl(documentNotebook) startPage.GetBuffer().LoadFile("start.txt") startPage.SetEditable(False) - notebook.AddPage(startPage, "Start") - - - # Create the splitter window that will divide the display in two - # parts. The left part contains the tree control. The right - # part is displaying the 3D scene. - scenePage = wx.SplitterWindow(notebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SP_NOBORDER) - self.leftWindow = wx.TreeCtrl(scenePage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS | wx.BORDER_NONE) - self.rightWindow = SceneWindow(scenePage, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.BORDER_NONE, "GLCanvas", 0, wx.NullPalette) - scenePage.SplitVertically(self.leftWindow, self.rightWindow) - - notebook.AddPage(scenePage, "Scene") + documentNotebook.AddPage(startPage, "Start") + # Add the tree control that displays all files in the project. + scenePage = SceneWindow(documentNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.BORDER_NONE, "GLCanvas", 0, wx.NullPalette) + documentNotebook.AddPage(scenePage, "Scene") + self.scene = scenePage + + # Display the tree control with all files in this project. + projectTreePage = wx.TreeCtrl(propertyNotebook, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.TR_HAS_BUTTONS | wx.BORDER_NONE) + propertyNotebook.AddPage(projectTreePage, "Project") + # Connect idle event. wx.EVT_IDLE(self, self.on_Idle) def on_Idle(self, event): # Only render when the scene is visible on screen. - if self.rightWindow.IsShownOnScreen(): - self.rightWindow.Frame() + if self.scene.IsShownOnScreen(): + self.scene.Frame() event.RequestMore() def GetSceneWindow(self): - return self.rightWindow \ No newline at end of file + return self.scene \ No newline at end of file |
From: <sv...@ww...> - 2008-01-12 23:11:01
|
Author: nsmoooose Date: 2008-01-12 15:10:52 -0800 (Sat, 12 Jan 2008) New Revision: 2206 Added: branches/layout_tool_improvements/csp/tools/layout2/cpp/FeatureGraph.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/FeatureGraph.h branches/layout_tool_improvements/csp/tools/layout2/cpp/Handle.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/Handle.h branches/layout_tool_improvements/csp/tools/layout2/cpp/LayoutNodes.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/LayoutNodes.h branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/ModelLoader.h branches/layout_tool_improvements/csp/tools/layout2/scripts/data/DataTree.py branches/layout_tool_improvements/csp/tools/layout2/scripts/data/Object.py branches/layout_tool_improvements/csp/tools/layout2/scripts/data/ObjectInterface.py branches/layout_tool_improvements/csp/tools/layout2/scripts/data/domtree.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/OpenCustomLayoutModelFileCommand.py branches/layout_tool_improvements/csp/tools/layout2/start.txt Removed: branches/layout_tool_improvements/csp/tools/layout2/swig/ Modified: branches/layout_tool_improvements/csp/tools/layout2/SConscript branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.h branches/layout_tool_improvements/csp/tools/layout2/layout.i branches/layout_tool_improvements/csp/tools/layout2/layout.py branches/layout_tool_improvements/csp/tools/layout2/scripts/data/ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/LayoutApplication.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: It is now possible to load a file in the theater layout tool again. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2206 Diff omitted (96397 bytes). |
From: <sv...@ww...> - 2008-01-05 17:54:02
|
Author: nsmoooose Date: 2008-01-05 09:53:55 -0800 (Sat, 05 Jan 2008) New Revision: 2205 Added: branches/layout_tool_improvements/csp/tools/layout2/images/ branches/layout_tool_improvements/csp/tools/layout2/images/document-new.png branches/layout_tool_improvements/csp/tools/layout2/images/document-new.svg branches/layout_tool_improvements/csp/tools/layout2/images/document-open.png branches/layout_tool_improvements/csp/tools/layout2/images/document-open.svg branches/layout_tool_improvements/csp/tools/layout2/images/document-save.png branches/layout_tool_improvements/csp/tools/layout2/images/document-save.svg branches/layout_tool_improvements/csp/tools/layout2/images/edit-delete.png branches/layout_tool_improvements/csp/tools/layout2/images/edit-delete.svg branches/layout_tool_improvements/csp/tools/layout2/images/edit-redo.png branches/layout_tool_improvements/csp/tools/layout2/images/edit-redo.svg branches/layout_tool_improvements/csp/tools/layout2/images/edit-undo.png branches/layout_tool_improvements/csp/tools/layout2/images/edit-undo.svg branches/layout_tool_improvements/csp/tools/layout2/images/go-home.png branches/layout_tool_improvements/csp/tools/layout2/images/go-home.svg branches/layout_tool_improvements/csp/tools/layout2/images/quit.png branches/layout_tool_improvements/csp/tools/layout2/images/quit.svg branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/Command.py Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py Log: Added common toolbar buttons for: open, save, redo, undo, quit, go-home Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2205 Diff omitted (201070 bytes). |
From: <sv...@ww...> - 2008-01-03 20:13:34
|
Author: nsmoooose Date: 2008-01-03 12:13:25 -0800 (Thu, 03 Jan 2008) New Revision: 2204 Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/__init__.py Modified: branches/layout_tool_improvements/csp/tools/layout2/readme.txt branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: Added a command infrastructure to the layout2 test application. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2204 Modified: branches/layout_tool_improvements/csp/tools/layout2/readme.txt =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/readme.txt 2008-01-01 19:11:40 UTC (rev 2203) +++ branches/layout_tool_improvements/csp/tools/layout2/readme.txt 2008-01-03 20:13:25 UTC (rev 2204) @@ -7,9 +7,12 @@ * Convert 3d file using osgconv.exe to the model.osg. * Object browser. Make it possible to display an object before we insert it. We could have a list of all the objects that are insertable. * All commands that can be issued should be its own object. ex: + MoveCameraToHomeCommand + + DeleteCommand UndoCommand ExitCommand FileLoadCommand (To generic name for this class) FileSaveCommand (To generic name for this class) - * Display the underlying terrain. \ No newline at end of file + * Display the underlying terrain. Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/CommandControlFactory.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -0,0 +1,37 @@ +#!/usr/bin/env python +import wx + +class CommandControlFactory: + """A factory that creates ui controls that is bound to command objects.""" + + def __init__(self, controlIdGenerator): + """ Constructs the control factory with a control id generator. The + generator is needed in order to create a unique id for each command + in the scope of the parent control.""" + self.controlIdGenerator = controlIdGenerator + + def GenerateMenuItems(self, parent, commands): + menu = wx.Menu() + for command in commands: + instance = command() + + controlId = self.controlIdGenerator.Generate() + menu.Append(controlId, instance.GetCaption()) + + wx.EVT_MENU(parent, controlId, CommandExecutor(instance).Execute) + return menu + +class CommandExecutor: + """This class can be bound to a wx event (click on a menuitem, button, toolbar + button etc). When the event is fired the command sent to the constructor is + executed.""" + + def __init__(self, command): + """Constructs this instance with a command object. This command will be + executed when the bound event is fired.""" + self.command = command + + def Execute(self, event): + """Bind this method to a wx event. When the event is fired the command will + be executed.""" + self.command.Execute() \ No newline at end of file Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -0,0 +1,17 @@ +#!/usr/bin/env python + +class ControlIdGenerator: + """This class purpose is to generate identities for user interface + controls. The id generated is an integer. These id's are usefull + together with the wx framework.""" + + def __init__(self, identity_start = 20000): + """Constructs a new generator. If no identity_start is specified + it will default to 20000.""" + self.identity = identity_start + + def Generate(self): + """Generates a new id and returns it.""" + newid = self.identity + self.identity = self.identity + 1 + return newid Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc =================================================================== (Binary files differ) Property changes on: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/ControlIdGenerator.pyc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-01 19:11:40 UTC (rev 2203) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -1,8 +1,13 @@ #!/usr/bin/env python import wx +from csp.tools.layout2.scripts.ui.ControlIdGenerator import ControlIdGenerator +from csp.tools.layout2.scripts.ui.CommandControlFactory import CommandControlFactory from csp.tools.layout2.scripts.ui.controls.SceneWindow import SceneWindow +from csp.tools.layout2.scripts.ui.commands.MoveCameraToHomeCommand import MoveCameraToHomeCommand +from csp.tools.layout2.scripts.ui.commands.QuitCommand import QuitCommand + ID_FILE_OPEN = 2000 ID_FILE_SAVE = 2001 ID_FILE_QUIT = 2002 @@ -12,14 +17,27 @@ # First, call the base class' __init__ method to create the frame wx.Frame.__init__(self, parent, id, title) + # Create a control id generator. This is used by all helper classes + # to actualy define an unique id for each control (menu, toolbar button) + # etc. + self.controlIdGenerator = ControlIdGenerator() + + # Declare a class that is responsible for creating instances of + # menu items, toolbar buttons and keyboard shortcuts to command + # objects. + controlFactory = CommandControlFactory(self.controlIdGenerator) + + fileMenuCommands = [QuitCommand] + viewMenuCommands = [MoveCameraToHomeCommand] + # Menu items. menuBar = wx.MenuBar() - fileMenu = wx.Menu() - fileMenu.Append(ID_FILE_OPEN, "Load") - fileMenu.Append(ID_FILE_SAVE, "Save") - fileMenu.Append(ID_FILE_QUIT, "Quit") + + fileMenu = controlFactory.GenerateMenuItems(self, fileMenuCommands) + menuBar.Append(fileMenu, "File") - menuBar.Append(fileMenu, "File") + viewMenu = controlFactory.GenerateMenuItems(self, viewMenuCommands) + menuBar.Append(viewMenu, "View") self.SetMenuBar(menuBar) Property changes on: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands ___________________________________________________________________ Name: svn:ignore + *.pyc Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/MoveCameraToHomeCommand.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -0,0 +1,28 @@ +#!/usr/bin/env python +import wx + +from csp.tools.layout2.scripts.ui.controls.SceneWindow import SceneWindow + +class MoveCameraToHomeCommand: + """This command moves the camera to the home position for + the current scene control. If the current wx control isn't + a SceneWindow the command is ignored.""" + + def GetCaption(self): + return "Move camera to home" + + def Execute(self): + focusWindow = wx.Window.FindFocus() + + # Test to see if we have got a window with focus. If not + # we simply return and ignore this command. + if focusWindow == None: + return + + # Test to see if the window is of the right type. If not + # we simply return and ignore this command. + if isinstance(focusWindow, SceneWindow) == False: + return + + # All is well. Lets execute the command. + focusWindow.MoveCameraToHome() Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/QuitCommand.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -0,0 +1,12 @@ +#!/usr/bin/env python +import wx + +class QuitCommand: + + def GetCaption(self): + return "Quit" + + def Execute(self): + topWindow = wx.GetApp().GetTopWindow() + if topWindow != None: + topWindow.Close() Added: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/__init__.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/__init__.py (rev 0) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/commands/__init__.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -0,0 +1 @@ +#!/usr/bin/env python Modified: branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py =================================================================== --- branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py 2008-01-01 19:11:40 UTC (rev 2203) +++ branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py 2008-01-03 20:13:25 UTC (rev 2204) @@ -18,6 +18,9 @@ self.graphicsWindow.connectToSetCurrent(self.on_SetCurrent) self.graphicsWindow.connectToSwapBuffers(self.on_SwapBuffers) + def MoveCameraToHome(self): + print('not implemented yet') + def Frame(self): self.graphicsWindow.Frame() @@ -36,6 +39,13 @@ event.Skip() def on_Mouse(self, event): + # Set focus to this control in order for it to + # retreive keyboard input. The view that has focus should + # handle the keyboard command sent. + self.SetFocus() + + # The mouse event (movement and clicking) should be + # processed by the manipulator implemented in c++. x, y = event.GetX(), event.GetY() if event.ButtonDown(): button = event.GetButton() |
From: <sv...@ww...> - 2008-01-01 19:11:48
|
Author: nsmoooose Date: 2008-01-01 11:11:40 -0800 (Tue, 01 Jan 2008) New Revision: 2203 Added: branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/Scene.h branches/layout_tool_improvements/csp/tools/layout2/readme.txt Modified: branches/layout_tool_improvements/csp/tools/layout2/SConscript branches/layout_tool_improvements/csp/tools/layout2/cpp/DynamicGrid.h branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.cpp branches/layout_tool_improvements/csp/tools/layout2/cpp/OsgGraphicsWindow.h branches/layout_tool_improvements/csp/tools/layout2/layout.i branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/MainFrame.py branches/layout_tool_improvements/csp/tools/layout2/scripts/ui/controls/SceneWindow.py Log: Added the dynamic grid to the layout tool. All keyboard events and mouse movements are sent to layout tool. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2203 Diff omitted (17992 bytes). |
From: <sv...@ww...> - 2007-12-31 08:45:17
|
Author: kondzik Date: 2007-12-31 00:45:09 -0800 (Mon, 31 Dec 2007) New Revision: 2202 Modified: trunk/csp/cspsim/CSPSim.cpp trunk/csp/cspsim/CSPSim.h trunk/csp/cspsim/EventMapIndex.cpp trunk/csp/cspsim/EventMapIndex.h trunk/csp/cspsim/EventMapping.cpp trunk/csp/cspsim/EventMapping.h trunk/csp/cspsim/GameScreen.cpp trunk/csp/cspsim/GameScreen.h trunk/csp/cspsim/InputInterface.h trunk/csp/cspsim/views/CameraCommand.h trunk/csp/cspsim/views/CameraKinematics.cpp trunk/csp/cspsim/views/CameraKinematics.h Log: Patch by Michael 'Alambic' Minault "I made a patch that permits the views to be controlled by joystick axes (in addition to mouse axes). It also initializes as many joysticks as needed by the mappings." Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2202 Diff omitted (12589 bytes). |