mantis 8517: let texture argument of PRIM_TEXTURE only change the other parameters. On PRIM_NORMAL and PRIM_SPECULAR will be as NULL_KEY removing the material. This may be changed for coerence in future
parent
11cad57c9c
commit
2b4e5fcded
|
@ -2410,13 +2410,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
|
|
||||||
UUID textureID = new UUID();
|
UUID textureID = new UUID();
|
||||||
|
bool dotexture = true;
|
||||||
|
if(String.IsNullOrEmpty(texture))
|
||||||
|
dotexture = false;
|
||||||
|
else
|
||||||
|
{
|
||||||
textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
|
textureID = ScriptUtils.GetAssetIdFromItemName(m_host, texture, (int)AssetType.Texture);
|
||||||
if (textureID == UUID.Zero)
|
if (textureID == UUID.Zero)
|
||||||
{
|
{
|
||||||
if (!UUID.TryParse(texture, out textureID))
|
if (!UUID.TryParse(texture, out textureID))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Primitive.TextureEntry tex = part.Shape.Textures;
|
Primitive.TextureEntry tex = part.Shape.Textures;
|
||||||
int nsides = GetNumberOfSides(part);
|
int nsides = GetNumberOfSides(part);
|
||||||
|
@ -2424,6 +2429,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
if (face >= 0 && face < nsides)
|
if (face >= 0 && face < nsides)
|
||||||
{
|
{
|
||||||
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
Primitive.TextureEntryFace texface = tex.CreateFace((uint)face);
|
||||||
|
if (dotexture)
|
||||||
texface.TextureID = textureID;
|
texface.TextureID = textureID;
|
||||||
texface.RepeatU = (float)scaleU;
|
texface.RepeatU = (float)scaleU;
|
||||||
texface.RepeatV = (float)ScaleV;
|
texface.RepeatV = (float)ScaleV;
|
||||||
|
@ -2440,6 +2446,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
if (tex.FaceTextures[i] != null)
|
if (tex.FaceTextures[i] != null)
|
||||||
{
|
{
|
||||||
|
if (dotexture)
|
||||||
tex.FaceTextures[i].TextureID = textureID;
|
tex.FaceTextures[i].TextureID = textureID;
|
||||||
tex.FaceTextures[i].RepeatU = (float)scaleU;
|
tex.FaceTextures[i].RepeatU = (float)scaleU;
|
||||||
tex.FaceTextures[i].RepeatV = (float)ScaleV;
|
tex.FaceTextures[i].RepeatV = (float)ScaleV;
|
||||||
|
@ -2448,6 +2455,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
tex.FaceTextures[i].Rotation = (float)rotation;
|
tex.FaceTextures[i].Rotation = (float)rotation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (dotexture)
|
||||||
tex.DefaultTexture.TextureID = textureID;
|
tex.DefaultTexture.TextureID = textureID;
|
||||||
tex.DefaultTexture.RepeatU = (float)scaleU;
|
tex.DefaultTexture.RepeatU = (float)scaleU;
|
||||||
tex.DefaultTexture.RepeatV = (float)ScaleV;
|
tex.DefaultTexture.RepeatV = (float)ScaleV;
|
||||||
|
@ -10422,8 +10430,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
string mapname = rules.Data[idx++].ToString();
|
string mapname = rules.Data[idx++].ToString();
|
||||||
|
UUID mapID = UUID.Zero;
|
||||||
UUID mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture);
|
if (!string.IsNullOrEmpty(mapname))
|
||||||
|
{
|
||||||
|
mapID = ScriptUtils.GetAssetIdFromItemName(m_host, mapname, (int)AssetType.Texture);
|
||||||
if (mapID == UUID.Zero)
|
if (mapID == UUID.Zero)
|
||||||
{
|
{
|
||||||
if (!UUID.TryParse(mapname, out mapID))
|
if (!UUID.TryParse(mapname, out mapID))
|
||||||
|
@ -10432,7 +10442,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LSL_Vector mnrepeat;
|
LSL_Vector mnrepeat;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -10489,8 +10499,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
}
|
}
|
||||||
|
|
||||||
string smapname = rules.Data[idx++].ToString();
|
string smapname = rules.Data[idx++].ToString();
|
||||||
|
UUID smapID = UUID.Zero;
|
||||||
UUID smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture);
|
if(!string.IsNullOrEmpty(smapname))
|
||||||
|
{
|
||||||
|
smapID = ScriptUtils.GetAssetIdFromItemName(m_host, smapname, (int)AssetType.Texture);
|
||||||
if (smapID == UUID.Zero)
|
if (smapID == UUID.Zero)
|
||||||
{
|
{
|
||||||
if (!UUID.TryParse(smapname, out smapID))
|
if (!UUID.TryParse(smapname, out smapID))
|
||||||
|
@ -10499,7 +10511,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return new LSL_List();
|
return new LSL_List();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
LSL_Vector msrepeat;
|
LSL_Vector msrepeat;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -10715,6 +10727,8 @@ 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)
|
||||||
mat = m_materialsModule.GetMaterialCopy(oldid);
|
mat = m_materialsModule.GetMaterialCopy(oldid);
|
||||||
|
|
||||||
|
@ -10728,11 +10742,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
mat.NormalRepeatY = repeatY;
|
mat.NormalRepeatY = repeatY;
|
||||||
mat.NormalRotation = rot;
|
mat.NormalRotation = rot;
|
||||||
|
|
||||||
UUID id = m_materialsModule.AddNewMaterial(mat);
|
mapID = m_materialsModule.AddNewMaterial(mat);
|
||||||
if(oldid == id)
|
}
|
||||||
|
if(oldid == mapID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
texface.MaterialID = id;
|
texface.MaterialID = mapID;
|
||||||
part.Shape.TextureEntry = tex.GetBytes(9);
|
part.Shape.TextureEntry = tex.GetBytes(9);
|
||||||
m_materialsModule.RemoveMaterial(oldid);
|
m_materialsModule.RemoveMaterial(oldid);
|
||||||
return true;
|
return true;
|
||||||
|
@ -10777,6 +10792,8 @@ 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)
|
||||||
mat = m_materialsModule.GetMaterialCopy(oldid);
|
mat = m_materialsModule.GetMaterialCopy(oldid);
|
||||||
|
|
||||||
|
@ -10795,11 +10812,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
mat.SpecularLightExponent = gloss;
|
mat.SpecularLightExponent = gloss;
|
||||||
mat.EnvironmentIntensity = env;
|
mat.EnvironmentIntensity = env;
|
||||||
|
|
||||||
UUID id = m_materialsModule.AddNewMaterial(mat);
|
mapID = m_materialsModule.AddNewMaterial(mat);
|
||||||
if(oldid == id)
|
}
|
||||||
|
|
||||||
|
if(oldid == mapID)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
texface.MaterialID = id;
|
texface.MaterialID = mapID;
|
||||||
part.Shape.TextureEntry = tex.GetBytes(9);
|
part.Shape.TextureEntry = tex.GetBytes(9);
|
||||||
m_materialsModule.RemoveMaterial(oldid);
|
m_materialsModule.RemoveMaterial(oldid);
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in New Issue