fix handling of materials maps clear and total removal with SLSL

master
UbitUmarov 2020-02-09 19:14:17 +00:00
parent 11c49c211c
commit fb2380efd6
1 changed files with 47 additions and 38 deletions

View File

@ -10663,8 +10663,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
FaceMaterial mat = null; FaceMaterial mat = null;
UUID oldid = texface.MaterialID; UUID oldid = texface.MaterialID;
if (oldid == UUID.Zero)
if(oldid != UUID.Zero) {
if (materialAlphaMode == 1)
return false;
}
else
mat = m_materialsModule.GetMaterialCopy(oldid); mat = m_materialsModule.GetMaterialCopy(oldid);
if(mat == null) if(mat == null)
@ -10673,7 +10677,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
mat.DiffuseAlphaMode = (byte)materialAlphaMode; mat.DiffuseAlphaMode = (byte)materialAlphaMode;
mat.AlphaMaskCutoff = (byte)materialMaskCutoff; mat.AlphaMaskCutoff = (byte)materialMaskCutoff;
UUID id = m_materialsModule.AddNewMaterial(mat); UUID id = m_materialsModule.AddNewMaterial(mat); // id is a hash of entire material hash, so this means no change
if(oldid == id) if(oldid == id)
return false; return false;
@ -10717,9 +10721,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
FaceMaterial mat = null; FaceMaterial mat = null;
UUID oldid = texface.MaterialID; UUID oldid = texface.MaterialID;
if(mapID != UUID.Zero) if (oldid == UUID.Zero)
{ {
if(oldid != UUID.Zero) if (mapID == UUID.Zero)
return false;
}
else
mat = m_materialsModule.GetMaterialCopy(oldid); mat = m_materialsModule.GetMaterialCopy(oldid);
if(mat == null) if(mat == null)
@ -10733,7 +10740,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
mat.NormalRotation = rot; mat.NormalRotation = rot;
mapID = m_materialsModule.AddNewMaterial(mat); mapID = m_materialsModule.AddNewMaterial(mat);
}
if(oldid == mapID) if(oldid == mapID)
return false; return false;
@ -10782,9 +10789,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
FaceMaterial mat = null; FaceMaterial mat = null;
UUID oldid = texface.MaterialID; UUID oldid = texface.MaterialID;
if (mapID != UUID.Zero) if(oldid == UUID.Zero)
{ {
if (oldid != UUID.Zero) if(mapID == UUID.Zero)
return false;
}
else
mat = m_materialsModule.GetMaterialCopy(oldid); mat = m_materialsModule.GetMaterialCopy(oldid);
if (mat == null) if (mat == null)
@ -10803,7 +10813,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
mat.EnvironmentIntensity = env; mat.EnvironmentIntensity = env;
mapID = m_materialsModule.AddNewMaterial(mat); mapID = m_materialsModule.AddNewMaterial(mat);
}
if(oldid == mapID) if(oldid == mapID)
return false; return false;