You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
(11) |
Apr
(47) |
May
(14) |
Jun
|
Jul
(73) |
Aug
(4) |
Sep
(2) |
Oct
(60) |
Nov
(48) |
Dec
(66) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
|
Feb
(1) |
Mar
(27) |
Apr
(82) |
May
(89) |
Jun
(91) |
Jul
(44) |
Aug
(53) |
Sep
(113) |
Oct
(20) |
Nov
(37) |
Dec
(10) |
2008 |
Jan
|
Feb
(2) |
Mar
|
Apr
(2) |
May
(21) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2009 |
Jan
(76) |
Feb
(89) |
Mar
(52) |
Apr
(11) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(27) |
2010 |
Jan
(11) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(9) |
Sep
|
Oct
|
Nov
|
Dec
(14) |
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(2) |
Sep
(11) |
Oct
(3) |
Nov
|
Dec
|
2013 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <spo...@us...> - 2009-12-17 23:21:32
|
Revision: 1151 http://opengate.svn.sourceforge.net/opengate/?rev=1151&view=rev Author: spom_spom Date: 2009-12-17 23:21:18 +0000 (Thu, 17 Dec 2009) Log Message: ----------- win32 compatibility commit Modified Paths: -------------- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 23:05:47 UTC (rev 1150) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 23:21:18 UTC (rev 1151) @@ -40,7 +40,8 @@ baseClass = wx.PyWindow -if wx.Platform == "__WXGTK__": + +if os.name == "Posix": import wx.glcanvas baseClass = wx.glcanvas.GLCanvas @@ -49,19 +50,23 @@ It is somewhat inspired from SampleFramework.py""" def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): - if type( baseClass ) == wx.PyWindow: - wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) + if 'resourceFile' in kwargs: + self.resourceFile = kwargs[ 'resourceFile' ] + del kwargs[ 'resourceFile' ] else: - wx.glcanvas.GLCanvas.__init__( self, parent + self.resourceFile = 'resources.cfg' + + if os.name == "Posix": + wx.glcanvas.GLCanvas.__init__( self, parent , size = parent.GetSize() #, style = wx.WANTS_CHARS | , style = wx.NO_FULL_REPAINT_ON_RESIZE , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) + else: + wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) - if 'resourceFile' in kwargs: - self.resourceFile = kwargs[ 'resourceFile' ] - else: - self.resourceFile = 'resources.cfg' + + print self.resourceFile @@ -120,10 +125,10 @@ parent = lastValid.GetParent() #print "windowhandle = ", handle - if type( baseClass ) == wx.PyWindow: + if os.name == 'Posix': + handle = wx.glcanvas.GLCanvas.GetHandle( self ) + else: handle = wx.PyWindow.GetHandle( self ) - else: - handle = wx.glcanvas.GLCanvas.GetHandle( self ) if handle == 0: try: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-17 23:06:02
|
Revision: 1150 http://opengate.svn.sourceforge.net/opengate/?rev=1150&view=rev Author: spom_spom Date: 2009-12-17 23:05:47 +0000 (Thu, 17 Dec 2009) Log Message: ----------- forgot file ^^ Added Paths: ----------- branches/ogEditor/ogEditor/wxOgre/CEGUI_framework.py Added: branches/ogEditor/ogEditor/wxOgre/CEGUI_framework.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/CEGUI_framework.py (rev 0) +++ branches/ogEditor/ogEditor/wxOgre/CEGUI_framework.py 2009-12-17 23:05:47 UTC (rev 1150) @@ -0,0 +1,58 @@ +# -*- coding: iso-8859-1 -*- +import ctypes +import os + +# The follow patch from Tim (Mithro) fixes a loder issue with CEGUI - previously we'd patched CEGUI to +# ensure the CEGUIBase was linked to every module to solve the issue with Python dynamically loading +# the _cegui_.so module without RTLD_GLOBAL set - then when CEGUI opened it's dynamic modules it +# couldn't find all the symbols. + +#print ctypes.CDLL("../../../root/usr/lib/libCEGUIBase.so", ctypes.RTLD_GLOBAL ) + +import ogre.gui.CEGUI as CEGUI + +# Another fix for CEGUI to ensure we get a working parser.. +if os.name == 'nt': + CEGUI.System.setDefaultXMLParserName("ExpatParser") +else: + CEGUI.System.setDefaultXMLParserName("TinyXMLParser") + +#import ogre.io.OIS as OIS +##import SampleFramework + +###----------------------------------------------------------------## +#def convertOISMouseButtonToCegui( buttonID): + #if buttonID ==0: + #return CEGUI.LeftButton + #elif buttonID ==1: + #return CEGUI.RightButton + #elif buttonID ==2: + #return CEGUI.MiddleButton + #elif buttonID ==3: + #return CEGUI.X1Button + #else: + #return CEGUI.LeftButton + +def _PointHack(x, y): + return CEGUI.Vector2(x, y) +CEGUI.Point = _PointHack + +def cegui_reldim ( x ) : + return CEGUI.UDim((x),0) + + +class wxCEGUIListener(): + def __init__( self, guiRenderer ): + self.ren = guiRenderer + pass + + def onMouseEvent( self, event ): + #print event.GetX(), self.ren.getWidth(), event.GetX() / self.ren.getWidth() + #print event.GetY(), self.ren.getHeight(), event.GetY() / self.ren.getHeight() + CEGUI.System.getSingleton().injectMousePosition( event.GetX(), event.GetY() ) + #if event.RightDown(): + + def onResize( self, size ): + self.ren.setDisplaySize( CEGUI.Size( size[0], size[1] ) ) + pass + \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-17 23:01:44
|
Revision: 1149 http://opengate.svn.sourceforge.net/opengate/?rev=1149&view=rev Author: spom_spom Date: 2009-12-17 23:01:30 +0000 (Thu, 17 Dec 2009) Log Message: ----------- ogedit:shows now all opengate cegui layouts Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/controls/resourceTree.py branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py Modified: branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-17 19:17:33 UTC (rev 1148) +++ branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-17 23:01:30 UTC (rev 1149) @@ -2,7 +2,6 @@ FileSystem=../../trunk/data/ FileSystem=../../trunk/data/capacitors FileSystem=../../trunk/data/commodities -FileSystem=../../trunk/data/gui FileSystem=../../trunk/data/gui/fonts FileSystem=../../trunk/data/gui/layouts FileSystem=../../trunk/data/gui/imagesets Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 19:17:33 UTC (rev 1148) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 23:01:30 UTC (rev 1149) @@ -1,5 +1,6 @@ # -*- coding: iso-8859-1 -*- +import os import wx from ogEditor.base import AppResource @@ -12,6 +13,21 @@ #from ogEditor.resources import loadIcon, MakeDisabledBitmap + +class CEGUILayout(): + def __init__( self, name, system ): + self.layoutName = name + self.guiSystem = system + self.layout = None + + def activate( self, active ): + print "activate ", active, self.layoutName + if active: + if self.layout is None: + self.layout = CEGUI.WindowManager.getSingleton().loadWindowLayout( self.layoutName ) + + self.guiSystem.setGUISheet( self.layout ) + #class OgreTest( ): class OpengateEditor( AppResource ): def __init__( self, parent, rendererSlot, propertyInspectorSlot ): @@ -95,8 +111,6 @@ self.GUISystem.setDefaultMouseCursor("opengateCursor", "Cursor1") self.GUISystem.setDefaultFont("BlueHighway-12") - self.GUISystem.setGUISheet( CEGUI.WindowManager.getSingleton().loadWindowLayout("opengateDocked.layout") ) - self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) #self.frameListener = GuiFrameListener( self.renderer_.renderWindow, self.renderer_.camera, self.GUIRenderer) #self.sceneManager) @@ -105,9 +119,79 @@ #self.renderer_.ogreRoot.addFrameListener(self.frameListener) #self.frameListener.showDebugOverlay(False) - + self.buildResourceTree( ) + return self.renderer_ + def buildResourceTree( self ): + + tree = self.parent.resourceTree + root = self.treeItem + + #resManNode = tree.AppendItem( root, "Ogre resource manager" ) + + ### Insert resources group managers (Material, Mesh, Texture etc. ) + ogreResourceGroupManager = ogre.ResourceGroupManager.getSingleton() + + ## Insert resources sorted by resource groups + resGroupManNode = tree.addItem( ogreResourceGroupManager, "Ogre resource groups", root ) + + resGroups = ogreResourceGroupManager.getResourceGroups( ) + + # this don't work it throws strange exception 'get' + # for resGroupName in resGroups ): + + for i in range( 0, len( resGroups ) ): + resGroupName = resGroups[ i ] + resGroupNode = tree.addItem( None, resGroupName, resGroupManNode ) + + resManIter = ogreResourceGroupManager.getResourceManagerIterator() + while resManIter.hasMoreElements(): + resManNodeIter = tree.addItem( resManIter.peekNextValue(), resManIter.peekNextKey(), resGroupNode ) + resIter = resManIter.peekNextValue().getResourceIterator() + + while resIter.hasMoreElements(): + if resIter.peekNextValue().getGroup() == resGroupName: + tree.addItem( resIter.peekNextValue(), resIter.peekNextValue().getName(), resManNodeIter ) + + resIter.getNext() + + resManIter.getNext() + + ceguiNode = tree.addItem( None, 'CEGUI', root ) + layouts = self.findResources( 'gui/layouts', '.layout' ) + + if layouts: + layoutNode = tree.addItem( None, 'layouts', ceguiNode ) + for l in layouts: + tree.addItem( CEGUILayout( l, self.GUISystem ), l, layoutNode ) + + + def findResources( self, filesystem, pattern ): + for res in self.renderer_.resourceLocations: + if res[ 1 ] == 'Opengate' and filesystem in res[ 0 ]: + ret = [] + + def findFiles( path, pattern, ret, cummulativPath = ''): + paths = os.listdir( path ) + if len( paths ) == 0: return ret + + dirs = [] + for p in paths: + if pattern in p: + ret.append( cummulativPath + p ) + elif os.path.isdir( os.path.join( path, p ) ) and p[0] is not '.': + dirs.append( p ) + + for d in dirs: + findFiles( os.path.join( path, d), pattern, ret, cummulativPath + d + '/' ) + + return ret + + return findFiles( res[ 0 ], pattern, ret ) + + return None + def menuFunction( self, event = None ): """ do nothing here, just to show the technique Modified: branches/ogEditor/ogEditor/controls/resourceTree.py =================================================================== --- branches/ogEditor/ogEditor/controls/resourceTree.py 2009-12-17 19:17:33 UTC (rev 1148) +++ branches/ogEditor/ogEditor/controls/resourceTree.py 2009-12-17 23:01:30 UTC (rev 1149) @@ -28,14 +28,17 @@ #print "select tree item", item, self.GetSelection() self.SelectItem( item ) - def addItem( self, data, name, parentNode = None ): + def addItem( self, data, name, parentNode = None, Expand = False ): if not parentNode: parentNode = self.root item = self.AppendItem( parentNode, name ); - self.SetPyData( item, data ) - data.treeItem = item - self.Expand( parentNode ) + if data is not None: + self.SetPyData( item, data ) + data.treeItem = item + + if Expand: + self.Expand( parentNode ) #self.UnselectAll( ) return item @@ -56,6 +59,15 @@ return #print "onSelectTreeObject", itemData + + if not hasattr( itemData, 'parentResource' ): + + self.lastActiveItemData.activate( False ) + itemData.activate( True ) + self.lastActiveItemData = itemData + event.Skip() + return + oldApplication = None newApplication = None Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 19:17:33 UTC (rev 1148) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 23:01:30 UTC (rev 1149) @@ -179,12 +179,12 @@ def _OnSize(self, event): if self.renderWindow is not None: - print self.GetSize(), self.parent.GetSize() +# print self.GetSize(), self.parent.GetSize() self.renderWindow.resize( self.GetSize()[ 0 ], self.GetSize()[ 1 ] ); self.renderWindow.windowMovedOrResized() self.UpdateRender() - print "ren", self.renderWindow.getWidth(), self.renderWindow.getHeight() + # print "ren", self.renderWindow.getWidth(), self.renderWindow.getHeight() for l in self.listener: l.onResize( self.GetSize() ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-17 19:17:41
|
Revision: 1148 http://opengate.svn.sourceforge.net/opengate/?rev=1148&view=rev Author: spom_spom Date: 2009-12-17 19:17:33 +0000 (Thu, 17 Dec 2009) Log Message: ----------- ogedit:opengatedit changed data resources to opengate data Modified Paths: -------------- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg branches/ogEditor/ogEditor/apps/opengate/opengateedit.py branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py Added Paths: ----------- branches/ogEditor/ogEditor/apps/opengate/opengate/ branches/ogEditor/ogEditor/apps/opengate/opengate/Makefile branches/ogEditor/ogEditor/apps/opengate/opengate/build.sh branches/ogEditor/ogEditor/apps/opengate/opengate/environment.py branches/ogEditor/ogEditor/apps/opengate/opengate/generate_code.py branches/ogEditor/ogEditor/apps/opengate/opengate/hand_made_wrappers.py branches/ogEditor/ogEditor/apps/opengate/opengate/python_ogre_masterlist.h branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate.h branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_aliases.h branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_sizeof.h Removed Paths: ------------- branches/ogEditor/ogEditor/apps/opengate/Makefile branches/ogEditor/ogEditor/apps/opengate/build.sh branches/ogEditor/ogEditor/apps/opengate/environment.py branches/ogEditor/ogEditor/apps/opengate/generate_code.py branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h branches/ogEditor/ogEditor/apps/opengate/python_opengate.h branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h Deleted: branches/ogEditor/ogEditor/apps/opengate/Makefile =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/Makefile 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/Makefile 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,32 +0,0 @@ -BOOSTINC=-I /usr/include/boost -PYTHONINC=-I /usr/include/python2.5 -OGREINC=`pkg-config --cflags OGRE gtk+-2.0 ogreopcode` -OPENGATEINC=-I $(HOME)/local/opengate/trunk/src - -BOOSTLIB=-L /usr/lib64 -lboost_python-mt -lboost_thread -lboost_regex -lboost_system - -OGRELIB=`pkg-config --libs OGRE gtk+-2.0 ogreopcode CEGUI-OGRE CEGUI openal freealut OIS vorbisfile` - -OGREGEN=-I /home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0 -TARGET=opengate -COPT=-Os -fPIC -DBOOST_PYTHON_NO_PY_SIGNATURES - -CONTAINERSUITE= -I ./indexing_suite_v2 -#CONTAINERSUITE= -I ./boost - -CPPCFILES = $(wildcard generated/*.cpp) -OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES)) -OPENGATEOBJ=$(wildcard $(HOME)/local/opengate/trunk/src/opengateclient*.o) - -default: $(TARGET) - -.cpp.o: - g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< - -$(TARGET): $(OBJECTS) - g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared $(OBJECTS) $(BOOSTLIB) $(OPENGATEOBJ) $(OGRELIB) - strip -g -S -d --strip-debug -s generated/$(TARGET).so -clean: - rm -rf generated/* - rm -f *.so - rm -f *.cache Deleted: branches/ogEditor/ogEditor/apps/opengate/build.sh =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/build.sh 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/build.sh 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,20 +0,0 @@ -#!/bin/bash - -if [ $OSTYPE = "msys" ]; then - echo "build for mingw" - python generate_code.py vector - bjam toolset=gcc -else - echo "build for linux gcc" - mkdir -p generated - MAKEOPTS=-j5 - make clean - sh build.wxogre_util.sh - - if [ $# -lt 1 ]; then - python generate_code.py - make $MAKEOPTS - cp generated/opengate.so packages_2.5/opengate/OpenGate.so - - fi -fi Deleted: branches/ogEditor/ogEditor/apps/opengate/environment.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/environment.py 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/environment.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,49 +0,0 @@ -#! /usr/bin/python -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import sys - -class settings: - module_name = 'OpenGate' - #opengate_path = '../../trunc/src/' - opengate_path = '/home/carsten/local/opengate/trunk/src/' - opengate_cache_file ='python_opengate.cache' - ogre_include_path = '' - ogreopcode_include_path = '' - boost_path = '' - boost_libs_path = '' - gccxml_path = '' - pygccxml_path = '' - pyplusplus_path = '' - python_libs_path = '' - python_include_path = '' - working_dir = '' - unittests_dir = '' - generated_files_dir = './generated' - opengate_defines = '' - def setup_environment(): - print settings.pygccxml_path - sys.path.append( settings.pygccxml_path ) - sys.path.append( settings.pyplusplus_path ) - setup_environment = staticmethod(setup_environment) - -if sys.platform == 'linux2': - settings.python_include_path = '/usr/include/python2.5' - settings.ogre_include_path = '/usr/include/OGRE' - settings.ogreopcode_include_path = '/usr/include/ogreopcode' - settings.gccxml_path = '/usr/bin' - settings.pygccxml_path = '/usr/lib64/python2.5/site-packages' - settings.pyplusplus_path = '/usr/lib64/python2.5/site-packages' - -elif sys.platform == 'win32': - settings.pygccxml_path = 'c:/python25/Lib/site-packages/' - settings.python_libs_path = 'c:/python25/libs' - settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' - settings.opengate_defines ='MINGW' -else: - raise RuntimeError( 'There is no configuration for "%s" platform.' % sys.platform ) - -settings.setup_environment() Deleted: branches/ogEditor/ogEditor/apps/opengate/generate_code.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/generate_code.py 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/generate_code.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,248 +0,0 @@ -#! /usr/bin/python -# -*- coding: iso-8859-1 -*- - -import os -import sys -import string -from environment import settings - -import hand_made_wrappers - -from pygccxml import parser -from pygccxml import declarations -from pygccxml.declarations import access_type_matcher_t -from pyplusplus import code_creators -from pyplusplus import module_builder -from pyplusplus.module_builder import call_policies - -import common_utils.ogre_properties as ogre_properties - -MAIN_NAMESPACE = 'OpenGate' - -def set_call_policies( mb ): -# - # Set the default policy to deal with pointer/reference return types to reference_existing object^M - # as this is the Ogre Default.^M - mem_funs = mb.calldefs () - mem_funs.create_with_signature = True #Generated code will not compile on^M - #MSVC 7.1 if function has throw modifier.^M - for mem_fun in mem_funs: - if mem_fun.call_policies: - continue - if declarations.is_pointer (mem_fun.return_type) or declarations.is_reference (mem_fun.return_type): - mem_fun.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) - - -class decl_starts_with (object): - def __init__ (self, prefix): - self.prefix = prefix - def __call__ (self, decl): - return self.prefix in decl.name - -def excludeFreeFunctionsByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.free_functions( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeFreeFunctionsByName( mb, functs): - for funct in functs: - fun = mb.global_ns.free_functions( name=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeFreeOperatorsByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.free_operators( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeClass( mb, functs): - for funct in functs: - fun = mb.global_ns.class_( funct ) - print "exclude", fun - fun.exclude() - -def excludeMemberByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.member_functions( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeMemberOperators( mb, functs): - for funct in functs: - fun = mb.global_ns.member_operators( symbol=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def setMemberFunctionCallPolicieByReturn(mb, MemberRetRef, callPolicie ): - for ref in MemberRetRef: - memFuns = mb.global_ns.member_functions( return_type=ref, allow_empty=True ) - print ref, len(memFuns) - - for memFun in memFuns: - if memFun.call_policies: - continue - else: - memFun.call_policies = \ - call_policies.return_value_policy( callPolicie ) - -def generate( defined_symbols ): - xml_cached_fc = parser.create_cached_source_fc( os.path.join( r"python_opengate.h" ), - settings.opengate_cache_file ) - - print xml_cached_fc - - mb = module_builder.module_builder_t( [xml_cached_fc], - gccxml_path = settings.gccxml_path, - working_directory = settings.opengate_path, - include_paths = [settings.opengate_path, settings.python_include_path, - settings.ogreopcode_include_path, settings.ogre_include_path], - define_symbols = defined_symbols, - indexing_suite_version = 1 ) - - ## This module depends on Ogre - #mb.register_module_dependency ( '/home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/' ) - mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0' ) - - global_ns = mb.global_ns - global_ns.exclude() - - main_ns = global_ns.namespace( MAIN_NAMESPACE ) - main_ns.include() - - global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) - - hand_made_wrappers.apply( mb ) - - mb.BOOST_PYTHON_MAX_ARITY = 25 - mb.classes().always_expose_using_scope = True - - set_call_policies( mb.global_ns.namespace ('OpenGate') ) - set_call_policies( mb.global_ns.namespace ('Ogre') ) - - for cls in main_ns.classes(): - print cls - cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) - - mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() - mb.calldefs( access_type_matcher_t( 'private' ) ).exclude() - - #mb.class_( '::std::set < ::std::string >' ).alias = 'stringSet'; - - excludeClass( mb, [ 'deletePtr' - ,'AiManager' - ,'GameStateListener' - ,'GameStateManager' - ,'Message' - ,'MessageBodyBase' - ,'MessageBodyDisconnect' - ,'MessageBodyChat' - ,'MessageBodyUserID' - ,'MessageBodyShipMovement' - ,'MessageBodyShipProjectileFired' - ,'MessageBodyShipRegister' - ,'MessageBodyShipStatus' - ,'MessageBodyUserID' - ,'MessageBodyUserName' - ,'MessageBodyShipBase' - ,'MessageBodyShipDied' - ,'MessageBodyShipAmmoHit' - ,'MessageBodyShipDeRegister' - ,'MessageBodyShipMovement' - ,'MessageBodyConnectionRefused' - ,'OpenALSoundSource' - ,'ServerUserObject_ptr' - ] ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.reference_existing_object ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.return_pointee_value ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.copy_const_reference ) - - setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' - ] - , call_policies.return_by_value ) - - #excludeFreeFunctionsByName( mb, ['strReplaceBlankWithUnderscore' - #'toStr', 'toInt', 'toFloat', 'toDouble', - #'getRowSubstrings', 'getNonEmptyRow', 'getSubstrings' ] ) - - #excludeFreeFunctionsByReturn( mb, [ 'float *', 'float &' ] ) - - #excludeFreeOperatorsByReturn( mb, [ '::std::ostream &', '::std::istream &' ] ) - - #excludeMemberOperators( mb, ['++', '--', '*'] ) - - -## setMemberFunctionCallPolicie( mb, [''], call_policies.copy_non_const_reference ) - - ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], - ##call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], - #call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], - #call_policies.return_by_value ) - - - # exclude all that does not match any predefined callpolicie - excludeRest = True - - if excludeRest: - mem_funs = mb.calldefs () - - for mem_fun in mem_funs: - if mem_fun.call_policies: - continue - if not mem_fun.call_policies and \ - (declarations.is_reference( mem_fun.return_type ) or declarations.is_pointer (mem_fun.return_type) ): - #print mem_fun - #mem_fun.exclude() - mem_fun.call_policies = \ - call_policies.return_value_policy( call_policies.reference_existing_object ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy( call_policies.return_pointee_value ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy( call_policies.return_opaque_pointer ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy(call_policies.copy_non_const_reference) - - # mb.print_declarations( main_ns ) -#I can print declarations to see what is going on -#mb.print_declarations() - -#Now it is the time to give a name to our module - mb.build_code_creator( settings.module_name ) - -#It is common requirement in software world - each file should have license - #mb.code_creator.license = '//Boost Software License( http://boost.org/more/license_info.html )' - -#I don't want absolute includes within code - mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) - - #And finally we can write code to the disk - mb.split_module( settings.generated_files_dir ) - #mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') ) - -if __name__ == '__main__': - - defined_symbols = ['OPENGATE'] - - generate( defined_symbols ) - print 'done' - - Deleted: branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,20 +0,0 @@ -#! /usr/bin/python - -import os -import environment - -WRAPPER_DEFINITION_General = \ -""" -""" - -WRAPPER_REGISTRATION_General = [ - """ - """] - -def apply_reg ( class_, code ): - for c in code: - class_.add_registration_code ( c ) - -def apply( mb ): - mb.add_declaration_code( WRAPPER_DEFINITION_General ) - apply_reg( mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Added: branches/ogEditor/ogEditor/apps/opengate/opengate/Makefile =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/Makefile (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/Makefile 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,32 @@ +BOOSTINC=-I /usr/include/boost +PYTHONINC=-I /usr/include/python2.5 +OGREINC=`pkg-config --cflags OGRE gtk+-2.0 ogreopcode` +OPENGATEINC=-I $(HOME)/local/opengate/trunk/src + +BOOSTLIB=-L /usr/lib64 -lboost_python-mt -lboost_thread -lboost_regex -lboost_system + +OGRELIB=`pkg-config --libs OGRE gtk+-2.0 ogreopcode CEGUI-OGRE CEGUI openal freealut OIS vorbisfile` + +OGREGEN=-I /home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0 +TARGET=opengate +COPT=-Os -fPIC -DBOOST_PYTHON_NO_PY_SIGNATURES + +CONTAINERSUITE= -I ./indexing_suite_v2 +#CONTAINERSUITE= -I ./boost + +CPPCFILES = $(wildcard generated/*.cpp) +OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES)) +OPENGATEOBJ=$(wildcard $(HOME)/local/opengate/trunk/src/opengateclient*.o) + +default: $(TARGET) + +.cpp.o: + g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< + +$(TARGET): $(OBJECTS) + g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared $(OBJECTS) $(BOOSTLIB) $(OPENGATEOBJ) $(OGRELIB) + strip -g -S -d --strip-debug -s generated/$(TARGET).so +clean: + rm -rf generated/* + rm -f *.so + rm -f *.cache Added: branches/ogEditor/ogEditor/apps/opengate/opengate/build.sh =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/build.sh (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/build.sh 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ $OSTYPE = "msys" ]; then + echo "build for mingw" + python generate_code.py vector + bjam toolset=gcc +else + echo "build for linux gcc" + mkdir -p generated + MAKEOPTS=-j5 + make clean + sh build.wxogre_util.sh + + if [ $# -lt 1 ]; then + python generate_code.py + make $MAKEOPTS + cp generated/opengate.so packages_2.5/opengate/OpenGate.so + + fi +fi Added: branches/ogEditor/ogEditor/apps/opengate/opengate/environment.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/environment.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/environment.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,49 @@ +#! /usr/bin/python +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import sys + +class settings: + module_name = 'OpenGate' + #opengate_path = '../../trunc/src/' + opengate_path = '/home/carsten/local/opengate/trunk/src/' + opengate_cache_file ='python_opengate.cache' + ogre_include_path = '' + ogreopcode_include_path = '' + boost_path = '' + boost_libs_path = '' + gccxml_path = '' + pygccxml_path = '' + pyplusplus_path = '' + python_libs_path = '' + python_include_path = '' + working_dir = '' + unittests_dir = '' + generated_files_dir = './generated' + opengate_defines = '' + def setup_environment(): + print settings.pygccxml_path + sys.path.append( settings.pygccxml_path ) + sys.path.append( settings.pyplusplus_path ) + setup_environment = staticmethod(setup_environment) + +if sys.platform == 'linux2': + settings.python_include_path = '/usr/include/python2.5' + settings.ogre_include_path = '/usr/include/OGRE' + settings.ogreopcode_include_path = '/usr/include/ogreopcode' + settings.gccxml_path = '/usr/bin' + settings.pygccxml_path = '/usr/lib64/python2.5/site-packages' + settings.pyplusplus_path = '/usr/lib64/python2.5/site-packages' + +elif sys.platform == 'win32': + settings.pygccxml_path = 'c:/python25/Lib/site-packages/' + settings.python_libs_path = 'c:/python25/libs' + settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' + settings.opengate_defines ='MINGW' +else: + raise RuntimeError( 'There is no configuration for "%s" platform.' % sys.platform ) + +settings.setup_environment() Added: branches/ogEditor/ogEditor/apps/opengate/opengate/generate_code.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/generate_code.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/generate_code.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,248 @@ +#! /usr/bin/python +# -*- coding: iso-8859-1 -*- + +import os +import sys +import string +from environment import settings + +import hand_made_wrappers + +from pygccxml import parser +from pygccxml import declarations +from pygccxml.declarations import access_type_matcher_t +from pyplusplus import code_creators +from pyplusplus import module_builder +from pyplusplus.module_builder import call_policies + +import common_utils.ogre_properties as ogre_properties + +MAIN_NAMESPACE = 'OpenGate' + +def set_call_policies( mb ): +# + # Set the default policy to deal with pointer/reference return types to reference_existing object^M + # as this is the Ogre Default.^M + mem_funs = mb.calldefs () + mem_funs.create_with_signature = True #Generated code will not compile on^M + #MSVC 7.1 if function has throw modifier.^M + for mem_fun in mem_funs: + if mem_fun.call_policies: + continue + if declarations.is_pointer (mem_fun.return_type) or declarations.is_reference (mem_fun.return_type): + mem_fun.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) + + +class decl_starts_with (object): + def __init__ (self, prefix): + self.prefix = prefix + def __call__ (self, decl): + return self.prefix in decl.name + +def excludeFreeFunctionsByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.free_functions( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeFreeFunctionsByName( mb, functs): + for funct in functs: + fun = mb.global_ns.free_functions( name=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeFreeOperatorsByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.free_operators( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeClass( mb, functs): + for funct in functs: + fun = mb.global_ns.class_( funct ) + print "exclude", fun + fun.exclude() + +def excludeMemberByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.member_functions( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeMemberOperators( mb, functs): + for funct in functs: + fun = mb.global_ns.member_operators( symbol=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def setMemberFunctionCallPolicieByReturn(mb, MemberRetRef, callPolicie ): + for ref in MemberRetRef: + memFuns = mb.global_ns.member_functions( return_type=ref, allow_empty=True ) + print ref, len(memFuns) + + for memFun in memFuns: + if memFun.call_policies: + continue + else: + memFun.call_policies = \ + call_policies.return_value_policy( callPolicie ) + +def generate( defined_symbols ): + xml_cached_fc = parser.create_cached_source_fc( os.path.join( r"python_opengate.h" ), + settings.opengate_cache_file ) + + print xml_cached_fc + + mb = module_builder.module_builder_t( [xml_cached_fc], + gccxml_path = settings.gccxml_path, + working_directory = settings.opengate_path, + include_paths = [settings.opengate_path, settings.python_include_path, + settings.ogreopcode_include_path, settings.ogre_include_path], + define_symbols = defined_symbols, + indexing_suite_version = 1 ) + + ## This module depends on Ogre + #mb.register_module_dependency ( '/home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/' ) + mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0' ) + + global_ns = mb.global_ns + global_ns.exclude() + + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + main_ns.include() + + global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) + + hand_made_wrappers.apply( mb ) + + mb.BOOST_PYTHON_MAX_ARITY = 25 + mb.classes().always_expose_using_scope = True + + set_call_policies( mb.global_ns.namespace ('OpenGate') ) + set_call_policies( mb.global_ns.namespace ('Ogre') ) + + for cls in main_ns.classes(): + print cls + cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + + mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() + mb.calldefs( access_type_matcher_t( 'private' ) ).exclude() + + #mb.class_( '::std::set < ::std::string >' ).alias = 'stringSet'; + + excludeClass( mb, [ 'deletePtr' + ,'AiManager' + ,'GameStateListener' + ,'GameStateManager' + ,'Message' + ,'MessageBodyBase' + ,'MessageBodyDisconnect' + ,'MessageBodyChat' + ,'MessageBodyUserID' + ,'MessageBodyShipMovement' + ,'MessageBodyShipProjectileFired' + ,'MessageBodyShipRegister' + ,'MessageBodyShipStatus' + ,'MessageBodyUserID' + ,'MessageBodyUserName' + ,'MessageBodyShipBase' + ,'MessageBodyShipDied' + ,'MessageBodyShipAmmoHit' + ,'MessageBodyShipDeRegister' + ,'MessageBodyShipMovement' + ,'MessageBodyConnectionRefused' + ,'OpenALSoundSource' + ,'ServerUserObject_ptr' + ] ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.reference_existing_object ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.return_pointee_value ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.copy_const_reference ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.return_by_value ) + + #excludeFreeFunctionsByName( mb, ['strReplaceBlankWithUnderscore' + #'toStr', 'toInt', 'toFloat', 'toDouble', + #'getRowSubstrings', 'getNonEmptyRow', 'getSubstrings' ] ) + + #excludeFreeFunctionsByReturn( mb, [ 'float *', 'float &' ] ) + + #excludeFreeOperatorsByReturn( mb, [ '::std::ostream &', '::std::istream &' ] ) + + #excludeMemberOperators( mb, ['++', '--', '*'] ) + + +## setMemberFunctionCallPolicie( mb, [''], call_policies.copy_non_const_reference ) + + ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], + ##call_policies.return_pointee_value ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], + #call_policies.return_pointee_value ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], + #call_policies.return_by_value ) + + + # exclude all that does not match any predefined callpolicie + excludeRest = True + + if excludeRest: + mem_funs = mb.calldefs () + + for mem_fun in mem_funs: + if mem_fun.call_policies: + continue + if not mem_fun.call_policies and \ + (declarations.is_reference( mem_fun.return_type ) or declarations.is_pointer (mem_fun.return_type) ): + #print mem_fun + #mem_fun.exclude() + mem_fun.call_policies = \ + call_policies.return_value_policy( call_policies.reference_existing_object ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy( call_policies.return_pointee_value ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy( call_policies.return_opaque_pointer ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy(call_policies.copy_non_const_reference) + + # mb.print_declarations( main_ns ) +#I can print declarations to see what is going on +#mb.print_declarations() + +#Now it is the time to give a name to our module + mb.build_code_creator( settings.module_name ) + +#It is common requirement in software world - each file should have license + #mb.code_creator.license = '//Boost Software License( http://boost.org/more/license_info.html )' + +#I don't want absolute includes within code + mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) + + #And finally we can write code to the disk + mb.split_module( settings.generated_files_dir ) + #mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') ) + +if __name__ == '__main__': + + defined_symbols = ['OPENGATE'] + + generate( defined_symbols ) + print 'done' + + Added: branches/ogEditor/ogEditor/apps/opengate/opengate/hand_made_wrappers.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/hand_made_wrappers.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/hand_made_wrappers.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,20 @@ +#! /usr/bin/python + +import os +import environment + +WRAPPER_DEFINITION_General = \ +""" +""" + +WRAPPER_REGISTRATION_General = [ + """ + """] + +def apply_reg ( class_, code ): + for c in code: + class_.add_registration_code ( c ) + +def apply( mb ): + mb.add_declaration_code( WRAPPER_DEFINITION_General ) + apply_reg( mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Added: branches/ogEditor/ogEditor/apps/opengate/opengate/python_ogre_masterlist.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_ogre_masterlist.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/python_ogre_masterlist.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,102 @@ +/* Master header file for the Ogre part of Python-Ogre + +Nov 21 2007: Major change to use Ogre.h and OgreStableHeaders.h, and then add missing files as needed. + +*/ + +#include "Ogre.h" +#include "OgreStableHeaders.h" + +#include "OgreAlignedAllocator.h" +#include "OgreAnimable.h" +#include "OgreArchiveFactory.h" +#include "OgreAutoParamDataSource.h" +#include "OgreBillboard.h" +#include "OgreBillboardParticleRenderer.h" +#include "OgreBlendMode.h" +#include "OgreBorderPanelOverlayElement.h" +// #include "OgreCodec.h" // this one causes a Py++ exception +#include "OgreCompiler2Pass.h" +#include "OgreCompositorScriptCompiler.h" +#include "OgreCompositorSerializer.h" +#include "OgreConfig.h" +#ifndef __APPLE_CC__ // need to exlude under MacOS X + #include "OgreConfigDialog.h" +#endif +#include "OgreConfigOptionMap.h" +#include "OgreController.h" +#include "OgreConvexBody.h" +// #include "OgreDDSCodec.h" /// not this one +#include "OgreDefaultHardwareBufferManager.h" +#include "OgreDynLib.h" +#include "OgreDynLibManager.h" +#include "OgreEdgeListBuilder.h" +#include "OgreErrorDialog.h" +#include "OgreExternalTextureSource.h" +#include "OgreExternalTextureSourceManager.h" +#include "OgreFactoryObj.h" +#include "OgreFont.h" +#include "OgreFontManager.h" +#include "OgreFrameListener.h" +// #include "OgreFreeImageCodec.h" // not this one +#include "OgreGpuProgramUsage.h" +#include "OgreHardwareBuffer.h" +#include "OgreImage.h" +// #include "OgreImageCodec.h" // not this one +#include "OgreIteratorWrappers.h" +#if OGRE_VERSION_MINOR == 4 + #include "OgreMaterialScriptCompiler.h" + #include "OgreMemoryMacros.h" + #include "OgreMemoryManager.h" + #include "OgreNoMemoryMacros.h" +#endif +#include "OgreMeshFileFormat.h" +#include "OgreMeshSerializerImpl.h" +#include "OgreMovablePlane.h" +#include "OgreNumerics.h" +#include "OgreOverlayElementCommands.h" +#include "OgreOverlayElementFactory.h" +#include "OgrePanelOverlayElement.h" +#include "OgreParticle.h" +#include "OgreParticleAffectorFactory.h" +#include "OgreParticleEmitterCommands.h" +#include "OgreParticleEmitterFactory.h" +#include "OgreParticleIterator.h" +#include "OgreParticleSystem.h" +#include "OgreParticleSystemRenderer.h" +#include "OgrePixelFormat.h" +#include "OgrePlaneBoundedVolume.h" +#include "OgrePlatform.h" +#include "OgrePlugin.h" +#include "OgrePolygon.h" +#include "OgrePose.h" +#include "OgrePredefinedControllers.h" +#include "OgrePrefabFactory.h" +#include "OgreProgressiveMesh.h" +#include "OgreRay.h" +#include "OgreRectangle.h" +#include "OgreRectangle2D.h" +#include "OgreRenderable.h" +#include "OgreRenderOperation.h" +#include "OgreRenderQueue.h" +#include "OgreRenderQueueSortingGrouping.h" +#include "OgreRenderSystemCapabilities.h" +#include "OgreRenderTarget.h" +#include "OgreResourceManager.h" +#include "OgreRotationalSpline.h" +#include "OgreSceneQuery.h" +#include "OgreScriptLoader.h" +// #include "OgreSearchOps.h" // not this one +#include "OgreShadowCaster.h" +#include "OgreShadowTextureManager.h" +#include "OgreShadowVolumeExtrudeProgram.h" +#include "OgreSkeletonFileFormat.h" +// #include "OgreSpotShadowFadePng.h" // Gets defined in every obj file so has link errors, needs to be defined as static +#include "OgreStaticFaceGroup.h" +#include "OgreTagPoint.h" +#include "OgreTextAreaOverlayElement.h" +#include "OgreTexture.h" +#include "OgreTimer.h" +#include "OgreUnifiedHighLevelGpuProgram.h" +#include "OgreVertexBoneAssignment.h" +#include "OgreVertexIndexData.h" Added: branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,118 @@ +#ifndef PYTHON_OPENGATE__H +#define PYTHON_OPENGATE__H + +#include "python_ogre_masterlist.h" +#include "OgreCEGUIRenderer.h" +#include "OgreCEGUIResourceProvider.h" + +#include <OgreVector3.h> +namespace CEGUI{ + class OgreCEGUIRenderer; +} +// namespace OpenGate{ +// class Foo{ +// Ogre::Vector3 vec_; +// public: +// void setVec( Ogre::Vector3 & vec ) { vec_ = vec ;} +// std::vector < double > v() const { +// std::vector < double > t; +// return t; +// } +// std::list < double > s() const { +// std::list < double > t; +// return t; +// } +// }; +// +// class Bar{ +// public: +// std::vector < Foo * > f() const { +// std::vector < Foo * > t; +// return t; +// } +// }; +// } +#include <OgreOpcode.h> + +#include "AiCommands.h" +#include "AiManager.h" +#include "AiObject.h" +#include "Avatar.h" +#include "BaseDialog.h" +#include "BaseObject.h" +#include "ConfigDialog.h" +#include "Console.h" +#include "DockedState.h" +#include "Entity.h" +#include "EntityManager.h" +#include "Equipment.h" +#include "GameState.h" +#include "GameStateManager.h" +#include "GunObject.h" +#include "Hud.h" +#include "InitState.h" +#include "InputManager.h" +#include "KeyMap.h" +#include "LogManager.h" +#include "LogManagerBase.h" +#include "LogManagerOpenGate.h" +#include "MarketDialog.h" +#include "Missile.h" +#include "Moveable.h" +#include "OpcodeWrapper.h" +#include "OpenALSoundManager.h" +#include "Opengate.h" +#include "Projectile.h" +#include "RadarObject.h" +#include "ResourceManager.h" +#include "Sector.h" +#include "SectorAvatarObject.h" +#include "SectorBaseObject.h" +#include "SectorBeaconObject.h" +#include "SectorBeaconPadObject.h" +#include "SectorChildObject.h" +#include "SectorCollisionObject.h" +#include "SectorEnvironmentObject.h" +#include "SectorExplosionObject.h" +#include "SectorMeshObject.h" +#include "SectorMissileObject.h" +#include "SectorMovableObject.h" +#include "SectorObject.h" +#include "SectorObjectAvatar.h" +#include "SectorObjectMissile.h" +#include "SectorObjectMoveable.h" +#include "SectorObjectVessel.h" +#include "SectorPadObject.h" +#include "SectorProjectileObject.h" +#include "SectorStationObject.h" +#include "SectorStationPadObject.h" +#include "SectorVesselObject.h" +#include "ShipConfigDialog.h" +#include "UnDockedState.h" +#include "Vessel.h" +#include "common.h" +#include "commonWithOgre.h" +#include "metaserver.h" +#include "networkClient.h" +#include "networkProtocol.h" +#include "networkServer.h" +#include "networkServerUser.h" + +namespace OpenGate{ + //void foo ( std::vector< char >, std::vector < Ogre::Vector3 > ){} +} + +//First we create a magic namespace to hold all our aliases +namespace pyplusplus { namespace aliases { +#include "python_opengate_aliases.h" +} } + +// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ +// +namespace python_opengate{ namespace details{ +inline void instantiate(){ +using namespace OpenGate; +#include "python_opengate_sizeof.h" +} } } + +#endif // PYTHON_OPENGATE__H Added: branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_aliases.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_aliases.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_aliases.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,10 @@ +typedef ::std::vector < ::std::string > stdVectorString; +typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; +typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; +typedef ::std::set < ::std::string > stdSetString; +typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; +typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; +typedef ::std::set< OpenGate::Vessel * > stdSetVessel; +typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; +typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; + Added: branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_sizeof.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_sizeof.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate/python_opengate_sizeof.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -0,0 +1,7 @@ +sizeof ( ::OpenGate::Message& ); +sizeof ( ::OpenGate::MessageBodyBase& ); +sizeof ( ::OpenGate::OpenALSoundSource* ); +sizeof ( ::OpenGate::OpenALSoundSource& ); +sizeof ( ::OpenGate::OpenALSoundSource ); + + Modified: branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-17 19:17:33 UTC (rev 1148) @@ -3,12 +3,12 @@ FileSystem=../../trunk/data/capacitors FileSystem=../../trunk/data/commodities FileSystem=../../trunk/data/gui -#FileSystem=../../trunk/data/gui/fonts -#FileSystem=../../trunk/data/gui/layouts -#FileSystem=../../trunk/data/gui/imagesets -#FileSystem=../../trunk/data/gui/schemes -#FileSystem=../../trunk/data/gui/looknfeel -#FileSystem=../../trunk/data/gui/overlays +FileSystem=../../trunk/data/gui/fonts +FileSystem=../../trunk/data/gui/layouts +FileSystem=../../trunk/data/gui/imagesets +FileSystem=../../trunk/data/gui/schemes +FileSystem=../../trunk/data/gui/looknfeel +FileSystem=../../trunk/data/gui/overlays FileSystem=../../trunk/data/ecms FileSystem=../../trunk/data/engines FileSystem=../../trunk/data/guns Modified: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -66,7 +66,7 @@ def getRenderer( self, slot = None): if not self.renderer_ and slot is not None: - self.renderer_ = OgreWindow( slot ) + self.renderer_ = OgreWindow( slot, resourceFile = os.path.join( os.path.dirname(__file__), 'opengate-resources.cfg' ) ) #self.renderer_.SetMinSize( wx.Size( 800, 600 ) ) self.renderer_.StartRendering() @@ -74,8 +74,8 @@ self.sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) rootNode = self.sceneManager.getRootSceneNode() - ninja = self.sceneManager.createEntity('ninja', 'ninja.mesh') - node = rootNode.createChildSceneNode("ninja_node", ogre.Vector3(0, 0, -500)) + ninja = self.sceneManager.createEntity('apteryx', 'apteryx.mesh') + node = rootNode.createChildSceneNode("apteryx_node", ogre.Vector3(0, 0, -100)) node.attachObject(ninja) if CEGUI.Version__.startswith ("0.6"): @@ -95,7 +95,7 @@ self.GUISystem.setDefaultMouseCursor("opengateCursor", "Cursor1") self.GUISystem.setDefaultFont("BlueHighway-12") - self.GUISystem.setGUISheet( CEGUI.WindowManager.getSingleton().loadWindowLayout("test.layout") ) + self.GUISystem.setGUISheet( CEGUI.WindowManager.getSingleton().loadWindowLayout("opengateDocked.layout") ) self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) Deleted: branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,102 +0,0 @@ -/* Master header file for the Ogre part of Python-Ogre - -Nov 21 2007: Major change to use Ogre.h and OgreStableHeaders.h, and then add missing files as needed. - -*/ - -#include "Ogre.h" -#include "OgreStableHeaders.h" - -#include "OgreAlignedAllocator.h" -#include "OgreAnimable.h" -#include "OgreArchiveFactory.h" -#include "OgreAutoParamDataSource.h" -#include "OgreBillboard.h" -#include "OgreBillboardParticleRenderer.h" -#include "OgreBlendMode.h" -#include "OgreBorderPanelOverlayElement.h" -// #include "OgreCodec.h" // this one causes a Py++ exception -#include "OgreCompiler2Pass.h" -#include "OgreCompositorScriptCompiler.h" -#include "OgreCompositorSerializer.h" -#include "OgreConfig.h" -#ifndef __APPLE_CC__ // need to exlude under MacOS X - #include "OgreConfigDialog.h" -#endif -#include "OgreConfigOptionMap.h" -#include "OgreController.h" -#include "OgreConvexBody.h" -// #include "OgreDDSCodec.h" /// not this one -#include "OgreDefaultHardwareBufferManager.h" -#include "OgreDynLib.h" -#include "OgreDynLibManager.h" -#include "OgreEdgeListBuilder.h" -#include "OgreErrorDialog.h" -#include "OgreExternalTextureSource.h" -#include "OgreExternalTextureSourceManager.h" -#include "OgreFactoryObj.h" -#include "OgreFont.h" -#include "OgreFontManager.h" -#include "OgreFrameListener.h" -// #include "OgreFreeImageCodec.h" // not this one -#include "OgreGpuProgramUsage.h" -#include "OgreHardwareBuffer.h" -#include "OgreImage.h" -// #include "OgreImageCodec.h" // not this one -#include "OgreIteratorWrappers.h" -#if OGRE_VERSION_MINOR == 4 - #include "OgreMaterialScriptCompiler.h" - #include "OgreMemoryMacros.h" - #include "OgreMemoryManager.h" - #include "OgreNoMemoryMacros.h" -#endif -#include "OgreMeshFileFormat.h" -#include "OgreMeshSerializerImpl.h" -#include "OgreMovablePlane.h" -#include "OgreNumerics.h" -#include "OgreOverlayElementCommands.h" -#include "OgreOverlayElementFactory.h" -#include "OgrePanelOverlayElement.h" -#include "OgreParticle.h" -#include "OgreParticleAffectorFactory.h" -#include "OgreParticleEmitterCommands.h" -#include "OgreParticleEmitterFactory.h" -#include "OgreParticleIterator.h" -#include "OgreParticleSystem.h" -#include "OgreParticleSystemRenderer.h" -#include "OgrePixelFormat.h" -#include "OgrePlaneBoundedVolume.h" -#include "OgrePlatform.h" -#include "OgrePlugin.h" -#include "OgrePolygon.h" -#include "OgrePose.h" -#include "OgrePredefinedControllers.h" -#include "OgrePrefabFactory.h" -#include "OgreProgressiveMesh.h" -#include "OgreRay.h" -#include "OgreRectangle.h" -#include "OgreRectangle2D.h" -#include "OgreRenderable.h" -#include "OgreRenderOperation.h" -#include "OgreRenderQueue.h" -#include "OgreRenderQueueSortingGrouping.h" -#include "OgreRenderSystemCapabilities.h" -#include "OgreRenderTarget.h" -#include "OgreResourceManager.h" -#include "OgreRotationalSpline.h" -#include "OgreSceneQuery.h" -#include "OgreScriptLoader.h" -// #include "OgreSearchOps.h" // not this one -#include "OgreShadowCaster.h" -#include "OgreShadowTextureManager.h" -#include "OgreShadowVolumeExtrudeProgram.h" -#include "OgreSkeletonFileFormat.h" -// #include "OgreSpotShadowFadePng.h" // Gets defined in every obj file so has link errors, needs to be defined as static -#include "OgreStaticFaceGroup.h" -#include "OgreTagPoint.h" -#include "OgreTextAreaOverlayElement.h" -#include "OgreTexture.h" -#include "OgreTimer.h" -#include "OgreUnifiedHighLevelGpuProgram.h" -#include "OgreVertexBoneAssignment.h" -#include "OgreVertexIndexData.h" Deleted: branches/ogEditor/ogEditor/apps/opengate/python_opengate.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate.h 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,118 +0,0 @@ -#ifndef PYTHON_OPENGATE__H -#define PYTHON_OPENGATE__H - -#include "python_ogre_masterlist.h" -#include "OgreCEGUIRenderer.h" -#include "OgreCEGUIResourceProvider.h" - -#include <OgreVector3.h> -namespace CEGUI{ - class OgreCEGUIRenderer; -} -// namespace OpenGate{ -// class Foo{ -// Ogre::Vector3 vec_; -// public: -// void setVec( Ogre::Vector3 & vec ) { vec_ = vec ;} -// std::vector < double > v() const { -// std::vector < double > t; -// return t; -// } -// std::list < double > s() const { -// std::list < double > t; -// return t; -// } -// }; -// -// class Bar{ -// public: -// std::vector < Foo * > f() const { -// std::vector < Foo * > t; -// return t; -// } -// }; -// } -#include <OgreOpcode.h> - -#include "AiCommands.h" -#include "AiManager.h" -#include "AiObject.h" -#include "Avatar.h" -#include "BaseDialog.h" -#include "BaseObject.h" -#include "ConfigDialog.h" -#include "Console.h" -#include "DockedState.h" -#include "Entity.h" -#include "EntityManager.h" -#include "Equipment.h" -#include "GameState.h" -#include "GameStateManager.h" -#include "GunObject.h" -#include "Hud.h" -#include "InitState.h" -#include "InputManager.h" -#include "KeyMap.h" -#include "LogManager.h" -#include "LogManagerBase.h" -#include "LogManagerOpenGate.h" -#include "MarketDialog.h" -#include "Missile.h" -#include "Moveable.h" -#include "OpcodeWrapper.h" -#include "OpenALSoundManager.h" -#include "Opengate.h" -#include "Projectile.h" -#include "RadarObject.h" -#include "ResourceManager.h" -#include "Sector.h" -#include "SectorAvatarObject.h" -#include "SectorBaseObject.h" -#include "SectorBeaconObject.h" -#include "SectorBeaconPadObject.h" -#include "SectorChildObject.h" -#include "SectorCollisionObject.h" -#include "SectorEnvironmentObject.h" -#include "SectorExplosionObject.h" -#include "SectorMeshObject.h" -#include "SectorMissileObject.h" -#include "SectorMovableObject.h" -#include "SectorObject.h" -#include "SectorObjectAvatar.h" -#include "SectorObjectMissile.h" -#include "SectorObjectMoveable.h" -#include "SectorObjectVessel.h" -#include "SectorPadObject.h" -#include "SectorProjectileObject.h" -#include "SectorStationObject.h" -#include "SectorStationPadObject.h" -#include "SectorVesselObject.h" -#include "ShipConfigDialog.h" -#include "UnDockedState.h" -#include "Vessel.h" -#include "common.h" -#include "commonWithOgre.h" -#include "metaserver.h" -#include "networkClient.h" -#include "networkProtocol.h" -#include "networkServer.h" -#include "networkServerUser.h" - -namespace OpenGate{ - //void foo ( std::vector< char >, std::vector < Ogre::Vector3 > ){} -} - -//First we create a magic namespace to hold all our aliases -namespace pyplusplus { namespace aliases { -#include "python_opengate_aliases.h" -} } - -// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ -// -namespace python_opengate{ namespace details{ -inline void instantiate(){ -using namespace OpenGate; -#include "python_opengate_sizeof.h" -} } } - -#endif // PYTHON_OPENGATE__H Deleted: branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,10 +0,0 @@ -typedef ::std::vector < ::std::string > stdVectorString; -typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; -typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; -typedef ::std::set < ::std::string > stdSetString; -typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; -typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; -typedef ::std::set< OpenGate::Vessel * > stdSetVessel; -typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; -typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; - Deleted: branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h 2009-12-17 19:17:33 UTC (rev 1148) @@ -1,7 +0,0 @@ -sizeof ( ::OpenGate::Message& ); -sizeof ( ::OpenGate::MessageBodyBase& ); -sizeof ( ::OpenGate::OpenALSoundSource* ); -sizeof ( ::OpenGate::OpenALSoundSource& ); -sizeof ( ::OpenGate::OpenALSoundSource ); - - Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 13:43:58 UTC (rev 1147) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 19:17:33 UTC (rev 1148) @@ -58,6 +58,13 @@ , style = wx.NO_FULL_REPAINT_ON_RESIZE , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) + if 'resourceFile' in kwargs: + self.resourceFile = kwargs[ 'resourceFile' ] + else: + self.resourceFile = 'resources.cfg' + + print self.resourceFile + self.parent = parent self.parent.Show() @@ -139,7 +146,7 @@ self.ogreRoot = ogre.Root( getPluginPath(), "ogre.cfg" ) # setup resources - self.AddResources( "resources.cfg" ); + self.AddResources( self.resourceFile ); renList = self.ogreRoot.getAvailableRenderers() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-17 13:44:06
|
Revision: 1147 http://opengate.svn.sourceforge.net/opengate/?rev=1147&view=rev Author: spom_spom Date: 2009-12-17 13:43:58 +0000 (Thu, 17 Dec 2009) Log Message: ----------- ogedit: add cegui view support Modified Paths: -------------- branches/ogEditor/ogEditor/apps/ogretest/__init__.py branches/ogEditor/ogEditor/apps/ogretest/ogretest.py branches/ogEditor/ogEditor/apps/opengate/__init__.py branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py Added Paths: ----------- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py Removed Paths: ------------- branches/ogEditor/resources.cfg Modified: branches/ogEditor/ogEditor/apps/ogretest/__init__.py =================================================================== --- branches/ogEditor/ogEditor/apps/ogretest/__init__.py 2009-12-16 21:50:41 UTC (rev 1146) +++ branches/ogEditor/ogEditor/apps/ogretest/__init__.py 2009-12-17 13:43:58 UTC (rev 1147) @@ -4,7 +4,7 @@ PluginApplication = OgreTest -MainMenuBarNew_Item = '&Ogre-test\tCtrl+T' +MainMenuBarNew_Item = 'Ogre-&test\tCtrl+T' MainMenuBarNew_ItemHelp = 'Create new Ogre test application' #MainOpenFileSuffix = [ '.mesh' ] Modified: branches/ogEditor/ogEditor/apps/ogretest/ogretest.py =================================================================== --- branches/ogEditor/ogEditor/apps/ogretest/ogretest.py 2009-12-16 21:50:41 UTC (rev 1146) +++ branches/ogEditor/ogEditor/apps/ogretest/ogretest.py 2009-12-17 13:43:58 UTC (rev 1147) @@ -5,7 +5,11 @@ from ogEditor.base import AppResource from ogEditor.wxOgre import ogre, OgreWindow +from ogEditor.wxOgre.CEGUI_framework import * +import ogre.gui.CEGUI as CEGUI + + #from ogEditor.resources import loadIcon, MakeDisabledBitmap #class OgreTest( ): @@ -16,7 +20,9 @@ # set the name of this application that appears to the resource tree self.setName("OgreTest") - + self.sceneManager = None + self.GUIRenderer = None + self.GUISystem = None ## optionaly load content informations for this application, generated by an gui-builder that wrote xrc-files ## eg. wxFormBuilder, __file__ is needed to find the xrc-file #self.loadXRC( 'testapp.xrc', __file__ ) @@ -61,18 +67,47 @@ def getRenderer( self, slot = None): if not self.renderer_ and slot is not None: self.renderer_ = OgreWindow( slot ) + #self.renderer_.SetMinSize( wx.Size( 800, 600 ) ) self.renderer_.StartRendering() - sceneManager = self.renderer_.sceneManager - sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) - rootNode = sceneManager.getRootSceneNode() + self.sceneManager = self.renderer_.sceneManager + self.sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) + rootNode = self.sceneManager.getRootSceneNode() - ninja = sceneManager.createEntity('ninja', 'ninja.mesh') + ninja = self.sceneManager.createEntity('ninja', 'ninja.mesh') node = rootNode.createChildSceneNode("ninja_node", ogre.Vector3(0, 0, -500)) node.attachObject(ninja) + + if CEGUI.Version__.startswith ("0.6"): + self.GUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderer_.renderWindow, + #self.GUIRenderer = CEGUI.OgreRenderer(self.renderWindow, + ogre.RENDER_QUEUE_OVERLAY, False, 3000, self.sceneManager) + self.GUISystem = CEGUI.System(self.GUIRenderer) + else: + self.GUIRenderer = CEGUI.OgreRenderer.bootstrapSystem() + self.GUISystem = CEGUI.System.getSingleton() + + logger = CEGUI.Logger.getSingleton() + level = CEGUI.Insane + logger.setLoggingLevel(level) + + CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") + self.GUISystem.setDefaultMouseCursor("opengateCursor", "Cursor1") + self.GUISystem.setDefaultFont("BlueHighway-12") + self.GUISystem.setGUISheet( CEGUI.WindowManager.getSingleton().loadWindowLayout("test.layout") ) + + self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) + + #self.frameListener = GuiFrameListener( self.renderer_.renderWindow, self.renderer_.camera, self.GUIRenderer) #self.sceneManager) + #self.frameListener.MenuMode = True # this stop the camera moving with the mouse cursor.. + + #self.renderer_.ogreRoot.addFrameListener(self.frameListener) + #self.frameListener.showDebugOverlay(False) + + return self.renderer_ - + def menuFunction( self, event = None ): """ do nothing here, just to show the technique Modified: branches/ogEditor/ogEditor/apps/opengate/__init__.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/__init__.py 2009-12-16 21:50:41 UTC (rev 1146) +++ branches/ogEditor/ogEditor/apps/opengate/__init__.py 2009-12-17 13:43:58 UTC (rev 1147) @@ -0,0 +1,12 @@ +# -*- coding: iso-8859-1 -*- + +from opengateedit import * + +PluginApplication = OpengateEditor + +MainMenuBarNew_Item = 'Open&gate\tCtrl+G' +MainMenuBarNew_ItemHelp = 'Create new Opengate editor application' + +#MainOpenFileSuffix = [ '.mesh' ] +#MainOpenFileSlot = TestOgre.loadMesh +#MainOpenWildcard = [ "TestOgre test suffix1 (*.mesh)" ] Added: branches/ogEditor/ogEditor/apps/opengate/opengateedit.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengateedit.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengateedit.py 2009-12-17 13:43:58 UTC (rev 1147) @@ -0,0 +1,127 @@ +# -*- coding: iso-8859-1 -*- + +import wx + +from ogEditor.base import AppResource + +from ogEditor.wxOgre import ogre, OgreWindow +from ogEditor.wxOgre.CEGUI_framework import * + +import ogre.gui.CEGUI as CEGUI + + +#from ogEditor.resources import loadIcon, MakeDisabledBitmap + +#class OgreTest( ): +class OpengateEditor( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + + # set the name of this application that appears to the resource tree + + self.setName("Opengate") + self.sceneManager = None + self.GUIRenderer = None + self.GUISystem = None + ## optionaly load content informations for this application, generated by an gui-builder that wrote xrc-files + ## eg. wxFormBuilder, __file__ is needed to find the xrc-file + #self.loadXRC( 'testapp.xrc', __file__ ) + + ## register a menu to the main-MenuBar, using this function ensures that this menu will be shown/hiden respective to the activate status of the application + #self.mbTestMenu = self.createMainMenu( '&Test Ogre' ) + + ## create an item to to the test menu + #self.createMenuItem( self.mbTestMenu + #, name = "Test Menu item" + #, help = "Test Menu item" + #, function = self.menuFunction ) + + ## the application has some properties that can be altered by the property inspector (PI), loaded and saved + #self.titleTextProp = self.appendProperty( "Title", default = 'unknown', valType = str ) + + # do some stuff after this application has created and registered to the resourcetree + #self.parent.addCommandToOnIdleQueue( self.postCreate ) + pass + + def postCreate( self ): + pass + #self.createSubPanel( TestMPLApp, "wxMPL" ) + #self.createSubPanel( TestVTKApp, "wxVTK" ) + + #def createPropertyPanel( self, parent ): + #""" + #Define and return panel that is shown in the property-inspector (PI) + #The panel will post created at the first call + #""" + + ## create a Notebook for the PI and add the content for the panel with the name piTestApplication defined in testapp.xrc + #panel = self.createPropertyInspectorNoteBookPanel( parent, 'piTestApplication', title = 'TestApplication' ) + + ## define property behaviour + #self.titleTextProp.setCtrl( ctrl = wx.xrc.XRCCTRL( panel, 'TitleTextCtrl' ) # name of the control in xrc + #, ctrlEvent = wx.EVT_TEXT # the event that should observed + #, targetFunct = self.setTitle ) # the callback when the event is called + + #return panel + + def getRenderer( self, slot = None): + if not self.renderer_ and slot is not None: + self.renderer_ = OgreWindow( slot ) + #self.renderer_.SetMinSize( wx.Size( 800, 600 ) ) + self.renderer_.StartRendering() + + self.sceneManager = self.renderer_.sceneManager + self.sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) + rootNode = self.sceneManager.getRootSceneNode() + + ninja = self.sceneManager.createEntity('ninja', 'ninja.mesh') + node = rootNode.createChildSceneNode("ninja_node", ogre.Vector3(0, 0, -500)) + node.attachObject(ninja) + + if CEGUI.Version__.startswith ("0.6"): + self.GUIRenderer = CEGUI.OgreCEGUIRenderer(self.renderer_.renderWindow, + #self.GUIRenderer = CEGUI.OgreRenderer(self.renderWindow, + ogre.RENDER_QUEUE_OVERLAY, False, 3000, self.sceneManager) + self.GUISystem = CEGUI.System(self.GUIRenderer) + else: + self.GUIRenderer = CEGUI.OgreRenderer.bootstrapSystem() + self.GUISystem = CEGUI.System.getSingleton() + + logger = CEGUI.Logger.getSingleton() + level = CEGUI.Insane + logger.setLoggingLevel(level) + + CEGUI.SchemeManager.getSingleton().loadScheme("opengate.scheme") + self.GUISystem.setDefaultMouseCursor("opengateCursor", "Cursor1") + self.GUISystem.setDefaultFont("BlueHighway-12") + + self.GUISystem.setGUISheet( CEGUI.WindowManager.getSingleton().loadWindowLayout("test.layout") ) + + self.renderer_.addListener( wxCEGUIListener( self.GUIRenderer ) ) + + #self.frameListener = GuiFrameListener( self.renderer_.renderWindow, self.renderer_.camera, self.GUIRenderer) #self.sceneManager) + #self.frameListener.MenuMode = True # this stop the camera moving with the mouse cursor.. + + #self.renderer_.ogreRoot.addFrameListener(self.frameListener) + #self.frameListener.showDebugOverlay(False) + + + return self.renderer_ + + def menuFunction( self, event = None ): + """ + do nothing here, just to show the technique + """ + pass + + def setTitle( self, title = None ): + """ + Set the title, either called manually or by callback + """ + if title is None: + title = self.titleTextProp() + else: + self.titleTextProp.setVal( title ) + + self.getResourceTree().SetItemText( self.treeItem, self.getName() + ": " + title ) + Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-16 21:50:41 UTC (rev 1146) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-17 13:43:58 UTC (rev 1147) @@ -12,14 +12,8 @@ print "no python-ogre installation found" print "download version 1.6.4 from http://sourceforge.net/projects/python-ogre/files/" - def toStr( vec ): return ("%g, %g, %g"%(vec.x, vec.y, vec.z)) -#try : - #import psyco #use psyco if available (JIT compiler) - #psyco.full() -#except ImportError: - #pass def getPluginPath(): """Return the absolute path to a valid plugins.cfg file.""" @@ -44,20 +38,25 @@ "simple dummy class to regroup scene entities in a single parameter" pass -from wx import glcanvas -class OgreWindow( wx.PyWindow ): - -#class OgreWindow( glcanvas.GLCanvas ): +baseClass = wx.PyWindow +if wx.Platform == "__WXGTK__": + import wx.glcanvas + baseClass = wx.glcanvas.GLCanvas + +class OgreWindow( baseClass ): """wx.Frame subclass to embed an Ogre window in wxPython It is somewhat inspired from SampleFramework.py""" def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): -# glcanvas.GLCanvas.__init__( self, parent -# , size = parent.GetSize() -# , style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE -# , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) - wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) + if type( baseClass ) == wx.PyWindow: + wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) + else: + wx.glcanvas.GLCanvas.__init__( self, parent + , size = parent.GetSize() + #, style = wx.WANTS_CHARS | + , style = wx.NO_FULL_REPAINT_ON_RESIZE + , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) self.parent = parent self.parent.Show() @@ -73,7 +72,9 @@ self.timer = wx.Timer() self.timer.SetOwner( self ) #Sets the timer to notify self: binding the timer event is not enough - self.renderWindow = None + self.renderWindow = None + self.ogreRoot = None + self.listener = [] #Ogre Initialisation self.weu = ogre.WindowEventUtilities() @@ -111,9 +112,11 @@ lastValid.Show( True ) parent = lastValid.GetParent() - #handle = glcanvas.GLCanvas.GetHandle( self ) #print "windowhandle = ", handle - handle = wx.PyWindow.GetHandle( self ) + if type( baseClass ) == wx.PyWindow: + handle = wx.PyWindow.GetHandle( self ) + else: + handle = wx.glcanvas.GLCanvas.GetHandle( self ) if handle == 0: try: @@ -142,7 +145,6 @@ bFound = False for r in renList: - print r.getName() if string.find(r.getName(),renderSystem) != -1 and bFound==False: self.ogreRoot.setRenderSystem ( r ) bFound = True @@ -150,7 +152,6 @@ if os.path.exists( "ogre.cfg" ): self.ogreRoot.restoreConfig() else: - print "create ogre.cfg" carryOn = self.ogreRoot.showConfigDialog() if not carryOn: sys.exit('Quit from Config Dialog') @@ -158,7 +159,7 @@ self.ogreRoot.initialise(False) renderParameters = ogre.NameValuePairList() - renderParameters['FSAA'] = "16" + renderParameters['FSAA'] = "0" self.__handle = self.GetHandle() renderParameters['externalWindowHandle'] = self.__handle @@ -170,15 +171,17 @@ ogre.ResourceGroupManager.getSingleton().initialiseAllResourceGroups() def _OnSize(self, event): - if getattr(self, 'ogreRoot', None): - print self.parent.GetSize() - print self.GetSize() + if self.renderWindow is not None: + print self.GetSize(), self.parent.GetSize() self.renderWindow.resize( self.GetSize()[ 0 ], self.GetSize()[ 1 ] ); self.renderWindow.windowMovedOrResized() self.UpdateRender() - print self.renderWindow.getWidth(), self.renderWindow.getHeight() + print "ren", self.renderWindow.getWidth(), self.renderWindow.getHeight() + for l in self.listener: + l.onResize( self.GetSize() ) + event.Skip() def _OnEraseBackground(self, event): @@ -212,8 +215,7 @@ #handle = wxHandle.get_window_handle_str( self ) #print "Update Render call: ", handle - - # unfortunally ogre seams to + # unfortunally ogre propably cant remap the windowhandle #if self.__handle is not self.GetHandle(): #print "handle change:", self.__handle, self.GetHandle() #renderParameters = ogre.NameValuePairList() @@ -307,6 +309,9 @@ #toStr( self.sceneEntities.camera.getDirection() ) ) ) event.Skip() + def addListener( self, listener ): + self.listener.append( listener ) + def _DefaultMouseEventManager( self, event ): "If you want to implement a similar callback function, do not forget the event.Skip() at the end" self.SetFocus() #Gives Keyboard focus to the window @@ -323,4 +328,7 @@ self.sceneEntities.cameraNode.yaw( ogre.Degree( dx / 5.0 ), ogre.Node.TS_LOCAL ) self.sceneEntities.cameraNode.pitch( ogre.Degree( dy / 5.0 ), ogre.Node.TS_LOCAL ) + for l in self.listener: + l.onMouseEvent( event ) + event.Skip() Deleted: branches/ogEditor/resources.cfg =================================================================== --- branches/ogEditor/resources.cfg 2009-12-16 21:50:41 UTC (rev 1146) +++ branches/ogEditor/resources.cfg 2009-12-17 13:43:58 UTC (rev 1147) @@ -1,15 +0,0 @@ -[Bootstrap] -Zip=c:\Programme\PythonOgreRelease\Demos\media\packs\OgreCore.zip - -[General] -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\fonts -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\gui -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\scripts -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\textures -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\programs -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\models -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\overlays -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\packs -FileSystem=c:\Programme\PythonOgreRelease\Demos\media\particle - - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-16 21:50:50
|
Revision: 1146 http://opengate.svn.sourceforge.net/opengate/?rev=1146&view=rev Author: spom_spom Date: 2009-12-16 21:50:41 +0000 (Wed, 16 Dec 2009) Log Message: ----------- win32 compatibility commit (wxOgreTest.py and ogedit working) Modified Paths: -------------- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py branches/ogEditor/resources.cfg branches/ogEditor/resources_win32.cfg Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-16 19:48:58 UTC (rev 1145) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-16 21:50:41 UTC (rev 1146) @@ -46,18 +46,18 @@ from wx import glcanvas -#class OgreWindow( wx.PyWindow ): +class OgreWindow( wx.PyWindow ): -class OgreWindow( glcanvas.GLCanvas ): +#class OgreWindow( glcanvas.GLCanvas ): """wx.Frame subclass to embed an Ogre window in wxPython It is somewhat inspired from SampleFramework.py""" def __init__( self, parent, ID = -1, size = wx.Size( 1280, 1024 ), renderSystem = "OpenGL", **kwargs ): - glcanvas.GLCanvas.__init__( self, parent - , size = parent.GetSize() - , style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE - , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) - #wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) +# glcanvas.GLCanvas.__init__( self, parent +# , size = parent.GetSize() +# , style = wx.WANTS_CHARS | wx.NO_FULL_REPAINT_ON_RESIZE +# , attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER] ) + wx.PyWindow.__init__( self, parent, ID, size = size, **kwargs ) self.parent = parent self.parent.Show() @@ -111,9 +111,10 @@ lastValid.Show( True ) parent = lastValid.GetParent() - handle = glcanvas.GLCanvas.GetHandle( self ) + #handle = glcanvas.GLCanvas.GetHandle( self ) #print "windowhandle = ", handle - + handle = wx.PyWindow.GetHandle( self ) + if handle == 0: try: import wxogre_util as wxHandle @@ -128,7 +129,7 @@ handle = 0 #return str( 0 ) - return str( handle ) + return str(handle ) def _OgreInit(self,size,renderSystem): #Root creation Modified: branches/ogEditor/resources.cfg =================================================================== --- branches/ogEditor/resources.cfg 2009-12-16 19:48:58 UTC (rev 1145) +++ branches/ogEditor/resources.cfg 2009-12-16 21:50:41 UTC (rev 1146) @@ -2,14 +2,14 @@ Zip=c:\Programme\PythonOgreRelease\Demos\media\packs\OgreCore.zip [General] -FileSystem=c:\Programme\PythonOgreRelease\Demos\models -FileSystem=c:\Programme\PythonOgreRelease\Demos\media -FileSystem=c:\Programme\PythonOgreRelease\Demos\fonts -FileSystem=c:\Programme\PythonOgreRelease\Demos\programs -FileSystem=c:\Programme\PythonOgreRelease\Demos\scripts -FileSystem=c:\Programme\PythonOgreRelease\Demos\textures -FileSystem=c:\Programme\PythonOgreRelease\Demos\models -FileSystem=c:\Programme\PythonOgreRelease\Demos\overlays -FileSystem=c:\Programme\PythonOgreRelease\Demos\particle -FileSystem=c:\Programme\PythonOgreRelease\Demos\gui +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\fonts +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\gui +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\scripts +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\textures +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\programs +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\overlays +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\packs +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\particle + Modified: branches/ogEditor/resources_win32.cfg =================================================================== --- branches/ogEditor/resources_win32.cfg 2009-12-16 19:48:58 UTC (rev 1145) +++ branches/ogEditor/resources_win32.cfg 2009-12-16 21:50:41 UTC (rev 1146) @@ -2,14 +2,14 @@ Zip=c:\Programme\PythonOgreRelease\Demos\media\packs\OgreCore.zip [General] -FileSystem=c:\Programme\PythonOgreRelease\Demos\models -FileSystem=c:\Programme\PythonOgreRelease\Demos\media -FileSystem=c:\Programme\PythonOgreRelease\Demos\fonts -FileSystem=c:\Programme\PythonOgreRelease\Demos\programs -FileSystem=c:\Programme\PythonOgreRelease\Demos\scripts -FileSystem=c:\Programme\PythonOgreRelease\Demos\textures -FileSystem=c:\Programme\PythonOgreRelease\Demos\models -FileSystem=c:\Programme\PythonOgreRelease\Demos\overlays -FileSystem=c:\Programme\PythonOgreRelease\Demos\particle -FileSystem=c:\Programme\PythonOgreRelease\Demos\gui +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\fonts +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\gui +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\scripts +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\textures +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\materials\programs +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\overlays +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\packs +FileSystem=c:\Programme\PythonOgreRelease\Demos\media\particle + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-16 19:49:11
|
Revision: 1145 http://opengate.svn.sourceforge.net/opengate/?rev=1145&view=rev Author: spom_spom Date: 2009-12-16 19:48:58 +0000 (Wed, 16 Dec 2009) Log Message: ----------- win32 compatibility commit Modified Paths: -------------- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py branches/ogEditor/resources.cfg Added Paths: ----------- branches/ogEditor/plugins_linux.cfg branches/ogEditor/plugins_win32.cfg branches/ogEditor/resources_linux.cfg branches/ogEditor/resources_win32.cfg Removed Paths: ------------- branches/ogEditor/ogEditorFirst-Impression-2.png branches/ogEditor/plugins.cfg Modified: branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py =================================================================== --- branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-16 18:21:36 UTC (rev 1144) +++ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py 2009-12-16 19:48:58 UTC (rev 1145) @@ -5,7 +5,13 @@ import string import time -import ogre.renderer.OGRE as ogre +try: + import ogre.renderer.OGRE as ogre +except Exception, e: + print e + print "no python-ogre installation found" + print "download version 1.6.4 from http://sourceforge.net/projects/python-ogre/files/" + def toStr( vec ): return ("%g, %g, %g"%(vec.x, vec.y, vec.z)) @@ -17,13 +23,14 @@ def getPluginPath(): """Return the absolute path to a valid plugins.cfg file.""" -# import sys + import sys paths = [ os.path.join( os.getcwd(), 'plugins.cfg'), os.path.join( os.path.dirname( os.path.abspath( __file__ ) ), 'plugins.cfg'), '/etc/OGRE/plugins.cfg' ] for path in paths: + print path if os.path.exists(path): return path @@ -105,7 +112,7 @@ parent = lastValid.GetParent() handle = glcanvas.GLCanvas.GetHandle( self ) - print "windowhandle = ", handle + #print "windowhandle = ", handle if handle == 0: try: Deleted: branches/ogEditor/ogEditorFirst-Impression-2.png =================================================================== (Binary files differ) Deleted: branches/ogEditor/plugins.cfg =================================================================== --- branches/ogEditor/plugins.cfg 2009-12-16 18:21:36 UTC (rev 1144) +++ branches/ogEditor/plugins.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -1,19 +0,0 @@ -# Defines plugins to load - -## Use this for Windows -# Define plugin folder -#PluginFolder=c:\PythonOgre/plugins -#Plugin=RenderSystem_GL.dll -#Plugin=RenderSystem_Direct3D9.dll -#Plugin=Plugin_ParticleFX.dll -#Plugin=Plugin_BSPSceneManager.dll -#Plugin=Plugin_OctreeSceneManager.dll -#Plugin=Plugin_CgProgramManager.dll - -## NOTE use this for MacOS or Linux -PluginFolder=/usr/lib/OGRE -Plugin=RenderSystem_GL -Plugin=Plugin_ParticleFX -#Plugin=Plugin_BSPSceneManager -#Plugin=Plugin_OctreeSceneManager -Plugin=Plugin_CgProgramManager Added: branches/ogEditor/plugins_linux.cfg =================================================================== --- branches/ogEditor/plugins_linux.cfg (rev 0) +++ branches/ogEditor/plugins_linux.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -0,0 +1,8 @@ +# Defines plugins to load +# NOTE use this for MacOS or Linux +PluginFolder=/usr/lib/OGRE +Plugin=RenderSystem_GL +Plugin=Plugin_ParticleFX +#Plugin=Plugin_BSPSceneManager +#Plugin=Plugin_OctreeSceneManager +Plugin=Plugin_CgProgramManager Added: branches/ogEditor/plugins_win32.cfg =================================================================== --- branches/ogEditor/plugins_win32.cfg (rev 0) +++ branches/ogEditor/plugins_win32.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -0,0 +1,8 @@ +# Use this for Windows +PluginFolder=c:\Programme\PythonOgreRelease\plugins +Plugin=RenderSystem_GL.dll +#Plugin=RenderSystem_Direct3D9.dll +Plugin=Plugin_ParticleFX.dll +#Plugin=Plugin_BSPSceneManager.dll +#Plugin=Plugin_OctreeSceneManager.dll +Plugin=Plugin_CgProgramManager.dll Modified: branches/ogEditor/resources.cfg =================================================================== --- branches/ogEditor/resources.cfg 2009-12-16 18:21:36 UTC (rev 1144) +++ branches/ogEditor/resources.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -1,28 +1,15 @@ -#[Bootstrap] -#Zip=c:\PythonOgre/demos/media/packs/OgreCore.zip - -#[General] -#FileSystem=c:\PythonOgre/demos/models -#FileSystem=c:\PythonOgre/demos/media -#FileSystem=c:\PythonOgre/demos/media/fonts -#FileSystem=c:\PythonOgre/demos/media/materials/programs -#FileSystem=c:\PythonOgre/demos/media/materials/scripts -#FileSystem=c:\PythonOgre/demos/media/materials/textures -#FileSystem=c:\PythonOgre/demos/media/models -#FileSystem=c:\PythonOgre/demos/media/overlays -#FileSystem=c:\PythonOgre/demos/media/particle -#FileSystem=c:\PythonOgre/demos/media/gui [Bootstrap] -Zip=../../../../local/python-ogre-ebuild/python-ogre/demos/media/packs/OgreCore.zip -# +Zip=c:\Programme\PythonOgreRelease\Demos\media\packs\OgreCore.zip + [General] -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/imemodels -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/fonts -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/programs -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/scripts -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/textures -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/models -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/overlays -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/particle -FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/gui +FileSystem=c:\Programme\PythonOgreRelease\Demos\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\media +FileSystem=c:\Programme\PythonOgreRelease\Demos\fonts +FileSystem=c:\Programme\PythonOgreRelease\Demos\programs +FileSystem=c:\Programme\PythonOgreRelease\Demos\scripts +FileSystem=c:\Programme\PythonOgreRelease\Demos\textures +FileSystem=c:\Programme\PythonOgreRelease\Demos\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\overlays +FileSystem=c:\Programme\PythonOgreRelease\Demos\particle +FileSystem=c:\Programme\PythonOgreRelease\Demos\gui + Added: branches/ogEditor/resources_linux.cfg =================================================================== --- branches/ogEditor/resources_linux.cfg (rev 0) +++ branches/ogEditor/resources_linux.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -0,0 +1,28 @@ +#[Bootstrap] +#Zip=c:\PythonOgre/demos/media/packs/OgreCore.zip + +#[General] +#FileSystem=c:\PythonOgre/demos/models +#FileSystem=c:\PythonOgre/demos/media +#FileSystem=c:\PythonOgre/demos/media/fonts +#FileSystem=c:\PythonOgre/demos/media/materials/programs +#FileSystem=c:\PythonOgre/demos/media/materials/scripts +#FileSystem=c:\PythonOgre/demos/media/materials/textures +#FileSystem=c:\PythonOgre/demos/media/models +#FileSystem=c:\PythonOgre/demos/media/overlays +#FileSystem=c:\PythonOgre/demos/media/particle +#FileSystem=c:\PythonOgre/demos/media/gui +[Bootstrap] +Zip=../../../../local/python-ogre-ebuild/python-ogre/demos/media/packs/OgreCore.zip +# +[General] +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/imemodels +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/fonts +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/programs +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/scripts +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/materials/textures +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/models +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/overlays +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/particle +FileSystem=../../../../local/python-ogre-ebuild/python-ogre/demos/media/gui Added: branches/ogEditor/resources_win32.cfg =================================================================== --- branches/ogEditor/resources_win32.cfg (rev 0) +++ branches/ogEditor/resources_win32.cfg 2009-12-16 19:48:58 UTC (rev 1145) @@ -0,0 +1,15 @@ +[Bootstrap] +Zip=c:\Programme\PythonOgreRelease\Demos\media\packs\OgreCore.zip + +[General] +FileSystem=c:\Programme\PythonOgreRelease\Demos\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\media +FileSystem=c:\Programme\PythonOgreRelease\Demos\fonts +FileSystem=c:\Programme\PythonOgreRelease\Demos\programs +FileSystem=c:\Programme\PythonOgreRelease\Demos\scripts +FileSystem=c:\Programme\PythonOgreRelease\Demos\textures +FileSystem=c:\Programme\PythonOgreRelease\Demos\models +FileSystem=c:\Programme\PythonOgreRelease\Demos\overlays +FileSystem=c:\Programme\PythonOgreRelease\Demos\particle +FileSystem=c:\Programme\PythonOgreRelease\Demos\gui + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-16 18:21:47
|
Revision: 1144 http://opengate.svn.sourceforge.net/opengate/?rev=1144&view=rev Author: spom_spom Date: 2009-12-16 18:21:36 +0000 (Wed, 16 Dec 2009) Log Message: ----------- add controls Added Paths: ----------- branches/ogEditor/ogEditor/controls/ branches/ogEditor/ogEditor/controls/__init__.py branches/ogEditor/ogEditor/controls/listCtrlComboPopup.py branches/ogEditor/ogEditor/controls/resourceTree.py Added: branches/ogEditor/ogEditor/controls/__init__.py =================================================================== --- branches/ogEditor/ogEditor/controls/__init__.py (rev 0) +++ branches/ogEditor/ogEditor/controls/__init__.py 2009-12-16 18:21:36 UTC (rev 1144) @@ -0,0 +1,4 @@ +# -*- coding: iso-8859-1 -*- + +from listCtrlComboPopup import * +from resourceTree import ResourceTree \ No newline at end of file Added: branches/ogEditor/ogEditor/controls/listCtrlComboPopup.py =================================================================== --- branches/ogEditor/ogEditor/controls/listCtrlComboPopup.py (rev 0) +++ branches/ogEditor/ogEditor/controls/listCtrlComboPopup.py 2009-12-16 18:21:36 UTC (rev 1144) @@ -0,0 +1,155 @@ +# -*- coding: iso-8859-1 -*- +import wx +import wx.combo + +class NullLog(): + def write( self, txt ): + pass + #print txt + +class ListCtrlComboPopupControl( wx.combo.ComboCtrl ): + + def __init__(self, *args, **kwargs): + + wx.combo.ComboCtrl.__init__( self, *args, **kwargs) + self.popup = ListCtrlComboPopup( ) + self.SetPopupControl( self.popup ) + + def Select( self, item ): + # print "ListCtrlComboPopupControl.Select", item, self.popup.GetItemText( item ) + self.SetValueWithEvent( self.popup.GetItemText( item ), True ) + + def GetSelection( self ): + return self.popup.curitem + #self.SetValue( self.popup.GetItemText( item ) ) + + def AddItems( self, txt ): + for t in txt: + self.popup.AddItem( t ) + +class ListCtrlComboPopup(wx.ListCtrl, wx.combo.ComboPopup): + + def __init__(self, log=None): + self.dismissCallback = None + if log: + self.log = log + else: + self.log = NullLog() + + + # Since we are using multiple inheritance, and don't know yet + # which window is to be the parent, we'll do 2-phase create of + # the ListCtrl instead, and call its Create method later in + # our Create method. (See Create below.) + self.PostCreate(wx.PreListCtrl()) + + # Also init the ComboPopup base class. + wx.combo.ComboPopup.__init__(self) + + def AddItem(self, txt): + self.InsertStringItem(self.GetItemCount(), txt) + + def OnMotion(self, evt): + item, flags = self.HitTest(evt.GetPosition()) + if item >= 0: + self.Select(item) + self.curitem = item + + def OnLeftDown(self, evt): + self.value = self.curitem + self.Dismiss() + + # The following methods are those that are overridable from the + # ComboPopup base class. Most of them are not required, but all + # are shown here for demonstration purposes. + + + # This is called immediately after construction finishes. You can + # use self.GetCombo if needed to get to the ComboCtrl instance. + def Init(self): + self.log.write("ListCtrlComboPopup.Init") + self.value = -1 + self.curitem = -1 + + + # Create the popup child control. Return true for success. + def Create(self, parent): + self.log.write("ListCtrlComboPopup.Create") + wx.ListCtrl.Create(self, parent, + style=wx.LC_LIST|wx.LC_SINGLE_SEL|wx.SIMPLE_BORDER) + + self.Bind(wx.EVT_MOTION, self.OnMotion) + self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) + return True + + + # Return the widget that is to be used for the popup + def GetControl(self): + #self.log.write("ListCtrlComboPopup.GetControl") + return self + + # Called just prior to displaying the popup, you can use it to + # 'select' the current item. + def SetStringValue(self, val): + self.log.write("ListCtrlComboPopup.SetStringValue") + idx = self.FindItem(-1, val) + if idx != wx.NOT_FOUND: + self.curitem = idx + self.Select(idx) + + # Return a string representation of the current item. + def GetStringValue(self): + self.log.write("ListCtrlComboPopup.GetStringValue") + if self.value >= 0: + return self.GetItemText(self.value) + return "" + + # Called immediately after the popup is shown + def OnPopup(self): + self.log.write("ListCtrlComboPopup.OnPopup") + wx.combo.ComboPopup.OnPopup(self) + + # Called when popup is dismissed + def OnDismiss(self): + self.log.write("ListCtrlComboPopup.OnDismiss") + if self.dismissCallback: + self.dismissCallback() + wx.combo.ComboPopup.OnDismiss(self) + + # This is called to custom paint in the combo control itself + # (ie. not the popup). Default implementation draws value as + # string. + def PaintComboControl(self, dc, rect): + # self.log.write("ListCtrlComboPopup.PaintComboControl") + wx.combo.ComboPopup.PaintComboControl(self, dc, rect) + + # Receives key events from the parent ComboCtrl. Events not + # handled should be skipped, as usual. + def OnComboKeyEvent(self, event): + self.log.write("ListCtrlComboPopup.OnComboKeyEvent") + wx.combo.ComboPopup.OnComboKeyEvent(self, event) + + # Implement if you need to support special action when user + # double-clicks on the parent wxComboCtrl. + def OnComboDoubleClick(self): + self.log.write("ListCtrlComboPopup.OnComboDoubleClick") + wx.combo.ComboPopup.OnComboDoubleClick(self) + + # Return final size of popup. Called on every popup, just prior to OnPopup. + # minWidth = preferred minimum width for window + # prefHeight = preferred height. Only applies if > 0, + # maxHeight = max height for window, as limited by screen size + # and should only be rounded down, if necessary. + def GetAdjustedSize(self, minWidth, prefHeight, maxHeight): + self.log.write("ListCtrlComboPopup.GetAdjustedSize: %d, %d, %d" % (minWidth, prefHeight, maxHeight)) + prefHeight = self.GetItemCount() * ( self.GetItemRect(0 )[3] + 3 ) + return wx.combo.ComboPopup.GetAdjustedSize(self, minWidth, prefHeight, maxHeight) + + # Return true if you want delay the call to Create until the popup + # is shown for the first time. It is more efficient, but note that + # it is often more convenient to have the control created + # immediately. + # Default returns false. + def LazyCreate(self): + self.log.write("ListCtrlComboPopup.LazyCreate") + return wx.combo.ComboPopup.LazyCreate(self) Added: branches/ogEditor/ogEditor/controls/resourceTree.py =================================================================== --- branches/ogEditor/ogEditor/controls/resourceTree.py (rev 0) +++ branches/ogEditor/ogEditor/controls/resourceTree.py 2009-12-16 18:21:36 UTC (rev 1144) @@ -0,0 +1,135 @@ +# -*- coding: iso-8859-1 -*- + +import wx + +class ResourceTree( wx.TreeCtrl ): + def __init__( self, parent ): + self.parent = parent + wx.TreeCtrl.__init__( self, parent ) + self.root = self.AddRoot( "Root" ); + self.SetPyData( self.root, parent ) + self.lastActiveItemData = None + self.activeProfile = None + + self.Bind( wx.EVT_TREE_SEL_CHANGED, self.onSelectTreeObject ) + self.Bind( wx.EVT_CONTEXT_MENU, self.onPopupMenu ) + self.Bind( wx.EVT_KEY_DOWN, self.onKeyDown ) + + def selectItem( self, data ): + item = None + if hasattr( data, 'treeItem' ): + item = data.treeItem + else: + item = data + + #print "selectItem", item + if item: + if item is not self.GetSelection(): + #print "select tree item", item, self.GetSelection() + self.SelectItem( item ) + + def addItem( self, data, name, parentNode = None ): + if not parentNode: + parentNode = self.root + + item = self.AppendItem( parentNode, name ); + self.SetPyData( item, data ) + data.treeItem = item + self.Expand( parentNode ) + #self.UnselectAll( ) + + return item + + def getSelectedData( self ): + """ + Return the current selected item data + """ + return self.GetPyData( self.GetSelection( ) ) + + def onSelectTreeObject(self, event): + try: + itemData = event.GetEventObject().GetPyData( event.GetEventObject().GetSelection() ) + except: + return + + if itemData is None or itemData is self.lastActiveItemData : + return + + #print "onSelectTreeObject", itemData + oldApplication = None + newApplication = None + + if self.lastActiveItemData is not None: + oldApplication = self.lastActiveItemData.parentResource + if oldApplication is None: + oldApplication = self.lastActiveItemData + + if hasattr( self.lastActiveItemData, 'activate' ): + #print "self.lastActiveItemData.activate( False )", self.lastActiveItemData + self.lastActiveItemData.activate( False ) + + newApplication = itemData.parentResource + if newApplication is None: + newApplication = itemData + + + # switch applications + #print "old:", oldApplication + #print "new:", newApplication + if oldApplication != newApplication: + if oldApplication is not None: + oldApplication.activateApplication( False ) + if newApplication is not None: + newApplication.activateApplication( True ) + + + + self.lastActiveItemData = itemData + #print "itemData.activate( True )", itemData + itemData.activate( True ) + + self.parent.ws.activeResource = itemData + + if itemData.parentResource is None: + self.activeParent = itemData + + event.Skip() + + def onPopupMenu( self, evt ): + menu = wx.Menu() + + self.popupDelete = wx.NewId() + #self.popupReRead = wx.NewId() + + menu.AppendItem( wx.MenuItem(menu, self.popupDelete, "&Delete\tCTRL+D" ) ) + self.Bind(wx.EVT_MENU, self.onDeleteSelectedItem, id=self.popupDelete ) + + #menu.AppendItem( wx.MenuItem(menu, self.popupReRead,"Reread\tCTRL+R") ) + #item = wx.MenuItem(menu, self.popupReRead,"Reread\tCTRL+R") + #self.treeCTRL.Bind(wx.EVT_MENU, self.OnReRead, id=self.popupReRead ) + + # Popup the menu. If an item is selected then its handler + # will be called before PopupMenu returns. + self.PopupMenu( menu ) + menu.Destroy() + + def onKeyDown(self, event ): + #print "resourceTree::onKeyDown",event, event.GetKeyCode(), event.GetModifiers() + + if event.GetKeyCode() == wx.WXK_DELETE or \ + ( ( event.GetModifiers() == wx.MOD_CMD ) and event.GetKeyCode() == 68 ): + + self.onDeleteSelectedItem() + + def onDeleteSelectedItem( self, event = None ): + item = self.GetPyData( self.GetSelection( ) ) + if not item: + return + + try: + item.destroy( ) + prev = self.GetPrevSibling( self.GetSelection( ) ) + self.Delete( self.GetSelection( ) ) + self.SelectItem( prev ) + except: + pass This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-16 18:16:25
|
Revision: 1143 http://opengate.svn.sourceforge.net/opengate/?rev=1143&view=rev Author: spom_spom Date: 2009-12-16 18:16:09 +0000 (Wed, 16 Dec 2009) Log Message: ----------- forgot file Added Paths: ----------- branches/ogEditor/ogedit Removed Paths: ------------- branches/ogEditor/ogEditor.py Deleted: branches/ogEditor/ogEditor.py =================================================================== --- branches/ogEditor/ogEditor.py 2009-12-16 18:07:48 UTC (rev 1142) +++ branches/ogEditor/ogEditor.py 2009-12-16 18:16:09 UTC (rev 1143) @@ -1,509 +0,0 @@ -#!/usr/bin/env python -import wxversion -wxversion.ensureMinimal('2.8') - -import sys -import wx - -sys.path.append( './packages_2.5' ) -sys.path.append( '../' ) -sys.path.append( './src' ) - -import wx.aui -import wx.py as py -import wx.lib.customtreectrl as CT - - -from ObjectInspectorPanels import * -from ResourceTreePane import * - -from OgreWindowWx import * -from SectorXMLWriter import * - -ID_MB_FILE_EXIT = wx.NewId() -ID_MB_VIEW_SCENETREE = wx.NewId() -ID_MB_VIEW_OBJECT = wx.NewId() -ID_MB_VIEW_RESOURCE = wx.NewId() -ID_MB_VIEW_MATERIAL = wx.NewId() -ID_MB_VIEW_PYCRUST = wx.NewId() -ID_TB_EXIT = wx.NewId() -ID_TB_TMP = wx.NewId() - -NAME_SCENETREE = "Scene tree" -NAME_OBJECT = "Property inspector" -NAME_RESOURCE = "Resource browser" -NAME_MATERIAL = "Material editor" -NAME_PYCRUST = "PyCrust" - -class WorkSpace: - activeResource = None; - def __init__(self): - Pass - -from OpenGateSpecs import * - - -class DropData(wx.CustomDataObject): - def __init__(self): - wx.CustomDataObject.__init__(self, wx.CustomDataFormat("MyDropData")) - #self.setObject(None) - - def setObject(self, obj): - print "drag data: ", obj -# global val is weird maybee using pyPickle/cpickle or something smarter - global dndObj__ - dndObj__=obj - self.SetData( "dndObj" ) - - def getObject(self): - print "drop data: ", dndObj__ - return dndObj__ - -class MyDropTarget(wx.PyDropTarget): - def __init__(self, tree): - wx.PyDropTarget.__init__(self) - self._makeObjects() - self.tree = tree - self.selections=[] - - def _makeObjects(self): - self.data = DropData() - self.fileObject = wx.FileDataObject() - comp = wx.DataObjectComposite() - comp.Add(self.data) - comp.Add(self.fileObject) - self.comp = comp - self.SetDataObject(comp) - - def _saveSelection(self): - self.selections = self.tree.GetSelections() - self.tree.UnselectAll() - - def _restoreSelection(self): - self.tree.UnselectAll() - for i in self.selections: - self.tree.SelectItem(i) - self.selections=[] - - def OnEnter(self, x, y, d): - self._saveSelection() - return d - - def OnLeave(self): - self._restoreSelection() - - def OnDrop(self, x, y): - self._restoreSelection() - #item, flags = self.tree.HitTest((x, y)) - - print "got an drop event at", x, y - return True - - def OnDragOver(self, x, y, d): - # provide visual feedback by selecting the item the mouse is over - print x ,y, d - item, flags = self.tree.HitTest(wx.Point(x,y)) - print item, flags - selections = self.tree.GetSelections() - if item: - if selections != [item]: - self.tree.UnselectAll() - self.tree.SelectItem(item) - elif selections: - self.tree.UnselectAll() - - # The value returned here tells the source what kind of visual - # feedback to give. For example, if wxDragCopy is returned then - # only the copy cursor will be shown, even if the source allows - # moves. You can use the passed in (x,y) to determine what kind - # of feedback to give. In this case we return the suggested value - # which is based on whether the Ctrl key is pressed. - return d - - # Called when OnDrop returns True. We need to get the data and - # do something with it. - def OnData(self, x, y, d): - if self.GetData(): - obj = self.data.getObject() - - if obj: - print "item: ", obj, - - item, flags = self.tree.HitTest(wx.Point(x,y)) - if item: - print "dropped on item:", self.tree.GetItemText(item) - #print type( self.tree.GetPyData( item ) ) - #print type( obj ) - if ( type( self.tree.GetPyData( item ) ) == ogre.SceneNode ) and ( type( obj ) == ogre.Mesh ): - print "add mesh" - self.tree.parent_.createObject( obj.getName(), obj.getName(), self.tree.GetPyData( item ) ) - else: - print "dropped nowhere" - - self._makeObjects() # reset data objects.. - - return d # what is returned signals the source what to do - # with the original data (move, copy, etc.) In this - # case we just return the suggested value given to us. - -class OGEditorPane: - def __init__( self, ID, Name, mbShortcut, creator, defaultCheck ): - self.ID_ = ID - self.name_ = Name - self.mbItem_ = None - self.mbShortcut_ = mbShortcut - self.creator_ = creator - self.defaultCheck_ = defaultCheck - -class MainFrame(wx.Frame): - def __init__(self, *args, **kwds): - kwds["style"] = wx.DEFAULT_FRAME_STYLE - wx.Frame.__init__(self, *args, **kwds) - self.SetSize( wx.Size( 1024, 768 ) ) - - global ws - ws = WorkSpace - self.allPanes = [] - self.allPanes.append( OGEditorPane( ID_MB_VIEW_SCENETREE, NAME_SCENETREE, "\tF1", None, True ) ) - self.allPanes.append( OGEditorPane( ID_MB_VIEW_OBJECT, NAME_OBJECT , "\tF2", None, True ) ) - self.allPanes.append( OGEditorPane( ID_MB_VIEW_RESOURCE, NAME_RESOURCE , "\tF3", None, False ) ) - self.allPanes.append( OGEditorPane( ID_MB_VIEW_MATERIAL, NAME_MATERIAL , "\tF4", None, False ) ) - self.allPanes.append( OGEditorPane( ID_MB_VIEW_PYCRUST, NAME_PYCRUST , "\tF9", None, False ) ) - - self.initMenuBar_() - self.initToolBar_() - self.initStatusBar_() - self.initFrameManager_() - self.setDefaultProperties_(); - - if haveOpenGatePlugin: - print "Found opengate plugin" - self.og = Opengate( self.ogreRenderWindow ) - self.og.initOpenGateResources_(); - self.og.sector = og.Sector( self.ogreRenderWindow.sceneManager, None ) - self.resourceTree.buildResourceTree( ) - self.UpdateSceneGraphEvent() - self.og.AddToSceneGraph( self.sceneTree, self.sceneTree.GetRootItem() ) - self.og.AddToResourcesTree( self.resourceTree, self.resourceTree.root_ ) - - else: - print "no default plugin found: start fallback" - ohNode = self.createObject( "ogreMesh", "ogrehead.mesh" ) - ohNode.translate( ogre.Vector3( 0.0, 0.0, -100 ) ); - - - self.auiMgr.Update() - - def initMenuBar_( self ): - self.mb = wx.MenuBar() - - self.mbFile = wx.Menu() - self.mbFile.Append( wx.ID_EXIT, "E&xit" ) - self.mb.Append( self.mbFile, "&File" ) - - self.mbView = wx.Menu() - - for pane in self.allPanes: - pane.mbItem_ = wx.MenuItem( self.mbView, pane.ID_, pane.name_ + pane.mbShortcut_, "", wx.ITEM_CHECK) - self.mbView.AppendItem( pane.mbItem_ ) - self.Bind( wx.EVT_MENU, self.doSwitchViewPane, id = pane.ID_ ) - - self.mb.Append( self.mbView, "&View") - - self.SetMenuBar( self.mb ) - - self.Bind( wx.EVT_MENU, self.doExit, id = wx.ID_EXIT ) - - def initToolBar_( self ): - self.tb = wx.ToolBar(self, -1) - self.SetToolBar( self.tb ) - self.tb.AddLabelTool( ID_TB_EXIT, "Exit", wx.ArtProvider_GetBitmap(wx.ART_QUIT), - wx.NullBitmap, wx.ITEM_NORMAL, "", "") - self.tb.AddLabelTool( ID_TB_TMP, "Up", wx.ArtProvider_GetBitmap(wx.ART_QUESTION), - wx.NullBitmap, wx.ITEM_NORMAL, "tempary tool button to force scenegraph update", "") - - - self.Bind( wx.EVT_TOOL, self.doExit, id = ID_TB_EXIT ) - self.Bind( wx.EVT_TOOL, self.UpdateSceneGraphEvent, id = ID_TB_TMP ) - - self.tb.Realize() - - def initStatusBar_( self ): - self.sb = self.CreateStatusBar(1, 0) -# statusbar_fields = ["frame_1_statusbar"] -# for i in range(len(frame_1_statusbar_fields)): -# self.frame_1_statusbar.SetStatusText(frame_1_statusbar_fields[i], i) - - - def initFrameManager_( self ): - self.auiMgr = wx.aui.AuiManager() - self.auiMgr.SetManagedWindow( self ) - - self.auiMgr.AddPane( self.createRenderWindow_(), - wx.aui.AuiPaneInfo().Name("OgreRenderWindow").CenterPane() ) - - self.auiMgr.AddPane( self.createCrustWindow_(), - wx.aui.AuiPaneInfo().Name( NAME_PYCRUST ).Caption( NAME_PYCRUST ). - BestSize( wx.Size( 200, 100 ) ).MinSize( wx.Size( 200, 100 ) ). - Bottom().Layer( 1 ).CloseButton(True).MaximizeButton(True)) - - self.auiMgr.AddPane( self.createSceneTree_(), - wx.aui.AuiPaneInfo().Name( NAME_SCENETREE ).Caption( NAME_SCENETREE ). - BestSize( wx.Size( 250, 200 ) ).MinSize( wx.Size( 250, 200 ) ). - Left().Layer( 1 ).Position( 1 ).CloseButton(True).MaximizeButton(True)) - - self.auiMgr.AddPane( self.createObjectInspector_(), - wx.aui.AuiPaneInfo().Name( NAME_OBJECT ).Caption( NAME_OBJECT ). - BestSize( wx.Size( 250, 200 ) ).MinSize( wx.Size( 250, 200 ) ). - Left().Layer( 1 ).Position( 2 ).CloseButton(True).MaximizeButton(True)) - - self.auiMgr.AddPane( self.createMaterialInspector_(), - wx.aui.AuiPaneInfo().Name( NAME_MATERIAL ).Caption( NAME_MATERIAL ). - BestSize( wx.Size( 250, 200 ) ).MinSize( wx.Size( 250, 200 ) ). - Left().Layer( 1 ).Position( 4 ).CloseButton(True).MaximizeButton(True)) - - self.auiMgr.AddPane( self.createResourceInspector_(), - wx.aui.AuiPaneInfo().Name( NAME_RESOURCE ).Caption( NAME_RESOURCE ). - BestSize( wx.Size( 250, 200 ) ).MinSize( wx.Size( 250, 200 ) ). - Left().Layer( 1 ).Position( 3 ).CloseButton(True).MaximizeButton(True)) - self.Bind( wx.aui.EVT_AUI_PANE_CLOSE, self.doClosePane ) - -################################################################################# -# create panes -################################################################################# - - def createRenderWindow_( self ): - self.ogreRenderWindow = OgreWindow( self, -1 ) - return self.ogreRenderWindow - - def createCrustWindow_( self ): - self.crust = wx.py.crust.Crust(self, -1) - return self.crust - - def createSceneTree_( self ): - self.sceneTree = MyCustomTree( self, -1, wx.Point(0, 0), wx.Size(160, 250), - style=wx.SUNKEN_BORDER | CT.TR_HAS_BUTTONS | - CT.TR_HAS_VARIABLE_ROW_HEIGHT | wx.WANTS_CHARS | wx.TR_TWIST_BUTTONS ) - self.sceneTree.SetConnectionPen( wx.Pen( wx.Colour(100,100,100), 1, wx.SOLID) ) - #self.sceneTree.SetFont( wx.Font( 8, wx.FONTFAMILY_DEFAULT, wx.TR_DEFAULT_STYLE, wx.FONTWEIGHT_NORMAL ) ) - self.sceneTree.SetFont( wx.Font( 8, wx.FONTFAMILY_DEFAULT, wx.FONTFAMILY_DEFAULT, wx.FONTWEIGHT_NORMAL ) ) - - il = wx.ImageList(12, 12) - self.SceneNodeIconID = il.Add( wx.ArtProvider_GetBitmap( wx.ART_GO_FORWARD, wx.ART_TOOLBAR, ( 12, 12 ) ) ) - self.SceneEntityIconID = il.Add( wx.ArtProvider_GetBitmap( wx.ART_TICK_MARK, wx.ART_TOOLBAR, ( 12, 12 ) ) ) - self.SceneUnknownIconID = il.Add( wx.ArtProvider_GetBitmap( wx.ART_QUESTION, wx.ART_TOOLBAR, ( 12, 12 ) ) ) - - self.sceneTree.AssignImageList( il ) - - self.sceneTree.SetDropTarget( MyDropTarget( self.sceneTree ) ) - - self.Bind( wx.EVT_TREE_SEL_CHANGED, self.doSelectTreeObject, self.sceneTree ) - self.Bind( CT.EVT_TREE_ITEM_CHECKED, self.doCheckTreeObject, self.sceneTree ) - #EVT_TREE_ITEM_CHECKING - return self.sceneTree - - def createObjectInspector_( self ): - self.objectInspector = ObjectInspectorPanel( self, self, -1, wx.Point(0, 0), wx.Size(160, 250) ) - return self.objectInspector - - def createMaterialInspector_( self ): - self.materialInspector = MaterialInspectorPanel( self, self, -1, wx.Point(0, 0), wx.Size(160, 250) ) - return self.materialInspector - - def createResourceInspector_( self ): - self.resourceTree = ResourceTreePane( self, -1, wx.Point( 0, 0 ), wx.Size( 160, 250 ), - wx.TR_DEFAULT_STYLE | wx.NO_BORDER ); - self.Bind( wx.EVT_TREE_SEL_CHANGED, self.doSelectTreeObject, self.resourceTree ) - self.resourceTree.Bind( wx.EVT_TREE_BEGIN_DRAG, self.OnBeginDrag ) - self.resourceTree.Bind( wx.EVT_TREE_BEGIN_RDRAG, self.OnBeginRDrag ) - self.resourceTree.Bind( wx.EVT_TREE_END_DRAG, self.OnEndDrag ) - return self.resourceTree - - def setDefaultProperties_( self ): - self.SetTitle("ogEditor") - self.sb.SetStatusWidths([-1]) - - for pane in self.allPanes: - pane.mbItem_.Check( pane.defaultCheck_ ) - if pane.defaultCheck_: - self.auiMgr.GetPane( pane.name_ ).Show() - else: - self.auiMgr.GetPane( pane.name_ ).Hide() - - self.UpdateSceneGraphEvent( None ) - self.resourceTree.buildResourceTree( ) - -################################################################################# -# events -################################################################################# - - def doExit( self, event ): - self.Close( True ) - event.Skip() - - def doClosePane( self, event ): - caption = event.GetPane().caption - for pane in self.allPanes: - if pane.name_ == caption: - self.mb.Check( pane.ID_, False ) - break - - def doSwitchViewPane( self, event ): - for pane in self.allPanes: - if event.GetId() == pane.ID_: - auiPane = self.auiMgr.GetPane( pane.name_ ) - if event.IsChecked(): - auiPane.Show( ) - else: - auiPane.Hide() - break - - self.auiMgr.Update() - event.Skip() - - def OnBeginDrag( self, event = None ): - print "OnBeginDrag", event - obj = event.GetEventObject().GetPyData( event.GetEventObject().GetSelection() ) - if obj: - dd=DropData() - dd.setObject( obj ) - comp = wx.DataObjectComposite() - comp.Add( dd ) - dropSource = wx.DropSource(self) - dropSource.SetData( comp ) - result = dropSource.DoDragDrop(wx.Drag_AllowMove) - else: - print "this is not dragable" - - def OnBeginRDrag( self, event = None ): - print "OnBeginRDrag", event - print item.GetWindow() - if item: - event.Allow() - - def OnEndDrag( self, event = None ): - print "OnEndDrag", event - #event.GetEventObject().Layout() - event.GetEventObject().RefreshSubtree( event.GetEventObject().root_ ) - #print item - - def doSelectTreeObject( self, event ): - - obj = event.GetEventObject().GetPyData( event.GetEventObject().GetSelection() ) - if type( obj ) == ogre.SceneNode: - #targetDir = ( obj.getWorldPosition()- self.ogreRenderWindow.sceneEntities.cameraNode.getWorldPosition() ).normalisedCopy() - #camDir = self.ogreRenderWindow.sceneEntities.cameraNode.getWorldOrientation() * ogre.Vector3.NEGATIVE_UNIT_Z - #camDir.normalise() - #rot = camDir.getRotationTo( targetDir ); - #rot.normalise() - #self.ogreRenderWindow.sceneEntities.cameraNode.rotate( rot ) - #print targetDir, camDir - #print self.ogreRenderWindow.sceneEntities.cameraNode.getWorldOrientation() * ogre.Vector3.NEGATIVE_UNIT_Z - #quat = self.ogreRenderWindow.sceneEntities.cameraNode.getOrientation() - #print (quat * rot)*ogre.Vector3.NEGATIVE_UNIT_Z - self.ogreRenderWindow.sceneEntities.cameraNode.lookAt( obj.getWorldPosition(), ogre.Node.TS_WORLD ); - #self.ogreRenderWindow.camera.setDirection( targetDir ) - - if type( obj ) == ogre.Material: - self.materialInspector.showData( obj ); - else: - self.objectInspector.showData( obj ); - - if ws.activeResource: - if type( ws.activeResource ) == ogre.SceneNode: - ws.activeResource.showBoundingBox( False ); - - if type( obj ) == ogre.SceneNode: - obj.showBoundingBox( True ); - - ws.activeResource = obj - event.Skip() - self.auiMgr.Update() - - def doCheckTreeObject( self, event ): - obj = event.GetEventObject().GetPyData( event.GetItem() ) - checked = event.GetEventObject().IsItemChecked( event.GetItem() ); - obj.setVisible( checked ) - - event.GetEventObject().EnableChildren( event.GetItem(), checked) - event.Skip() - -################################################################################# -# utils -################################################################################# - - def createObject( self, name, meshname, rootNode = None ): - sceneManager = self.ogreRenderWindow.sceneManager; - - if not rootNode: - node = sceneManager.getRootSceneNode().createChildSceneNode( name ); - else: - node = rootNode.createChildSceneNode( name ); - - entity = sceneManager.createEntity( name, meshname ); - node.attachObject( entity ); - self.UpdateSceneGraphEvent(); - return node - - def UpdateSceneGraphEvent(self, event = None): - self.sceneTree.DeleteAllItems() - root = self.sceneTree.AddRoot( "SceneManager" ) - self.sceneTree.SetPyData( root, self.ogreRenderWindow.sceneManager ) - - rootSceneNode = self.ogreRenderWindow.sceneManager.getRootSceneNode() - rootSceneNodeTreeNode = self.sceneTree.AppendItem( root, rootSceneNode.getName() ) - self.sceneTree.SetPyData( rootSceneNodeTreeNode, rootSceneNode ) - - self.dumpSceneNode_( rootSceneNodeTreeNode, rootSceneNode ) - self.sceneTree.Expand( root ) - - if event != None: - event.Skip() - - def dumpSceneNode_( self, treenode, scenenode ): - node_it = scenenode.getChildIterator() - while node_it.hasMoreElements(): - nextnode = node_it.getNext() -# print nextnode.getName() - nexttreenode = self.sceneTree.AppendItem( treenode, nextnode.getName(), 1 ) - self.sceneTree.SetItemImage(nexttreenode, self.SceneNodeIconID, CT.TreeItemIcon_Normal) - self.sceneTree.SetItemImage(nexttreenode, self.SceneNodeIconID, CT.TreeItemIcon_Selected) - self.sceneTree.SetPyData( nexttreenode, nextnode ) - - self.sceneTree.CheckItem( nexttreenode, True ); - #if nextnode.getAttachedObject( 0 ).isVisible(): - #self.sceneTree.CheckItem( nexttreenode, True ); - #else: - #self.sceneTree.CheckItem( nexttreenode, False ); - - self.dumpAttachedMovableObjects_( nexttreenode, nextnode ) - self.dumpSceneNode_( nexttreenode, nextnode ) - - def dumpAttachedMovableObjects_( self, treenode, scenenode ): - object_it = scenenode.getAttachedObjectIterator() - while object_it.hasMoreElements(): - m = object_it.getNext() - item = self.sceneTree.AppendItem( treenode, m.getName(), 1 ) - #item = self.sceneTree.AppendItem( treenode, m.getMovableType() + "-" + m.getName() ) - - if m.getMovableType() == "Entity": - id = self.SceneEntityIconID - if m.getNumSubEntities() > 1: - for i in range( 0, m.getNumSubEntities() ): - subentNode = self.sceneTree.AppendItem( item, m.getSubEntity( i ).getMaterialName(), 1 ) - self.sceneTree.SetPyData( subentNode, m.getSubEntity( i ) ) - else: - id = self.SceneUnknownIconID - - self.sceneTree.SetItemImage(item, id, CT.TreeItemIcon_Normal) - self.sceneTree.SetItemImage(item, id, CT.TreeItemIcon_Selected) - self.sceneTree.SetPyData( item, m ) - -if __name__ == "__main__": - ogEditor = wx.PySimpleApp(0) - wx.InitAllImageHandlers() - mainFrame = MainFrame(None, -1 ) - ogEditor.SetTopWindow(mainFrame) - mainFrame.Show() - mainFrame.ogreRenderWindow.StartRendering() - ogEditor.MainLoop() Added: branches/ogEditor/ogedit =================================================================== --- branches/ogEditor/ogedit (rev 0) +++ branches/ogEditor/ogedit 2009-12-16 18:16:09 UTC (rev 1143) @@ -0,0 +1,51 @@ +#!/usr/bin/python +# -*- coding: iso-8859-1 -*- + +import sys, os + +class WorkSpace: + activeResource = None; + def __init__(self): + None + +if not hasattr(sys, "frozen"): + # These checks are only necessary in a non-frozen environment, i.e. we + # skip these checks when run from a py2exe-fied application + try: + import wxversion + wxversion.ensureMinimal("2.8-unicode", optionsRequired = True ) + except: + pass + try: + sys.path.append( os.path.join( os.path.dirname( __file__ ), 'ogEditor' ) ) + import ogEditor + except ImportError: + sys.stderr.write('''ERROR: cannot import the library ogEditor'.''') + sys.exit( 1 ) + +def start(): + from ogEditor.main import MainApp + from optparse import OptionParser + parser = OptionParser() + #parser.add_option( "-f", "--file", dest="filename", + #help="write report to FILE", metavar="FILE") + #parser.add_option("-q", "--quiet", + #action="store_false", dest="verbose", default=True, + #help="don't print status messages to stdout") + + (options, args) = parser.parse_args() +# print options, args + #options, args = config.ApplicationOptionParser().parse_args() + #app = application.Application(options, args) + #if options.profile: + # import cProfile + # cProfile.runctx('app.start()', globals(), locals(), filename='.profile') + #else: + global ws + ws = WorkSpace() + + app = MainApp( options, args, ws ) + app.start() + +if __name__ == '__main__': + start() Property changes on: branches/ogEditor/ogedit ___________________________________________________________________ Added: svn:executable + * This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <spo...@us...> - 2009-12-16 18:07:57
|
Revision: 1142 http://opengate.svn.sourceforge.net/opengate/?rev=1142&view=rev Author: spom_spom Date: 2009-12-16 18:07:48 +0000 (Wed, 16 Dec 2009) Log Message: ----------- restructure ogeditor Modified Paths: -------------- branches/ogEditor/resources.cfg Added Paths: ----------- branches/ogEditor/ogEditor/ branches/ogEditor/ogEditor/__init__.py branches/ogEditor/ogEditor/apps/ branches/ogEditor/ogEditor/apps/__init__.py branches/ogEditor/ogEditor/apps/ogretest/ branches/ogEditor/ogEditor/apps/ogretest/__init__.py branches/ogEditor/ogEditor/apps/ogretest/ogretest.py branches/ogEditor/ogEditor/apps/opengate/ branches/ogEditor/ogEditor/apps/opengate/Makefile branches/ogEditor/ogEditor/apps/opengate/__init__.py branches/ogEditor/ogEditor/apps/opengate/build.sh branches/ogEditor/ogEditor/apps/opengate/environment.py branches/ogEditor/ogEditor/apps/opengate/generate_code.py branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h branches/ogEditor/ogEditor/apps/opengate/python_opengate.h branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h branches/ogEditor/ogEditor/base/ branches/ogEditor/ogEditor/base/__init__.py branches/ogEditor/ogEditor/base/base.py branches/ogEditor/ogEditor/main/ branches/ogEditor/ogEditor/main/__init__.py branches/ogEditor/ogEditor/main/mainApp.fbp branches/ogEditor/ogEditor/main/mainApp.py branches/ogEditor/ogEditor/main/mainApp.xrc branches/ogEditor/ogEditor/resources/ branches/ogEditor/ogEditor/resources/__init__.py branches/ogEditor/ogEditor/resources/icons/ branches/ogEditor/ogEditor/resources/icons/application-exit-16.png branches/ogEditor/ogEditor/resources/icons/application-exit.png branches/ogEditor/ogEditor/resources/icons/document-open-16.png branches/ogEditor/ogEditor/resources/resources.py branches/ogEditor/ogEditor/wxOgre/ branches/ogEditor/ogEditor/wxOgre/OgreWindowWx.py branches/ogEditor/ogEditor/wxOgre/__init__.py branches/ogEditor/ogEditor/wxOgre/build.wxogre_util.sh branches/ogEditor/ogEditor/wxOgre/wxogre_util.cpp branches/ogEditor/ogEditor/wxOgre/wxogre_util.py branches/ogEditor/wxOgreTest.py Removed Paths: ------------- branches/ogEditor/Makefile branches/ogEditor/build.sh branches/ogEditor/build.wxogre_util.sh branches/ogEditor/environment.py branches/ogEditor/generate_code.py branches/ogEditor/generated/ branches/ogEditor/hand_made_wrappers.py branches/ogEditor/ogtest.py branches/ogEditor/opengate-resources.cfg branches/ogEditor/propgridtest.py branches/ogEditor/python_ogre_masterlist.h branches/ogEditor/python_opengate.h branches/ogEditor/python_opengate_aliases.h branches/ogEditor/python_opengate_sizeof.h branches/ogEditor/treetest.py branches/ogEditor/wxogre_util.cpp branches/ogEditor/wxogre_util.py Deleted: branches/ogEditor/Makefile =================================================================== --- branches/ogEditor/Makefile 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/Makefile 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,34 +0,0 @@ -BOOSTINC=-I /usr/include/boost -PYTHONINC=-I /usr/include/python2.5 -OGREINC=`pkg-config --cflags OGRE gtk+-2.0 ogreopcode` -OPENGATEINC=-I $(HOME)/local/opengate/trunk/src - -BOOSTLIB=-L /usr/lib64 -lboost_python -EXTLIB=/usr/lib64/libCEGUIOgreRenderer.so -L/var/tmp/portage/media-libs/devil-1.6.7-r2/work/DevIL-1.6.7/src-IL/src -L/usr/lib64 /usr/lib64/libCEGUIBase.so /usr/lib64/libpcre.so -lbz2 -lxerces-c /usr/lib64/libalut.so /usr/lib64/libopenal.so /usr/lib64/libvorbisfile.so /usr/lib64/libvorbis.so -lm /usr/lib64/libogg.so /usr/lib64/libOIS.so -L/usr/X11R6/lib /usr/lib64/libopcode.so /usr/lib64/libogreopcode.so /usr/lib64/libOgreMain.so /usr/lib64/libzzip.so /usr/lib64/libgtk-x11-2.0.so /usr/lib64/libgdk-x11-2.0.so /usr/lib64/libatk-1.0.so /usr/lib64/libgdk_pixbuf-2.0.so /usr/lib64/libpangocairo-1.0.so /usr/lib64/libpangoft2-1.0.so /usr/lib64/libpango-1.0.so /usr/lib64/libcairo.so /usr/lib64/libfontconfig.so /usr/lib64/libfreetype.so /usr/lib64/libexpat.so /usr/lib64/libXrender.so /usr/lib64/libgobject-2.0.so /usr/lib64/libgmodule-2.0.so /usr/lib64/libglib-2.0.so /usr/lib64/libX11.so /usr/lib64/libXau.so /usr/lib64/libXdmcp.so -lXaw /usr/lib64/libILU.so /usr/lib64/libIL.so -lCg /usr/lib64/libpng12.so /usr/lib64/libtiff.so /usr/lib64/libjpeg.so -lpthread -lz -ldl -lboost_thread -lboost_regex - -OGREGEN=-I /home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/ -TARGET=opengate -COPT=-Os -fPIC - -#CONTAINERSUITE= -I ./indexing_suite_v2 - -CPPCFILES = $(wildcard generated/*.cpp) -OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES)) -OPENGATEOBJ=$(wildcard $(HOME)/local/opengate/trunk/src/opengateclient*.o) - -default: $(TARGET) - -.cpp.o: - g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< - -$(TARGET): $(OBJECTS) - g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ --shared \ - $(OBJECTS) \ - $(BOOSTLIB) \ - $(OPENGATEOBJ) \ - $(EXTLIB) - strip -g -S -d --strip-debug -s generated/$(TARGET).so -clean: - rm -rf generated/* - rm -f *.so - rm -f *.cache Deleted: branches/ogEditor/build.sh =================================================================== --- branches/ogEditor/build.sh 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/build.sh 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,21 +0,0 @@ -#!/bin/bash - -if [ $OSTYPE = "msys" ]; then - echo "build for mingw" - python generate_code.py vector - bjam toolset=gcc -else - echo "build for linux gcc" - mkdir -p generated - MAKEOPTS=-j5 - make clean - sh build.wxogre_util.sh -# cp ./indexing_suite_v2/src/indexing/* generated/ - - if [ $# -lt 1 ]; then - python generate_code.py - make $MAKEOPTS - cp generated/opengate.so packages_2.5/opengate/OpenGate.so - - fi -fi Deleted: branches/ogEditor/build.wxogre_util.sh =================================================================== --- branches/ogEditor/build.wxogre_util.sh 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/build.wxogre_util.sh 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,8 +0,0 @@ -#! /bin/bash - -#RELEASE=ansi-release-2.6 -#RELEASE=unicode-release-2.6 -RELEASE=unicode-release-2.8 - -g++ -shared -fPIC `/usr/lib/wx/config/gtk2-$RELEASE --cflags` `pkg-config gtk+-2.0 --cflags` `/usr/lib/wx/config/gtk2-$RELEASE --libs` `pkg-config gtk+-2.0 --libs` -lGL wxogre_util.cpp -o libwxogre_util.so - Deleted: branches/ogEditor/environment.py =================================================================== --- branches/ogEditor/environment.py 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/environment.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,49 +0,0 @@ -#! /usr/bin/python -# Copyright 2004 Roman Yakovenko. -# Distributed under the Boost Software License, Version 1.0. (See -# accompanying file LICENSE_1_0.txt or copy at -# http://www.boost.org/LICENSE_1_0.txt) - -import sys - -class settings: - module_name = 'OpenGate' - #opengate_path = '../../trunc/src/' - opengate_path = '/home/carsten/local/opengate/trunk/src/' - opengate_cache_file ='python_opengate.cache' - ogre_include_path = '' - ogreopcode_include_path = '' - boost_path = '' - boost_libs_path = '' - gccxml_path = '' - pygccxml_path = '' - pyplusplus_path = '' - python_libs_path = '' - python_include_path = '' - working_dir = '' - unittests_dir = '' - generated_files_dir = './generated' - opengate_defines = '' - def setup_environment(): - print settings.pygccxml_path - sys.path.append( settings.pygccxml_path ) - sys.path.append( settings.pyplusplus_path ) - setup_environment = staticmethod(setup_environment) - -if sys.platform == 'linux2': - settings.python_include_path = '/usr/include/python2.5' - settings.ogre_include_path = '/usr/include/OGRE' - settings.ogreopcode_include_path = '/usr/include/ogreopcode' - settings.gccxml_path = '/usr/bin' - settings.pygccxml_path = '/usr/lib64/python2.5/site-packages' - settings.pyplusplus_path = '/usr/lib64/python2.5/site-packages' - -elif sys.platform == 'win32': - settings.pygccxml_path = 'c:/python25/Lib/site-packages/' - settings.python_libs_path = 'c:/python25/libs' - settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' - settings.opengate_defines ='MINGW' -else: - raise RuntimeError( 'There is no configuration for "%s" platform.' % sys.platform ) - -settings.setup_environment() Deleted: branches/ogEditor/generate_code.py =================================================================== --- branches/ogEditor/generate_code.py 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/generate_code.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,224 +0,0 @@ -#! /usr/bin/python - -import os -import sys -import string -from environment import settings - -import hand_made_wrappers - -from pygccxml import parser -from pygccxml import declarations -from pygccxml.declarations import access_type_matcher_t -from pyplusplus import code_creators -from pyplusplus import module_builder -from pyplusplus.module_builder import call_policies - -import common_utils.ogre_properties as ogre_properties - -MAIN_NAMESPACE = 'OpenGate' - -def set_call_policies( mb ): -# - # Set the default policy to deal with pointer/reference return types to reference_existing object^M - # as this is the Ogre Default.^M - mem_funs = mb.calldefs () - mem_funs.create_with_signature = True #Generated code will not compile on^M - #MSVC 7.1 if function has throw modifier.^M - for mem_fun in mem_funs: - if mem_fun.call_policies: - continue - if declarations.is_pointer (mem_fun.return_type) or declarations.is_reference (mem_fun.return_type): - mem_fun.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) - - -class decl_starts_with (object): - def __init__ (self, prefix): - self.prefix = prefix - def __call__ (self, decl): - return self.prefix in decl.name - -def excludeFreeFunctionsByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.free_functions( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeFreeFunctionsByName( mb, functs): - for funct in functs: - fun = mb.global_ns.free_functions( name=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeFreeOperatorsByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.free_operators( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeClass( mb, functs): - for funct in functs: - fun = mb.global_ns.class_( funct ) - print "exclude", fun - fun.exclude() - -def excludeMemberByReturn( mb, functs): - for funct in functs: - fun = mb.global_ns.member_functions( return_type=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def excludeMemberOperators( mb, functs): - for funct in functs: - fun = mb.global_ns.member_operators( symbol=funct, allow_empty=True ) - print "exclude", funct, len( fun ) - for f in fun: - f.exclude() - -def setMemberFunctionCallPolicieByReturn(mb, MemberRetRef, callPolicie ): - for ref in MemberRetRef: - memFuns = mb.global_ns.member_functions( return_type=ref, allow_empty=True ) - print ref, len(memFuns) - - for memFun in memFuns: - if memFun.call_policies: - continue - else: - memFun.call_policies = \ - call_policies.return_value_policy( callPolicie ) - -def generate( defined_symbols ): - xml_cached_fc = parser.create_cached_source_fc( os.path.join( r"python_opengate.h" ), - settings.opengate_cache_file ) - - print xml_cached_fc - - mb = module_builder.module_builder_t( [xml_cached_fc], - gccxml_path = settings.gccxml_path, - working_directory = settings.opengate_path, - include_paths = [settings.opengate_path, settings.python_include_path, - settings.ogreopcode_include_path, settings.ogre_include_path], - define_symbols = defined_symbols, - indexing_suite_version = 2 ) - - ## This module depends on Ogre - mb.register_module_dependency ( '/home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/' ) - - global_ns = mb.global_ns - global_ns.exclude() - - main_ns = global_ns.namespace( MAIN_NAMESPACE ) - main_ns.include() - - global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) - - hand_made_wrappers.apply( mb ) - - mb.BOOST_PYTHON_MAX_ARITY = 25 - mb.classes().always_expose_using_scope = True - - set_call_policies( mb.global_ns.namespace ('OpenGate') ) - set_call_policies( mb.global_ns.namespace ('Ogre') ) - - for cls in main_ns.classes(): - print cls - cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) - - - mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() - mb.calldefs( access_type_matcher_t( 'private' ) ).exclude() - - #mb.class_( '::std::set < ::std::string >' ).alias = 'stringSet'; - - excludeClass( mb, [ 'deletePtr' - ,'AiManager' - ,'GameStateListener' - ,'GameStateManager' - ,'Message' - ,'MessageBodyBase' - ,'MessageBodyShipAmmoHit' - ,'MessageBodyShipDeRegister' - ,'OpenALSoundSource' - ] ) - - # mb.class_( 'Vector<double>' ).alias = 'RVector' - - - #call_policies.return_value_policy( call_policies.reference_existing_object ) - #call_policies.return_value_policy( call_policies.copy_non_const_reference ) - #call_policies.return_value_policy( call_policies.copy_const_reference ) - - #excludeFreeFunctionsByName( mb, ['strReplaceBlankWithUnderscore' - #'toStr', 'toInt', 'toFloat', 'toDouble', - #'getRowSubstrings', 'getNonEmptyRow', 'getSubstrings' ] ) - - #excludeFreeFunctionsByReturn( mb, [ 'float *', 'float &' ] ) - - #excludeFreeOperatorsByReturn( mb, [ '::std::ostream &', '::std::istream &' ] ) - - #excludeMemberOperators( mb, ['++', '--', '*'] ) - - -## setMemberFunctionCallPolicie( mb, [''], call_policies.copy_non_const_reference ) - - ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], - ##call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], - #call_policies.return_pointee_value ) - - #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], - #call_policies.return_by_value ) - - - # exclude all that does not match any predefined callpolicie - excludeRest = True - - if excludeRest: - mem_funs = mb.calldefs () - - for mem_fun in mem_funs: - if mem_fun.call_policies: - continue - if not mem_fun.call_policies and \ - (declarations.is_reference( mem_fun.return_type ) or declarations.is_pointer (mem_fun.return_type) ): - #print mem_fun - mem_fun.exclude() - #mem_fun.call_policies = \ - #call_policies.return_value_policy( call_policies.reference_existing_object ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy( call_policies.return_pointee_value ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy( call_policies.return_opaque_pointer ) - #mem_fun.call_policies = \ - # call_policies.return_value_policy(call_policies.copy_non_const_reference) - - # mb.print_declarations( main_ns ) -#I can print declarations to see what is going on -#mb.print_declarations() - -#Now it is the time to give a name to our module - mb.build_code_creator( settings.module_name ) - -#It is common requirement in software world - each file should have license - #mb.code_creator.license = '//Boost Software License( http://boost.org/more/license_info.html )' - -#I don't want absolute includes within code - mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) - - #And finally we can write code to the disk - mb.split_module( settings.generated_files_dir ) - #mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') ) - -if __name__ == '__main__': - - defined_symbols = ['OPENGATE'] - - generate( defined_symbols ) - print 'done' - - Deleted: branches/ogEditor/hand_made_wrappers.py =================================================================== --- branches/ogEditor/hand_made_wrappers.py 2009-09-09 18:48:36 UTC (rev 1141) +++ branches/ogEditor/hand_made_wrappers.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -1,20 +0,0 @@ -#! /usr/bin/python - -import os -import environment - -WRAPPER_DEFINITION_General = \ -""" -""" - -WRAPPER_REGISTRATION_General = [ - """ - """] - -def apply_reg ( class_, code ): - for c in code: - class_.add_registration_code ( c ) - -def apply( mb ): - mb.add_declaration_code( WRAPPER_DEFINITION_General ) - apply_reg( mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Added: branches/ogEditor/ogEditor/apps/ogretest/__init__.py =================================================================== --- branches/ogEditor/ogEditor/apps/ogretest/__init__.py (rev 0) +++ branches/ogEditor/ogEditor/apps/ogretest/__init__.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,12 @@ +# -*- coding: iso-8859-1 -*- + +from ogretest import * + +PluginApplication = OgreTest + +MainMenuBarNew_Item = '&Ogre-test\tCtrl+T' +MainMenuBarNew_ItemHelp = 'Create new Ogre test application' + +#MainOpenFileSuffix = [ '.mesh' ] +#MainOpenFileSlot = TestOgre.loadMesh +#MainOpenWildcard = [ "TestOgre test suffix1 (*.mesh)" ] Added: branches/ogEditor/ogEditor/apps/ogretest/ogretest.py =================================================================== --- branches/ogEditor/ogEditor/apps/ogretest/ogretest.py (rev 0) +++ branches/ogEditor/ogEditor/apps/ogretest/ogretest.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,92 @@ +# -*- coding: iso-8859-1 -*- + +import wx + +from ogEditor.base import AppResource + +from ogEditor.wxOgre import ogre, OgreWindow + +#from ogEditor.resources import loadIcon, MakeDisabledBitmap + +#class OgreTest( ): +class OgreTest( AppResource ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + AppResource.__init__( self, parent, rendererSlot, propertyInspectorSlot ) + + # set the name of this application that appears to the resource tree + + self.setName("OgreTest") + + ## optionaly load content informations for this application, generated by an gui-builder that wrote xrc-files + ## eg. wxFormBuilder, __file__ is needed to find the xrc-file + #self.loadXRC( 'testapp.xrc', __file__ ) + + ## register a menu to the main-MenuBar, using this function ensures that this menu will be shown/hiden respective to the activate status of the application + #self.mbTestMenu = self.createMainMenu( '&Test Ogre' ) + + ## create an item to to the test menu + #self.createMenuItem( self.mbTestMenu + #, name = "Test Menu item" + #, help = "Test Menu item" + #, function = self.menuFunction ) + + ## the application has some properties that can be altered by the property inspector (PI), loaded and saved + #self.titleTextProp = self.appendProperty( "Title", default = 'unknown', valType = str ) + + # do some stuff after this application has created and registered to the resourcetree + #self.parent.addCommandToOnIdleQueue( self.postCreate ) + pass + + def postCreate( self ): + pass + #self.createSubPanel( TestMPLApp, "wxMPL" ) + #self.createSubPanel( TestVTKApp, "wxVTK" ) + + #def createPropertyPanel( self, parent ): + #""" + #Define and return panel that is shown in the property-inspector (PI) + #The panel will post created at the first call + #""" + + ## create a Notebook for the PI and add the content for the panel with the name piTestApplication defined in testapp.xrc + #panel = self.createPropertyInspectorNoteBookPanel( parent, 'piTestApplication', title = 'TestApplication' ) + + ## define property behaviour + #self.titleTextProp.setCtrl( ctrl = wx.xrc.XRCCTRL( panel, 'TitleTextCtrl' ) # name of the control in xrc + #, ctrlEvent = wx.EVT_TEXT # the event that should observed + #, targetFunct = self.setTitle ) # the callback when the event is called + + #return panel + + def getRenderer( self, slot = None): + if not self.renderer_ and slot is not None: + self.renderer_ = OgreWindow( slot ) + self.renderer_.StartRendering() + + sceneManager = self.renderer_.sceneManager + sceneManager.setAmbientLight(ogre.ColourValue(1, 1, 1)) + rootNode = sceneManager.getRootSceneNode() + + ninja = sceneManager.createEntity('ninja', 'ninja.mesh') + node = rootNode.createChildSceneNode("ninja_node", ogre.Vector3(0, 0, -500)) + node.attachObject(ninja) + + return self.renderer_ + + def menuFunction( self, event = None ): + """ + do nothing here, just to show the technique + """ + pass + + def setTitle( self, title = None ): + """ + Set the title, either called manually or by callback + """ + if title is None: + title = self.titleTextProp() + else: + self.titleTextProp.setVal( title ) + + self.getResourceTree().SetItemText( self.treeItem, self.getName() + ": " + title ) + Added: branches/ogEditor/ogEditor/apps/opengate/Makefile =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/Makefile (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/Makefile 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,32 @@ +BOOSTINC=-I /usr/include/boost +PYTHONINC=-I /usr/include/python2.5 +OGREINC=`pkg-config --cflags OGRE gtk+-2.0 ogreopcode` +OPENGATEINC=-I $(HOME)/local/opengate/trunk/src + +BOOSTLIB=-L /usr/lib64 -lboost_python-mt -lboost_thread -lboost_regex -lboost_system + +OGRELIB=`pkg-config --libs OGRE gtk+-2.0 ogreopcode CEGUI-OGRE CEGUI openal freealut OIS vorbisfile` + +OGREGEN=-I /home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0 +TARGET=opengate +COPT=-Os -fPIC -DBOOST_PYTHON_NO_PY_SIGNATURES + +CONTAINERSUITE= -I ./indexing_suite_v2 +#CONTAINERSUITE= -I ./boost + +CPPCFILES = $(wildcard generated/*.cpp) +OBJECTS = $(patsubst %.cpp,%.o,$(CPPCFILES)) +OPENGATEOBJ=$(wildcard $(HOME)/local/opengate/trunk/src/opengateclient*.o) + +default: $(TARGET) + +.cpp.o: + g++ $(COPT) $(DEFINES) -c -o $(patsubst %.cpp,%.o, $<) -I ./ $(CONTAINERSUITE) $(BOOSTINC) $(OPENGATEINC) $(PYTHONINC) $(OGREGEN) $(OGREINC) $< + +$(TARGET): $(OBJECTS) + g++ -o generated/$(TARGET).so -Wl,-rpath=\/../../lib `pkg-config --libs OGRE` --strip-all -lstdc++ -shared $(OBJECTS) $(BOOSTLIB) $(OPENGATEOBJ) $(OGRELIB) + strip -g -S -d --strip-debug -s generated/$(TARGET).so +clean: + rm -rf generated/* + rm -f *.so + rm -f *.cache Added: branches/ogEditor/ogEditor/apps/opengate/build.sh =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/build.sh (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/build.sh 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,20 @@ +#!/bin/bash + +if [ $OSTYPE = "msys" ]; then + echo "build for mingw" + python generate_code.py vector + bjam toolset=gcc +else + echo "build for linux gcc" + mkdir -p generated + MAKEOPTS=-j5 + make clean + sh build.wxogre_util.sh + + if [ $# -lt 1 ]; then + python generate_code.py + make $MAKEOPTS + cp generated/opengate.so packages_2.5/opengate/OpenGate.so + + fi +fi Added: branches/ogEditor/ogEditor/apps/opengate/environment.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/environment.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/environment.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,49 @@ +#! /usr/bin/python +# Copyright 2004 Roman Yakovenko. +# Distributed under the Boost Software License, Version 1.0. (See +# accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +import sys + +class settings: + module_name = 'OpenGate' + #opengate_path = '../../trunc/src/' + opengate_path = '/home/carsten/local/opengate/trunk/src/' + opengate_cache_file ='python_opengate.cache' + ogre_include_path = '' + ogreopcode_include_path = '' + boost_path = '' + boost_libs_path = '' + gccxml_path = '' + pygccxml_path = '' + pyplusplus_path = '' + python_libs_path = '' + python_include_path = '' + working_dir = '' + unittests_dir = '' + generated_files_dir = './generated' + opengate_defines = '' + def setup_environment(): + print settings.pygccxml_path + sys.path.append( settings.pygccxml_path ) + sys.path.append( settings.pyplusplus_path ) + setup_environment = staticmethod(setup_environment) + +if sys.platform == 'linux2': + settings.python_include_path = '/usr/include/python2.5' + settings.ogre_include_path = '/usr/include/OGRE' + settings.ogreopcode_include_path = '/usr/include/ogreopcode' + settings.gccxml_path = '/usr/bin' + settings.pygccxml_path = '/usr/lib64/python2.5/site-packages' + settings.pyplusplus_path = '/usr/lib64/python2.5/site-packages' + +elif sys.platform == 'win32': + settings.pygccxml_path = 'c:/python25/Lib/site-packages/' + settings.python_libs_path = 'c:/python25/libs' + settings.gccxml_path = 'c:/Programme/GCCXMLcomplete/bin' + settings.opengate_defines ='MINGW' +else: + raise RuntimeError( 'There is no configuration for "%s" platform.' % sys.platform ) + +settings.setup_environment() Added: branches/ogEditor/ogEditor/apps/opengate/generate_code.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/generate_code.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/generate_code.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,248 @@ +#! /usr/bin/python +# -*- coding: iso-8859-1 -*- + +import os +import sys +import string +from environment import settings + +import hand_made_wrappers + +from pygccxml import parser +from pygccxml import declarations +from pygccxml.declarations import access_type_matcher_t +from pyplusplus import code_creators +from pyplusplus import module_builder +from pyplusplus.module_builder import call_policies + +import common_utils.ogre_properties as ogre_properties + +MAIN_NAMESPACE = 'OpenGate' + +def set_call_policies( mb ): +# + # Set the default policy to deal with pointer/reference return types to reference_existing object^M + # as this is the Ogre Default.^M + mem_funs = mb.calldefs () + mem_funs.create_with_signature = True #Generated code will not compile on^M + #MSVC 7.1 if function has throw modifier.^M + for mem_fun in mem_funs: + if mem_fun.call_policies: + continue + if declarations.is_pointer (mem_fun.return_type) or declarations.is_reference (mem_fun.return_type): + mem_fun.call_policies = call_policies.return_value_policy( call_policies.reference_existing_object ) + + +class decl_starts_with (object): + def __init__ (self, prefix): + self.prefix = prefix + def __call__ (self, decl): + return self.prefix in decl.name + +def excludeFreeFunctionsByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.free_functions( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeFreeFunctionsByName( mb, functs): + for funct in functs: + fun = mb.global_ns.free_functions( name=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeFreeOperatorsByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.free_operators( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeClass( mb, functs): + for funct in functs: + fun = mb.global_ns.class_( funct ) + print "exclude", fun + fun.exclude() + +def excludeMemberByReturn( mb, functs): + for funct in functs: + fun = mb.global_ns.member_functions( return_type=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def excludeMemberOperators( mb, functs): + for funct in functs: + fun = mb.global_ns.member_operators( symbol=funct, allow_empty=True ) + print "exclude", funct, len( fun ) + for f in fun: + f.exclude() + +def setMemberFunctionCallPolicieByReturn(mb, MemberRetRef, callPolicie ): + for ref in MemberRetRef: + memFuns = mb.global_ns.member_functions( return_type=ref, allow_empty=True ) + print ref, len(memFuns) + + for memFun in memFuns: + if memFun.call_policies: + continue + else: + memFun.call_policies = \ + call_policies.return_value_policy( callPolicie ) + +def generate( defined_symbols ): + xml_cached_fc = parser.create_cached_source_fc( os.path.join( r"python_opengate.h" ), + settings.opengate_cache_file ) + + print xml_cached_fc + + mb = module_builder.module_builder_t( [xml_cached_fc], + gccxml_path = settings.gccxml_path, + working_directory = settings.opengate_path, + include_paths = [settings.opengate_path, settings.python_include_path, + settings.ogreopcode_include_path, settings.ogre_include_path], + define_symbols = defined_symbols, + indexing_suite_version = 1 ) + + ## This module depends on Ogre + #mb.register_module_dependency ( '/home/carsten/local/python-ogre/python-ogre/generated/ogre_1.4/' ) + mb.register_module_dependency( '/home/carsten/local/python-ogre-ebuild/python-ogre/generated/ogre_1.6.0' ) + + global_ns = mb.global_ns + global_ns.exclude() + + main_ns = global_ns.namespace( MAIN_NAMESPACE ) + main_ns.include() + + global_ns.namespace( 'Ogre' ).class_('Vector3').include(already_exposed=True) + + hand_made_wrappers.apply( mb ) + + mb.BOOST_PYTHON_MAX_ARITY = 25 + mb.classes().always_expose_using_scope = True + + set_call_policies( mb.global_ns.namespace ('OpenGate') ) + set_call_policies( mb.global_ns.namespace ('Ogre') ) + + for cls in main_ns.classes(): + print cls + cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) + + mb.calldefs( access_type_matcher_t( 'protected' ) ).exclude() + mb.calldefs( access_type_matcher_t( 'private' ) ).exclude() + + #mb.class_( '::std::set < ::std::string >' ).alias = 'stringSet'; + + excludeClass( mb, [ 'deletePtr' + ,'AiManager' + ,'GameStateListener' + ,'GameStateManager' + ,'Message' + ,'MessageBodyBase' + ,'MessageBodyDisconnect' + ,'MessageBodyChat' + ,'MessageBodyUserID' + ,'MessageBodyShipMovement' + ,'MessageBodyShipProjectileFired' + ,'MessageBodyShipRegister' + ,'MessageBodyShipStatus' + ,'MessageBodyUserID' + ,'MessageBodyUserName' + ,'MessageBodyShipBase' + ,'MessageBodyShipDied' + ,'MessageBodyShipAmmoHit' + ,'MessageBodyShipDeRegister' + ,'MessageBodyShipMovement' + ,'MessageBodyConnectionRefused' + ,'OpenALSoundSource' + ,'ServerUserObject_ptr' + ] ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.reference_existing_object ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.return_pointee_value ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.copy_const_reference ) + + setMemberFunctionCallPolicieByReturn( mb, ['::OpenGate::ServerUserObject*' + ] + , call_policies.return_by_value ) + + #excludeFreeFunctionsByName( mb, ['strReplaceBlankWithUnderscore' + #'toStr', 'toInt', 'toFloat', 'toDouble', + #'getRowSubstrings', 'getNonEmptyRow', 'getSubstrings' ] ) + + #excludeFreeFunctionsByReturn( mb, [ 'float *', 'float &' ] ) + + #excludeFreeOperatorsByReturn( mb, [ '::std::ostream &', '::std::istream &' ] ) + + #excludeMemberOperators( mb, ['++', '--', '*'] ) + + +## setMemberFunctionCallPolicie( mb, [''], call_policies.copy_non_const_reference ) + + ##setMemberFunctionCallPolicieByReturn( mb, ['::Ogre::Vector3' ], + ##call_policies.return_pointee_value ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string *', 'float *', 'double *'], + #call_policies.return_pointee_value ) + + #setMemberFunctionCallPolicieByReturn( mb, ['::std::string &', 'double &' ], + #call_policies.return_by_value ) + + + # exclude all that does not match any predefined callpolicie + excludeRest = True + + if excludeRest: + mem_funs = mb.calldefs () + + for mem_fun in mem_funs: + if mem_fun.call_policies: + continue + if not mem_fun.call_policies and \ + (declarations.is_reference( mem_fun.return_type ) or declarations.is_pointer (mem_fun.return_type) ): + #print mem_fun + #mem_fun.exclude() + mem_fun.call_policies = \ + call_policies.return_value_policy( call_policies.reference_existing_object ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy( call_policies.return_pointee_value ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy( call_policies.return_opaque_pointer ) + #mem_fun.call_policies = \ + # call_policies.return_value_policy(call_policies.copy_non_const_reference) + + # mb.print_declarations( main_ns ) +#I can print declarations to see what is going on +#mb.print_declarations() + +#Now it is the time to give a name to our module + mb.build_code_creator( settings.module_name ) + +#It is common requirement in software world - each file should have license + #mb.code_creator.license = '//Boost Software License( http://boost.org/more/license_info.html )' + +#I don't want absolute includes within code + mb.code_creator.user_defined_directories.append( os.path.abspath('.') ) + + #And finally we can write code to the disk + mb.split_module( settings.generated_files_dir ) + #mb.write_module( os.path.join( settings.generated_files_dir, settings.module_name + '.cpp') ) + +if __name__ == '__main__': + + defined_symbols = ['OPENGATE'] + + generate( defined_symbols ) + print 'done' + + Added: branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/hand_made_wrappers.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,20 @@ +#! /usr/bin/python + +import os +import environment + +WRAPPER_DEFINITION_General = \ +""" +""" + +WRAPPER_REGISTRATION_General = [ + """ + """] + +def apply_reg ( class_, code ): + for c in code: + class_.add_registration_code ( c ) + +def apply( mb ): + mb.add_declaration_code( WRAPPER_DEFINITION_General ) + apply_reg( mb, WRAPPER_REGISTRATION_General ) \ No newline at end of file Added: branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/opengate-resources.cfg 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,33 @@ +[Opengate] +FileSystem=../../trunk/data/ +FileSystem=../../trunk/data/capacitors +FileSystem=../../trunk/data/commodities +FileSystem=../../trunk/data/gui +#FileSystem=../../trunk/data/gui/fonts +#FileSystem=../../trunk/data/gui/layouts +#FileSystem=../../trunk/data/gui/imagesets +#FileSystem=../../trunk/data/gui/schemes +#FileSystem=../../trunk/data/gui/looknfeel +#FileSystem=../../trunk/data/gui/overlays +FileSystem=../../trunk/data/ecms +FileSystem=../../trunk/data/engines +FileSystem=../../trunk/data/guns +FileSystem=../../trunk/data/materials +FileSystem=../../trunk/data/asteroids +FileSystem=../../trunk/data/misc +FileSystem=../../trunk/data/missiles +FileSystem=../../trunk/data/power_plants +FileSystem=../../trunk/data/radars +FileSystem=../../trunk/data/shields +FileSystem=../../trunk/data/ships/octavius/apteryx +FileSystem=../../trunk/data/ships/quantar/storm +FileSystem=../../trunk/data/ships/squadrok/squid +FileSystem=../../trunk/data/ships/tauseti/lady_kickstart +FileSystem=../../trunk/data/skybox +FileSystem=../../trunk/data/stations +FileSystem=../../trunk/data/textures + +Zip=../../trunk/data/skybox/simpleSkybox.zip + +#FileSystem=../../trunk/data/MediaFromOgre +#FileSystem=../../trunk/data/MediaFromOgre/AdvancedMaterials Added: branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/python_ogre_masterlist.h 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,102 @@ +/* Master header file for the Ogre part of Python-Ogre + +Nov 21 2007: Major change to use Ogre.h and OgreStableHeaders.h, and then add missing files as needed. + +*/ + +#include "Ogre.h" +#include "OgreStableHeaders.h" + +#include "OgreAlignedAllocator.h" +#include "OgreAnimable.h" +#include "OgreArchiveFactory.h" +#include "OgreAutoParamDataSource.h" +#include "OgreBillboard.h" +#include "OgreBillboardParticleRenderer.h" +#include "OgreBlendMode.h" +#include "OgreBorderPanelOverlayElement.h" +// #include "OgreCodec.h" // this one causes a Py++ exception +#include "OgreCompiler2Pass.h" +#include "OgreCompositorScriptCompiler.h" +#include "OgreCompositorSerializer.h" +#include "OgreConfig.h" +#ifndef __APPLE_CC__ // need to exlude under MacOS X + #include "OgreConfigDialog.h" +#endif +#include "OgreConfigOptionMap.h" +#include "OgreController.h" +#include "OgreConvexBody.h" +// #include "OgreDDSCodec.h" /// not this one +#include "OgreDefaultHardwareBufferManager.h" +#include "OgreDynLib.h" +#include "OgreDynLibManager.h" +#include "OgreEdgeListBuilder.h" +#include "OgreErrorDialog.h" +#include "OgreExternalTextureSource.h" +#include "OgreExternalTextureSourceManager.h" +#include "OgreFactoryObj.h" +#include "OgreFont.h" +#include "OgreFontManager.h" +#include "OgreFrameListener.h" +// #include "OgreFreeImageCodec.h" // not this one +#include "OgreGpuProgramUsage.h" +#include "OgreHardwareBuffer.h" +#include "OgreImage.h" +// #include "OgreImageCodec.h" // not this one +#include "OgreIteratorWrappers.h" +#if OGRE_VERSION_MINOR == 4 + #include "OgreMaterialScriptCompiler.h" + #include "OgreMemoryMacros.h" + #include "OgreMemoryManager.h" + #include "OgreNoMemoryMacros.h" +#endif +#include "OgreMeshFileFormat.h" +#include "OgreMeshSerializerImpl.h" +#include "OgreMovablePlane.h" +#include "OgreNumerics.h" +#include "OgreOverlayElementCommands.h" +#include "OgreOverlayElementFactory.h" +#include "OgrePanelOverlayElement.h" +#include "OgreParticle.h" +#include "OgreParticleAffectorFactory.h" +#include "OgreParticleEmitterCommands.h" +#include "OgreParticleEmitterFactory.h" +#include "OgreParticleIterator.h" +#include "OgreParticleSystem.h" +#include "OgreParticleSystemRenderer.h" +#include "OgrePixelFormat.h" +#include "OgrePlaneBoundedVolume.h" +#include "OgrePlatform.h" +#include "OgrePlugin.h" +#include "OgrePolygon.h" +#include "OgrePose.h" +#include "OgrePredefinedControllers.h" +#include "OgrePrefabFactory.h" +#include "OgreProgressiveMesh.h" +#include "OgreRay.h" +#include "OgreRectangle.h" +#include "OgreRectangle2D.h" +#include "OgreRenderable.h" +#include "OgreRenderOperation.h" +#include "OgreRenderQueue.h" +#include "OgreRenderQueueSortingGrouping.h" +#include "OgreRenderSystemCapabilities.h" +#include "OgreRenderTarget.h" +#include "OgreResourceManager.h" +#include "OgreRotationalSpline.h" +#include "OgreSceneQuery.h" +#include "OgreScriptLoader.h" +// #include "OgreSearchOps.h" // not this one +#include "OgreShadowCaster.h" +#include "OgreShadowTextureManager.h" +#include "OgreShadowVolumeExtrudeProgram.h" +#include "OgreSkeletonFileFormat.h" +// #include "OgreSpotShadowFadePng.h" // Gets defined in every obj file so has link errors, needs to be defined as static +#include "OgreStaticFaceGroup.h" +#include "OgreTagPoint.h" +#include "OgreTextAreaOverlayElement.h" +#include "OgreTexture.h" +#include "OgreTimer.h" +#include "OgreUnifiedHighLevelGpuProgram.h" +#include "OgreVertexBoneAssignment.h" +#include "OgreVertexIndexData.h" Added: branches/ogEditor/ogEditor/apps/opengate/python_opengate.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate.h 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,118 @@ +#ifndef PYTHON_OPENGATE__H +#define PYTHON_OPENGATE__H + +#include "python_ogre_masterlist.h" +#include "OgreCEGUIRenderer.h" +#include "OgreCEGUIResourceProvider.h" + +#include <OgreVector3.h> +namespace CEGUI{ + class OgreCEGUIRenderer; +} +// namespace OpenGate{ +// class Foo{ +// Ogre::Vector3 vec_; +// public: +// void setVec( Ogre::Vector3 & vec ) { vec_ = vec ;} +// std::vector < double > v() const { +// std::vector < double > t; +// return t; +// } +// std::list < double > s() const { +// std::list < double > t; +// return t; +// } +// }; +// +// class Bar{ +// public: +// std::vector < Foo * > f() const { +// std::vector < Foo * > t; +// return t; +// } +// }; +// } +#include <OgreOpcode.h> + +#include "AiCommands.h" +#include "AiManager.h" +#include "AiObject.h" +#include "Avatar.h" +#include "BaseDialog.h" +#include "BaseObject.h" +#include "ConfigDialog.h" +#include "Console.h" +#include "DockedState.h" +#include "Entity.h" +#include "EntityManager.h" +#include "Equipment.h" +#include "GameState.h" +#include "GameStateManager.h" +#include "GunObject.h" +#include "Hud.h" +#include "InitState.h" +#include "InputManager.h" +#include "KeyMap.h" +#include "LogManager.h" +#include "LogManagerBase.h" +#include "LogManagerOpenGate.h" +#include "MarketDialog.h" +#include "Missile.h" +#include "Moveable.h" +#include "OpcodeWrapper.h" +#include "OpenALSoundManager.h" +#include "Opengate.h" +#include "Projectile.h" +#include "RadarObject.h" +#include "ResourceManager.h" +#include "Sector.h" +#include "SectorAvatarObject.h" +#include "SectorBaseObject.h" +#include "SectorBeaconObject.h" +#include "SectorBeaconPadObject.h" +#include "SectorChildObject.h" +#include "SectorCollisionObject.h" +#include "SectorEnvironmentObject.h" +#include "SectorExplosionObject.h" +#include "SectorMeshObject.h" +#include "SectorMissileObject.h" +#include "SectorMovableObject.h" +#include "SectorObject.h" +#include "SectorObjectAvatar.h" +#include "SectorObjectMissile.h" +#include "SectorObjectMoveable.h" +#include "SectorObjectVessel.h" +#include "SectorPadObject.h" +#include "SectorProjectileObject.h" +#include "SectorStationObject.h" +#include "SectorStationPadObject.h" +#include "SectorVesselObject.h" +#include "ShipConfigDialog.h" +#include "UnDockedState.h" +#include "Vessel.h" +#include "common.h" +#include "commonWithOgre.h" +#include "metaserver.h" +#include "networkClient.h" +#include "networkProtocol.h" +#include "networkServer.h" +#include "networkServerUser.h" + +namespace OpenGate{ + //void foo ( std::vector< char >, std::vector < Ogre::Vector3 > ){} +} + +//First we create a magic namespace to hold all our aliases +namespace pyplusplus { namespace aliases { +#include "python_opengate_aliases.h" +} } + +// then we exposed everything needed (and more) to ensure GCCXML makes them visible to Py++ +// +namespace python_opengate{ namespace details{ +inline void instantiate(){ +using namespace OpenGate; +#include "python_opengate_sizeof.h" +} } } + +#endif // PYTHON_OPENGATE__H Added: branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate_aliases.h 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,10 @@ +typedef ::std::vector < ::std::string > stdVectorString; +typedef ::std::vector < OpenGate::Entity * > stdVectorEntity; +typedef ::std::vector < OpenGate::Triangle > stdVectorTriangle; +typedef ::std::set < ::std::string > stdSetString; +typedef ::std::set< ::OpenGate::Entity * > stdSetEntity; +typedef ::std::set< OpenGate::SectorObject * > stdSetSectorObject; +typedef ::std::set< OpenGate::Vessel * > stdSetVessel; +typedef ::std::map< int, ::std::vector< Ogre::Vector3 > > stdMapIntVector3; +typedef ::std::list< std::deque< OpenGate::Entity * > > stdListEntityDeque; + Added: branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h =================================================================== --- branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h (rev 0) +++ branches/ogEditor/ogEditor/apps/opengate/python_opengate_sizeof.h 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,7 @@ +sizeof ( ::OpenGate::Message& ); +sizeof ( ::OpenGate::MessageBodyBase& ); +sizeof ( ::OpenGate::OpenALSoundSource* ); +sizeof ( ::OpenGate::OpenALSoundSource& ); +sizeof ( ::OpenGate::OpenALSoundSource ); + + Added: branches/ogEditor/ogEditor/base/__init__.py =================================================================== --- branches/ogEditor/ogEditor/base/__init__.py (rev 0) +++ branches/ogEditor/ogEditor/base/__init__.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,4 @@ +# -*- coding: iso-8859-1 -*- + +from base import ManagedProperties, AppResource + Added: branches/ogEditor/ogEditor/base/base.py =================================================================== --- branches/ogEditor/ogEditor/base/base.py (rev 0) +++ branches/ogEditor/ogEditor/base/base.py 2009-12-16 18:07:48 UTC (rev 1142) @@ -0,0 +1,484 @@ +# -*- coding: iso-8859-1 -*- + +import sys, os +import wx +import wx.xrc as xrc + +try: + from agw import aui + from agw.aui import aui_switcherdialog as ASD +except ImportError: # if it's not there locally, try the wxPython lib. + import wx.lib.agw.aui as aui + from wx.lib.agw.aui import aui_switcherdialog as ASD + +class Property: + def __init__( self, name, default = None, valType = None, ctrl = None, ctrlEvent = None, targetFunct = None ): + self.name = name + self.val = default + self.valType = valType + + self.ctrl = ctrl + self.ctrlEvent = ctrlEvent + self.targetFunct = targetFunct + + self.minVal = None + self.maxVal = None + + self.parent = None + + def __call__( self ): + return self.val + + def setValidRange( self, minVal, maxVal ): + self.minVal = minVal + self.maxVal = maxVal + + def setCtrl( self, ctrl, ctrlEvent, targetFunct ): + if self.ctrl is None: + self.ctrl = ctrl + self.ctrlEvent = ctrlEvent + self.targetFunct = targetFunct + + if self.val is not None: + self.setVal( self() ) + + if self.ctrl is not None: + self.ctrl.Bind( self.ctrlEvent, self.onPropertyChanged ) + else: + print "no ctrl given" + + def onPropertyChanged( self, event ): + oldVal = self.val + self.setValFromCtrl() + + #print "onPropertyChanged( self, event ):", oldVal, self.val + + if self.val != oldVal: + if self.parent is not None: + self.parent.propertyChanged() + + if self.targetFunct is not None: + self.targetFunct() + + + try: + event.skip() + except: + pass + + def setVal( self, val ): + #print "set value for: ", self.name, self.ctrl, val + if val is None: + sys.stderr.write( "internal: No value given for setter: " + self.name + self.ctrl ) + return + + if self.valType is not None: + self.val = self.valType( val ) + else: + if val == 'True': + self.val = True + elif val == 'False': + self.val = False + else: + self.val = val + + if self.ctrl is not None: + if isinstance( self.ctrl, wx.SpinCtrl ): + self.ctrl.SetValue( int( val ) ) + elif isinstance( self.ctrl, wx.Choice ): + self.ctrl.SetSelection( self.ctrl.FindString( val ) ) + elif isinstance( self.ctrl, wx.TextCtrl ): + self.ctrl.SetValue( str( val ) ) + elif hasattr( self.ctrl, 'SetValue' ): + if hasattr( self.ctrl, 'IsChecked' ): + self.ctrl.SetValue( bool( val ) ) + elif type( self.ctrl.GetValue() ) == self.valType: + self.ctrl.SetValue( val ) + else: + self.ctrl.SetValue( str( val ) ) + + def setValFromCtrl( self ): + #print "setValFromCtrl", self.ctrl + if isinstance( self.ctrl, wx.SpinCtrl ): + self.val = int( self.ctrl.GetValue( ) ) + elif isinstance( self.ctrl, wx.Choice ): + #print "setValFromCtrl:choice" + self.val = self.ctrl.GetStringSelection( ) + + elif hasattr( self.ctrl, 'IsChecked' ): + self.val = self.ctrl.IsChecked(); + elif hasattr( self.ctrl, 'GetValue' ): + val = self.ctrl.GetValue() + #print "setValFromCtrl", val + if type( val ) == self.valType \ + or self.valType is None \ + or self.valType == str: + self.val = self.ctrl.GetValue() + else: + #print "setValFromCtrl", val + if val: + self.val = self.valType( val ) + if self.minVal != None: + self.setVal( max( self.minVal, self.val ) ) + if self.maxVal != None: + self.setVal( min( self.maxVal, self.val ) ) + + # print self.val + +class ManagedProperties: + def __init__( self ): + self.properties = dict() + self.piCaption = "None" + + def appendProperty( self, name, default = None, valType = None + , ctrl = None, ctrlEvent = None, targetFunct = None ): + prop = None + if name in self.properties: + prop = self.properties[ name ] + else: + prop = Property( name, default, valType ) + self.properties[ name ] = prop + prop.parent = self + + if ctrl is not None: + prop.setCtrl( ctrl, ctrlEvent, targetFunct ) + + if default is None: + prop.setValFromCtrl() + + return prop + + def writePropertiesToFile( self, fi ): + fi.write( "[" + self.piCaption + "]\n" ) + + for k, v in self.properties.iteritems(): + print "write:", k, v, v() + fi.write( k + "=" + str( v() ) + "\n" ) + + def setProperties( self, props ): + print props + for k, v in props.iteritems(): + if k in self.properties: + self.properties[ k ].setVal( v ) + else: + sys.stderr.write( "unknown property for panel " + self.piCaption + " : " + k + "\n" ) + + def propertyChanged( self ): + """Abstract: will be called if some property value changed. to be overridden by child classes """ + pass + +class AppResource( ManagedProperties ): + def __init__( self, parent, rendererSlot, propertyInspectorSlot ): + ManagedProperties.__init__( self ) + self.xrc = None + self.parent = parent + + self.name_ = "No Name" + self.rendererSlot_ = rendererSlot + self.propertyInspectorSlot_ = propertyInspectorSlot + + self.propertyPanel_ = None + self.rendererPanel_ = None + self.renderer_ = None + + self.treeItem = None + self.active = False + self.parentResource = None + + self.dependencyList = [] + self.listenerList = [] + + self.subPanels = [] + + self.mainMenus = dict() + self.needProcessing_ = True + + + def setName( self, name ) : self.name_ = name; + def getName( self ) : return self.name_; + def getResourceTree( self ): return self.parent.resourceTree + + def loadXRC( self, xrcfile, localfile ): + self.xrc = xrc.EmptyXmlResource() + + if hasattr( sys, "frozen"): + globPath = os.path.dirname( sys.argv[ 0 ] ) + else: + globPath = os.path.dirname( localfile ) + + mainXRCFile=os.path.join( globPath, xrcfile ) + + if not os.path.exists( mainXRCFile ): + raise IOError('Could not find xrc file "%s"; dying'%mainXRCFile) + + self.xrc.Load( mainXRCFile ) + + def destroy( self ): + self.activate( False ) + self.activateApplication( False ) + + def getDependency( self, classname ): + for c in self.dependencyList: + if isinstance( c, classname ): + return c + + def addDependency( self, c ): + if c not in self.dependencyList: + self.dependencyList.append( c ) + + if self not in c.listenerList: + c.listenerList.append( self ) + + def needProcessing( self ): self.needProcessing_ = True + + def listenerNeedProcessing( self, force = False ): + for l in self.listenerList: + l.listenerNeedProcessing() + #if l.IsShownOnScreen() or force: + #l.prozess( False ) + #else: + l.needProcessing() + + def checkDependencies( self ): + for d in self.dependencyList: + d.checkDependencies( ) + + if self.prozessData(): + self.listenerNeedProcessing() + + self.needProcessing_ = False + + def prozess( self, dependency = True ): + self.checkDependencies( ) + + if self.parentResource: + for s in self.parentResource.subPanels: + if s.IsShownOnScreen() and s.needProcessing_: + s.prozess() + + def prozessData( self ): pass + + def createMainMenu( self, name ): + menu = wx.Menu( ) + self.parent.GetMenuBar().Insert( 3, menu, name ) + menu.SetTitle( name.replace( '&', '' ) ) + self.mainMenus[ menu ] = name + return menu + + def createMenuItem( self, menu, name = "", help = "", function = None, bitmap = None ): + item = wx.MenuItem( menu, wx.NewId(), name, help ) + if bitmap is not None: + item.SetBitmap( bitmap ) + menu.AppendItem( item ) + self.parent.Bind( wx.EVT_MENU, function, id = item.GetId() ) + return item + + def getPropertyPanel( self, slot ): + if self.propertyPanel_ is None and slot is not None: + if hasattr( self, 'createPropertyPanel' ): + self.propertyPan... [truncated message content] |
From: <eg...@us...> - 2009-09-09 18:48:45
|
Revision: 1141 http://opengate.svn.sourceforge.net/opengate/?rev=1141&view=rev Author: egore Date: 2009-09-09 18:48:36 +0000 (Wed, 09 Sep 2009) Log Message: ----------- Add shave support This adds support for shave to reduce the output during the build process. For more details see: http://damien.lespiau.name/blog/2009/02/18/shave-making-the-autotools-output-sane/ Modified Paths: -------------- trunk/configure.ac Added Paths: ----------- trunk/acinclude.m4 trunk/shave-libtool.in trunk/shave.in Added: trunk/acinclude.m4 =================================================================== --- trunk/acinclude.m4 (rev 0) +++ trunk/acinclude.m4 2009-09-09 18:48:36 UTC (rev 1141) @@ -0,0 +1,77 @@ +dnl Make automake/libtool output more friendly to humans +dnl Damien Lespiau <dam...@gm...> +dnl +dnl SHAVE_INIT([shavedir],[default_mode]) +dnl +dnl shavedir: the directory where the shave scripts are, it defaults to +dnl $(top_builddir) +dnl default_mode: (enable|disable) default shave mode. This parameter +dnl controls shave's behaviour when no option has been +dnl given to configure. It defaults to disable. +dnl +dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just +dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and +dnl LIBTOOL, you don't want the configure tests to have these variables +dnl re-defined. +dnl * This macro requires GNU make's -s option. + +AC_DEFUN([_SHAVE_ARG_ENABLE], +[ + AC_ARG_ENABLE([shave], + AS_HELP_STRING( + [--enable-shave], + [use shave to make the build pretty [[default=$1]]]),, + [enable_shave=$1] + ) +]) + +AC_DEFUN([SHAVE_INIT], +[ + dnl you can tweak the default value of enable_shave + m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) + + if test x"$enable_shave" = xyes; then + dnl where can we find the shave scripts? + m4_if([$1],, + [shavedir="$ac_pwd"], + [shavedir="$ac_pwd/$1"]) + AC_SUBST(shavedir) + + dnl make is now quiet + AC_SUBST([MAKEFLAGS], [-s]) + AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) + + dnl we need sed + AC_CHECK_PROG(SED,sed,sed,false) + + dnl substitute libtool + SHAVE_SAVED_LIBTOOL=$LIBTOOL + LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" + AC_SUBST(LIBTOOL) + + dnl substitute cc/cxx + SHAVE_SAVED_CC=$CC + SHAVE_SAVED_CXX=$CXX + SHAVE_SAVED_FC=$FC + SHAVE_SAVED_F77=$F77 + SHAVE_SAVED_OBJC=$OBJC + CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}" + CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}" + FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}" + F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}" + OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}" + AC_SUBST(CC) + AC_SUBST(CXX) + AC_SUBST(FC) + AC_SUBST(F77) + AC_SUBST(OBJC) + + V=@ + else + V=1 + fi + Q='$(V:1=)' + AC_SUBST(V) + AC_SUBST(Q) +]) + Modified: trunk/configure.ac =================================================================== --- trunk/configure.ac 2009-05-24 08:39:15 UTC (rev 1140) +++ trunk/configure.ac 2009-09-09 18:48:36 UTC (rev 1141) @@ -10,6 +10,8 @@ AM_MAINTAINER_MODE +AC_CONFIG_FILES([shave shave-libtool]) + AM_CONFIG_HEADER([config.h]) dnl set compiler warnings based on http://blogs.gnome.org/otte/2008/12/22/warning-options/ @@ -97,6 +99,8 @@ [AC_MSG_ERROR([*** boost_system library not found!])] ) +SHAVE_INIT(.,enable) + AC_OUTPUT([ Makefile data/Makefile Added: trunk/shave-libtool.in =================================================================== --- trunk/shave-libtool.in (rev 0) +++ trunk/shave-libtool.in 2009-09-09 18:48:36 UTC (rev 1141) @@ -0,0 +1,69 @@ +#!/bin/sh + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the real libtool to use +LIBTOOL="$1" +shift + +# if 1, don't print anything, the underlaying wrapper will do it +pass_though=0 + +# scan the arguments, keep the right ones for libtool, and discover the mode +preserved_args= +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + preserved_args="$preserved_args $opt" + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args $opt" + ;; + esac +done + +case "$mode" in +compile) + # shave will be called and print the actual CC/CXX/LINK line + preserved_args="$preserved_args --shave-mode=$mode" + pass_though=1 + ;; +link) + preserved_args="$preserved_args --shave-mode=$mode" + Q=" LINK " + ;; +*) + # let's u + # echo "*** libtool: Unimplemented mode: $mode, fill a bug report" + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +if test -z $V; then + if test $pass_though -eq 0; then + echo "$Q$output" + fi + $LIBTOOL --silent $preserved_args +else + echo $LIBTOOL $preserved_args + $LIBTOOL $preserved_args +fi Added: trunk/shave.in =================================================================== --- trunk/shave.in (rev 0) +++ trunk/shave.in 2009-09-09 18:48:36 UTC (rev 1141) @@ -0,0 +1,79 @@ +#!/bin/sh + +# we need sed +SED=@SED@ +if test -z "$SED" ; then +SED=sed +fi + +lt_unmangle () +{ + last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` +} + +# the tool to wrap (cc, cxx, ar, ranlib, ..) +tool="$1" +shift + +# the reel tool (to call) +REEL_TOOL="$1" +shift + +pass_through=0 +preserved_args= +while test "$#" -gt 0; do + opt="$1" + shift + + case $opt in + --shave-mode=*) + mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` + ;; + -o) + lt_output="$1" + preserved_args="$preserved_args $opt" + ;; + *) + preserved_args="$preserved_args $opt" + ;; + esac +done + +# mode=link is handled in the libtool wrapper +case "$mode,$tool" in +link,*) + pass_through=1 + ;; +*,cxx) + Q=" CXX " + ;; +*,cc) + Q=" CC " + ;; +*,fc) + Q=" FC " + ;; +*,f77) + Q=" F77 " + ;; +*,objc) + Q=" OBJC " + ;; +*,*) + # should not happen + Q=" CC " + ;; +esac + +lt_unmangle "$lt_output" +output=$last_result + +if test -z $V; then + if test $pass_through -eq 0; then + echo "$Q$output" + fi + $REEL_TOOL $preserved_args +else + echo $REEL_TOOL $preserved_args + $REEL_TOOL $preserved_args +fi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <eg...@us...> - 2009-05-24 08:39:22
|
Revision: 1140 http://opengate.svn.sourceforge.net/opengate/?rev=1140&view=rev Author: egore Date: 2009-05-24 08:39:15 +0000 (Sun, 24 May 2009) Log Message: ----------- GCC 4.4 compile fixes Modified Paths: -------------- trunk/src/common.h Modified: trunk/src/common.h =================================================================== --- trunk/src/common.h 2009-04-17 22:25:52 UTC (rev 1139) +++ trunk/src/common.h 2009-05-24 08:39:15 UTC (rev 1140) @@ -48,6 +48,7 @@ #include <algorithm> #include <sys/timeb.h> #include <stdexcept> +#include <stdint.h> typedef uint8_t Uint8; typedef uint16_t Uint16; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-17 22:25:57
|
Revision: 1139 http://opengate.svn.sourceforge.net/opengate/?rev=1139&view=rev Author: Ultrasick Date: 2009-04-17 22:25:52 +0000 (Fri, 17 Apr 2009) Log Message: ----------- masks now really function like a mask and don't just draw a border there are still several known bugs Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-16 14:09:14 UTC (rev 1138) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-17 22:25:52 UTC (rev 1139) @@ -128,81 +128,69 @@ absolute.append(plane['offset'][1] + plane['vectors'][0][1] * x_relative + plane['vectors'][1][1] * y_relative) absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) - # define a big value for the distance - distance = 999 + # get the color intensity of the border of the mask + mask_color_intensity = self.get_mask_color_intensity(absolute, mask_edges) - # get the distance to the closest edge of the mask - for mask_edge in mask_edges: - # get the current distance - current_distance = geometry.get_distance_to_a_line(mask_edge[0], mask_edge[1], absolute) + # check if the texture map should be drawn at this coordinates (because for example the absolute position is inside the mask) + draw_texture_map = self.get_draw_texture_map(absolute, mask_edges) - if current_distance<distance: - # store the current_distance - distance = current_distance + if draw_texture_map: + # get the color on the texture map + texture_map_color = textures[texture_category][texture_name].get_color(absolute, self.face) - # multiply the distance with 100 (because 0.01 blender units are 1 meter) - distance *= 100 + # get the decimal values of the colors of the texture map + texture_map_color = (int(texture_map_color[1:3], 16), int(texture_map_color[3:5], 16), int(texture_map_color[5:], 16)) - # multiply the distance with resolution_texture_map (because it's value says how much pixel per meter) - distance *= resolution_texture_map + # get the decimal values of the colors of the mask border + mask_border_color = (64, 64, 64) - # get the intensity of the mask color - mask_color_intensity = 2 - distance + # define an array for the new color values + color = [] - if mask_color_intensity>1: - mask_color_intensity = 1 - elif mask_color_intensity<0: - mask_color_intensity = 0 + # get the new color value for red + if texture_map_color[0]<mask_border_color[0]: + color.append(texture_map_color[0] + abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) + else: + color.append(texture_map_color[0] - abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) - # get the color on the texture map - texture_map_color = textures[texture_category][texture_name].get_color(absolute, self.face) + # get the new color value for green + if texture_map_color[1]<mask_border_color[1]: + color.append(texture_map_color[1] + abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) + else: + color.append(texture_map_color[1] - abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) - # get the decimal values of the colors - texture_map_color = (int(texture_map_color[1:3], 16), int(texture_map_color[3:5], 16), int(texture_map_color[5:], 16)) - mask_border_color = (int('40', 16), int('40', 16), int('40', 16)) + # get the new color value for blue + if texture_map_color[2]<mask_border_color[2]: + color.append(texture_map_color[2] + abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) + else: + color.append(texture_map_color[2] - abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) - # define an array for the new color values - color = [] + # round the color values + color[0] = int(round(color[0])) + color[1] = int(round(color[1])) + color[2] = int(round(color[2])) - # get the new color value for red - if texture_map_color[0]<mask_border_color[0]: - color.append(texture_map_color[0] + abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) + # join the red, green and blue value + color = '#' + hex(color[0])[2:] + hex(color[1])[2:] + hex(color[2])[2:] + elif mask_color_intensity>0: + color = '#404040' else: - color.append(texture_map_color[0] - abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) + color = none - # get the new color value for green - if texture_map_color[1]<mask_border_color[1]: - color.append(texture_map_color[1] + abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) - else: - color.append(texture_map_color[1] - abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) + if color!=none: + if absolute==self.offset: + x = 0 + y = 0 + else: + # get the relative position on the drawing area + x, y = self.get_relative_position(absolute) - # get the new color value for blue - if texture_map_color[2]<mask_border_color[2]: - color.append(texture_map_color[2] + abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) - else: - color.append(texture_map_color[2] - abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) + # center the position on the drawing area + x, y = self.center_position(x, y) - # round the color values - color[0] = int(round(color[0])) - color[1] = int(round(color[1])) - color[2] = int(round(color[2])) + # draw the pixel + self.drawing_area.draw_point(self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse(color))), x, y) - # join the red, green and blue value - color = '#' + hex(color[0])[2:] + hex(color[1])[2:] + hex(color[2])[2:] - - if absolute==self.offset: - x = 0 - y = 0 - else: - # get the relative position on the drawing area - x, y = self.get_relative_position(absolute) - - # center the position on the drawing area - x, y = self.center_position(x, y) - - # draw the pixel - self.drawing_area.draw_point(self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse(color))), x, y) - def get_border(self): # define arrays for the coordinates self.border_x = [] @@ -232,6 +220,116 @@ self.y_center /= 2 self.y_center -= min(self.border_y) + def get_draw_texture_map(self, absolute, mask_edges): + if mask_edges==[]: + return true + + mask_edges_pointer = 0 + end = len(mask_edges) + while mask_edges_pointer<>end: + # define/reset the array for the edges of the current triangle + triangle_edges = [] + + # get the 3 edges of the triangle + triangle_edges.append(mask_edges[mask_edges_pointer]) + triangle_edges.append(mask_edges[mask_edges_pointer + 1]) + triangle_edges.append(mask_edges[mask_edges_pointer + 2]) + + # set the new value for the pointer of the mask edges + mask_edges_pointer += 3 + + # define/reset the array for the vectors of the current triangle + triangle_vectors = [] + + # get the 3 vectors of the triangle + triangle_vectors.append(geometry.get_vector(triangle_edges[0][0], triangle_edges[0][1])) + triangle_vectors.append(geometry.get_vector(triangle_edges[1][0], triangle_edges[1][1])) + triangle_vectors.append(geometry.get_vector(triangle_edges[2][0], triangle_edges[2][1])) + + for vertice_pointer in range(0, 3): + if triangle_edges[vertice_pointer][0]==absolute or triangle_edges[vertice_pointer][1]==absolute: + failed = false + + break + + # get the vector of the absolute coordinate (from current vertice of the triangle to the absolute coordinates) + absolute_vector = geometry.get_vector(triangle_edges[vertice_pointer][0], absolute) + + # get the 0. vector of the triangle which starts in the current vertice + vector_0 = triangle_vectors[vertice_pointer] + + # get the index of the 1. vector of the triangle which ends in the current vertice + if vertice_pointer==0: + vector_1_index = 2 + else: + vector_1_index = vertice_pointer - 1 + + # get the vector and toggle the direction + vector_1 = [] + vector_1.append(triangle_vectors[vector_1_index][0] * (-1)) + vector_1.append(triangle_vectors[vector_1_index][1] * (-1)) + vector_1.append(triangle_vectors[vector_1_index][2] * (-1)) + + # get the angle between the 2 vectors of the triangle which start or end in current vertice + triangle_angle = geometry.get_angle(vector_0, vector_1) + + # check if the angle between the vector of the absolute coordinate and vector 0 is in the allowed range + absolute_angle = geometry.get_angle(absolute_vector, vector_0) + + if absolute_angle>triangle_angle: + failed = true + + break + else: + failed = false + + # check if the angle between the vector of the absolute coordinate and vector 1 is in the allowed range + absolute_angle = geometry.get_angle(absolute_vector, vector_1) + + if absolute_angle>triangle_angle: + failed = true + + break + else: + failed = false + + if failed==false: + break + + if failed==false: + return true + else: + return false + + def get_mask_color_intensity(self, absolute, mask_edges): + # define a big value for the distance + distance = 999 + + # get the distance to the closest edge of the mask + for mask_edge in mask_edges: + # get the current distance + current_distance = geometry.get_distance_to_a_line(mask_edge[0], mask_edge[1], absolute) + + if current_distance<distance: + # store the current_distance + distance = current_distance + + # multiply the distance with 100 (because 0.01 blender units are 1 meter) + distance *= 100 + + # multiply the distance with resolution_texture_map (because it's value says how much pixel per meter) + distance *= resolution_texture_map + + # get the intensity of the mask color + mask_color_intensity = 2 - distance + + if mask_color_intensity>1: + mask_color_intensity = 1 + elif mask_color_intensity<0: + mask_color_intensity = 0 + + return mask_color_intensity + def get_mask_edges(self, face_vertices, mask_triangles): # define an array for the vectors of the face face_vectors = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-16 14:09:24
|
Revision: 1138 http://opengate.svn.sourceforge.net/opengate/?rev=1138&view=rev Author: Ultrasick Date: 2009-04-16 14:09:14 +0000 (Thu, 16 Apr 2009) Log Message: ----------- fixed a typos Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-16 14:08:17 UTC (rev 1137) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-16 14:09:14 UTC (rev 1138) @@ -962,7 +962,7 @@ equation = float(equation) # multiply with 0.01 because 1 meter = 0.01 blender units - equation *= 0.001 + equation *= 0.01 # divide through the total length equation /= length This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-16 14:08:29
|
Revision: 1137 http://opengate.svn.sourceforge.net/opengate/?rev=1137&view=rev Author: Ultrasick Date: 2009-04-16 14:08:17 +0000 (Thu, 16 Apr 2009) Log Message: ----------- changing todo list; this stuff is not necessary for the first release Modified Paths: -------------- trunk/TODO.gluck Modified: trunk/TODO.gluck =================================================================== --- trunk/TODO.gluck 2009-04-16 13:59:41 UTC (rev 1136) +++ trunk/TODO.gluck 2009-04-16 14:08:17 UTC (rev 1137) @@ -1,3 +1,2 @@ -before first release: * metaserver f\xFCr die sektorverwaltung vorbereiten * sektoren in opacma aufnehmen (asteroiden fehlen + random bilder fehlen) \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-16 13:59:58
|
Revision: 1136 http://opengate.svn.sourceforge.net/opengate/?rev=1136&view=rev Author: Ultrasick Date: 2009-04-16 13:59:41 +0000 (Thu, 16 Apr 2009) Log Message: ----------- fixed a bug Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-12 09:46:09 UTC (rev 1135) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-16 13:59:41 UTC (rev 1136) @@ -490,8 +490,8 @@ for vertice in triangle: # solve the equations - x = solve(vertice[0], 1) * (self.width/2) - y = solve(vertice[1], 1) * (self.width/2) + x = solve(vertice[0], 0.01) * (self.width/2) + y = solve(vertice[1], 0.01) * (self.width/2) # center the coordinates x, y = self.center_position(x, y) @@ -921,9 +921,15 @@ # throw out the "+" equation = equation.replace('+', '') - # divide the remaining equation through the total length - equation = float(equation) / length + # make a float value from the remaining equation + equation = float(equation) + # multiply with 0.01 because 1 meter = 0.01 blender units + equation *= 0.01 + + # divide through the total length + equation /= length + # add the percent value equation += percent_value elif '-' in equation: @@ -933,9 +939,15 @@ # throw out the "-" equation = equation.replace('-', '') - # divide the remaining equation through the total length - equation = float(equation) / length + # make a float value from the remaining equation + equation = float(equation) + # multiply with 0.01 because 1 meter = 0.01 blender units + equation *= 0.01 + + # divide through the total length + equation /= length + if minus_index==0: equation = percent_value - equation else: @@ -946,9 +958,15 @@ equation = percent_value except: - # make a floating point value + # make a float value from the remaining equation equation = float(equation) + # multiply with 0.01 because 1 meter = 0.01 blender units + equation *= 0.001 + + # divide through the total length + equation /= length + return equation def update_ui(): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-12 09:46:09 UTC (rev 1135) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-16 13:59:41 UTC (rev 1136) @@ -233,59 +233,72 @@ self.y_center -= min(self.border_y) def get_mask_edges(self, face_vertices, mask_triangles): - # get the offset of the face - face_offset = face_vertices[0] + # define an array for the vectors of the face + face_vectors = [] # get the vectors - face_x_vector = geometry.get_vector(face_offset, face_vertices[1]) - face_y_vector = geometry.get_vector(face_offset, face_vertices[len(face_vertices) - 1]) + face_vectors.append(geometry.get_vector(face_vertices[0], face_vertices[1])) + face_vectors.append(geometry.get_vector(face_vertices[0], face_vertices[len(face_vertices) - 1])) + if len(face_vertices)==4: + # get another vector + face_vectors.append(geometry.get_vector(face_vertices[1], face_vertices[2])) + + # define an array for the lengths of the vectors + face_vectors_lengths = [] + # get the lengths - face_x_length = geometry.get_distance(face_x_vector) - face_y_length = geometry.get_distance(face_y_vector) + for vector in face_vectors: + face_vectors_lengths.append(geometry.get_distance(vector)) # create an array for the edges of the mask mask_edges = [] - for triangle_index, triangle_content in enumerate(mask_triangles): - # get the lambda values of the 0. triangle vertice - lambda_0 = [] - lambda_0.append(solve(triangle_content[0][0], face_x_length)) - lambda_0.append(solve(triangle_content[0][1], face_y_length)) + for triangle_content in mask_triangles: + # define/reset the array for the solved vertices + mask_vertices_solved = [] - # get the lambda values of the 1. triangle vertice - lambda_1 = [] - lambda_1.append(solve(triangle_content[1][0], face_x_length)) - lambda_1.append(solve(triangle_content[1][1], face_y_length)) + for vertice in triangle_content: + x_0 = solve(vertice[0], face_vectors_lengths[0]) - # get the lambda values of the 2. triangle vertice - lambda_2 = [] - lambda_2.append(solve(triangle_content[2][0], face_x_length)) - lambda_2.append(solve(triangle_content[2][1], face_y_length)) + rest = 1 - x_0 - # get the coordinates of vertice_0 - vertice_0 = [] - vertice_0.append(face_offset[0] + lambda_0[0] * face_x_vector[0] + lambda_0[1] * face_y_vector[0]) - vertice_0.append(face_offset[1] + lambda_0[0] * face_x_vector[1] + lambda_0[1] * face_y_vector[1]) - vertice_0.append(face_offset[2] + lambda_0[0] * face_x_vector[2] + lambda_0[1] * face_y_vector[2]) + y = solve(vertice[1], face_vectors_lengths[1]) - # get the coordinates of vertice_1 - vertice_1 = [] - vertice_1.append(face_offset[0] + lambda_1[0] * face_x_vector[0] + lambda_1[1] * face_y_vector[0]) - vertice_1.append(face_offset[1] + lambda_1[0] * face_x_vector[1] + lambda_1[1] * face_y_vector[1]) - vertice_1.append(face_offset[2] + lambda_1[0] * face_x_vector[2] + lambda_1[1] * face_y_vector[2]) + if y<=rest or len(face_vertices)==3: + y_0 = solve(vertice[1], face_vectors_lengths[1]) + y_1 = 0 + else: + y_0 = rest + y_1 = solve(vertice[1], face_vectors_lengths[2]) - rest - # get the coordinates of vertice_2 - vertice_2 = [] - vertice_2.append(face_offset[0] + lambda_2[0] * face_x_vector[0] + lambda_2[1] * face_y_vector[0]) - vertice_2.append(face_offset[1] + lambda_2[0] * face_x_vector[1] + lambda_2[1] * face_y_vector[1]) - vertice_2.append(face_offset[2] + lambda_2[0] * face_x_vector[2] + lambda_2[1] * face_y_vector[2]) + if y_1==0: + # get the coordinates of the vertice + mask_vertice = [] + mask_vertice.append(face_vertices[0][0] + x_0 * face_vectors[0][0] + y_0 * face_vectors[1][0]) + mask_vertice.append(face_vertices[0][1] + x_0 * face_vectors[0][1] + y_0 * face_vectors[1][1]) + mask_vertice.append(face_vertices[0][2] + x_0 * face_vectors[0][2] + y_0 * face_vectors[1][2]) + else: + # get the coordinates of the vertice + mask_vertice = [] + mask_vertice.append(face_vertices[0][0] + x_0 * face_vectors[0][0] + y_0 * face_vectors[1][0] + y_1 * face_vectors[2][0]) + mask_vertice.append(face_vertices[0][1] + x_0 * face_vectors[0][1] + y_0 * face_vectors[1][1] + y_1 * face_vectors[2][1]) + mask_vertice.append(face_vertices[0][2] + x_0 * face_vectors[0][2] + y_0 * face_vectors[1][2] + y_1 * face_vectors[2][2]) - # store the edges - mask_edges.append((vertice_0, vertice_1)) - mask_edges.append((vertice_1, vertice_2)) - mask_edges.append((vertice_2, vertice_0)) + # store the coordinates + mask_vertices_solved.append(mask_vertice) + for vertice_index, vertice_content in enumerate(mask_vertices_solved): + if vertice_index<(len(mask_vertices_solved) - 1): + next_vertice_content = mask_vertices_solved[vertice_index + 1] + else: + next_vertice_content = mask_vertices_solved[0] + + edge = (vertice_content, next_vertice_content) + + # store the edge + mask_edges.append(edge) + return mask_edges def get_planes(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-12 09:46:21
|
Revision: 1135 http://opengate.svn.sourceforge.net/opengate/?rev=1135&view=rev Author: Ultrasick Date: 2009-04-12 09:46:09 +0000 (Sun, 12 Apr 2009) Log Message: ----------- ups, fixing comment Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-12 09:43:50 UTC (rev 1134) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-12 09:46:09 UTC (rev 1135) @@ -258,7 +258,7 @@ lambda_1.append(solve(triangle_content[1][0], face_x_length)) lambda_1.append(solve(triangle_content[1][1], face_y_length)) - # get the lambda values of the 1. triangle vertice + # get the lambda values of the 2. triangle vertice lambda_2 = [] lambda_2.append(solve(triangle_content[2][0], face_x_length)) lambda_2.append(solve(triangle_content[2][1], face_y_length)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-12 09:43:57
|
Revision: 1134 http://opengate.svn.sourceforge.net/opengate/?rev=1134&view=rev Author: Ultrasick Date: 2009-04-12 09:43:50 +0000 (Sun, 12 Apr 2009) Log Message: ----------- fixed a bug (there are still several known) Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-05 17:53:33 UTC (rev 1133) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-12 09:43:50 UTC (rev 1134) @@ -946,8 +946,8 @@ equation = percent_value except: - # divide the remaining equation through the total length - equation = float(equation) / length + # make a floating point value + equation = float(equation) return equation Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-05 17:53:33 UTC (rev 1133) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-12 09:43:50 UTC (rev 1134) @@ -248,11 +248,21 @@ mask_edges = [] for triangle_index, triangle_content in enumerate(mask_triangles): - # get the lambda values of the triangle vertices - lambda_0 = (solve(triangle_content[0][0], face_x_length), solve(triangle_content[0][1], face_y_length)) - lambda_1 = (solve(triangle_content[1][0], face_x_length), solve(triangle_content[1][1], face_y_length)) - lambda_2 = (solve(triangle_content[2][0], face_x_length), solve(triangle_content[2][1], face_y_length)) + # get the lambda values of the 0. triangle vertice + lambda_0 = [] + lambda_0.append(solve(triangle_content[0][0], face_x_length)) + lambda_0.append(solve(triangle_content[0][1], face_y_length)) + # get the lambda values of the 1. triangle vertice + lambda_1 = [] + lambda_1.append(solve(triangle_content[1][0], face_x_length)) + lambda_1.append(solve(triangle_content[1][1], face_y_length)) + + # get the lambda values of the 1. triangle vertice + lambda_2 = [] + lambda_2.append(solve(triangle_content[2][0], face_x_length)) + lambda_2.append(solve(triangle_content[2][1], face_y_length)) + # get the coordinates of vertice_0 vertice_0 = [] vertice_0.append(face_offset[0] + lambda_0[0] * face_x_vector[0] + lambda_0[1] * face_y_vector[0]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-05 17:53:37
|
Revision: 1133 http://opengate.svn.sourceforge.net/opengate/?rev=1133&view=rev Author: Ultrasick Date: 2009-04-05 17:53:33 +0000 (Sun, 05 Apr 2009) Log Message: ----------- fixed a wrong comment Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-05 17:48:42 UTC (rev 1132) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-05 17:53:33 UTC (rev 1133) @@ -140,7 +140,7 @@ # store the current_distance distance = current_distance - # multiply the distance with 100 (because 100 blender units are 1 meter) + # multiply the distance with 100 (because 0.01 blender units are 1 meter) distance *= 100 # multiply the distance with resolution_texture_map (because it's value says how much pixel per meter) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-05 17:48:48
|
Revision: 1132 http://opengate.svn.sourceforge.net/opengate/?rev=1132&view=rev Author: Ultrasick Date: 2009-04-05 17:48:42 +0000 (Sun, 05 Apr 2009) Log Message: ----------- Grey mask borders are now visible. There are still some known bugs. Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/main/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-04 20:42:20 UTC (rev 1131) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-05 17:48:42 UTC (rev 1132) @@ -68,27 +68,46 @@ self.parse(value, prefix + new_prefix, false) def Print(self, Array, level = 0): - print 'array(' + if type(Array)==dict: + print 'array{' - if type(Array)==list: - for Schlussel, Wert in enumerate(Array): - if type(Wert)==list or type(Wert)==dict: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , - self.Print(Wert, level + 1) - else: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) - elif type(Array)==dict: - for Schlussel, Wert in Array.items(): - if type(Wert)==list or type(Wert)==dict: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , - self.Print(Wert, level + 1) - else: - print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + # get the content + content = Array.items() + elif type(Array)==list: + print 'array[' + + # get the content + content = enumerate(Array) + elif type(Array)==str: + # print the content + print '-->' + Array + '<--' + + return '' + elif type(Array)==tuple: + print 'array(' + + # get the content + content = enumerate(Array) else: + # print error message print 'unbekanntes Format' - print '\t' * level + ')' + return '' + for Schlussel, Wert in content: + if type(Wert)==list or type(Wert)==dict or type(Wert)==tuple: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , + self.Print(Wert, level + 1) + else: + print '\t' * (level + 1) + '[' + str(Schlussel) + '] =' , str(Wert) + + if type(Array)==dict: + print '\t' * level + '}' + elif type(Array)==list: + print '\t' * level + ']' + elif type(Array)==tuple: + print '\t' * level + ')' + return '' def save(self, file_name, Array): @@ -246,6 +265,8 @@ # compensate rounding errors if fraction_value>1: fraction_value = 1 + elif fraction_value<-1: + fraction_value = -1 return acos(fraction_value) @@ -269,6 +290,34 @@ def get_distance(self, vector): return sqrt(vector[0] ** 2 + vector[1] ** 2 + vector[2] ** 2) + def get_distance_to_a_line(self, line_vertice_1, line_vertice_2, point_vertice): + if point_vertice==line_vertice_1: + return 0 + + # get the line offset + line_offset = line_vertice_1 + + # get the line vector + line_vector = self.get_vector(line_offset, line_vertice_2) + + # get the vector from the line_offset and the point_vertice + vector = self.get_vector(line_offset, point_vertice) + + # get the length of this vector + length = self.get_distance(vector) + + # get the angle between the 2 vectors + angle = self.get_angle(vector, line_vector) + + if length>self.get_distance(line_vector) or ((angle*360)/(2*pi))>90: + # define the distance of the point from the line + distance = length + else: + # calculate the distance of the point from the line + distance = sin(angle) * length + + return distance + def get_plane(self, offset, vector_1, vector_2): # create an array for the plane plane = {} @@ -441,8 +490,8 @@ for vertice in triangle: # solve the equations - x = self.solve(vertice[0]) - y = self.solve(vertice[1]) + x = solve(vertice[0], 1) * (self.width/2) + y = solve(vertice[1], 1) * (self.width/2) # center the coordinates x, y = self.center_position(x, y) @@ -482,63 +531,6 @@ # calculate the center for the y-axis self.y_center = self.x_center - def solve(self, equation): - if '%' in equation: - percent_end_index = equation.index('%') - - # get the start index of the percent value - percent_start_index = percent_end_index - 1 - while percent_start_index>=0 and equation[percent_start_index] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']: - percent_start_index -= 1 - - percent_start_index += 1 - - # get the percent value - percent_value = equation[percent_start_index : percent_end_index] - - # divide through 100 - percent_value = float(percent_value) / 100 - - # multiply with the half of the width - percent_value *= self.width / 2 - - # throw the percent info out of the equation - equation = equation[:percent_start_index] + equation[percent_end_index + 1:] - - if '+' in equation: - # throw out the "+" - equation = equation.replace('+', '') - - # multiply half of the width with the remaining equation - equation = float(equation) * (self.width / 2) - - # add the percent value - equation += percent_value - elif '-' in equation: - # get the index of the "-" - minus_index = equation.index('-') - - # throw out the "-" - equation = equation.replace('-', '') - - # multiply half of the width with the remaining equation - equation = float(equation) * (self.width / 2) - - if minus_index==0: - equation = percent_value - equation - else: - equation = equation - percent_value - else: - try: - percent_value - - equation = percent_value - except: - # multiply half of the width with the remaining equation - equation = float(equation) * (self.width / 2) - - return equation - class project: def deconstruct(self, model): # coordinates -> vertice number @@ -905,6 +897,60 @@ simplefilter('ignore', DeprecationWarning) +def solve(equation, length): + if '%' in equation: + percent_end_index = equation.index('%') + + # get the start index of the percent value + percent_start_index = percent_end_index - 1 + while percent_start_index>=0 and equation[percent_start_index] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']: + percent_start_index -= 1 + + percent_start_index += 1 + + # get the percent value + percent_value = equation[percent_start_index : percent_end_index] + + # divide through 100 + percent_value = float(percent_value) / 100 + + # throw the percent info out of the equation + equation = equation[:percent_start_index] + equation[percent_end_index + 1:] + + if '+' in equation: + # throw out the "+" + equation = equation.replace('+', '') + + # divide the remaining equation through the total length + equation = float(equation) / length + + # add the percent value + equation += percent_value + elif '-' in equation: + # get the index of the "-" + minus_index = equation.index('-') + + # throw out the "-" + equation = equation.replace('-', '') + + # divide the remaining equation through the total length + equation = float(equation) / length + + if minus_index==0: + equation = percent_value - equation + else: + equation = equation - percent_value + else: + try: + percent_value + + equation = percent_value + except: + # divide the remaining equation through the total length + equation = float(equation) / length + + return equation + def update_ui(): while gtk.events_pending(): gtk.main_iteration(false) \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-04-04 20:42:20 UTC (rev 1131) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-04-05 17:48:42 UTC (rev 1132) @@ -7,24 +7,9 @@ textures['global'] = {} class glass: - def __init__(self): - self.initialized = false - - def initialize(self): - # select the right object as the drawing area - self.drawing_area = screen.canvas.preview.window - - # save the blue - self.drawing_area.colors['#00013C'] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse('#00013C'))) - - self.initialized = true - def get_color(self, vertice = none, face = none): - if self.initialized==false: - self.initialize() + return '#00013C' - return self.drawing_area.colors['#00013C'] - textures['global']['glass'] = glass() # create and array for the tauseti specific textures @@ -295,12 +280,8 @@ # get the color color = model['textures']['Tauseti']['panels'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] - if self.drawing_area.colors.has_key(color)==false: - # save the color - self.drawing_area.colors[color] = self.drawing_area.new_gc(foreground = self.color_map.alloc_color(gtk.gdk.color_parse(color))) + return color - return self.drawing_area.colors[color] - textures['Tauseti']['panels'] = panels() class dark_background: @@ -472,10 +453,6 @@ # get the color color = model['textures']['Tauseti']['dark background'][most_parallel_side][coordinates[axis_1]][coordinates[axis_0]] - if self.drawing_area.colors.has_key(color)==false: - # save the color - self.drawing_area.colors[color] = self.drawing_area.new_gc(foreground = self.color_map.alloc_color(gtk.gdk.color_parse(color))) + return color - return self.drawing_area.colors[color] - textures['Tauseti']['dark background'] = dark_background() \ No newline at end of file Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-04-04 20:42:20 UTC (rev 1131) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/global/index.py 2009-04-05 17:48:42 UTC (rev 1132) @@ -9,7 +9,7 @@ def __init__(self): # show bar self.bar = gtk.MenuBar() - window.vbox.pack_start(self.bar, false, true) + window.vbox.pack_start(self.bar, false) self.bar.show() # show "project" menu @@ -58,7 +58,7 @@ # show container for the content window.content = gtk.Alignment() -window.vbox.pack_start(window.content, false, true) +window.vbox.pack_start(window.content, false) window.content.show() def handle_keyboard(widget, event): Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-04 20:42:20 UTC (rev 1131) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-05 17:48:42 UTC (rev 1132) @@ -77,8 +77,12 @@ if type(layer)==str: self.draw_texture(layer) else: + # get the edges of the mask + mask_edges = self.get_mask_edges(self.face['vertices'], layer['triangles']) + + # draw the textures of this mask for child in layer['children'][::-1]: - self.draw_texture(child) + self.draw_texture(child, mask_edges) def draw_border(self): # create an array for the points of the polygon @@ -91,7 +95,7 @@ # draw the highlighted face self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) - def draw_texture(self, texture): + def draw_texture(self, texture, mask_edges = []): texture = texture.split(' - ') texture_category = texture[0] @@ -124,6 +128,68 @@ absolute.append(plane['offset'][1] + plane['vectors'][0][1] * x_relative + plane['vectors'][1][1] * y_relative) absolute.append(plane['offset'][2] + plane['vectors'][0][2] * x_relative + plane['vectors'][1][2] * y_relative) + # define a big value for the distance + distance = 999 + + # get the distance to the closest edge of the mask + for mask_edge in mask_edges: + # get the current distance + current_distance = geometry.get_distance_to_a_line(mask_edge[0], mask_edge[1], absolute) + + if current_distance<distance: + # store the current_distance + distance = current_distance + + # multiply the distance with 100 (because 100 blender units are 1 meter) + distance *= 100 + + # multiply the distance with resolution_texture_map (because it's value says how much pixel per meter) + distance *= resolution_texture_map + + # get the intensity of the mask color + mask_color_intensity = 2 - distance + + if mask_color_intensity>1: + mask_color_intensity = 1 + elif mask_color_intensity<0: + mask_color_intensity = 0 + + # get the color on the texture map + texture_map_color = textures[texture_category][texture_name].get_color(absolute, self.face) + + # get the decimal values of the colors + texture_map_color = (int(texture_map_color[1:3], 16), int(texture_map_color[3:5], 16), int(texture_map_color[5:], 16)) + mask_border_color = (int('40', 16), int('40', 16), int('40', 16)) + + # define an array for the new color values + color = [] + + # get the new color value for red + if texture_map_color[0]<mask_border_color[0]: + color.append(texture_map_color[0] + abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) + else: + color.append(texture_map_color[0] - abs(texture_map_color[0] - mask_border_color[0]) * mask_color_intensity) + + # get the new color value for green + if texture_map_color[1]<mask_border_color[1]: + color.append(texture_map_color[1] + abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) + else: + color.append(texture_map_color[1] - abs(texture_map_color[1] - mask_border_color[1]) * mask_color_intensity) + + # get the new color value for blue + if texture_map_color[2]<mask_border_color[2]: + color.append(texture_map_color[2] + abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) + else: + color.append(texture_map_color[2] - abs(texture_map_color[2] - mask_border_color[2]) * mask_color_intensity) + + # round the color values + color[0] = int(round(color[0])) + color[1] = int(round(color[1])) + color[2] = int(round(color[2])) + + # join the red, green and blue value + color = '#' + hex(color[0])[2:] + hex(color[1])[2:] + hex(color[2])[2:] + if absolute==self.offset: x = 0 y = 0 @@ -135,7 +201,7 @@ x, y = self.center_position(x, y) # draw the pixel - self.drawing_area.draw_point(textures[texture_category][texture_name].get_color(absolute, self.face), x, y) + self.drawing_area.draw_point(self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse(color))), x, y) def get_border(self): # define arrays for the coordinates @@ -166,6 +232,52 @@ self.y_center /= 2 self.y_center -= min(self.border_y) + def get_mask_edges(self, face_vertices, mask_triangles): + # get the offset of the face + face_offset = face_vertices[0] + + # get the vectors + face_x_vector = geometry.get_vector(face_offset, face_vertices[1]) + face_y_vector = geometry.get_vector(face_offset, face_vertices[len(face_vertices) - 1]) + + # get the lengths + face_x_length = geometry.get_distance(face_x_vector) + face_y_length = geometry.get_distance(face_y_vector) + + # create an array for the edges of the mask + mask_edges = [] + + for triangle_index, triangle_content in enumerate(mask_triangles): + # get the lambda values of the triangle vertices + lambda_0 = (solve(triangle_content[0][0], face_x_length), solve(triangle_content[0][1], face_y_length)) + lambda_1 = (solve(triangle_content[1][0], face_x_length), solve(triangle_content[1][1], face_y_length)) + lambda_2 = (solve(triangle_content[2][0], face_x_length), solve(triangle_content[2][1], face_y_length)) + + # get the coordinates of vertice_0 + vertice_0 = [] + vertice_0.append(face_offset[0] + lambda_0[0] * face_x_vector[0] + lambda_0[1] * face_y_vector[0]) + vertice_0.append(face_offset[1] + lambda_0[0] * face_x_vector[1] + lambda_0[1] * face_y_vector[1]) + vertice_0.append(face_offset[2] + lambda_0[0] * face_x_vector[2] + lambda_0[1] * face_y_vector[2]) + + # get the coordinates of vertice_1 + vertice_1 = [] + vertice_1.append(face_offset[0] + lambda_1[0] * face_x_vector[0] + lambda_1[1] * face_y_vector[0]) + vertice_1.append(face_offset[1] + lambda_1[0] * face_x_vector[1] + lambda_1[1] * face_y_vector[1]) + vertice_1.append(face_offset[2] + lambda_1[0] * face_x_vector[2] + lambda_1[1] * face_y_vector[2]) + + # get the coordinates of vertice_2 + vertice_2 = [] + vertice_2.append(face_offset[0] + lambda_2[0] * face_x_vector[0] + lambda_2[1] * face_y_vector[0]) + vertice_2.append(face_offset[1] + lambda_2[0] * face_x_vector[1] + lambda_2[1] * face_y_vector[1]) + vertice_2.append(face_offset[2] + lambda_2[0] * face_x_vector[2] + lambda_2[1] * face_y_vector[2]) + + # store the edges + mask_edges.append((vertice_0, vertice_1)) + mask_edges.append((vertice_1, vertice_2)) + mask_edges.append((vertice_2, vertice_0)) + + return mask_edges + def get_planes(self): # create an array for the planes of the triangles self.planes = [] Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-04-04 20:42:20 UTC (rev 1131) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-04-05 17:48:42 UTC (rev 1132) @@ -45,7 +45,7 @@ triangle_number = len(model['masks'][screen.canvas.mask_image.mask_number]) # create the new triangle - model['masks'][screen.canvas.mask_image.mask_number].append([('0', '0', '0'), ('0', '0', '0'), ('0', '0', '0')]) + model['masks'][screen.canvas.mask_image.mask_number].append([['0', '0'], ['0', '0'], ['0', '0']]) # update the list self.update(select = (triangle_number)) @@ -168,9 +168,9 @@ triangle = model['masks'][screen.canvas.mask_image.mask_number][row_index[0]] # store the vertices - triangle[0] = (self.input_x[0](), self.input_y[0](), 0) - triangle[1] = (self.input_x[1](), self.input_y[1](), 0) - triangle[2] = (self.input_x[2](), self.input_y[2](), 0) + triangle[0] = [self.input_x[0](), self.input_y[0]()] + triangle[1] = [self.input_x[1](), self.input_y[1]()] + triangle[2] = [self.input_x[2](), self.input_y[2]()] # close the edit window self.edit_window.destroy() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-04 20:42:33
|
Revision: 1131 http://opengate.svn.sourceforge.net/opengate/?rev=1131&view=rev Author: Ultrasick Date: 2009-04-04 20:42:20 +0000 (Sat, 04 Apr 2009) Log Message: ----------- fixed some bugs Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/textures.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-04-02 19:07:04 UTC (rev 1130) +++ branches/ogEditor/data/modules/texturizer/scripts/main/textures.py 2009-04-04 20:42:20 UTC (rev 1131) @@ -12,7 +12,7 @@ def initialize(self): # select the right object as the drawing area - self.drawing_area = screen.preview.preview.window + self.drawing_area = screen.canvas.preview.window # save the blue self.drawing_area.colors['#00013C'] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(gtk.gdk.color_parse('#00013C'))) @@ -32,8 +32,8 @@ class panels: def initialize_step_1(self): - # don't reload the preview image for now - screen.preview.preview.handler_block(screen.preview.refresh_id) + # don't reload the image of the canvas for now + screen.canvas.preview.handler_block(screen.canvas.refresh_id) # create an array for the faces of the bounding box faces = [] @@ -254,7 +254,7 @@ def get_color(self, vertice, face): # select the right object as the drawing area - self.drawing_area = screen.preview.preview.window + self.drawing_area = screen.canvas.preview.window # select the color map self.color_map = self.drawing_area.get_colormap() @@ -426,12 +426,12 @@ # store the pixels model['textures']['Tauseti']['dark background']['z_max'] = file_selection_window.return_value - # make the preview image reload again - screen.preview.preview.handler_unblock(screen.preview.refresh_id) + # make the image of the canvas reload again + screen.canvas.preview.handler_unblock(screen.canvas.refresh_id) def get_color(self, vertice, face): # select the right object as the drawing area - self.drawing_area = screen.preview.preview.window + self.drawing_area = screen.canvas.preview.window # select the color map self.color_map = self.drawing_area.get_colormap() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-04-02 19:07:04 UTC (rev 1130) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-04-04 20:42:20 UTC (rev 1131) @@ -29,24 +29,28 @@ # get the path to the selected row row_path = treeview.get_cursor()[0] - # get the treestore - treestore = screen.layers_used.treestore + # get the treemodel + treemodel = treeview.get_model() # get the "iter" to the selected row - row_iter = treestore.get_iter(row_path) + row_iter = treemodel.get_iter(row_path) # get the caption of the selected row - row_caption = treestore.get_value(row_iter, 0) + row_caption = treemodel.get_value(row_iter, 0) - # split the caption - row_caption = row_caption.split(' - ') + if '-' in row_caption: + # split the caption + row_caption = row_caption.split(' - ') - # get the category name and the texture name - self.category_name = row_caption[0] - self.texture_name = row_caption[1] + # get the category name and the texture name + self.category_name = row_caption[0] + self.texture_name = row_caption[1] - # update the preview image - self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + # update the preview image + self.preview.set_from_file(path[0] + '/graphic/textures/preview/' + self.category_name.lower().replace(' ', '_') + '/' + self.texture_name.lower().replace(' ', '_') + '.png') + else: + # clear the preview image + self.preview.clear() screen.layer_preview = layer_preview(table) @@ -68,6 +72,8 @@ # connect the functions self.treeview.connect('cursor-changed', screen.layer_preview.refresh) self.treeview.connect('row-activated', self.remove) + self.treeview.connect('drag-begin', lambda x, y: screen.canvas.deactivate()) + self.treeview.connect('drag-end', self.get_new_list_order) # show "used layers:" self.column = gtk.TreeViewColumn('used layers:') @@ -81,25 +87,23 @@ # refresh the list self.refresh(true) - def remove(self, treeview, row_path, column): - # get the "iter" to the selected row - row_iter = self.treestore.get_iter(row_path) + def get_new_list_order(self, treeview, drag_context): + # create an array for the used masks + used_masks = {} - # get the caption of the selected row - row_caption = self.treestore.get_value(row_iter, 0) + for layer in self.face['layers']: + if type(layer)==dict: + used_masks[layer['number']] = layer - # get the index of the layer - layer_index = self.face['layers'].index(row_caption) + # reset the layers array + self.face['layers'] = [] - # remove the layer - del(self.face['layers'][layer_index]) + # store the entry + self.treestore.foreach(self.store_list_entry, used_masks) - # refresh the list - self.refresh() + # reactivate the redrawing of the image of the canvas + screen.canvas.reactivate() - # clear the preview image - screen.layer_preview.preview.clear() - def refresh(self, fast = false): # clear the list self.treestore.clear() @@ -115,9 +119,85 @@ self.treestore.append(mask, [child]) if fast==false: - # update the big preview image - screen.preview.draw() + # update the big image on the canvas + screen.canvas.draw() + def remove(self, treeview, row_path, column): + # get the "iter" to the selected row + row_iter = self.treestore.get_iter(row_path) + + # get the caption of the selected row + row_caption = self.treestore.get_value(row_iter, 0) + + if row_caption[:4]=='mask': + # get the mask number + mask_number = int(row_caption[6:]) + + for layer_index, layer_content in enumerate(self.face['layers']): + if type(layer_content)==str: + continue + + if layer_content['number']==mask_number: + # remove the layer from the array + del(self.face['layers'][layer_index]) + + break + else: + try: + # get the index of the layer + layer_index = self.face['layers'].index(row_caption) + + # remove the layer from the array + del(self.face['layers'][layer_index]) + except: + for layer_index, layer_content in enumerate(self.face['layers']): + if type(layer_content)==str: + continue + + try: + child_index = layer_content['children'].index(row_caption) + + # remove the layer from the array + del(self.face['layers'][layer_index]['children'][child_index]) + + break + except: + pass + + # refresh the list + self.refresh() + + # clear the preview image + screen.layer_preview.preview.clear() + + def store_list_entry(self, treemodel, row_path, row_iter, used_masks): + # get the caption of the current row + row_caption = treemodel.get_value(row_iter, 0) + + # work-around for a bug in GTk+ + if row_caption==none: + return + + # get the iter of the parent + parent_iter = treemodel.iter_parent(row_iter) + + # check if this entry has a parent + if parent_iter==none: + if '-' in row_caption: + self.face['layers'].append(row_caption) + else: + # get the mask number + mask_number = row_caption[6:] + + # store the mask + self.face['layers'].append({'number' : int(mask_number), 'triangles' : used_masks[int(mask_number)]['triangles'], 'children' : []}) + else: + # get the index of parent + parent_index = len(self.face['layers']) - 1 + + # store the texture + self.face['layers'][parent_index]['children'].append(row_caption) + screen.layers_used = layers_used(table) class tools: Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-02 19:07:04 UTC (rev 1130) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-04 20:42:20 UTC (rev 1131) @@ -12,7 +12,7 @@ frame.add(table) table.show() -class preview: +class canvas: def __init__(self, parent): # show preview image self.preview = gtk.DrawingArea() @@ -21,7 +21,7 @@ self.preview.show() # set autoredraw - self.refresh_id = self.preview.connect('expose_event', self.draw) + self.refresh_id = self.preview.connect('expose_event', lambda x, y: self.draw()) # select the right object as the drawing area self.drawing_area = self.preview.window @@ -50,7 +50,22 @@ # get the planes of the triangles self.get_planes() - def draw(self, widget = none, event = none): + def center_position(self, x, y): + # center the coordinates + x += self.x_center + y += self.y_center + + # round the coordinates + x = int(round(x)) + y = int(round(y)) + + return (x, y) + + def deactivate(self): + # don't redraw the image for now + self.preview.handler_block(self.refresh_id) + + def draw(self): # clear the drawing area self.drawing_area.clear() @@ -58,11 +73,11 @@ self.draw_border() # insert the layers - for layer in self.face['layers']: + for layer in self.face['layers'][::-1]: if type(layer)==str: self.draw_texture(layer) else: - for child in layer['children']: + for child in layer['children'][::-1]: self.draw_texture(child) def draw_border(self): @@ -197,19 +212,15 @@ return (vector_x, vector_y) - def center_position(self, x, y): - # center the coordinates - x += self.x_center - y += self.y_center + def reactivate(self): + # redraw the image + self.draw() - # round the coordinates - x = int(round(x)) - y = int(round(y)) + # redraw the image again + self.preview.handler_unblock(self.refresh_id) - return (x, y) +screen.canvas = canvas(table) -screen.preview = preview(table) - class tools: def __init__(self, parent): # create an empty toolbar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-02 19:07:10
|
Revision: 1130 http://opengate.svn.sourceforge.net/opengate/?rev=1130&view=rev Author: Ultrasick Date: 2009-04-02 19:07:04 +0000 (Thu, 02 Apr 2009) Log Message: ----------- renaming array "textures" to "layers" Modified Paths: -------------- templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z Modified: templates/data/ships/tauseti/lady_kickstart/lady_kickstart.ogeditor.texturizer.7z =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-04-01 17:52:12
|
Revision: 1129 http://opengate.svn.sourceforge.net/opengate/?rev=1129&view=rev Author: Ultrasick Date: 2009-04-01 17:52:02 +0000 (Wed, 01 Apr 2009) Log Message: ----------- Selected masks are now shown in the face editor. There are still some known bugs but I will try to fix them, it's merely a matter of time. Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-31 19:17:52 UTC (rev 1128) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-04-01 17:52:02 UTC (rev 1129) @@ -865,7 +865,7 @@ vertices.append(vertice_number) # store the new face in the model['faces'] array - model['faces'].append({'vertices' : vertices, 'textures' : []}) + model['faces'].append({'vertices' : vertices, 'layers' : []}) model = project.reconstruct(model) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-03-31 19:17:52 UTC (rev 1128) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/layers.py 2009-04-01 17:52:02 UTC (rev 1129) @@ -88,11 +88,11 @@ # get the caption of the selected row row_caption = self.treestore.get_value(row_iter, 0) - # get the index of the texture - texture_index = self.face['textures'].index(row_caption) + # get the index of the layer + layer_index = self.face['layers'].index(row_caption) - # remove the texture - del(self.face['textures'][texture_index]) + # remove the layer + del(self.face['layers'][layer_index]) # refresh the list self.refresh() @@ -104,10 +104,16 @@ # clear the list self.treestore.clear() - # add the texture categories and the textures to the treestore - for texture in self.face['textures']: - self.treestore.append(none, [texture]) + # add the layers to the treestore + for layer in self.face['layers']: + if type(layer)==str: + self.treestore.append(none, [layer]) + else: + mask = self.treestore.append(none, ['mask #' + str(layer['number'])]) + for child in layer['children']: + self.treestore.append(mask, [child]) + if fast==false: # update the big preview image screen.preview.draw() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-03-31 19:17:52 UTC (rev 1128) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/face_editor/frames/view_the_face.py 2009-04-01 17:52:02 UTC (rev 1129) @@ -54,14 +54,17 @@ # clear the drawing area self.drawing_area.clear() - if len(self.face['textures'])==0: - # draw the pink border - self.draw_border() - else: - # insert the textures - for texture in self.face['textures']: - self.draw_texture(texture) + # draw the pink border + self.draw_border() + # insert the layers + for layer in self.face['layers']: + if type(layer)==str: + self.draw_texture(layer) + else: + for child in layer['children']: + self.draw_texture(child) + def draw_border(self): # create an array for the points of the polygon points = [] Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-31 19:17:52 UTC (rev 1128) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-04-01 17:52:02 UTC (rev 1129) @@ -72,7 +72,7 @@ def add(self, widget, mask_number): # add the mask - model['faces'][window.face_number]['masks'].append(mask_number) + model['faces'][window.face_number]['layers'].append({'number' : mask_number, 'triangles' : model['masks'][mask_number], 'children' : []}) # go back to the face editor screen show_screen('project/face_editor') Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-31 19:17:52 UTC (rev 1128) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-04-01 17:52:02 UTC (rev 1129) @@ -68,7 +68,7 @@ def add(self, widget, texture): # add the texture - model['faces'][window.face_number]['textures'].append(texture[0] + ' - ' + texture[1]) + model['faces'][window.face_number]['layers'].append(texture[0] + ' - ' + texture[1]) # go back to the face editor screen show_screen('project/face_editor') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-31 19:18:02
|
Revision: 1128 http://opengate.svn.sourceforge.net/opengate/?rev=1128&view=rev Author: Ultrasick Date: 2009-03-31 19:17:52 +0000 (Tue, 31 Mar 2009) Log Message: ----------- fixed a bug Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-31 19:13:13 UTC (rev 1127) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-31 19:17:52 UTC (rev 1128) @@ -14,6 +14,10 @@ class texture_selector: def __init__(self, parent): + if len(model['masks'])==0: + # nothing to show nor to selected, return + return + # show a table table = gtk.Table() table.set_col_spacings(3) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ult...@us...> - 2009-03-31 19:13:23
|
Revision: 1127 http://opengate.svn.sourceforge.net/opengate/?rev=1127&view=rev Author: Ultrasick Date: 2009-03-31 19:13:13 +0000 (Tue, 31 Mar 2009) Log Message: ----------- adding a mask selector to choose a mask from the ones you created. The texturizer doesn't know how to handle a mask jet so he crashes instead :-) Modified Paths: -------------- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py Modified: branches/ogEditor/data/modules/texturizer/scripts/main/functions.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/main/functions.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -371,6 +371,174 @@ return true +class mask_image: + def __init__(self, image_object, mask_number = none): + # save the parameters + self.drawing_area = image_object.window + self.mask_number = mask_number + + # set autoredraw + self.refresh_id = image_object.connect('expose_event', self.draw) + + # define the width + self.width, y = image_object.get_size_request() + + # define the colors + self.drawing_area.colors = {} + + for color_name, color_content in colors.items(): + self.drawing_area.colors[color_name] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(color_content)) + + # define the base line + self.base_line = (1, 0, 0) + + # define the offset + self.offset = (0, 0, 0) + + # get the border + self.get_border() + + def center_position(self, x, y): + # center the coordinates + x += self.x_center + y += self.y_center + + # round the coordinates + x = int(round(x)) + y = int(round(y)) + + return (x, y) + + def draw(self, widget = none, event = none): + # clear the drawing area + self.drawing_area.clear() + + if self.mask_number!=none: + # draw the pink border + self.draw_border() + + # get the triangles + triangles = model['masks'][self.mask_number] + + # draw the triangles + for triangle in triangles: + self.draw_triangle(triangle) + + def draw_border(self): + # create an array for the points of the polygon + points = [] + + # center the coordinates + for i in range(0, len(self.border_x)): + points.append(self.center_position(self.border_x[i], self.border_y[i])) + + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) + + def draw_triangle(self, triangle): + # create an array for the points of the polygon + points = [] + + for vertice in triangle: + # solve the equations + x = self.solve(vertice[0]) + y = self.solve(vertice[1]) + + # center the coordinates + x, y = self.center_position(x, y) + + # store the coordinates + points.append((x, y)) + + # draw the highlighted face + self.drawing_area.draw_polygon(self.drawing_area.colors['black'], true, points) + + def get_border(self): + # define arrays for the coordinates + self.border_x = [] + self.border_y = [] + + # add 1. vertice of the border + self.border_x.append(0) + self.border_y.append(0) + + # add 2. vertice of the border + self.border_x.append(self.width / 2) + self.border_y.append(0) + + # add 3. vertice of the border + self.border_x.append(self.width / 2) + self.border_y.append(self.width / 2) + + # add 4. vertice of the border + self.border_x.append(0) + self.border_y.append(self.width / 2) + + # calculate the center for the x-axis + self.x_center = self.width + self.x_center -= self.width / 2 + self.x_center /= 2 + + # calculate the center for the y-axis + self.y_center = self.x_center + + def solve(self, equation): + if '%' in equation: + percent_end_index = equation.index('%') + + # get the start index of the percent value + percent_start_index = percent_end_index - 1 + while percent_start_index>=0 and equation[percent_start_index] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']: + percent_start_index -= 1 + + percent_start_index += 1 + + # get the percent value + percent_value = equation[percent_start_index : percent_end_index] + + # divide through 100 + percent_value = float(percent_value) / 100 + + # multiply with the half of the width + percent_value *= self.width / 2 + + # throw the percent info out of the equation + equation = equation[:percent_start_index] + equation[percent_end_index + 1:] + + if '+' in equation: + # throw out the "+" + equation = equation.replace('+', '') + + # multiply half of the width with the remaining equation + equation = float(equation) * (self.width / 2) + + # add the percent value + equation += percent_value + elif '-' in equation: + # get the index of the "-" + minus_index = equation.index('-') + + # throw out the "-" + equation = equation.replace('-', '') + + # multiply half of the width with the remaining equation + equation = float(equation) * (self.width / 2) + + if minus_index==0: + equation = percent_value - equation + else: + equation = equation - percent_value + else: + try: + percent_value + + equation = percent_value + except: + # multiply half of the width with the remaining equation + equation = float(equation) * (self.width / 2) + + return equation + class project: def deconstruct(self, model): # coordinates -> vertice number Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/masks.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -41,14 +41,11 @@ self.update() def create(self, widget): - # get the new mask number - window.mask_number = len(model['masks']) - # create the new mask model['masks'].append([]) # update the list - self.update(select = (window.mask_number)) + self.update(select = (len(model['masks']) - 1)) # update the image screen.canvas.update() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/triangles.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -40,12 +40,12 @@ self.update() def create(self, widget): - if window.mask_number!=none: + if screen.canvas.mask_image.mask_number!=none: # get the new triangle number - triangle_number = len(model['masks'][window.mask_number]) + triangle_number = len(model['masks'][screen.canvas.mask_image.mask_number]) # create the new triangle - model['masks'][window.mask_number].append([('0', '0', '0'), ('0', '0', '0'), ('0', '0', '0')]) + model['masks'][screen.canvas.mask_image.mask_number].append([('0', '0', '0'), ('0', '0', '0'), ('0', '0', '0')]) # update the list self.update(select = (triangle_number)) @@ -55,7 +55,7 @@ def edit(self, widget = none): # don't reload the preview image for now - screen.canvas.preview.handler_block(screen.canvas.refresh_id) + screen.canvas.preview.handler_block(screen.canvas.mask_image.refresh_id) # destroy the edit window if it still exists try: @@ -71,7 +71,7 @@ return # get the triangle - triangle = model['masks'][window.mask_number][row_index[0]] + triangle = model['masks'][screen.canvas.mask_image.mask_number][row_index[0]] # show a new window self.edit_window = gtk.Window() @@ -145,7 +145,7 @@ def reactivate(self, widget): # make the preview image reload again, if the window is closed - screen.canvas.preview.handler_unblock(screen.canvas.refresh_id) + screen.canvas.preview.handler_unblock(screen.canvas.mask_image.refresh_id) # update the image screen.canvas.update() @@ -155,7 +155,7 @@ row_index = treeview.get_cursor()[0] # remove the texture - del(model['masks'][window.mask_number][row_index[0]]) + del(model['masks'][screen.canvas.mask_image.mask_number][row_index[0]]) # update the image and the triangle list screen.canvas.update() @@ -165,7 +165,7 @@ row_index = self.treeview.get_cursor()[0] # get the triangle - triangle = model['masks'][window.mask_number][row_index[0]] + triangle = model['masks'][screen.canvas.mask_image.mask_number][row_index[0]] # store the vertices triangle[0] = (self.input_x[0](), self.input_y[0](), 0) @@ -179,9 +179,9 @@ # clear the list self.treestore.clear() - if window.mask_number!=none: + if screen.canvas.mask_image.mask_number!=none: # add the triangles to the treestore - for triangle_index in range(0, len(model['masks'][window.mask_number])): + for triangle_index in range(0, len(model['masks'][screen.canvas.mask_image.mask_number])): self.treestore.append(none, ['triangle #' + str(triangle_index)]) if select!=none: Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_editor/frames/view_the_mask.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -12,203 +12,33 @@ frame.add(table) table.show() -# define the mask number -window.mask_number = none - class canvas: def __init__(self, parent): - # show preview image + # show the preview image self.preview = gtk.DrawingArea() self.preview.set_size_request(view_size * 2, view_size * 2) parent.attach(self.preview, 0, 1, 1, 2, xpadding = 3, ypadding = 3) self.preview.show() - # set autoredraw - self.refresh_id = self.preview.connect('expose_event', self.draw) + # attach the functions to the mask image + self.mask_image = mask_image(self.preview) - # select the right object as the drawing area - self.drawing_area = self.preview.window - - # define the colors - self.preview.window.colors = {} - - for color_name, color_content in colors.items(): - self.drawing_area.colors[color_name] = self.drawing_area.new_gc(foreground = self.drawing_area.get_colormap().alloc_color(color_content)) - - # create the base line - self.base_line = (1, 0, 0) - - # get the offset - self.offset = (0, 0, 0) - - # get the border - self.get_border() - - def center_position(self, x, y): - # center the coordinates - x += self.x_center - y += self.y_center - - # round the coordinates - x = int(round(x)) - y = int(round(y)) - - return (x, y) - - def draw(self, widget = none, event = none): - # clear the drawing area - self.drawing_area.clear() - - if window.mask_number!=none: - # draw the pink border - self.draw_border() - - # get the triangles - triangles = model['masks'][window.mask_number] - - # draw the triangles - for triangle in triangles: - self.draw_triangle(triangle) - - def draw_border(self): - # create an array for the points of the polygon - points = [] - - # center the coordinates - for i in range(0, len(self.border_x)): - points.append(self.center_position(self.border_x[i], self.border_y[i])) - - # draw the highlighted face - self.drawing_area.draw_polygon(self.drawing_area.colors['pink'], false, points) - - def draw_triangle(self, triangle): - # create an array for the points of the polygon - points = [] - - for vertice in triangle: - # solve the equations - x = self.solve(vertice[0]) - y = self.solve(vertice[1]) - - # center the coordinates - x, y = self.center_position(x, y) - - # store the coordinates - points.append((x, y)) - - # draw the highlighted face - self.drawing_area.draw_polygon(self.drawing_area.colors['black'], true, points) - - def get_border(self): - # define arrays for the coordinates - self.border_x = [] - self.border_y = [] - - # add 1. vertice of the border - self.border_x.append(0) - self.border_y.append(0) - - # add 2. vertice of the border - self.border_x.append(view_size) - self.border_y.append(0) - - # add 3. vertice of the border - self.border_x.append(view_size) - self.border_y.append(view_size) - - # add 4. vertice of the border - self.border_x.append(0) - self.border_y.append(view_size) - - # define lengths - self.x_length = view_size - self.y_length = view_size - - # calculate the center for the x-axis - self.x_center = view_size * 2 - self.x_center -= self.x_length - self.x_center /= 2 - self.x_center -= min(self.border_x) - - # calculate the center for the y-axis - self.y_center = view_size * 2 - self.y_center -= self.y_length - self.y_center /= 2 - self.y_center -= min(self.border_y) - - def solve(self, equation): - if '%' in equation: - percent_end_index = equation.index('%') - - # get the start index of the percent value - percent_start_index = percent_end_index - 1 - while percent_start_index>=0 and equation[percent_start_index] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.']: - percent_start_index -= 1 - - percent_start_index += 1 - - # get the percent value - percent_value = equation[percent_start_index : percent_end_index] - - # divide through 100 - percent_value = float(percent_value) / 100 - - # multiply with the view_size - percent_value *= view_size - - # throw the percent info out of the equation - equation = equation[:percent_start_index] + equation[percent_end_index + 1:] - - if '+' in equation: - # throw out the "+" - equation = equation.replace('+', '') - - # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) - equation = float(equation) * view_size - - # add the percent value - equation += percent_value - elif '-' in equation: - # get the index of the "-" - minus_index = equation.index('-') - - # throw out the "-" - equation = equation.replace('-', '') - - # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) - equation = float(equation) * view_size - - if minus_index==0: - equation = percent_value - equation - else: - equation = equation - percent_value - else: - try: - percent_value - - equation = percent_value - except: - # multiply the view_size with the remaining equation (which defines the amout of pixels for 1 meter as the width of the variable view_size) - equation = float(equation) * view_size - - return equation - def update(self, treeview = none): # get the row index of the mask list row_index = screen.masks_available.treeview.get_cursor()[0] if row_index==none: # update the mask number - window.mask_number = none + self.mask_image.mask_number = none # clear the canvas image - screen.canvas.drawing_area.clear() + self.mask_image.drawing_area.clear() else: # update the mask number - window.mask_number = row_index[0] + self.mask_image.mask_number = row_index[0] # update the canvas image - self.draw() + self.mask_image.draw() # update the triangle list screen.triangles_available.update() Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/mask_selector/frames/select_the_mask.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -18,48 +18,60 @@ table = gtk.Table() table.set_col_spacings(3) table.set_row_spacings(3) - parent.attach(table, 0, 1, 1, 2) + parent.attach(table, 0, 1, 1, 2, xpadding = 3, ypadding = 3) table.show() - # define the radio button variable - '''button = none + # get the table width + x_max = int(round(sqrt(len(model['masks'])))) - # add the texture categories and the textures - for category_name, category_textures in textures.items(): - # show the category name - text = gtk.Label() - text.set_markup('<b>' + category_name + ':</b>') - table.attach(text, category_number * 2, (category_number * 2) + 1, 0, 1) - text.show() + # define the coordinates in the table + x = 0 + y = 0 - # define the texture number - texture_number = 0 + for y in range(0, 999): + for x in range(0, x_max): + # get mask number + mask_number = x + y * x_max - for texture_name, texture_function in category_textures.items(): + if mask_number>=len(model['masks']): + break + + # show a table for the button content + button_content_table = gtk.Table() + button_content_table.set_col_spacings(3) + button_content_table.show() + # show the preview image - image = gtk.Image() - image.set_from_file(path[0] + '/graphic/textures/preview/' + category_name.lower().replace(' ', '_') + '/' + texture_name.lower().replace(' ', '_') + '.png') - table.attach(image, category_number * 2, (category_number * 2) + 1, texture_number + 1, texture_number + 2) + image = gtk.DrawingArea() + image.set_size_request(150, 150) + button_content_table.attach(image, 0, 1, 0, 1) image.show() - # show the radio button - button = gtk.RadioButton(button, texture_name) - button.connect('toggled', self.add, (category_name, texture_name)) - table.attach(button, (category_number * 2) + 1, (category_number * 2) + 2, texture_number + 1, texture_number + 2) + # show the number as the "name" + text = gtk.Label() + text.set_markup('<span font_desc="Courier New">mask #' + str(mask_number) + '</span>') + button_content_table.attach(text, 1, 2, 0, 1) + text.show() + + # show the button + button = gtk.Button() + button.add(button_content_table) + button.connect('clicked', self.add, mask_number) + table.attach(button, x, x + 1, y, y + 1) button.show() - # increase the texture number - texture_number += 1 + # attach the mask functions to the preview image + current_mask_image = mask_image(image, mask_number) - # increase the category number - category_number += 1''' + if mask_number>=len(model['masks']): + break - def add(self, widget, mask): - '''# add the mask - model['faces'][window.face_number]['textures'].append(texture[0] + ' - ' + texture[1]) + def add(self, widget, mask_number): + # add the mask + model['faces'][window.face_number]['masks'].append(mask_number) # go back to the face editor screen - show_screen('project/face_editor')''' + show_screen('project/face_editor') texture_selector(table) Modified: branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py =================================================================== --- branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-30 18:18:36 UTC (rev 1126) +++ branches/ogEditor/data/modules/texturizer/scripts/screens/project/texture_selector/frames/select_the_texture.py 2009-03-31 19:13:13 UTC (rev 1127) @@ -29,7 +29,7 @@ # show the category name text = gtk.Label() text.set_markup('<b>' + category_name + ':</b>') - table.attach(text, category_number * 2, (category_number * 2) + 1, 0, 1) + table.attach(text, category_number, category_number + 1, 0, 1) text.show() # define the texture number @@ -57,7 +57,7 @@ button = gtk.Button() button.add(button_content_table) button.connect('clicked', self.add, (category_name, texture_name)) - table.attach(button, category_number * 2, (category_number * 2) + 1, texture_number + 1, texture_number + 2) + table.attach(button, category_number, category_number + 1, texture_number + 1, texture_number + 2) button.show() # increase the texture number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |