From 68021fa8ff35c482bea6a47d4fcffb7f47676a13 Mon Sep 17 00:00:00 2001 From: Charles Krinke Date: Mon, 6 Oct 2008 14:50:58 +0000 Subject: [PATCH] Mantis#2342. Thank you kindly, Ralphos for a patch that solves: llSetLinkApha is not fully implemented and has not been updated to use the recently added GetLinkParts and associated implementation pattern as per llSetLinkColor and llSetLinkPrimitiveParams. --- .../Shared/Api/Implementation/LSL_Api.cs | 88 +++---------------- 1 file changed, 10 insertions(+), 78 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fffc331a1e..10318891aa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1332,6 +1332,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SetAlpha(m_host, alpha, face); } + public void llSetLinkAlpha(int linknumber, double alpha, int face) + { + m_host.AddScriptLPS(1); + + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + SetAlpha(part, alpha, face); + } + private void SetAlpha(SceneObjectPart part, double alpha, int face) { Primitive.TextureEntry tex = part.Shape.Textures; @@ -6239,84 +6249,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return DateTime.Now.ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"); } - public void llSetLinkAlpha(int linknumber, double alpha, int face) - { - m_host.AddScriptLPS(1); - SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(linknumber); - if (linknumber > -1) - { - Primitive.TextureEntry tex = part.Shape.Textures; - Color4 texcolor; - if (face >= 0 && face < GetNumberOfSides(m_host)) - { - texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.FaceTextures[face].RGBA = texcolor; - part.UpdateTexture(tex); - return; - } - else if (face == ScriptBaseClass.ALL_SIDES) - { - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; - for (uint i = 0; i < GetNumberOfSides(m_host); i++) - { - if (tex.FaceTextures[i] != null) - { - texcolor = tex.FaceTextures[i].RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.FaceTextures[i].RGBA = texcolor; - } - } - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; - part.UpdateTexture(tex); - return; - } - return; - } - else if (linknumber == -1) - { - int num = m_host.ParentGroup.PrimCount; - for (int w = 0; w < num; w++) - { - linknumber = w; - part = m_host.ParentGroup.GetLinkNumPart(linknumber); - Primitive.TextureEntry tex = part.Shape.Textures; - Color4 texcolor; - if (face > -1) - { - texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.FaceTextures[face].RGBA = texcolor; - part.UpdateTexture(tex); - } - else if (face == -1) - { - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; - for (uint i = 0; i < 32; i++) - { - if (tex.FaceTextures[i] != null) - { - texcolor = tex.FaceTextures[i].RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.FaceTextures[i].RGBA = texcolor; - } - } - texcolor = tex.DefaultTexture.RGBA; - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); - tex.DefaultTexture.RGBA = texcolor; - part.UpdateTexture(tex); - } - } - return; - } - } - public LSL_Integer llGetNumberOfPrims() { m_host.AddScriptLPS(1);