Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
What prevents create() returning same thing staticCast() returns? I am sure it is pretty obvious that if we call MaterialManager::create() then we are expecting to get Material, not Texture, not anything else. So what is the point of typing obvious thing when it could be avoided?
What prevents create() returning same thing staticCast() returns? I am sure it is pretty obvious that if we call MaterialManager::create() then we are expecting to get Material, not Texture, not anything else. So what is the point of typing obvious thing when it could be avoided?
However in the provided context it is indeed not that useful. One possible improvements is to add a more specific function in each ResourceManager child which return the specific type, something like:
I don't know if a refactoring would avoid this kind of problem, but in doubt as there is a GSoC going on about resource management system, I'll point the author to read this.
Both solutions do not sound perfect to be honest. They are one bit too redundant, but definitely better than static cast.
What about making ResourceManager::create() non-virtual? As far as i can see there is no real requirement for polymorphism, we are using resource managers directly. So in the end we would keep create() in all classes and yet returning object of correct type without any manual casts or useless typing. Best part is that child resource managers will still be able to utilize ResourceManager::create() if needed so there would be no code duplication either.
I would have removed the ResourceManager as a base class altogether or made it CRTP, personally, but I see in the Ogre code base that the abstract interface is used in a lot of cases, in particular in mechanisms systems like the background loader (which will be rewritten anyway).
In that case ResourceManager::create() could be refactored to something like ResourceManager::createInternal() freeing up straightforward non-virtual create() for use by users. Cant wait to see the direction this goes ^_^
As has been discussed, the current state is very much "interim". I drafted the patch for 2.0 and it got pulled into 1.9 because it is a significant memory (and sometimes performance) improvement.
In my working copy the way the resource system works is very different. There should be, by the end of it, convenience functions for most of these use cases.
Transporter - CEGUI will not be dropping OGRE support anytime soon - look at the last comment by Paul (aka Crazy Eddie).
The patch/pull request wasn't accepted because it broke compatibility with older versions of OGRE, and adding Ogre.h would just increase compile time unnecessarily.
I've made a new patch that doesn't break compatibility and doesn't include Ogre.h, you can find my pull request (not yet reviewed by the CEGUI team) here and my repository with support for OGRE 1.9 here.
Hey guys, since I'm using Gorilla, I updated it and remembered this thread, and thought it might save someone the trouble of adding all those version checks. (Easy, but annoying and boring as hell)
So, here's a patch. If you want, please add it to the original post for better visibility, transporter.
Gorilla.patch
You do not have the required permissions to view the files attached to this post.
When I am building my app I get the errors from sharedptr but no link to which line is creating the error. I end up searching code for ptr. Is there an easier way to find lines that need to be fixed?