Revision: 831
http://python-ogre.svn.sourceforge.net/python-ogre/?rev=831&view=rev
Author: andy_miller
Date: 2008-12-18 12:21:14 +0000 (Thu, 18 Dec 2008)
Log Message:
-----------
Updates to OgreForests code base
Set windows build back to a shared lib (dll) build for Boost
Significant changes in common code to support Pure Virtual functions needing transformation (requires the latest Py++)
Reasonable set of updates to PhysX (Dermont's wrapper code + more)
Small update to Bullet due to new common wrapping code
Modified Paths:
--------------
trunk/python-ogre/PythonOgreConfig_nt.py
trunk/python-ogre/ReportVersion.py
trunk/python-ogre/SConstruct
trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp
trunk/python-ogre/ThirdParty/forests/GrassLoader.h
trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp
trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp
trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp
trunk/python-ogre/code_generators/bullet/generate_code.py
trunk/python-ogre/code_generators/common_utils/__init__.py
trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py
trunk/python-ogre/code_generators/physx/generate_code.py
trunk/python-ogre/code_generators/physx/hand_made_wrappers.py
trunk/python-ogre/demos/ogre/Demo_Basic.py
trunk/python-ogre/environment.py
trunk/python-ogre/scripts/UpdateDLLs.bat
Modified: trunk/python-ogre/PythonOgreConfig_nt.py
===================================================================
--- trunk/python-ogre/PythonOgreConfig_nt.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/PythonOgreConfig_nt.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -13,17 +13,13 @@
## path to the root of your boost dir, should have 'libs', 'boost' subdirectories
-PATH_Boost = os.path.join(BASE_DIR, 'boost_1_36_0' ) #-trunk')
+PATH_Boost = os.path.join(BASE_DIR, 'boost_1_37_0' ) #-trunk')
## Path to your boost_pythonxxxx lib file
PATH_LIB_Boost = os.path.join(PATH_Boost, 'bin.v2/libs/python/build/msvc-9.0/release/threading-multi')
-
-## and the name of the boost python library
-## now part of class boos tin environtment.py
-# LIB_Boost = r'boost_python-vc90-mt-1_37'
-# # LIB_Boost = r'boost_python-vc80-mt-1_34_1'
-# LIB_Boost = r'boost_python-vc-mt-1_35'
-
+PATH_LIB_Boost_STATIC = os.path.join(PATH_Boost, 'bin.v2/libs/python/build/msvc-9.0/release/link-static/threading-multi')
+PATH_LIB_Thread_STATIC = os.path.join(PATH_Boost, 'bin.v2/libs/thread/build/msvc-9.0/release/link-static/threading-multi')
+PATH_LIB_date_time_STATIC = os.path.join(PATH_Boost, 'bin.v2/libs/date_time/build/msvc-9.0/release/link-static/threading-multi')
# in Linux we need to code in the Relative path for the library
RPATH=""
@@ -36,7 +32,7 @@
PATH_THIRDPARTY = os.path.join(module_dir, 'ThirdParty' )
PATH_Ogre = os.path.join(BASE_DIR, 'ogre')
PATH_OgreAddons = os.path.join(BASE_DIR, 'OgreAddons')
-PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.1')
+PATH_CEGUI = os.path.join(BASE_DIR, 'CEGUI-0.6.2')
PATH_OIS = os.path.join(BASE_DIR, 'ois' ) ##'ois-1.0RC1')
PATH_Newton = os.path.join(BASE_DIR, 'newtonsdk','sdk')
Modified: trunk/python-ogre/ReportVersion.py
===================================================================
--- trunk/python-ogre/ReportVersion.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ReportVersion.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -4,6 +4,7 @@
import os, sys, time, shutil
import logging
#import BuildModule as bm
+import ogre.renderer.OGRE as o
#add environment to the path
sys.path.append( '.' )
@@ -17,7 +18,7 @@
moduleList = ( 'ogre.renderer.OGRE',
'ogre.io.OIS',
- 'ogre.gui.CEGUI','ogre.gui.QuickGUI', 'ogre.gui.betagui',
+ 'ogre.gui.betagui', # 'ogre.gui.CEGUI', 'ogre.gui.QuickGUI',
'ogre.sound.OgreAL',
'ogre.physics.ODE', 'ogre.physics.OgreRefApp',
'ogre.physics.OgreOde', 'ogre.physics.OgreNewt', 'ogre.physics.Opcode',
@@ -51,3 +52,5 @@
except ImportError:
print "Import failed:", basename
# logger.error ( "Import failed:" + basename )
+ except TypeError:
+ print "Type Error:"
Modified: trunk/python-ogre/SConstruct
===================================================================
--- trunk/python-ogre/SConstruct 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/SConstruct 2008-12-18 12:21:14 UTC (rev 831)
@@ -50,7 +50,7 @@
def get_ccflags(cls):
if os.name=='nt':
CCFLAGS=''
- #CCFLAGS += '-DBOOST_PYTHON_MAX_ARITY=19'
+ CCFLAGS += ' /DBOOST_PYTHON_MAX_ARITY=19 '
CCFLAGS += ' /nologo -Zm200 '
CCFLAGS += ' /W3 /wd4675' # warning level -Zc:wchar_t
CCFLAGS += ' /TP /MD /Zc:forScope /EHs /c /Ox /Ob2 /Oi /Ot /Oy /GS- /GR '
Modified: trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ThirdParty/forests/GrassLoader.cpp 2008-12-18 12:21:14 UTC (rev 831)
@@ -260,6 +260,13 @@
if (heightFunction){
y1 = heightFunction(x1, z1, heightFunctionUserData);
y2 = heightFunction(x2, z2, heightFunctionUserData);
+
+ if (layer->getMaxSlope() < (Math::Abs(y1 - y2) / (halfScaleX * 2))) {
+ //Degenerate the face
+ x2 = x1;
+ y2 = y1;
+ z2 = z1;
+ }
} else {
y1 = 0;
y2 = 0;
@@ -398,6 +405,13 @@
if (heightFunction){
y1 = heightFunction(x1, z1, heightFunctionUserData);
y2 = heightFunction(x2, z2, heightFunctionUserData);
+
+ if (layer->getMaxSlope() < (Math::Abs(y1 - y2) / (halfScaleX * 2))) {
+ //Degenerate the face
+ x2 = x1;
+ y2 = y1;
+ z2 = z1;
+ }
} else {
y1 = 0;
y2 = 0;
@@ -432,6 +446,13 @@
float y3, y4;
if (heightFunction){
+ if (layer->getMaxSlope() < (Math::Abs(y1 - y2) / (halfScaleX * 2))) {
+ //Degenerate the face
+ x2 = x1;
+ y2 = y1;
+ z2 = z1;
+ }
+
y3 = heightFunction(x3, z3, heightFunctionUserData);
y4 = heightFunction(x4, z4, heightFunctionUserData);
} else {
@@ -659,6 +680,7 @@
minWidth = 1.0f; maxWidth = 1.0f;
minHeight = 1.0f; maxHeight = 1.0f;
minY = 0; maxY = 0;
+ maxSlope = 1000;
renderTechnique = GRASSTECH_QUAD;
fadeTechnique = FADETECH_ALPHA;
animMag = 1.0f;
Modified: trunk/python-ogre/ThirdParty/forests/GrassLoader.h
===================================================================
--- trunk/python-ogre/ThirdParty/forests/GrassLoader.h 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ThirdParty/forests/GrassLoader.h 2008-12-18 12:21:14 UTC (rev 831)
@@ -169,7 +169,6 @@
heightFunctionUserData = userData;
}
-
/** INTERNAL FUNCTION - DO NOT USE */
void loadPage(PageInfo &page);
/** INTERNAL FUNCTION - DO NOT USE */
@@ -276,6 +275,34 @@
as necessary. */
void setHeightRange(float minHeight, float maxHeight = 0) { minY = minHeight; maxY = maxHeight; }
+ /** \brief Set the maximum slope a grass of blade can be placed on.
+ \param maxSlopeRatio The maximum slope (h/w ratio) a grass blade is allowed to be placed on.
+
+ This function can be used to set the maximum slope you want your grass to be placed on
+ (although it doesn't work for sprite grass). By default grass is allowed on any slope.
+
+ This version of setMaxSlope() accepts a slope ratio value, where ATan(maxSlopeRatio) =
+ maxSlopeAngle. If you wish to provide a maximum slope as an angle, either use the other
+ overload of this function, or convert your angle to a slope ratio first with Tan().*/
+ void setMaxSlope(const float maxSlopeRatio) { maxSlope = maxSlopeRatio; }
+
+ void setMaxSlope(Ogre::Radian maxSlopeAngle) {
+ if (maxSlopeAngle > Ogre::Degree(89.99f))
+ maxSlopeAngle = Ogre::Degree(89.99f);
+ if (maxSlopeAngle < Ogre::Degree(0))
+ maxSlopeAngle = Ogre::Degree(0);
+
+ maxSlope = Ogre::Math::Tan(maxSlopeAngle);
+ }
+
+ /** \brief Get the maximum slope a grass blade can be placed on (as set by setMaxSlope()).
+ \returns The currently set maximum slope ratio value (not an angle).
+
+ This returns the currently set maximum slope which is used to determine what ground is too steep
+ for grass to be placed on. Note that this returns the slope as a slope ratio, not an angle. If you
+ need an angle value, convert with ATan() (maxSlopeAngle = ATan(maxSlopeRatio)).*/
+ float getMaxSlope() const { return maxSlope; }
+
/** \brief Sets the density map used for this grass layer
\param mapFile The density map image
\param channel The color channel(s) to from the image to interpret as density
@@ -487,6 +514,7 @@
float minHeight, maxHeight;
float minY, maxY;
+ float maxSlope;
FadeTechnique fadeTechnique;
GrassTechnique renderTechnique;
Modified: trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ThirdParty/forests/ImpostorPage.cpp 2008-12-18 12:21:14 UTC (rev 831)
@@ -49,6 +49,7 @@
if (++selfInstances == 1){
//Set up a single instance of a scene node which will be used when rendering impostor textures
geom->getSceneNode()->createChildSceneNode("ImpostorPage::renderNode");
+ geom->getSceneNode()->createChildSceneNode("ImpostorPage::cameraNode");
}
}
@@ -63,6 +64,7 @@
if (--selfInstances == 0){
sceneMgr->destroySceneNode("ImpostorPage::renderNode");
+ sceneMgr->destroySceneNode("ImpostorPage::cameraNode");
}
}
@@ -445,6 +447,7 @@
RenderTexture *renderTarget;
Camera *renderCamera;
Viewport *renderViewport;
+ SceneNode *camNode;
//Set up RTT texture
uint32 textureSize = ImpostorPage::impostorResolution;
@@ -459,7 +462,9 @@
renderTarget->setAutoUpdated(false);
//Set up camera
+ camNode = sceneMgr->getSceneNode("ImpostorPage::cameraNode");
renderCamera = sceneMgr->createCamera(getUniqueID("ImpostorCam"));
+ camNode->attachObject(renderCamera);
renderCamera->setLodBias(1000.0f);
renderViewport = renderTarget->addViewport(renderCamera);
renderViewport->setOverlaysEnabled(false);
Modified: trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ThirdParty/forests/PagedGeometry.cpp 2008-12-18 12:21:14 UTC (rev 831)
@@ -166,7 +166,7 @@
{
if (!managerList.empty())
OGRE_EXCEPT(0, "PagedGeometry::setBounds() cannot be called after detail levels have been added. Call removeDetailLevels() first.", "PagedGeometry::setBounds()");
- if (bounds.width() != bounds.height())
+ if (!Math::RealEqual(bounds.width(), bounds.height(), 0.01f))
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Bounds must be square", "PagedGeometry::setBounds()");
if (bounds.width() <= 0 || bounds.height() <=0)
OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS, "Bounds must have positive width and height", "PagedGeometry::setBounds()");
Modified: trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp
===================================================================
--- trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/ThirdParty/forests/PropertyMaps.cpp 2008-12-18 12:21:14 UTC (rev 831)
@@ -131,6 +131,10 @@
float boundsWidth = mapBounds.width();
float boundsHeight = mapBounds.height();
+ //Patch incorrect PixelBox::getWidth() in OpenGL mode
+ if (Root::getSingleton().getRenderSystem()->getName() == "OpenGL Rendering Subsystem")
+ --mapWidth;
+
uint32 xindex = mapWidth * (x - mapBounds.left) / boundsWidth;
uint32 zindex = mapHeight * (z - mapBounds.top) / boundsHeight;
if (xindex < 0 || zindex < 0 || xindex >= mapWidth || zindex >= mapHeight)
@@ -153,6 +157,10 @@
float boundsWidth = mapBounds.width();
float boundsHeight = mapBounds.height();
+ //Patch incorrect PixelBox::getWidth() in OpenGL mode
+ if (Root::getSingleton().getRenderSystem()->getName() == "OpenGL Rendering Subsystem")
+ --mapWidth;
+
float xIndexFloat = (mapWidth * (x - mapBounds.left) / boundsWidth) - 0.5f;
float zIndexFloat = (mapHeight * (z - mapBounds.top) / boundsHeight) - 0.5f;
Modified: trunk/python-ogre/code_generators/bullet/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/bullet/generate_code.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/code_generators/bullet/generate_code.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -212,7 +212,14 @@
f=main_ns.class_('btCollisionWorld').mem_fun('addCollisionObject')
f.arguments[1].default_value = 'btBroadphaseProxy::DefaultFilter' # (short int)(btBroadphaseProxy::DefaultFilter)
f.arguments[2].default_value = 'btBroadphaseProxy::AllFilter' # (short int)(btBroadphaseProxy::AllFilter)
-
+
+ f = ['::btBroadphaseInterface::createProxy',
+ '::btDispatcher::getNewManifold'
+ ]
+ for fun in f:
+ print "setting call policy", fun
+ main_ns.member_function(fun).call_policies = call_policies.default_call_policies()
+
############################################################
##
## And things that need to have their argument and call values fixed.
Modified: trunk/python-ogre/code_generators/common_utils/__init__.py
===================================================================
--- trunk/python-ogre/code_generators/common_utils/__init__.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/code_generators/common_utils/__init__.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -282,6 +282,7 @@
arg_position = 0
trans=[]
desc=""
+ ft_type = None
ctypes_conversion = False
for arg in fun.arguments:
rawarg = declarations.remove_declarated(
@@ -301,10 +302,12 @@
arg.type.decl_string + " ) takes a CTypes.addressof(xx). \\n"
ctypes_conversion = True
ctypes_arg = arg.type.decl_string.split()[0]
+ ft_type = 'CTYPES'
elif declarations.is_reference(arg.type)and not declarations.is_const(declarations.remove_reference( arg.type)): # seen functions passing const ref's
trans.append( ft.inout(arg_position ) )
desc = desc + "Argument: "+arg.name+ "( pos:" + str(arg_position) + " - " +\
arg.type.decl_string + " ) converted to an input/output (change to return types).\\n"
+ ft_type = 'INOUT'
elif declarations.is_reference(arg.type):
print "Warning: - possible code change.", fun,arg," not wrapped as const reference to base type invalid"
else:
@@ -313,10 +316,23 @@
pass # it's not a var we need to handle
arg_position += 1
if trans:
+ const_return = False # declarations.is_const(fun)
+ if fun.decl_string.endswith('const'):
+ const_return=True
+ simple_return = declarations.is_arithmetic(fun.return_type) or declarations.is_void(fun.return_type)
+ nonpublic_destructor = declarations.is_class(fun.parent) and declarations.has_destructor(fun.parent) and\
+ not declarations.has_public_destructor(fun.parent)
+
if fun.documentation or fun.transformations: # it's already be tweaked:
print "AUTOFT ERROR: Duplicate Tranforms.", fun, fun.documentation
- elif hasattr(fun, "virtuality") and fun.virtuality == "pure virtual": # free functions don't have virtuality arrtibute
- print "AUTOFT WARNING: PURE VIRTUAL function requires tranform.", fun
+
+ # if the class has a protected destruction AND the return value is const or a non arithmatic value then exclude it.
+ elif nonpublic_destructor and const_return:
+ print "AUTOFT ERROR Const: Parent has non public destructor and const return.", fun.parent.name, fun.return_type.decl_string, fun
+ fun.documentation="Python-Ogre Warning: function required transformation - not possible due to non public destructor and const return value.."
+ elif nonpublic_destructor and not simple_return:
+ print "AUTOFT ERROR Const: Parent has non public destructor and complex return value.", fun.parent.name, fun.return_type.decl_string, fun
+ fun.documentation="Python-Ogre Warning: function required transformation - not possible due to non public destructor and complex return value.."
else:
new_alias = fun.name
if ctypes_conversion: # only manage name changes if ctypes changing
@@ -338,7 +354,7 @@
desc = desc + "\\\nWARNING FUNCTION NAME CHANGE - from "+fun.name + " -- " + fun.decl_string +" to " + new_alias + " \\n"
print "INFO: Adjusting Alias as multiple overlapping functions:", new_alias
- print "AUTOFT OK: Tranformed ", fun, "(",new_alias,")"
+ print "AUTOFT OK: Tranformed ", fun.return_type.decl_string, fun, "(",new_alias,")"
fun.add_transformation ( * trans , **{"alias":new_alias} )
fun.documentation = docit ("Auto Modified Arguments:",
desc, "...")
@@ -362,13 +378,13 @@
desc = desc +"Argument: "+arg.name+ "( pos:" + str(arg_position) +") takes a CTypes.addressof(xx). "
arg_position +=1
if trans:
- if fun.virtuality == "pure virtual":
- print "*** WARNING: Unable to apply transformation to PURE VIRTUAL function", fun, desc
- else:
- print "Tranformation applied to ", fun, desc, fun.virtuality
- fun.add_transformation ( * trans , **{"alias":fun.name} )
- fun.documentation = docit ("Modified Input Argument to work with CTypes",
- desc, "...")
+# if fun.virtuality == "pure virtual":
+# print "*** WARNING: Unable to apply transformation to PURE VIRTUAL function", fun, desc
+# else:
+ print "Tranformation applied to ", fun, desc, fun.virtuality
+ fun.add_transformation ( * trans , **{"alias":fun.name} )
+ fun.documentation = docit ("Modified Input Argument to work with CTypes",
+ desc, "...")
for fun in mb.member_functions():
fixVoids ( fun )
@@ -511,6 +527,7 @@
""" There are some cases where function transformations don't get applied as Py++ doesn't
support all cases -- the only current one is pure virtual functions don't get managed correctly
"""
+ return
ACCESS_TYPES = declarations.ACCESS_TYPES
VIRTUALITY_TYPES = declarations.VIRTUALITY_TYPES
for f in mb.member_functions():
Modified: trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py
===================================================================
--- trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/code_generators/ogre/hand_made_wrappers.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -78,61 +78,7 @@
]
-WRAPPER_DEFINITION_RenderQueueListener =\
-"""
-struct RenderQueueListener_wrapper : Ogre::RenderQueueListener, bp::wrapper< Ogre::RenderQueueListener > {
- void RenderQueueListener_renderQueueEnded( ::Ogre::uint8 queueGroupId, ::Ogre::String const & invocation, bool & repeatThisInvocation ){
- bool holder;
- if ( bp::override func_renderQueueEnded = this->get_override( "renderQueueEnded" ) ) {
- holder = func_renderQueueEnded( queueGroupId, invocation, repeatThisInvocation );
- repeatThisInvocation = holder;
- }
- else {
- Ogre::RenderQueueListener::renderQueueEnded ( queueGroupId, invocation, repeatThisInvocation );
- }
- }
-
-
- void RenderQueueListener_renderQueueStarted( ::Ogre::uint8 queueGroupId, ::Ogre::String const & invocation, bool & skipThisInvocation ){
- bool holder;
- if ( bp::override func_renderQueueStarted = this->get_override( "renderQueueStarted" ) ) {
- holder = func_renderQueueStarted( queueGroupId, invocation, skipThisInvocation );
- skipThisInvocation = holder;
- }
- else {
- Ogre::RenderQueueListener::renderQueueStarted ( queueGroupId, invocation, skipThisInvocation );
- }
-
- }
-};
-"""
-
-WRAPPER_REGISTRATION_RenderQueueListener = [
- """def( "renderQueueStarted", &::RenderQueueListener_renderQueueStarted,\\
- "Python-Ogre Helper Function: This method is called by the SceneManager\\n\\
- before each queue group is rendered.
- @param queueGroupId The id of the queue group which has just been rendered
- @param invocation Name of the invocation which is causing this to be
- called (@see RenderQueueInvocation)
- @param .\\n\\
- Input: queueGroupId The id of the queue group which has just been rendered\\n\\
- Input: invocation Name of the invocation which is causing this to be called\\n\\
- Input: skipThisInvocation A boolean which is by default set to false.\\n\\
- Output: "skipThisInvocation" If the event sets this to true, the queue will be skipped\\n\\
- and not rendered. Note that in this case the renderQueueEnded event will not be raised\\n\\
- for this queue group");""",
- """def( "renderQueueEnded", &::RenderQueueListener_renderQueueEnded,\\
- "Python-Ogre Helper Function: This method is called by the SceneManager\\n\\
- after each queue group is rendered.\\n\\
- Input: queueGroupId The id of the queue group which has just been rendered\\n\\
- Input: invocation Name of the invocation which is causing this to be called\\n\\
- Input: repeatThisInvocation A boolean which is by default set to false.\\n\\
- Output: "repeatThisInvocation" If return true, the queue which has just been\\n\\
- rendered will be repeated, and the renderQueueStarted and renderQueueEnded\\n\\
- events will also be fired for it again");"""
- ]
-
WRAPPER_DEFINITION_OverlayElement = \
"""
Ogre::OverlayElement * OverlayElement_castElementAsOverlayContainer(Ogre::OverlayElement * e){
@@ -185,26 +131,6 @@
bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());',
]
-# WRAPPER_DEFINITION_OverlayManager = \
-# """
-# Ogre::OverlayElement* OverlayManager_createOverlayElement(Ogre::OverlayManager &me, const Ogre::String& typeName,
-# const Ogre::String& instanceName, bool isTemplate = false){
-# Ogre::OverlayElement* e = me.createOverlayElement(typeName, instanceName, isTemplate );
-# if( dynamic_cast< Ogre::TextAreaOverlayElement * >( e ) ){
-# return (Ogre::TextAreaOverlayElement*) e;
-# }
-# if( dynamic_cast< Ogre::OverlayContainer * >( e ) ){
-# return (Ogre::OverlayContainer*) e;
-# }
-# return ( e );
-# }
-# """
-#
-# WRAPPER_REGISTRATION_OverlayManager = [
-# 'def( "createOverlayElement", &::OverlayManager_createOverlayElement,\
-# "Python-Ogre Hand Wrapped\\nShould Return the correct Type (TextAreOverlayElement or OverlayContainer)",\
-# bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());',
-# ]
WRAPPER_DEFINITION_Bone = \
"""
@@ -566,12 +492,6 @@
return boost::python::object( r ); //unknown type
}
-// void
-// Utility_setFloat(void * ptrin, float datain)
-// {
-// float * newptr = reinterpret_cast<float *>(ptrin);
-// newptr[0]= datain;
-// }
"""
WRAPPER_REGISTRATION_General = [
@@ -943,18 +863,6 @@
Ouput: List containing particles" );"""
]
-# #################################################################################################
-# WRAPPER_DEFINITION_Vector3 =\
-# """
-# int Vector3_len( Ogre::Vector3 & me ) {
-# return 3;
-# }
-# """
-# WRAPPER_REGISTRATION_Vector3 = [
-# """def( "__len__", &Vector3_len,
-# "Python-Ogre Helper Function: return length of Vector3");""",
-# ]
-#
#################################################################################################
def iter_as_generator_vector( cls ):
@@ -995,10 +903,6 @@
rt.add_declaration_code( WRAPPER_DEFINITION_RenderTarget )
apply_reg (rt, WRAPPER_REGISTRATION_RenderTarget )
-# rt = mb.class_( 'Vector3' )
-# rt.add_declaration_code( WRAPPER_DEFINITION_Vector3 )
-# apply_reg (rt, WRAPPER_REGISTRATION_Vector3 )
-
rt = mb.class_( 'ResourceManager' )
rt.add_declaration_code( WRAPPER_DEFINITION_ResourceManager )
apply_reg (rt, WRAPPER_REGISTRATION_ResourceManager )
@@ -1019,18 +923,10 @@
rt.add_declaration_code( WRAPPER_DEFINITION_PixelBox )
apply_reg (rt, WRAPPER_REGISTRATION_PixelBox )
-# rt = mb.class_( 'ShadowRenderable' )
-# rt.add_declaration_code( WRAPPER_DEFINITION_ShadowRenderable )
-# apply_reg (rt, WRAPPER_REGISTRATION_ShadowRenderable )
-
rt = mb.class_( 'OverlayElement' )
rt.add_declaration_code( WRAPPER_DEFINITION_OverlayElement )
apply_reg (rt, WRAPPER_REGISTRATION_OverlayElement )
-# rt = mb.class_( 'OverlayManager' )
-# rt.add_declaration_code( WRAPPER_DEFINITION_OverlayManager )
-# apply_reg (rt, WRAPPER_REGISTRATION_OverlayManager )
-
rt = mb.class_( 'Frustum' )
rt.add_declaration_code( WRAPPER_DEFINITION_Frustum )
apply_reg (rt, WRAPPER_REGISTRATION_Frustum )
@@ -1066,30 +962,4 @@
for cls in map_iterators:
iter_as_generator_map( cls )
- rt = mb.class_( 'RenderQueueListener' )
-# # # # # rt.add_declaration_code( WRAPPER_DEFINITION_RenderQueueListener )
-# # # # # apply_reg (rt, WRAPPER_REGISTRATION_RenderQueueListener )
-# print "WRAPPER CODE\n\n"
-# print rt.wrapper_code
-# print rt
-# print dir(rt)
-# # rt.add_wrapper_code ( WRAPPER_WRAPPER_RenderQueueListener )
-# print "NOW\n\n"
-# print rt.wrapper_code
-
-# cls = mb.class_('Animation').class_('NodeTrackIterator')
-# iter_as_generator_map( cls )
-# global_ns = mb.global_ns
-# ogre_ns = global_ns.namespace( 'Ogre' )
-# i = ogre_ns.typedef( name="NodeTrackIterator" )
-# iter_as_generator_map( i )
-
-# typedef std::map<unsigned short, NodeAnimationTrack*> NodeTrackList;
-# typedef ConstMapIterator<NodeTrackList> NodeTrackIterator;
-# typedef std::map<unsigned short, NumericAnimationTrack*> NumericTrackList;
-# typedef ConstMapIterator<NumericTrackList> NumericTrackIterator;
-
-# typedef std::map<unsigned short, VertexAnimationTrack*> VertexTrackList;
-# typedef ConstMapIterator<VertexTrackList> VertexTrackIterator;
-
Modified: trunk/python-ogre/code_generators/physx/generate_code.py
===================================================================
--- trunk/python-ogre/code_generators/physx/generate_code.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/code_generators/physx/generate_code.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -63,20 +63,34 @@
,'::NxArray< NxForceFieldShapeDesc*, NxAllocatorDefault >::resize'
,'::NxArray< NxForceFieldShapeGroup*, NxAllocatorDefault >::resize'
,'::NxArray<NxShapeDesc*, NxAllocatorDefault>::end'
-# ,'::NxCloth::overlapAABBTriangles' # ugly argument that boost doesn't like.. To Fix in hand wrappers
- # these have const refs to classes with protected desctuctors - a bad combination for boost
+
+ # These have const refs to classes with protected desctuctors - a bad combination for boost
,'::NxCookingInterface::NxCreatePMap'
-# # ,'::NxForceField::releaseShape'
,'::NxUtilLib::NxGetBoxEdgesAxes'
-# ,'::NxHeightFieldShape::overlapAABBTrianglesDeprecated'
-# # ,'::NxImplicitScreenMesh::getProjectionMatrix' # returns a const int pointer
,'::NxVec3::get'
- # not in source
+
+ # Not in source
,'::NxBitField::rangeToDenseMask'
,'::NxBitField::maskToShift'
,'::NxVec3::setNotUsed'
,'::NxVec3::isNotUsed'
-
+
+ # These show up as now handling FT on pure virtual - however need a public class destructor
+ # so these are hand wrapped
+ ,'::NxCompartment::getTiming' # requires a functional transform however destructor is protected so compile fails
+ ,'::NxScene::getTiming' # requires a functional transform however destructor is protected so compile fails
+ ,'::NxConvexMesh::getMassInformation'
+ ,'::NxTriangleMesh::getMassInformation'
+ ,'::NxPhysicsSDK::getInternalVersion'
+
+ ,'::NxHeightField::saveCells' # excluded
+
+ ,'::NxForceFieldShapeGroup::releaseShape' # has a const forecfieldshape as arg and there isn't a public desctuctor
+ #
+
+
+# ,'::NxStream::storeBuffer'
+
]
if os.name =='nt':
excludes.append('::NxArray<NxFluidEmitterDesc, NxAllocatorDefault>::deleteEntry')
@@ -94,17 +108,11 @@
global_ns.free_functions(e).exclude()
excludes = [
- #'NxArray<NxShapeDesc*, NxAllocatorDefault>', ## doesn't have a defult constructor for ElemType
- #'NxArray<NxForceFieldShapeDesc*, NxAllocatorDefault>', ## Elemtype issue
- #'NxArray<NxForceFieldShapeGroup*, NxAllocatorDefault>', ## Elemtype issue
- 'NxForceFieldShapeGroup' ## seems to have access issues..
+# 'NxForceFieldShapeGroup' ## seems to have access issues..
]
-# for c in global_ns.classes():
-# print c
if os.name =='nt':
pass
-# excludes.append('NxArray<NxFluidEmitterDesc, NxAllocatorDefault>') ## needs ElemType changed to NxFluidEmitterDesc
else:
excludes.append ( '::NxFluidUserNotify')
for e in excludes:
@@ -125,7 +133,15 @@
if not "const" in o.decl_string:
o.exclude()
print "Excluding Operator:", o
-
+
+ # this is really a fix however needs to happen for the automatic stuff as we set the doc string to
+ # stop any further functional transformation happening
+ s = ['::NxStream::storeBuffer'
+ ,'::NxUserAllocator::realloc'
+ ]
+ for f in s:
+ global_ns.mem_fun(f).documentation="broken function as auto wrapping fails"
+
############################################################
##
## And there are things that manually need to be INCLUDED
@@ -160,16 +176,14 @@
if c.arguments[x].default_value:
if "ElemType" in c.arguments[x].default_value:
c.arguments[x].default_value=''
-
-# known = ['points', 'triangles']
-# for c in global_ns.classes():
-# if c.name.startswith ('Nx'):
-# print "Checking", c
-# for v in c.variables(allow_empty = True ):
-# if v.name in known:
-# v.expose_address = True
-# print "Exposing Address: ", v.name, " of class: ", c.name
-
+
+
+ for f in global_ns.member_functions():
+ for arg in f.arguments:
+ if arg.default_value == '-1u':
+ arg.default_value = '0xffffffff'
+
+
############################################################
##
## And things that need to have their argument and call values fixed.
@@ -186,12 +200,6 @@
def create_output( size ):
return [ ft.output( i ) for i in range( size ) ]
-# f=main_ns.free_function( "NxCreatePhysicsSDK")
-# f.add_transformation(ft.output('errorCode'))
-# f.documentation = docit ("","", "tuple - SDK, ErrorCode")
-# f=main_ns.free_function( "NxCreatePhysicsSDKWithID")
-# f.add_transformation(ft.output('errorCode'))
-# f.documentation = docit ("","", "tuple - SDK, ErrorCode")
###############################################################################
##
@@ -206,17 +214,6 @@
global_ns = mb.global_ns
main_ns = global_ns # No namespaces in NxPhysics
- # vars that are static consts but have their values set in the header file are bad
-# # Remove_Static_Consts ( main_ns )
-
-# ## Exclude protected and private that are not pure virtual
-# query = ~declarations.access_type_matcher_t( 'public' ) \
-# & ~declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.PURE_VIRTUAL )
-# try:
-# non_public_non_pure_virtual = main_ns.calldefs( query )
-# non_public_non_pure_virtual.exclude()
-# except:
-# pass
#Virtual functions that return reference could not be overriden from Python
query = declarations.virtuality_type_matcher_t( declarations.VIRTUALITY_TYPES.VIRTUAL ) \
@@ -264,15 +261,6 @@
main_ns = global_ns # .namespace( ns )
- # arguments passed as refs but not const are not liked by boost
-# Fix_Ref_Not_Const ( main_ns )
-
-# # Functions that have void pointers in their argument list need to change to unsigned int's
-# 3_Args ( main_ns )
-#
-# # and change functions that return a variety of pointers to instead return unsigned int's
-# Fix_Pointer_Returns ( main_ns )
-#
# and change functions that return a variety of pointers to instead return unsigned int's
pointee_types=['unsigned int','int', 'float', 'unsigned char', 'char','::NxI32']
ignore_names=['getName'] # these are function names we know it's cool to exclude
Modified: trunk/python-ogre/code_generators/physx/hand_made_wrappers.py
===================================================================
--- trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/code_generators/physx/hand_made_wrappers.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -1,6 +1,127 @@
import os
import environment
+WRAPPER_WRAPPER_DEF_NxForceFieldShapeGroup = \
+"""
+ virtual void releaseShape( ::NxForceFieldShape const & arg0 ){
+ bp::override func_releaseShape = this->get_override( "releaseShape" );
+ func_releaseShape( boost::ref(arg0) );
+ }
+"""
+
+WRAPPER_DEFINITION_NxScene = \
+"""bp::tuple NxScene_getTiming( ::NxScene & me) {
+ NxReal maxTimestep;
+ NxTimeStepMethod method;
+ NxU32 maxIter;
+ NxU32 numSubSteps;
+ me.getTiming(maxTimestep, maxIter, method, &numSubSteps);
+ return ( boost::python::make_tuple( maxTimestep, maxIter, method, numSubSteps ) );
+ }
+"""
+WRAPPER_WRAPPER_DEF_NxScene = \
+"""
+ virtual void getTiming(NxReal& maxTimestep, NxU32& maxIter, NxTimeStepMethod& method, NxU32* numSubSteps=NULL) const {
+ // placeholder so wrapper will compile
+ }
+"""
+
+WRAPPER_REGISTRATION_NxScene = [
+ 'def( "getTiming", &::NxScene_getTiming,\
+ "Python-Ogre Hand Wrapped\\nReturns a tuple with maxTimestep, maxIter, method, numSubSteps");'
+# ,\
+# bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());',
+ ]
+
+WRAPPER_DEFINITION_NxStream = \
+""" NxStream& NxStream_storeBuffer(NxStream & me, const void* buffer, NxU32 size) {
+// NOT YET IMPLEMENTED
+ NxStream result;
+ return result;
+}
+"""
+
+WRAPPER_WRAPPER_DEF_NxStream = \
+"""
+ virtual NxStream& storeBuffer(const void* buffer, NxU32 size) {
+ // placeholder so wrapper will compile
+ }
+"""
+
+WRAPPER_REGISTRATION_NxStream = [
+ 'def( "storeBuffer", &::NxStream_storeBuffer,\
+ "Python-Ogre Hand Wrapped NOT IMPLEMENTED\\nReturns a NxStream -- takes a python list",\
+ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());',
+ ]
+
+
+WRAPPER_DEFINITION_NxCompartment = \
+"""bp::tuple NxCompartment_getTiming( ::NxCompartment & me) {
+ NxReal maxTimestep;
+ NxTimeStepMethod method;
+ NxU32 maxIter;
+ NxU32 numSubSteps;
+ me.getTiming(maxTimestep, maxIter, method, &numSubSteps);
+ return ( boost::python::make_tuple( maxTimestep, maxIter, method, numSubSteps ) );
+ }
+"""
+
+WRAPPER_REGISTRATION_NxCompartment = [
+ 'def( "getTiming", &::NxCompartment_getTiming,\
+ "Python-Ogre Hand Wrapped\\nReturns a tuple with maxTimestep, maxIter, method, numSubSteps");',
+ ]
+
+WRAPPER_DEFINITION_NxConvexMesh= \
+"""bp::tuple NxConvexMesh_getMassInformation( ::NxConvexMesh & me) {
+ NxReal mass;
+ NxMat33 localInertia;
+ NxVec3 localCenterOfMass;
+ me.getMassInformation( mass, localInertia, localCenterOfMass );
+ return ( boost::python::make_tuple( mass, localInertia, localCenterOfMass ) );
+ }
+"""
+WRAPPER_REGISTRATION_NxConvexMesh = [
+ 'def( "getMassInformation", &::NxConvexMesh_getMassInformation,\
+ "Python-Ogre Hand Wrapped\\nReturns a tuple with mass, localInertia, localCenterOfMass");',
+ ]
+
+WRAPPER_DEFINITION_NxTriangleMesh= \
+"""bp::tuple NxTriangleMesh_getMassInformation( ::NxTriangleMesh & me) {
+ NxReal mass;
+ NxMat33 localInertia;
+ NxVec3 localCenterOfMass;
+ me.getMassInformation( mass, localInertia, localCenterOfMass );
+ return ( boost::python::make_tuple( mass, localInertia, localCenterOfMass ) );
+ }
+"""
+WRAPPER_REGISTRATION_NxTriangleMesh = [
+ 'def( "getMassInformation", &::NxTriangleMesh_getMassInformation,\
+ "Python-Ogre Hand Wrapped\\nReturns a tuple with mass, localInertia, localCenterOfMass");',
+ ]
+
+WRAPPER_WRAPPER_DEF_NxPhysicsSDK= \
+"""
+ virtual ::NxU32 getInternalVersion( ::NxU32 & apiRev, ::NxU32 & descRev, ::NxU32 & branchId ) const {
+ // dummy function as place holder
+ return 0;
+ };
+"""
+
+WRAPPER_DEFINITION_NxPhysicsSDK= \
+"""bp::tuple NxPhysicsSDK_getInternalVersion(::NxPhysicsSDK & me ) {
+ NxU32 apiRev;
+ NxU32 descRev;
+ NxU32 branchId;
+ NxU32 sdkRev;
+ sdkRev = me.getInternalVersion( apiRev, descRev, branchId );
+ return ( boost::python::make_tuple( sdkRev, apiRev, descRev, branchId ) );
+ }
+"""
+WRAPPER_REGISTRATION_NxPhysicsSDK = [
+ 'def( "getInternalVersion", &::NxPhysicsSDK_getInternalVersion,\
+ "Python-Ogre Hand Wrapped\\nReturns a tuple with sdkRev, apiRev, descRev, branchId");',
+ ]
+
WRAPPER_DEFINITION_NxActor_Wrapper = \
"""
virtual ::NxShape * const * getShapes( ) const {
@@ -118,7 +239,44 @@
// bp::override func_getProjectionMatrix = this->get_override( "getProjectionMatrix" );
// return func_getProjectionMatrix( );
}
-"""
+"""
+
+WRAPPER_DEFINITION_NxSimpleTriangleMesh=\
+"""
+void NxSimpleTriangleMesh_setPoints(::NxSimpleTriangleMesh& me,boost::python::list vertices, unsigned int vertex_count ){
+
+ unsigned int index;
+ ::NxVec3* verts = new NxVec3[vertex_count];
+ for (index =0 ; index < vertex_count ; index ++) {
+ verts[index] = bp::extract<::NxVec3> (vertices[index]);
+ }
+ me.points = verts;
+}
+void NxSimpleTriangleMesh_setFaces(::NxSimpleTriangleMesh& me,boost::python::list faces, unsigned int face_count ) {
+ unsigned int index;
+ ::NxU32* triangles = new NxU32[face_count];
+ for (index =0 ; index < face_count ; index ++) {
+ triangles[index] = (::NxU32)(bp::extract<float> (faces[index]));
+ }
+ me.triangles = triangles;
+}
+"""
+
+WRAPPER_REGISTRATION_NxSimpleTriangleMesh = [
+ """def( "setPoints", &::NxSimpleTriangleMesh_setPoints,
+ ( bp::arg("vertices"), bp::arg("vertex_count")),
+ "Python-Ogre Hand Wrapped\\nSet's the points for a SimpleTriangleMesh",
+ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""",
+ """def( "setFaces", &::NxSimpleTriangleMesh_setFaces,
+ ( bp::arg("faces"), bp::arg("face_count")),
+ "Python-Ogre Hand Wrapped\\nSet's the faces for a SimpleTriangleMesh",
+ bp::return_value_policy< bp::reference_existing_object, bp::default_call_policies >());""",
+
+ ]
+
+
+
+
ConstPointerReference=\
"""
virtual %(FuncDecl)s {
@@ -127,8 +285,7 @@
"""
PointerReg=\
"""
-def( "%(function_name)s", &::%(classname)s_%(function_name)s,\
- "Python-Ogre Hand Wrapped\\n");
+def( "%(function_name)s", &::%(classname)s_%(function_name)s,"Python-Ogre Hand Wrapped\\n");
"""
PointerDec=\
"""
@@ -146,7 +303,7 @@
return outlist;
}
"""
-PointerWrapper = \
+PointerWrapper=\
"""
virtual %(returnType)s %(function_name)s( ) %(const)s {
bp::override func_%(function_name)s = this->get_override( "%(function_name)s" );
@@ -154,6 +311,33 @@
}
"""
+
+UserDataDec=\
+"""
+void %(classname)s_setUserData ( ::%(classname)s& me, PyObject * data) {
+ me.userData = data;
+ }
+
+PyObject * %(classname)s_getUserData ( ::%(classname)s& me) {
+ void * data = me.userData;
+ if ( data == NULL) {
+ Py_INCREF(Py_None);
+ return Py_None;
+ }
+ else {
+ Py_INCREF( (PyObject *) data ); // I'm passing a reference to this object so better inc the ref :)
+ return (PyObject *) data;
+ }
+ }
+"""
+
+UserDataReg=[
+ """def( "setUserData", &::%(classname)s_setUserData,"Python-Ogre Hand Wrapped\\n");""",
+ """def( "getUserData", &::%(classname)s_getUserData,"Python-Ogre Hand Wrapped\\n");"""
+ ]
+
+
+
#################################################################################################
#################################################################################################
@@ -180,8 +364,6 @@
for f in global_ns.member_functions():
if f.parent.name in ignoreClasses:
continue
- else:
- print "Class OK:", f.parent.name
for a in f.arguments:
if "unsigned int const * &" in a.type.decl_string:
f.exclude()
@@ -227,14 +409,61 @@
print "Wrapped:", f, values
else:
print "Excluded:",f
+
+ # Patch from Dermont to make userData more useful and simple to use
+ vars = ["userData"]
+ for var in global_ns.variables ():
+ class_ = var.parent
+ classname = class_.name
+ if var.name in vars:
+ if var.type.decl_string.startswith('void'):
+ values = { 'classname':classname }
+ for i in range(len(UserDataReg)):
+ regcode = UserDataReg[i] % values
+ class_.add_registration_code( regcode )
+ deccode = UserDataDec % values
+ class_.add_declaration_code( deccode )
+ print "Hand Wrapped:", var.name, values
+
-
rt = mb.class_( 'NxUtilLib' )
rt.add_wrapper_code(WRAPPER_WRAPPER_DEF_NxUtilLib)
rt = mb.class_( 'NxCookingInterface' )
rt.add_wrapper_code(WRAPPER_WRAPPER_DEF_NxCookingInterface)
rt = mb.class_( 'NxForceField' )
rt.add_wrapper_code(WRAPPER_WRAPPER_DEF_NxForceField)
+
+ rt = mb.class_( 'NxForceFieldShapeGroup' )
+ rt.add_wrapper_code( WRAPPER_WRAPPER_DEF_NxForceFieldShapeGroup )
+
+
+ rt = mb.class_( 'NxScene' )
+ rt.add_declaration_code( WRAPPER_DEFINITION_NxScene )
+ rt.add_wrapper_code( WRAPPER_WRAPPER_DEF_NxScene )
+ apply_reg (rt, WRAPPER_REGISTRATION_NxScene )
+
+# rt = mb.class_( 'NxStream' )
+# rt.add_declaration_code( WRAPPER_DEFINITION_NxStream )
+# rt.add_wrapper_code( WRAPPER_WRAPPER_DEF_NxStream )
+# apply_reg (rt, WRAPPER_REGISTRATION_NxStream )
+
+ rt = mb.class_( 'NxCompartment' )
+ rt.add_declaration_code( WRAPPER_DEFINITION_NxCompartment )
+ apply_reg (rt, WRAPPER_REGISTRATION_NxCompartment )
+
+ rt = mb.class_( 'NxConvexMesh' )
+ rt.add_declaration_code( WRAPPER_DEFINITION_NxConvexMesh )
+ apply_reg (rt, WRAPPER_REGISTRATION_NxConvexMesh )
+
+ rt = mb.class_( 'NxTriangleMesh' )
+ rt.add_declaration_code( WRAPPER_DEFINITION_NxTriangleMesh )
+ apply_reg (rt, WRAPPER_REGISTRATION_NxTriangleMesh )
+
+ rt = mb.class_( 'NxPhysicsSDK' )
+ rt.add_wrapper_code( WRAPPER_WRAPPER_DEF_NxPhysicsSDK )
+ rt.add_declaration_code( WRAPPER_DEFINITION_NxPhysicsSDK )
+ apply_reg (rt, WRAPPER_REGISTRATION_NxPhysicsSDK )
+
# rt = mb.class_( 'NxHeightFieldShape' )
# rt.add_wrapper_code(WRAPPER_WRAPPER_DEF_NxHeightFieldShape)
# rt = mb.class_( 'NxImplicitScreenMesh' )
Modified: trunk/python-ogre/demos/ogre/Demo_Basic.py
===================================================================
--- trunk/python-ogre/demos/ogre/Demo_Basic.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/demos/ogre/Demo_Basic.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -17,10 +17,9 @@
import time
import ogre.renderer.OGRE as ogre
-import ogre.io.OIS as OIS
class OGREMain(ogre.Root):
- def __init__(self, plugins_path='plugins.cfg',resource_path='../resources.cfg'):
+ def __init__(self, plugins_path='../plugins.cfg',resource_path='../resources.cfg'):
ogre.Root.__init__(self, plugins_path)
self.plugins_path = plugins_path
self.resource_path = resource_path
@@ -97,7 +96,11 @@
def main():
- root = OGREMain(plugins_path='../plugins.cfg')
+ import os
+ if os.name == 'nt':
+ root = OGREMain(plugins_path='../plugins.cfg.nt')
+ else:
+ root = OGREMain(plugins_path='../plugins.cfg.linux')
weu = ogre.WindowEventUtilities()
while not root.window.isClosed():
weu.messagePump()
Modified: trunk/python-ogre/environment.py
===================================================================
--- trunk/python-ogre/environment.py 2008-12-09 08:36:19 UTC (rev 830)
+++ trunk/python-ogre/environment.py 2008-12-18 12:21:14 UTC (rev 831)
@@ -18,7 +18,6 @@
_LOGGING_ON = False
_PreCompiled = True
-
def log ( instring ):
if _LOGGING_ON:
print __file__, "LOG::", instring
@@ -49,12 +48,14 @@
##
-## set this to True if you compiled Ogre with Threads enabled
+## set this to True if you compiled Ogre with Threads enabled and setting a static boost link
##
if isWindows():
- _USE_THREADS = True
+ _USE_THREADS = False
+ BOOST_STATIC = False
else:
_USE_THREADS = False
+ BOOST_STATIC = False
PythonOgreMajorVersion = "1"
@@ -212,7 +213,7 @@
else:
source_version = "20080901"
source = [
- [cvs, " -d :pserver:an...@ww...:/cvsroot/GCC_XML co "+base, os.getcwd()]
+ [cvs, " -d :pserver:an...@ww...:/cvsroot/GCC_XML co -D 01Aug2008 "+base, os.getcwd()]
]
if isLinux() or isMac():
buildCmds = [
@@ -464,29 +465,40 @@
class boost: ## also included bjam
active = True
- version = "3.5"
+ version = "1.37"
pythonModule = False
ModuleName = ""
+ # move lib path here (lib name is already here) so we can easily do a static link for windows
+ PATH_LIB = Config.PATH_LIB_Boost
if isWindows():
+ PATH_LIB_THREAD=Config.PATH_LIB_Thread_STATIC
+ PATH_LIB_DATETIME=Config.PATH_LIB_date_time_STATIC
if _STABLE:
base = 'boost_1_36_0'
lib = 'boost_python-vc90-mt-1_36'
versionBase = '1_36' ## the version used on the library name
else:
- base = 'boost_1_36_0'
- lib = 'boost_python-vc90-mt-1_36'
- versionBase = '1_36' ## the version used on the library name
+ base = 'boost_1_37_0'
+ lib = 'boost_python-vc90-mt-1_37'
+ PATH_LIB = Config.PATH_LIB_Boost
+
+ # change to handle static boost linking...
+ if BOOST_STATIC:
+ lib = 'libboost_python-vc90-mt-1_37'
+ PATH_LIB = Config.PATH_LIB_Boost_STATIC
+
+ versionBase = '1_37' ## the version used on the library name
else:
if _STABLE:
base = 'boost_1_34_1'
versionBase = '1_34' ## the version used on the library name
else:
- base = 'boost_1_36_0'
- versionBase = '1_36' ## the version used on the library name
+ base = 'boost_1_37_0'
+ versionBase = '1_37' ## the version used on the library name
if isLinux() or isMac():
- bjambase = 'boost-jam-3.1.16'
+ bjambase = 'boost-jam-3.1.17'
if isMac():
bjambuilddir = 'bin.macosxx86'
bjambuildset = 'darwin'
@@ -498,7 +510,7 @@
bjambuildset = 'gcc'
source = [
- [wget,'http://downloads.sourceforge.net/boost/boost-jam-3.1.16.tgz', downloadPath],
+ [wget,'http://downloads.sourceforge.net/boost/boost-jam-3.1.17-1.tgz', downloadPath],
[wget,'http://downloads.sourceforge.net/boost/'+base+'.tar.gz',downloadPath]
]
buildCmds = [
@@ -520,7 +532,7 @@
]
if isWindows():
- bjambase = 'boost-jam-3.1.16-1-ntx86'
+ bjambase = 'boost-jam-3.1.17-1-ntx86'
source = [
[wget,'http://downloads.sourceforge.net/boost/'+bjambase+'.zip',downloadPath] ,
[wget,'http://downloads.sourceforge.net/boost/'+base+'.zip',downloadPath]
@@ -529,12 +541,12 @@
buildCmds = [
[0,unzip + os.path.join(downloadPath, bjambase+".zip"), ''],
[0,unzip + os.path.join(downloadPath, base + ".zip"), ''],
- [0,'xcopy /s /i /y '+os.path.join('python-ogre','boost') + ' ' + base , ''], # need to overwrite the boost with our files
- [0,'sed -i s/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/ '+base+'/configure', '' ],
- [0,'sed -i s/"BOOST_PYTHON_MAX_ARITY 15"/"BOOST_PYTHON_MAX_ARITY 19"/ '+base+'/boost/python/detail/preprocessor.hpp', ''],
- [0,'sed -i s/"# include <boost\/preprocessor\/cat.hpp>"/"\\n#define BOOST_PYTHON_NO_PY_SIGNATURES\\n# include <boost\/preprocessor\/cat.hpp>"/ '+base+'/boost/python/detail/preprocessor.hpp', '' ],
- [0,'sed -i s/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/ '+base+'/boost/python/detail/preprocessor.hpp', '' ],
- [0,os.path.join(os.getcwd(), bjambase, "bjam.exe") + ' release --with-python ',os.path.join(os.getcwd(),base)] # --toolset=msvc-8
+# # [0,'xcopy /s /i /y '+os.path.join('python-ogre','boost') + ' ' + base , ''], # need to overwrite the boost with our files
+# [0,'sed -i s/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/ '+base+'/configure', '' ],
+# [0,'sed -i s/"BOOST_PYTHON_MAX_ARITY 15"/"BOOST_PYTHON_MAX_ARITY 19"/ '+base+'/boost/python/detail/preprocessor.hpp', ''],
+# [0,'sed -i s/"# include <boost\/preprocessor\/cat.hpp>"/"\\n#define BOOST_PYTHON_NO_PY_SIGNATURES\\n# include <boost\/preprocessor\/cat.hpp>"/ '+base+'/boost/python/detail/preprocessor.hpp', '' ],
+# [0,'sed -i s/BJAM_CONFIG=\"\"/BJAM_CONFIG=release/ '+base+'/boost/python/detail/preprocessor.hpp', '' ],
+# [0,os.path.join(os.getcwd(), bjambase, "bjam.exe") + ' release --with-python ',os.path.join(os.getcwd(),base)] # --toolset=msvc-8
]
if not isWindows():
@@ -579,7 +591,6 @@
pythonModule = True
name='ogre'
ModuleName='OGRE'
- CCFLAGS = " "
cflags=''
moduleParentLocation = "renderer"
parent = "ogre/renderer"
@@ -624,7 +635,7 @@
pchincludes = ['python_ogre_precompiled.h']
libs=[boost.lib, 'OgreMain']
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
, Config.PATH_LIB_Ogre_CEGUIRenderer
, Config.PATH_LIB_Ogre_OgreMain
, Config.PATH_LIB_Ogre_Dependencies #needed for ceguibase.lib etc
@@ -634,7 +645,6 @@
, Config.PATH_INCLUDE_Ogre
, Config.PATH_INCLUDE_NEDMALLOC
]
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19 '
LINKFLAGS = ''
externalFiles=['OgreMain.dll', 'OgreGuiRender.dll', boost.lib+'.dll']
elif isLinux():
@@ -667,7 +677,7 @@
libs.append ( boost_python_index.lib )
lib_dirs=[Config.LOCAL_LIB]
include_dirs=[Config.PATH_Boost, Config.PATH_INCLUDE_Ogre]
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19 -D__PYTHONOGRE_BUILD_CODE '
+ CCFLAGS = ' -D__PYTHONOGRE_BUILD_CODE '
source = [
[wget, "http://downloads.sourceforge.net/ogre/"+base+".tar.bz2",downloadPath],
@@ -699,13 +709,12 @@
]
libs=[boost.lib]
- lib_dirs = [ Config.PATH_LIB_Boost ]
+ lib_dirs = [ boost.PATH_LIB ]
include_dirs = [ Config.PATH_Boost
, Config.PATH_INCLUDE_Ogre
, python_include_dirs
]
- CCFLAGS = ''
LINKFLAGS = ''
cflags += ''
@@ -768,7 +777,7 @@
include_dirs = [ Config.PATH_Boost
, Config.PATH_INCLUDE_OIS
]
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
, Config.PATH_LIB_OIS
]
ModuleName = 'OIS'
@@ -799,7 +808,7 @@
else:
libs=[boost.lib, 'OgreMain', 'ode', 'ReferenceAppLayer']
libs.append ( boost_python_index.lib )
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
, Config.PATH_LIB_Ogre_OgreMain
, Config.PATH_LIB_ODE
, Config.PATH_LIB_OgreRefApp
@@ -809,7 +818,6 @@
,Config.PATH_INCLUDE_OgreRefApp
,Config.PATH_INCLUDE_ODE
]
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19'
ModuleName = 'OgreRefApp'
CheckIncludes = ['boost/python.hpp', 'Ogre.h', 'OgreReferenceAppLayer.h', 'ode/ode.h']
@@ -853,13 +861,12 @@
, Config.PATH_INCLUDE_OgreNewt
, Config.PATH_INCLUDE_Ogre_Dependencies #needed for OIS/OIS.h
]
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
,Config.PATH_LIB_Newton
,Config.PATH_LIB_OgreNewt
, Config.PATH_LIB_Ogre_OgreMain
]
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19'
ModuleName = 'OgreNewt'
CheckIncludes=['boost/python.hpp', 'Ogre.h', 'OgreNewt.h', 'Newton.h']
@@ -871,7 +878,7 @@
if _STABLE:
version = "0.5.0b"
else:
- version = "0.6.1"
+ version = "0.6.2b"
if isWindows():
if _PreCompiled:
pchstop = 'cegui.h'
@@ -891,7 +898,7 @@
else:
base = "CEGUI-0.6.1"
source=[
- [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.6.1.tar.gz?download", downloadPath]
+ [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.6.2b.tar.gz?download", downloadPath]
]
buildCmds = [
@@ -907,13 +914,16 @@
[0,'make install', os.path.join(os.getcwd(), base )]
]
if isWindows():
- version = "0.6.1"
- base = "CEGUI-0.6.1"
+ version = "0.6.2b"
+ base = "CEGUI-0.6.2"
source=[
- [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.6.1.zip?download", downloadPath]
+ [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-0.6.2b.zip", downloadPath],
+ [wget, "http://prdownloads.sourceforge.net/crayzedsgui/CEGUI-DEPS-0.6.0-vc9.zip", downloadPath]
]
buildCmds = [
- [0, unzip + " " + os.path.join(downloadPath,base)+".zip", os.getcwd()],
+ [0, unzip + " " + os.path.join(downloadPath,"CEGUI-0.6.2b.zip"), os.getcwd()],
+ [0, unzip + " " + os.path.join(downloadPath,"CEGUI-DEPS-0.6.0-vc9.zip"), os.path.join(os.getcwd(),base) ],
+ [0, 'move CEGUI-0.6.0\dependencies .', os.path.join(os.getcwd(),base) ],
[0, 'echo Now run build_vs2008.bat from the CEGUI makefiles\premake directory',''],
[0, 'echo then use MSVC to build the CEGUI Release project',''],
[0, 'echo WARNING - Check that RTTI is enabled in the compiler options',''],
@@ -927,13 +937,12 @@
, Config.PATH_INCLUDE_Ogre_Dependencies ## needed as OgreCEGUI uses CEGUI/.. in #includes
]
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
##, Config.PATH_LIB_Ogre_CEGUIRenderer
, Config.PATH_LIB_Ogre_OgreMain
, Config.PATH_LIB_CEGUI
, Config.PATH_LIB_Ogre_Dependencies
]
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19'
ModuleName = 'CEGUI'
CheckIncludes = ['boost/python.hpp', 'Ogre.h', 'CEGUI.h', 'OgreCEGUIRenderer.h']
if isLinux():
@@ -954,7 +963,7 @@
libs= [boost.lib, odeLibraryName, 'User32'] # needed for MessageBox function
else:
libs.append ( boost_python_index.lib )
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
, Config.PATH_LIB_ODE
]
include_dirs = [ Config.PATH_Boost
@@ -997,7 +1006,7 @@
libs=[boost.lib]
if isLinux():
libs.append ( boost_python_index.lib )
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
]
include_dirs = [ Config.PATH_Boost
, Config.PATH_INCLUDE_OPCODE
@@ -1019,7 +1028,7 @@
Config.PATH_INCLUDE_Ogre,
Config.PATH_caelum
]
- lib_dirs = [Config.PATH_LIB_Boost,
+ lib_dirs = [boost.PATH_LIB,
Config.PATH_LIB_Ogre_OgreMain
]
CheckIncludes=[]
@@ -1040,7 +1049,7 @@
base = 'ogreaddons/ogreode'
baseDir = os.path.join(os.getcwd(), base )
- lib_dirs = [ Config.PATH_LIB_Boost
+ lib_dirs = [ boost.PATH_LIB
, Config.PATH_LIB_OgreOde
, Config.PATH_LIB_OgreOdePrefab
, Config.PATH_LIB_OgreOdeLoader
@@ -1077,7 +1086,6 @@
libs.append ( boost_python_index.lib )
else:
libs.append('ode_single')
- CCFLAGS = ' -DBOOST_PYTHON_MAX_ARITY=19'
CheckIncludes = ['boost/python.hpp', 'Ogre.h', 'ode/ode.h', 'ode/odecpp.h', 'OgreOde_Core.h', 'OgreOde_Loader.h',
'Ogreode_Prefab.h']
@@ -1105,7 +1113,7 @@
Config.PATH_INCLUDE_quickgui
#,Config.PATH_INCLUDE_freetype
]
- lib_dirs = [Config.PATH_LIB_Boost,
+ lib_dirs = [boost.PATH_LIB,
Config.PATH_LIB_Ogre_OgreMain
##,Config.PATH_LIB_quickgui
]
@@ -1129,7 +1137,7 @@
...
[truncated message content] |