Game Development Community

Removing unused materials from a materials.cs?

by Bryce · in Torque 3D Professional · 11/27/2012 (5:20 pm) · 4 replies

Hey everyone,

I've been working on a building in Blender that's gotten absolutely massive, with over 100 materials. The problem is, a lot of those materials went unused as I work, but they still end up floating around in the materials.cs file. I know this is a shot in the dark, but is there any easy way to clean up those material definitions? I don't want any unused material data in the materials.cs for my building for the sake of saving memory.

Help is appreciated!
-Bryce

#1
11/27/2012 (5:28 pm)
Yes, one method I know to work is to put all the geometry and necessary textures into the same folder as you would with any model for the engine.
When you import the model into the game you'll get feedback in the Log or just press the Tilde key. If your missing any textures it will be listed in the console as red text and the engine ignores those that are not used.
You will get a material.cs when you get the model into the engine. It should list the materials used for the *.dae file.
At least I think you can sort them out this way... just by seeing which ones you actually need.(?)
#2
11/28/2012 (2:12 am)
What I do is probably the difficult way of doing it, cause thats how i roll... but i move my materials.cs out the folder, add the model's im using, check whats coming up missing in the console logs, and copy over from the backup into the new one. save it in place, reload torque just to check and everything should be golden.
#3
11/28/2012 (3:08 am)
This might be oversimplifying the problem, but you can't just delete materials.cs and re-export/import?

EDIT: Oh right, 'cause you might have made changes to the exported materials. How about moving the materials.cs file somewhere else, re-importing, and then using WinMerge or something to resolve your hand-tailored differences?
#4
11/28/2012 (5:07 am)
Bryce,

Sounds like your base problem is not removing the unused materials prior to export. Pretty sure there was a plug in at one time for blender that would auto remove unused materials. If you can find it, you might want to add that step to the art pipeline.

Ron