Getting access to a list of ResourceGroups

A place for users of OGRE to discuss ideas and experiences of utilitising OGRE in their games / demos / applications.
User avatar
pagan
Gnoblar
Posts: 4
Joined: Mon Feb 28, 2005 3:49 pm

Getting access to a list of ResourceGroups

Post by pagan »

Greetings all,

I just started using OGRE v1.0 [Azathoth] this past week and already I have a couple of questions:

First, I would like to iterate through all the ResourceDeclarations in a ResourceGroup to display them in a sort of resource browser. However I noticed that ResourceGroupManager::getResourceGroup is a protected function. Would it be possible to get public access to a (constant?) ResourceGroup reference? If not, is there another method to get at this resource information?

I already tried ResourceGroupManager::listResourceNames. However this does not provide me with the type of resource the name refers to, or the ResourceGroup it belongs to.

A related question, is there a plan to provide a list of created ResourceGroups that the ResourceGroupManager is aware of? I could keep track of these groups myself of course, but I wouldn't mind if Ogre provided the information it already knows about.

Thanks for your time,
and thank to the Ogre team for all their great work!

- pagan
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66

Post by sinbad »

How's this?

Code: Select all

		/** Get a list of the currently defined resource groups. 
		@note This method intentionally returns a copy rather than a reference in
			order to avoid any contention issues in multithreaded applications.
		@returns A copy of list of currently defined groups.
		*/
		StringVector getResourceGroups(void);
		/** Get the list of resource declarations for the specified group name. 
		@note This method intentionally returns a copy rather than a reference in
			order to avoid any contention issues in multithreaded applications.
		@param groupName The name of the group
		@returns A copy of list of currently defined resources.
		*/
		ResourceDeclarationList getResourceDeclarationList(const String& groupName);
I've committed it, anyway. :) Update on the v1-0 branch to get the implementation.
User avatar
pagan
Gnoblar
Posts: 4
Joined: Mon Feb 28, 2005 3:49 pm

Post by pagan »

Wow!! Never expected such a quick response =)
That is indeed exactly what I'm looking for. Many thanks!

(If I get anything useful working, I'll be sure to post it here)