Problems building or running the engine, queries about how to use features etc.
Zeal
Ogre Magi
Posts: 1260 Joined: Mon Aug 07, 2006 6:16 am
Location: Colorado Springs, CO USA
Quote
0
login to like this post
Post
by Zeal » Mon Apr 23, 2007 3:19 am
Is there anyway to check and see if a resource group already esists? I tried..
Code: Select all
Ogre::ResourceGroupManager::getSingleton().getResourceDeclarationList( "GroupName" );
But it crashes if the resource group doesnt exists.
The reason I want this feature is so I can easily tell if a resource group has already been initialised when my app reloads, or switches game states, ect...
stoneCold
OGRE Expert User
Posts: 867 Joined: Fri Oct 01, 2004 9:13 pm
Location: Carinthia, Austria
x 1
Quote
0
login to like this post
Post
by stoneCold » Mon Apr 23, 2007 3:32 am
You can always extend the above with "try{}catch(...){}" to get the desired effect, though it might be worth a patch if such a function not already exists.
At least I don't know one.
CheetahShrk
Kobold
Posts: 38 Joined: Wed Dec 13, 2006 4:52 am
Quote
0
login to like this post
Post
by CheetahShrk » Mon Apr 23, 2007 4:02 am
http://www.ogre3d.org/docs/api/html/cla ... Managera43
Use getResourceGroups, and go through the list you get to check if it exists.
A quick function, not sure if it works though.
Code: Select all
bool groupExists( Ogre::String &group )
{
Ogre::StringVector groupNameList = Ogre::ResourceGroupManager::getSingleton().getResourceGroups();
Ogre::StringVector::iterator resGroupIter = groupNameList.begin();
for(;resGroupIter < groupNameList.end();resGroupIter++)
{
Ogre::String resGroupName = (*resGroupIter);
if( resGroupName == group )
{
return true;
}
}
return false;
}
Zeal
Ogre Magi
Posts: 1260 Joined: Mon Aug 07, 2006 6:16 am
Location: Colorado Springs, CO USA
Quote
0
login to like this post
Post
by Zeal » Mon Apr 23, 2007 4:55 am
Yeah I thought about writing a little function like that to iterate through the groups.
I was hoping there would be a built in command, but this will work I guess.