changing material names in dts files
by Rex Hiebert · in Torque 3D Professional · 04/14/2010 (8:12 am) · 1 replies
We have a lot of dts models (over 200) and need to change the material names in the dts files. Since these are simple materials I wasn't looking to create a materials.cs entry for each. I just need to rename the existing materials. I tried searching in the forums and the resources but didn't find anything that answered the question directly. I believe the easiest way would be to load the shape file, get the material name, change it then save the shape file. I'm just having trouble finding where in the engine code this could be done. Any pointers?
Torque Owner Netwyrm
Canopic Games
Use a sector editor to open the .dts file, and search carefully for the name of the material (it's usually after the data, so towards the end of the file). Change that name carefully, being very sure not to make it longer or shorter than the originally embedded string.
1) Work on a copy of your original .dts file, with a backup stored somewhere else. You can damage the file unrecoverably (i.e., it will never load successfully in Torque again!) if you aren't exceptionally careful.
2) Try changing just one character of the embedded material name--this is enough to make an unique material name, though it may be gibberish now. To the engine, one unique string looks pretty much like another unique string.
3) You may need to set parameter "computeCRC = false" in the datablock associated with the file, if it has one, or comment out the computeCRC line.
4) Don't forget to create a material with the "mapto = yournewmaterialname" tag changed to the new string to bind to the model.