About getting a list of objects from TorqueObjectDatabase
by Alexander de Hartdegen · in Torque X 2D · 01/20/2008 (7:20 am) · 6 replies
Hi.
Is there a way to get a list of objects registered in the TorqueObjectDatabase??
Any advice is appreciated.
Thanks
Alexander
Is there a way to get a list of objects registered in the TorqueObjectDatabase??
Any advice is appreciated.
Thanks
Alexander
#2
01/20/2008 (4:26 pm)
Does that mean I can also get a list of materials via this method as well???
#3
01/20/2008 (10:20 pm)
Err.... it doesn't work for me. TorqueObjectDatabase does not have FindObjects<>() method. It only has a FindObject() method which return a single object.
#4
01/21/2008 (1:04 am)
I use the 1.5 beta, the templated method might be new.
#5
01/21/2008 (3:06 am)
So only 1.5 beta supports it? hmm..... because I am currently working on my school project and I am using an earlier version of Torque X. Might be too late for me to move over to 1.5 beta... any other way besides using 1.5 beta??
#6
Now, your "materials" list will be filled with all of the materials that are registered with the object database.
John K.
01/21/2008 (8:48 am)
Just checked and you can use the Edwin's approach to find a list materials. Just be sure to include the Materials namespace at the top of your code: using GarageGames.Torque.Materials; . Then, you can do something like this:List<SimpleMaterial> materials = new List<SimpleMaterial>(); TorqueObjectDatabase.Instance.FindObjects<SimpleMaterial>(ref materials);
Now, your "materials" list will be filled with all of the materials that are registered with the object database.
John K.
Torque Owner Edwin R
ex :
List
give you the list of all registered T2DSceneObject.