Fixes assignment of the mapTo field for terrain FX materials to point to the assetId rather than just the assetName, fixing the material mapping lookups

Fixes project import to comply to above change
Makes Material default mEffectColor to white instead of whatever default value it comes up with due to memset
This commit is contained in:
JeffR 2022-03-31 18:58:06 -05:00
parent c2857efe28
commit bae6a3f514
4 changed files with 8 additions and 5 deletions

View file

@ -229,6 +229,9 @@ Material::Material()
dMemset(mEffectColor, 0, sizeof(mEffectColor));
mEffectColor[0] = LinearColorF::WHITE;
mEffectColor[1] = LinearColorF::WHITE;
mFootstepSoundId = -1; mImpactSoundId = -1;
mImpactFXIndex = -1;
INIT_ASSET(CustomFootstepSound);

View file

@ -32,7 +32,7 @@ function AssetBrowser::createTerrainMaterialAsset(%this)
%fxMatDef = new Material("TerrainFX_" @ %assetName)
{
mapTo = %assetName;
mapTo = %moduleName @ ":" @ %assetName;
footstepSoundId = 0;
terrainMaterials = "1";
ShowDust = "1";

View file

@ -1203,7 +1203,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject
{
%fxMatObj = getField(%fxMatList, %i);
%fxMatObjMapTo = findObjectField(%fxMatObj, "mapTo");
if(%fxMatObjMapTo $= %objectName)
if(%fxMatObjMapTo $= %objectName || %fxMatObjMapTo $= %assetName)
{
%fileObject.FXMaterial = %fxMatObj;
break;
@ -1215,7 +1215,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject
if(%fileObject.FXMaterial !$= "")
{
//Ensure our mapto is up to date for any name sanitize/tweaks
setObjectField(%fileObject.FXMaterial, "mapTo", %objectName);
setObjectField(%fileObject.FXMaterial, "mapTo", %moduleName @ ":" @ %assetName);
//we associated to an FX material, so process that now
%objectDefinition = "";
@ -1249,7 +1249,7 @@ function T3Dpre4ProjectImporter::processTerrainMaterialObject(%this, %fileObject
//if after all that we still have no FXMaterial, just create a new one
%fxMat = new Material("TerrainFX_" @ %objectName)
{
mapTo = %objectName;
mapTo = %moduleName @ ":" @ %assetName;
};
%asset.add(%fxMat);
}

View file

@ -603,7 +603,7 @@ function TerrainMaterialDlg::prepSaveDirtyMaterial(%this, %material)
if(!isObject(%fxMat))
{
%fxMat = new Material("TerrainFX_" @ %assetDef.assetName){
mapTo = %assetDef.assetName;
mapTo = %material.internalName;
};
%assetDef.add(%fxMat);