I've put a sprite bank into my file selector to give it file type icons and that's all working well but when i remove the file selector the sprite bank doesn't get removed so when i then create a new file selector (which creates a new sprite bank with the same name as the previous one) it fails to create the sprite bank.
When i create the sprite bank i grab a reference to it and then drop it in the file selector destructor but this doesn't delete it. Presumably the GUI is holding on to a reference to the sprite bank and there's no way to get it to drop it.
Is this an oversight? Should there be a removeSpriteBank() function in the GUI environment? Or am i just doing something wrong myself?
Code can be provided if necessary. (using irrlicht 1.4.1)
CGUISpriteBank bug?
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
Perhaps I'm misunderstanding the problem, but IGUIEnvironment::getSpriteBank() returns an existing sprite bank if one with that name exists. The commenting could certainly be clearer, but it looks like typical usage should be:
Note: add, not create, so your user app shouldn't expect nor attempt to drop() it to destruction.
You're correct that there's no way to force the CGUIEnvironment to drop() a specified sprite bank: they're all wiped in ~CGUIEnvironment(). Fancy submitting a patch?
Code: Select all
IGUISpriteBank* bank = guiEnv->getSpriteBank("banksy");
if(!bank)
bank = guiEnv->addEmptySpriteBank("banksy");
You're correct that there's no way to force the CGUIEnvironment to drop() a specified sprite bank: they're all wiped in ~CGUIEnvironment(). Fancy submitting a patch?
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
A patch? You're like a crazy person...
Your suggestion ain't too bad... but what if that sprite bank is currently in use? There's probably no way of knowing if it is really.... If it is in use then you don't wanna go messing around with it by reusing it or anything...
I reckon adding the feature to remove sprite banks would be the best way to go, i'll have to look into it when i get a chance!
And yah... probably shouldn't drop a sprite bank in that case...
Your suggestion ain't too bad... but what if that sprite bank is currently in use? There's probably no way of knowing if it is really.... If it is in use then you don't wanna go messing around with it by reusing it or anything...
I reckon adding the feature to remove sprite banks would be the best way to go, i'll have to look into it when i get a chance!
And yah... probably shouldn't drop a sprite bank in that case...