subclassing SceneNode.

saladin

13-08-2008 13:57:40

Hi,
I am trying to subclass the SceneNode class and add some properties/behaviours to it to form my own scene graph.

like this:
class Foo(ogre.SceneNode):
pass

bar = Foo(sceneManager)

spam = Foo(sceneManager)

spam.addChild(bar)


Well, this does all the tricks as far as the scene graph is concerned. But since it didn't go through the process sceneManager.createSceneNode, the scene node is not registered with sceneManager.mSceneNodes. Hence it cannot be found when I call sceneManager.hasSceneNode(bar1.name) or sceneManager.destroySceneNode(bar1.name).

Apart from using a sceneNode as component and hand wrap functions of my class, what can I do to solve this problem? Maybe we can have access func to SceneManager.mSceneNodes in future releases?

andy

13-08-2008 15:50:40

mSceneNodes is a protected variable so doesn't currently get exposed (which is why you can't get to it)..

In looking at the C++ code you'd have to subclass SceneManager and override the createSceneNodeImpl function (to either return your special sceneNode or a standard one).. Of course this raises another set of problems..

Perhaps the best way is to create a movable object (with the necessary functions/properties that you need) and attach this to the sceneNode (attachObject) as I think this is the 'Ogre' way of extending nodes...

Regards

Andy

saladin

13-08-2008 22:09:59

mSceneNodes is a protected variable so doesn't currently get exposed (which is why you can't get to it)..

In looking at the C++ code you'd have to subclass SceneManager and override the createSceneNodeImpl function (to either return your special sceneNode or a standard one).. Of course this raises another set of problems..

Perhaps the best way is to create a movable object (with the necessary functions/properties that you need) and attach this to the sceneNode (attachObject) as I think this is the 'Ogre' way of extending nodes...

Regards

Andy


Yeah I do feel like what I'm doing is beyond the scope of python ogre. It's good to have it confirmed from you.

Cheers.

andy

13-08-2008 23:55:56

I think the subclassing of the MovableObject can easily be done within Python-Ogre and this is how the Physics modules (and OgreAL) add non Ogre information to nodes...

I think if you are wanting to implement a completely new SceneGraph then you are "meant" to implement a new SceneManager for Ogre..

If you really need access to mSceneNodes then create a ticket on SourceForge and I'll look to hand wrap it..

Andy