OgreBulletD missing inherited attributes from OgreBulletC

CheeseSucker

21-04-2010 10:50:52

It appears that bulletD does not inherit the attributes from bulletC. This e.g. means that it is impossible to set a debug drawer on a DynamicsWorld.

Is there a way to work around this?


Python 2.6.4 (r264:75708, Oct 26 2009, 08:23:19) [MSC v.1500 32 bit (Intel)] on win32Type "help", "copyright", "credits" or "license" for more information.
>>> import ogre.renderer.OGRE
>>> import ogre.physics.bullet
>>> import ogre.physics.bullet as bullet
>>> import ogre.physics.OgreBulletC as bulletC
>>> import ogre.physics.OgreBulletD as bulletD
>>> dir(bulletC.CollisionsWorld)
['BulletCollisionWorld', 'SceneManager', 'ShowDebugContactPoints', 'ShowDebugShapes', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__instance_size__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'addObject', 'discreteCollide', 'findObject', 'getBulletCollisionWorld', 'getDebugContactPoints', 'getDebugDrawer', 'getSceneManager', 'getShowDebugContactPoints', 'getShowDebugShapes', 'isObjectregistered', 'launchRay', 'removeObject', 'setDebugContactPoints', 'setDebugDrawer', 'setShowDebugContactPoints', 'setShowDebugShapes']



>>> dir(bulletD.DynamicsWorld)
['BulletDynamicsWorld', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__instance_size__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'addConstraint', 'addRigidBody', 'addVehicle', 'getBulletDynamicsWorld', 'isConstraintRegistered', 'removeConstraint', 'stepSimulation']




>>> dir(bulletC.Object)
['AnimableValueNames', 'Attached', 'BoundingBox', 'BoundingRadius', 'BulletCollisionWorld', 'BulletObject', 'CastShadows', 'CollisionWorld', 'DebugDisplayEnabled', 'DebugShape', 'InScene', 'LightCapBounds', 'Listener', 'MovableType', 'Name', 'ParentNode', 'ParentSceneNode', 'QueryFlags', 'RenderQueueGroup', 'RenderingDistance', 'Shape', 'TypeFlags', 'TypeID', 'TypeName', 'UserAny', 'VisibilityFlags', 'Visible', 'WorldOrientation', 'WorldPosition', '__class__', '__delattr__','__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__instance_size__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_getAnimableValueNames', '_getCreator', '_getLightList', '_getManager', '_getParentNodeFullTransform', '_notifyAttached', '_notifyCreator', '_notifyCurrentCamera', '_notifyManager', '_notifyMoved', '_updateRenderQueue', 'addQueryFlags', 'addVisibilityFlags', 'animableValueNames', 'attached', 'castShadows', 'createAnimableDictionary', 'createAnimableValue', 'debugDisplayEnabled', 'detatchFromParent', 'extrudeBounds', 'extrudeVertices', 'generateShadowVolume', 'getAnimableDictionaryName', 'getAnimableValueNames', 'getBoundingBox', 'getBoundingRadius', 'getBulletCollisionWorld', 'getBulletObject', 'getCastShadows', 'getCollisionWorld', 'getDarkCapBounds', 'getDebugShape', 'getDefaultQueryFlags', 'getDefaultVisibilityFlags', 'getEdgeList', 'getExtrusionDistance', 'getLightCapBounds', 'getListener', 'getMovableType', 'getName', 'getParentNode', 'getParentSceneNode','getPointExtrusionDistance', 'getQueryFlags', 'getReceivesShadows', 'getRenderQueueGroup', 'getRenderingDistance', 'getRootNode', 'getShadowVolumeRenderableIterator', 'getShape', 'getTypeFlags', 'getTypeID', 'getTypeName', 'getUserAny', 'getUserObject', 'getVisibilityFlags', 'getVisible', 'getWorldBoundingBox', 'getWorldBoundingSphere', 'getWorldOrientation', 'getWorldPosition', 'hasEdgeList', 'inScene', 'initialiseAnimableDictionary', 'isAttached', 'isDebugDisplayEnabled', 'isInScene', 'isVisible', 'lightCapBounds', 'mMovableType', 'name', 'parentNode', 'parentSceneNode', 'queryFlags', 'queryLights', 'removeQueryFlags', 'removeVisibilityFlags', 'renderQueueGroup', 'renderingDistance', 'setCastShadows', 'setDebugDisplayEnabled', 'setDefaultQueryFlags', 'setDefaultVisibilityFlags', 'setListener', 'setOrientation', 'setPosition', 'setQueryFlags', 'setRenderQueueGroup', 'setRenderingDistance', 'setShape', 'setTransform', 'setUserAny', 'setUserObject', 'setVisibilityFlags', 'setVisible', 'showDebugShape', 'typeFlags', 'typeID', 'typeName', 'updateEdgeListLightFacing', 'userAny', 'visibilityFlags', 'visible', 'visitRenderables']




>>> dir(bulletD.RigidBody)
['BulletDynamicsWorld', 'BulletRigidBody', 'CenterOfMassOrientation', 'CenterOfMassPosition', 'CenterOfMassTransform', 'KinematicObject', 'SceneNode', 'StaticObject', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__instance_size__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'applyForce', 'applyImpulse', 'disableDeactivation', 'enableActiveState', 'forceActivationState', 'getBulletDynamicsWorld', 'getBulletRigidBody', 'getCenterOfMassOrientation', 'getCenterOfMassPivot','getCenterOfMassPosition', 'getCenterOfMassTransform', 'getDynamicsWorld', 'getLinearVelocity', 'getSceneNode', 'isKinematicObject', 'isStaticObject', 'setDamping', 'setDeactivationTime', 'setKinematicObject', 'setLinearVelocity', 'setShape', 'setStaticShape']
>>>

andy

24-04-2010 10:00:04

Not quite sure what you mean here -- the two OgreBullet libraries are 'separate' as thats how they are implemented in the C++ library however BulletD is very much dependent on BulletC..

Having said that its very likely that functions haven't been exposed and I'm happy to fix these -- could you put a small piece of Python code together that demonstrates what you expect to happen (or let me know what functions you were looking for in a particular class/module and I'll go looking to see why they are missing and fix them)...

Thanks
Andy

dermont

01-05-2010 06:09:20

It appears that bulletD does not inherit the attributes from bulletC. This e.g. means that it is impossible to set a debug drawer on a DynamicsWorld.

Is there a way to work around this?

...


You are probably just missing a module_dependency to "ogrebulletc" in the ogrebulletd code generator.

- Update ogrebulletd/generate_code.py to include "mb.register_module_dependency ( environment.ogrebulletc.generated_dir ) "
- Delete cache/ogrebulletd_r2684_cache.xml and generate/build the ogrebulletd modules should resolve your problem.



Index: generate_code.py
===================================================================
--- generate_code.py (revision 1115)
+++ generate_code.py (working copy)
@@ -62,8 +62,8 @@
else:

main_ns = global_ns
excludes=[]
- if environment.isLinux():
- excludes.append('::btSimulationIslandManager')
+ #if environment.isLinux():
+ # excludes.append('::btSimulationIslandManager')
for e in excludes:
print "excluding class", e
global_ns.class_(e).exclude()

@@ -234,8 +234,12 @@
defined_symbols.append( 'VERSION_' + environment.ogrebulletd.version )

if environment._USE_THREADS:
- defined_symbols.append('BOOST_HAS_THREADS')
- defined_symbols.append('BOOST_HAS_WINTHREADS')
+ if environment.isWindows():
+ defined_symbols.append('BOOST_HAS_THREADS')
+ defined_symbols.append('BOOST_HAS_WINTHREADS')
+ else:
+ defined_symbols.append('BOOST_HAS_THREADS')
+ defined_symbols.append('BOOST_HAS_PTHREADS')
if environment.Config._SVN: # building Ogre 1.7
defined_symbols.append ('HAVE_OGRE_BUILDSETTINGS_H') # it uses the cmake buildsettings include

@@ -252,7 +256,10 @@
)

# if this module depends on another set it here
- mb.register_module_dependency ( environment.ogre.generated_dir ) # ,environment.ogrebulletd.generated_dir] )
+ mb.register_module_dependency ( environment.ogre.generated_dir )
+ mb.register_module_dependency ( environment.ogrebulletc.generated_dir )
+
+ # ,environment.ogrebulletd.generated_dir] )

# normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off
mb.constructors().allow_implicit_conversion = False

CheeseSucker

06-05-2010 20:50:44

Sorry, about my late reply.

The bulletD had enough functionality available so I could hack around most of what was not exposed. This is not an optimal solution though.

-------------------------------------------------------------

Not quite sure what you mean here -- the two OgreBullet libraries are 'separate' as thats how they are implemented in the C++ library however BulletD is very much dependent on BulletC..

Having said that its very likely that functions haven't been exposed and I'm happy to fix these -- could you put a small piece of Python code together that demonstrates what you expect to happen (or let me know what functions you were looking for in a particular class/module and I'll go looking to see why they are missing and fix them)...

Thanks
Andy


Well, classes in bulletD that inherits from bulletC classes does not have any of the functions defined in bulletC.
For example, bulletD.DynamicsWorld does not have the method getBulletCollisionWorld, even though it inherits from bulletC.CollisionsWorld.

So a simple example of what one would expect to work is:

bounds = ogre.AxisAlignedBox(ogre.Vector3(0,0,0), ogre.Vector3(2000, 2000, 2000))
self.gravityVector = ogre.Vector3(0, -9.80665, 0)
self.world = bulletD.DynamicsWorld(self.sceneMgr, bounds, gravityVector)
bulletWorld = self.world.getBulletCollisionWorld()

But this will fail with an AttributeError in the current release.

-------------------------------------------------------------


You are probably just missing a module_dependency to "ogrebulletc" in the ogrebulletd code generator.

- Update ogrebulletd/generate_code.py to include "mb.register_module_dependency ( environment.ogrebulletc.generated_dir ) "
- Delete cache/ogrebulletd_r2684_cache.xml and generate/build the ogrebulletd modules should resolve your problem.



That worked! Thanks :D

This should be applied to the official python-ogre repository.