Change behavior of terrain painter when deleting a material
by Kenneth Eves · 09/28/2012 (11:30 pm) · 1 comments
Have you ever deleted a material in T3D terrain painter and had that material's assignment mysteriously jump to another material? I found a fix.
What happens is the deleted material assignment gets dropped to the next lower material. What I've done is created a rule that material 0 is default and anything in use by a deleted material gets reassigned to that.
It's not a bug fix, just my preferred method of handling this case.
terrData.cpp in function TerrainBlock::removeMaterial
What happens is the deleted material assignment gets dropped to the next lower material. What I've done is created a rule that material 0 is default and anything in use by a deleted material gets reassigned to that.
It's not a bug fix, just my preferred method of handling this case.
terrData.cpp in function TerrainBlock::removeMaterial
//KENHACK if material is in use, reassign to default.
//This prevents accidental assignments to other materials.
//REPLACEMENT
for ( S32 i = 0; i < mFile->mLayerMap.size(); i++ )
{
if ( mFile->mLayerMap[i] == index )
{
//assign to default
mFile->mLayerMap[i] = 0;
}
if ( mFile->mLayerMap[i] > index && mFile->mLayerMap[i] != 0 )
{
mFile->mLayerMap[i]--;
}
}
// ORIGINAL
// for ( S32 i = 0; i < mFile->mLayerMap.size(); i++ )
// {
// if ( mFile->mLayerMap[i] >= index &&
// mFile->mLayerMap[i] != 0 )
// {
// mFile->mLayerMap[i]--;
// }
// }About the author
<3 TGE/A Quickly becoming a fan of T3D 1.2

Torque Owner D Fasel
Game 3D