Accessing Loaded Resource List to make a Resource Browser


23-01-2010 17:47:35


Thanks again to Smiley for all his help on the event handling, everything is working beautifully now!

Is there a method of getting a list of loaded resources based on them being loaded from the resources.cfg? I am hunting through the ResourceGroupManager methods and have tried a few things but with no success.

Basically I am want to build a resource browser that should have all available resources and when an end user wants to use one it will initialize that resource and let them place it in the world.

I would like to know:

1. Prerequsites (Root has to be instanced, resources have to be loaded from the resources.cfg, etc...)
2. How to find them all so I can populate a list or a tree with them

Many thanks!


24-01-2010 14:53:09

List<string> allResources = new List<string>();
using (StringVector resourceGroups = ResourceGroupManager.Singleton.GetResourceGroups())
foreach (string resourceGroup in resourceGroups)
using (StringVector resources = ResourceGroupManager.Singleton.FindResourceNames(resourceGroup, "*", false))

Gets the names of all resource of all resource groups.

Should be all files from the locations which had been added previously with ResourceGroupManager.Singleton.AddResourceLocation.