Game Development Community

AllMaterialsInUse.dump(); ?

by Steve Acaster · in Torque 3D Professional · 10/14/2010 (1:52 pm) · 2 replies

I'm expecting that the answer is no ... but ... is there a way to list all the materials that are used in a level (by their name)?

It's just that the "load texture on-fly" can cause a nasty bit of judder/lag until all materials have been loaded into texture memory, and I was thinking of sticking all textures on a tiny object at the player's spawn as a hacky way of preloading the lot at the beginning.

It'd be easy (for me) to dump a list rather than look through ALL my models.

Or is there actually a way that I can choose what materials to add to texture memory in my level startup scripts?

#1
10/14/2010 (5:08 pm)
I was under the impression you could easily tell what objects are loaded. If you can tell what objects are loaded then you should be able to parse out the material's list from all of those objects into a file. So if you wrote a function
for (all game objects)
if( object has material )
writeline ( material into document )

There are cleanup class arrays that you could possible parse (Mission cleanup comes to mind)
#2
10/15/2010 (10:08 am)
Steve, I like your idea about preloading the textures, and like to dig deeper into it, but I'm lacking the time at this moment I'm sorry.

But I was thinking oh that hurts, maybe take a look at the material-selector in the material-editor. This thing almost does what you want, at least I think this is more or less what you want ;) , building a list of all materials.