IAnimatedMesh in IAnimatedMeshSceneNode
IAnimatedMesh in IAnimatedMeshSceneNode
Hi!
I have a IAnimatedMeshSceneNode that contains IAnimatedMesh as child.
How can I cycle across the childrens?
I tried with ->getChildren but retrieve a IMesh and my node contains only animated meshes
thanks
I have a IAnimatedMeshSceneNode that contains IAnimatedMesh as child.
How can I cycle across the childrens?
I tried with ->getChildren but retrieve a IMesh and my node contains only animated meshes
thanks
Re: IAnimatedMesh in IAnimatedMeshSceneNode
First a scene node can only have other scene nodes as children not meshes ('fix me' if I'm wrong).ghiboz wrote:Hi!
I have a IAnimatedMeshSceneNode that contains IAnimatedMesh as child.
How can I cycle across the childrens?
Second, to iterate across its (the scene node's) children you can do something like this:
Code: Select all
const core::list<ISceneNode*>& list = YourNode->getChildren();
core::list<ISceneNode*>::ConstIterator it = list.begin();
for (; it!=list.end(); ++it)
{
// (*it) is the current children.
// do with *it whatever you want
// e.g: (*it)->remove();
}
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Re: IAnimatedMesh in IAnimatedMeshSceneNode
IAnimatedMeshSceneNode has at most one (1) IAnimatedMesh.ghiboz wrote:I have a IAnimatedMeshSceneNode that contains IAnimatedMesh as child. How can I cycle across the childrens?
Code: Select all
IAnimatedMesh* IAnimatedMeshSceneNode::getMesh(void);
Which getChildren() method do you think is returning you an IMesh, or an array of IMesh? Can you point at that method in the API?ghiboz wrote:I tried with ->getChildren but retrieve a IMesh
IAnimatedMeshSceneNode::getChildren() resolves to ISceneNode::getChildren().
Code: Select all
const core::list<ISceneNode*>& getChildren() const
It contains at most one (1) IAnimatedMesh. What is leading you to believe otherwise?ghiboz wrote:and my node contains only animated meshes
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
thanks for your replies:
I explain better...
I made my personal file importer and I have this:
gbzNode is an AnimatedMeshSceneNode that contains many animatedmeshshenenodes (right?)
i tried to do this:
but doesn't work, 'cause the getChildren retrieve a MeshNode and not AnimatedMeshNode
I explain better...
I made my personal file importer and I have this:
Code: Select all
IAnimatedMeshSceneNode* gbzNode = 0;
for( int gm = 0; gm < gbzMeshes.size(); gm ++ )
{
IAnimatedMesh* mesh = readStaticMesh( gm );
gbzNode = Smgr->addAnimatedMeshSceneNode( mesh );
}
return gbzNode;
i tried to do this:
Code: Select all
core::list<scene::ISceneNode*>::ConstIterator it gbzNode->getChildren().begin();
for (; it != gbzNode->getChildren().end(); it = gbzNode->getChildren().begin())
(*it)->setDebugDataVisible(scene::EDS_OFF);
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
I'd imagine that you want something like this:
No, it does not.
IAnimatedMeshSceneNode::getChildren() returns core::list<ISceneNode*>&, not any form of "MeshNode". You presumably already know this, because you're using an appropriate iterator.
Code: Select all
ISceneNode * yourFunctionOrMethod(...)
{
...
ISceneNode * parent = Smgr->addEmptySceneNode(0);
IAnimatedMeshSceneNode* gbzNode = 0;
for( int gm = 0; gm < gbzMeshes.size(); gm ++ )
{
IAnimatedMesh* mesh = readStaticMesh( gm );
if(mesh)
(void)Smgr->addAnimatedMeshSceneNode( mesh, parent );
}
return parent;
}
but doesn't work, 'cause the getChildren retrieve a MeshNode and not AnimatedMeshNode
No, it does not.
IAnimatedMeshSceneNode::getChildren() returns core::list<ISceneNode*>&, not any form of "MeshNode". You presumably already know this, because you're using an appropriate iterator.
Please upload candidate patches to the tracker.
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way
Need help now? IRC to #irrlicht on irc.freenode.net
How To Ask Questions The Smart Way