ISceneNode::addChild now recursively updates SceneManager pointers if the node was from another SceneManager.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@1700 dfc29bdd-3216-0410-991c-e03cc46cb475
master
bitplane 2008-11-06 17:46:04 +00:00
parent f43d2dfa2a
commit 4e840b1c60
3 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,7 @@
Changes in version 1.5 (... 2008)
- ISceneNode::setParent and addChild now updates node SceneManager pointers if the node was from another SceneManager.
- Basic support for joystick input events on Windows, Linux and SDL devices.
- Major API change: RTTs are now created via addRenderTargetTexture instead of createRenderTargetTexture, which allows to retrieve them from the texture cache, but also changes the way of removing the RTTs, and especially one must not drop the pointer anymore.
@ -1302,7 +1304,7 @@ Changes in version 0.14.0 (30 November 2005)
- Lights now draw their bounding box and radius when debugdata is set to visible for them.
- Upgraded to irrXML 1.2. Thanks to some hints by Patrik Müller, irrXML, the XML parser used
- Upgraded to irrXML 1.2. Thanks to some hints by Patrik Mller, irrXML, the XML parser used
by the Irrlicht Engine now has CDATA support and some other useful new features.
- Support for VisualC++ (Express) 2005. Added a project file and a IrrlichtPropsVC2005.vsprops

View File

@ -248,6 +248,10 @@ namespace scene
{
if (child && (child != this))
{
// Change scene manager?
if (SceneManager != child->SceneManager)
child->setSceneManager(SceneManager);
child->grab();
child->remove(); // remove from old parent
Children.push_back(child);
@ -717,6 +721,17 @@ namespace scene
}
}
//! Sets the new scene manager for this node and all children.
//! Called by addChild when moving nodes between scene managers
void setSceneManager(ISceneManager* newManager)
{
SceneManager = newManager;
core::list<ISceneNode*>::Iterator it = Children.begin();
for (; it != Children.end(); ++it)
(*it)->setSceneManager(newManager);
}
//! Name of the scene node.
core::stringc Name;

View File

@ -170,6 +170,9 @@ CSceneManager::CSceneManager(video::IVideoDriver* driver, io::IFileSystem* fs,
ISceneNode::setDebugName("CSceneManager ISceneNode");
#endif
// root node's scene manager
SceneManager = this;
if (Driver)
Driver->grab();