I see in the documentation I'm not supposed to drop one of these when I use the addAnimatedMeshScene node call--since the name does not start with "create." But now I have a pointer for one, so what do I do? I assume if I don't want to work with that mesh anymore, then I can just delete it.
BTW -- I'm asking just to verify here. I was getting some segfaults when I was previously trying to delete it, but not now that I've reigned in a lot of my code. So I am assuming the deletes I was doing before were not a source of the problem. Still I just want to be sure.
Do I delete an IAnimatedMeshSceneNode when I'm done with it?
-
- Posts: 48
- Joined: Tue Aug 31, 2010 6:27 am
Re: Do I delete an IAnimatedMeshSceneNode when I'm done with
If you have not grab()'ed a reference to it then it will be automatically be deleted when it's no longer used. Assuming you didn't do anything special that means when you remove it from the scenemanager the node will be removed. Note that the mesh might still be in the mesh-cache as well as textures can still be in the texture-cache.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
-
- Posts: 48
- Joined: Tue Aug 31, 2010 6:27 am
Re: Do I delete an IAnimatedMeshSceneNode when I'm done with
Woah there. There's something in ISceneManager for removing the node? I don't see it in the method list:CuteAlien wrote:If you have not grab()'ed a reference to it then it will be automatically be deleted when it's no longer used. Assuming you didn't do anything special that means when you remove it from the scenemanager the node will be removed. Note that the mesh might still be in the mesh-cache as well as textures can still be in the texture-cache.
http://irrlicht.sourceforge.net/docu/cl ... _node.html
I assume I'm just missing this, since it has occurred to me this would be kind of important . I don't know if I understand the automatic removal rules for the animated node. I saw in the source that when I add an animated mesh scene node, there is implicitly a drop() call done on the reference before it's given to me. Am I supposed to grab it upon reception of it? I am assuming not since I don't think I've ever had a reference to one dropped out from under me, so I am as. I get reference counting generally; I just got confused with how it was applying it in addAnimatedMeshSceneNode.
Re: Do I delete an IAnimatedMeshSceneNode when I'm done with
You're looking in the wrong place, that url only shows methods specific to IAnimatedMeshSceneNode. ISceneNode has remove function.Rocko Bonaparte wrote:Woah there. There's something in ISceneManager for removing the node? I don't see it in the method list:CuteAlien wrote:If you have not grab()'ed a reference to it then it will be automatically be deleted when it's no longer used. Assuming you didn't do anything special that means when you remove it from the scenemanager the node will be removed. Note that the mesh might still be in the mesh-cache as well as textures can still be in the texture-cache.
http://irrlicht.sourceforge.net/docu/cl ... _node.html
http://irrlicht.sourceforge.net/docu/cl ... _node.html
Working on game: Marrbles (Currently stopped).
Re: Do I delete an IAnimatedMeshSceneNode when I'm done with
The implicit drop is because addAnimatedMeshSceneNode created the element with new and then passed it on to the scenemanager. New already creates one reference in Irrlicht. Adding to the scenemanger is done (wrongly) in the constructor of the scenenode, so that adds a second reference. Should be 2 commands (also for more important other reasons) then it would be more obvious.
For now - you have don't have to grab() - the scenemanager is already holding one reference.
For now - you have don't have to grab() - the scenemanager is already holding one reference.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm