diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 098b2d9dd9..2a9ee3a5d4 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2850,63 +2850,17 @@ namespace OpenSim.Region.Framework.Scenes pa.VehicleRotationParam(param, rotation); } - /// - /// Set the color of prim faces - /// - /// - /// - public void SetFaceColor(Vector3 color, int face) - { - Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); - - // The only way to get a deep copy/ If we don't do this, we can - // never detect color changes further down. - Byte[] buf = Shape.Textures.GetBytes(); - Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); - Color4 texcolor; - if (face >= 0 && face < GetNumberOfSides()) - { - texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - tex.FaceTextures[face].RGBA = texcolor; - UpdateTextureEntry(tex.GetBytes()); - return; - } - else if (face == ALL_SIDES) - { - for (uint i = 0; i < GetNumberOfSides(); i++) - { - if (tex.FaceTextures[i] != null) - { - texcolor = tex.FaceTextures[i].RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - tex.FaceTextures[i].RGBA = texcolor; - } - texcolor = tex.DefaultTexture.RGBA; - texcolor.R = clippedColor.X; - texcolor.G = clippedColor.Y; - texcolor.B = clippedColor.Z; - tex.DefaultTexture.RGBA = texcolor; - } - UpdateTextureEntry(tex.GetBytes()); - return; - } - } - /// /// Set the color & alpha of prim faces /// /// /// /// - public void SetFaceColorAlpha(int face, Vector3 color, double alpha) + public void SetFaceColorAlpha(int face, Vector3 color, double ?alpha) { Vector3 clippedColor = Util.Clip(color, 0.0f, 1.0f); - float clippedAlpha = Util.Clip((float)alpha, 0.0f, 1.0f); + float clippedAlpha = alpha.HasValue ? + Util.Clip((float)alpha.Value, 0.0f, 1.0f) : 0; // The only way to get a deep copy/ If we don't do this, we can // never detect color changes further down. @@ -2919,7 +2873,10 @@ namespace OpenSim.Region.Framework.Scenes texcolor.R = clippedColor.X; texcolor.G = clippedColor.Y; texcolor.B = clippedColor.Z; - texcolor.A = clippedAlpha; + if (alpha.HasValue) + { + texcolor.A = clippedAlpha; + } tex.FaceTextures[face].RGBA = texcolor; UpdateTextureEntry(tex.GetBytes()); return; @@ -2934,14 +2891,20 @@ namespace OpenSim.Region.Framework.Scenes texcolor.R = clippedColor.X; texcolor.G = clippedColor.Y; texcolor.B = clippedColor.Z; - texcolor.A = clippedAlpha; + if (alpha.HasValue) + { + texcolor.A = clippedAlpha; + } tex.FaceTextures[i].RGBA = texcolor; } texcolor = tex.DefaultTexture.RGBA; texcolor.R = clippedColor.X; texcolor.G = clippedColor.Y; texcolor.B = clippedColor.Z; - texcolor.A = clippedAlpha; + if (alpha.HasValue) + { + texcolor.A = clippedAlpha; + } tex.DefaultTexture.RGBA = texcolor; } UpdateTextureEntry(tex.GetBytes()); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0cbb3173b4..8140416b80 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1377,7 +1377,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (face == ScriptBaseClass.ALL_SIDES) face = SceneObjectPart.ALL_SIDES; - m_host.SetFaceColor(color, face); + m_host.SetFaceColorAlpha(face, color, null); } public void SetTexGen(SceneObjectPart part, int face,int style) @@ -3572,7 +3572,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) - part.SetFaceColor(color, face); + part.SetFaceColorAlpha(face, color, null); } public void llCreateLink(string target, int parent)