From bcbd450fe441e94d6c0f547055b4e95f75a5b0d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 20 Aug 2012 20:24:54 +0100 Subject: Add --force flag to "kick user" console command to allow bypassing of recent race condition checks. This is to allow a second attempt to remove an avatar even if "show connections" shows them as already inactive (i.e. close has already been attempted once). You should only attempt --force if a normal kick fails. This is partly for diagnostics as we have seen some connections occasionally remain on lbsa plaza even if they are registered as inactive. This is not a permanent solution and may not work anyway - the ultimate solution is to stop this problem from happening in the first place. --- OpenSim/Region/Framework/Scenes/Scene.cs | 9 ++++++--- OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d2d6aba..ad74189 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4116,16 +4116,19 @@ namespace OpenSim.Region.Framework.Scenes /// /// Tell a single agent to disconnect from the region. /// - /// /// - public bool IncomingCloseAgent(UUID agentID) + /// + /// Force the agent to close even if it might be in the middle of some other operation. You do not want to + /// force unless you are absolutely sure that the agent is dead and a normal close is not working. + /// + public bool IncomingCloseAgent(UUID agentID, bool force) { //m_log.DebugFormat("[SCENE]: Processing incoming close agent for {0}", agentID); ScenePresence presence = m_sceneGraph.GetScenePresence(agentID); if (presence != null) { - presence.ControllingClient.Close(); + presence.ControllingClient.Close(force); return true; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs index 5758869..5faf131 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAgentTests.cs @@ -141,7 +141,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests TestScene scene = new SceneHelpers().SetupScene(); ScenePresence sp = SceneHelpers.AddScenePresence(scene, TestHelpers.ParseTail(0x1)); - scene.IncomingCloseAgent(sp.UUID); + scene.IncomingCloseAgent(sp.UUID, false); Assert.That(scene.GetScenePresence(sp.UUID), Is.Null); Assert.That(scene.AuthenticateHandler.GetAgentCircuitData(sp.UUID), Is.Null); -- cgit v1.1 From aee4353e9cf811bd66a17f292c6f17c9495831fc Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 17 Aug 2012 14:47:53 +0100 Subject: fix typo --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 53b4f7e..0535dcb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2858,7 +2858,7 @@ namespace OpenSim.Region.Framework.Scenes public void SetFaceColor(Vector3 color, int face) { // The only way to get a deep copy/ If we don't do this, we can - // mever detect color changes further down. + // never detect color changes further down. Byte[] buf = Shape.Textures.GetBytes(); Primitive.TextureEntry tex = new Primitive.TextureEntry(buf, 0, buf.Length); Color4 texcolor; -- cgit v1.1 From b863a15a820be7c3b86b27ef24944d6a85fa5360 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 17 Aug 2012 15:09:52 +0100 Subject: single operation for PRIM_COLOR --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 49 ++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0535dcb..6741e5e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2896,6 +2896,55 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Set the color & alpha of prim faces + /// + /// + /// + /// + public void SetFaceColorAlpha(int face, Vector3 color, double alpha) + { + // 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 = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + 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 = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + tex.FaceTextures[i].RGBA = texcolor; + } + texcolor = tex.DefaultTexture.RGBA; + texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); + texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); + texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + tex.DefaultTexture.RGBA = texcolor; + } + UpdateTextureEntry(tex.GetBytes()); + return; + } + } + + /// /// Get the number of sides that this part has. /// /// -- cgit v1.1 From ede3b9ab07dc1ed4a51684b7257cbb4d76e9bdfd Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:26:26 +0100 Subject: making use of implicit operators and Util.Clip handling of Vector3 --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 47 ++++++++++++---------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6741e5e..098b2d9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2857,6 +2857,8 @@ namespace OpenSim.Region.Framework.Scenes /// 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(); @@ -2865,9 +2867,9 @@ namespace OpenSim.Region.Framework.Scenes if (face >= 0 && face < GetNumberOfSides()) { texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; tex.FaceTextures[face].RGBA = texcolor; UpdateTextureEntry(tex.GetBytes()); return; @@ -2879,15 +2881,15 @@ namespace OpenSim.Region.Framework.Scenes if (tex.FaceTextures[i] != null) { texcolor = tex.FaceTextures[i].RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; tex.FaceTextures[i].RGBA = texcolor; } texcolor = tex.DefaultTexture.RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; tex.DefaultTexture.RGBA = texcolor; } UpdateTextureEntry(tex.GetBytes()); @@ -2903,6 +2905,9 @@ namespace OpenSim.Region.Framework.Scenes /// 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); + // 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(); @@ -2911,10 +2916,10 @@ namespace OpenSim.Region.Framework.Scenes if (face >= 0 && face < GetNumberOfSides()) { texcolor = tex.CreateFace((uint)face).RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; + texcolor.A = clippedAlpha; tex.FaceTextures[face].RGBA = texcolor; UpdateTextureEntry(tex.GetBytes()); return; @@ -2926,17 +2931,17 @@ namespace OpenSim.Region.Framework.Scenes if (tex.FaceTextures[i] != null) { texcolor = tex.FaceTextures[i].RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; + texcolor.A = clippedAlpha; tex.FaceTextures[i].RGBA = texcolor; } texcolor = tex.DefaultTexture.RGBA; - texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f); - texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f); - texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f); - texcolor.A = Util.Clip((float)alpha, 0.0f, 1.0f); + texcolor.R = clippedColor.X; + texcolor.G = clippedColor.Y; + texcolor.B = clippedColor.Z; + texcolor.A = clippedAlpha; tex.DefaultTexture.RGBA = texcolor; } UpdateTextureEntry(tex.GetBytes()); -- cgit v1.1 From 481c00f50a1961ac77e800d64a68e9c30a4b69de Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Mon, 20 Aug 2012 09:31:29 +0100 Subject: refactoring out SetFaceColor --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 67 +++++----------------- 1 file changed, 15 insertions(+), 52 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 098b2d9..2a9ee3a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2851,62 +2851,16 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// 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()); -- cgit v1.1