From cd2c5843a86af5b6b49b6675e90b702b479fd258 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 2 Aug 2012 11:19:33 +0100 Subject: reduced-complexity implementation of function to get rezzing object key Signed-off-by: Melanie --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 3 ++- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 8 ++++++++ OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 8 ++++++++ OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 6 ++++++ OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 5 files changed, 29 insertions(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index d18fffd..a2016da 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2131,7 +2131,8 @@ namespace OpenSim.Region.Framework.Scenes if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) sourcePart.Inventory.RemoveInventoryItem(item.ItemID); } - + + group.RezzingObjectID = sourcePart.UUID; AddNewSceneObject(group, true, pos, rot, vel); // We can only call this after adding the scene object, since the scene object references the scene diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 52469a2..c9345e5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -611,6 +611,14 @@ namespace OpenSim.Region.Framework.Scenes public UUID FromItemID { get; set; } /// + /// Refers to the SceneObjectPart.UUID property of the object that this object was rezzed from, if applicable. + /// + /// + /// If not applicable will be UUID.Zero + /// + public UUID RezzingObjectID { get; set; } + + /// /// The folder ID that this object was rezzed from, if applicable. /// /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 44de176..e5a4fe8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3314,5 +3314,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return Math.Max(a, b); } + + public LSL_Key osGetRezzingObject() + { + CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); + m_host.AddScriptLPS(1); + + return new LSL_Key(m_host.ParentGroup.RezzingObjectID.ToString()); + } } } \ No newline at end of file diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index f73a85e..1f000a3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -299,5 +299,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// /// LSL_Float osMax(double a, double b); + + /// + /// Get the key of the object that rezzed this object. + /// + /// Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown. + LSL_Key osGetRezzingObject(); } } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 53daa13..94405d2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -945,5 +945,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_OSSL_Functions.osMax(a, b); } + + public LSL_Key osGetRezzingObject() + { + return m_OSSL_Functions.osGetRezzingObject(); + } } } -- cgit v1.1 From 86b005de1dc2192dc9d18988eed63e144a085866 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 2 Aug 2012 22:14:09 +0100 Subject: Add simple draw test for the VectorRenderModule --- .../VectorRender/Tests/VectorRenderModuleTests.cs | 75 ++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs new file mode 100644 index 0000000..9787c8c --- /dev/null +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs @@ -0,0 +1,75 @@ +/* + * Copyright (c) Contributors, http://opensimulator.org/ + * See CONTRIBUTORS.TXT for a full list of copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the OpenSimulator Project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +using System; +using System.Collections.Generic; +using System.IO; +using System.Reflection; +using System.Threading; +using log4net.Config; +using NUnit.Framework; +using OpenMetaverse; +using OpenMetaverse.Assets; +using OpenSim.Framework; +using OpenSim.Region.CoreModules.Scripting.DynamicTexture; +using OpenSim.Region.CoreModules.Scripting.VectorRender; +using OpenSim.Region.Framework.Scenes; +using OpenSim.Region.Framework.Scenes.Serialization; +using OpenSim.Tests.Common; +using OpenSim.Tests.Common.Mock; + +namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests +{ + [TestFixture] + public class VectorRenderModuleTests + { + [Test] + public void TestDraw() + { + TestHelpers.InMethod(); + + Scene scene = new SceneHelpers().SetupScene(); + DynamicTextureModule dtm = new DynamicTextureModule(); + VectorRenderModule vrm = new VectorRenderModule(); + SceneHelpers.SetupSceneModules(scene, dtm, vrm); + + SceneObjectGroup so = SceneHelpers.AddSceneObject(scene); + UUID originalTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; + + dtm.AddDynamicTextureData( + scene.RegionInfo.RegionID, + so.UUID, + vrm.GetContentType(), + "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", + "", + 0); + + + Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); + } + } +} \ No newline at end of file -- cgit v1.1 From 68406ab8f9fad40636a9e3576e80c1086b1f48f2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 2 Aug 2012 22:34:46 +0100 Subject: Initialize the Rezzing object to UUID.Zero --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index c9345e5..13cc5cd 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -26,6 +26,7 @@ */ using System; +using System.ComponentModel; using System.Collections.Generic; using System.Drawing; using System.IO; @@ -641,6 +642,7 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup() { + RezzingObjectID = UUID.Zero; } /// @@ -648,7 +650,7 @@ namespace OpenSim.Region.Framework.Scenes /// The original SceneObjectPart will be used rather than a copy, preserving /// its existing localID and UUID. /// - public SceneObjectGroup(SceneObjectPart part) + public SceneObjectGroup(SceneObjectPart part) : this() { SetRootPart(part); } @@ -656,9 +658,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Constructor. This object is added to the scene later via AttachToScene() /// - public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) + public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) :this(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)) { - SetRootPart(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)); } /// -- cgit v1.1 From eeef9d7e990cf158de5c143de546fc671169b3bd Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Aug 2012 00:00:54 +0100 Subject: Properly dispose of all GDI+ entities used in VectorRenderModule for dynamic textures. The convention is that if an object implements IDiposable() the code must explicitly call Dispose() or call it via the using statement. This may be particularly important for GDI+ objects since they encapsulate native code entities. --- .../Scripting/VectorRender/VectorRenderModule.cs | 569 ++++++++++++--------- 1 file changed, 316 insertions(+), 253 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index c061868..d039111 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -98,16 +98,18 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize) { - Font myFont = new Font(fontName, fontSize); - SizeF stringSize = new SizeF(); - lock (m_graph) { - stringSize = m_graph.MeasureString(text, myFont); - xSize = stringSize.Width; - ySize = stringSize.Height; + using (Font myFont = new Font(fontName, fontSize)) + { + SizeF stringSize = new SizeF(); + lock (m_graph) + { + stringSize = m_graph.MeasureString(text, myFont); + xSize = stringSize.Width; + ySize = stringSize.Height; + } } } - #endregion #region IRegionModule Members @@ -121,6 +123,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender if (m_graph == null) { + // We won't dispose of these explicitly since this module is only removed when the entire simulator + // is shut down. Bitmap bitmap = new Bitmap(1024, 1024, PixelFormat.Format32bppArgb); m_graph = Graphics.FromImage(bitmap); } @@ -299,53 +303,64 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } } - Bitmap bitmap; - - if (alpha == 256) - { - bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); - } - else - { - bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); - } - - Graphics graph = Graphics.FromImage(bitmap); - - // this is really just to save people filling the - // background color in their scripts, only do when fully opaque - if (alpha >= 255) - { - graph.FillRectangle(new SolidBrush(bgColor), 0, 0, width, height); - } + Bitmap bitmap = null; + Graphics graph = null; - for (int w = 0; w < bitmap.Width; w++) + try { - if (alpha <= 255) + if (alpha == 256) + bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb); + else + bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb); + + graph = Graphics.FromImage(bitmap); + + // this is really just to save people filling the + // background color in their scripts, only do when fully opaque + if (alpha >= 255) { - for (int h = 0; h < bitmap.Height; h++) + using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) { - bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); + graph.FillRectangle(bgFillBrush, 0, 0, width, height); } } - } - - GDIDraw(data, graph, altDataDelim); - - byte[] imageJ2000 = new byte[0]; + + for (int w = 0; w < bitmap.Width; w++) + { + if (alpha <= 255) + { + for (int h = 0; h < bitmap.Height; h++) + { + bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h))); + } + } + } + + GDIDraw(data, graph, altDataDelim); + + byte[] imageJ2000 = new byte[0]; + + try + { + imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Exception {0}{1}", + e.Message, e.StackTrace); + } - try - { - imageJ2000 = OpenJPEG.EncodeFromImage(bitmap, true); + m_textureManager.ReturnData(id, imageJ2000); } - catch (Exception e) + finally { - m_log.ErrorFormat( - "[VECTORRENDERMODULE]: OpenJpeg Encode Failed. Exception {0}{1}", - e.Message, e.StackTrace); - } + if (graph != null) + graph.Dispose(); - m_textureManager.ReturnData(id, imageJ2000); + if (bitmap != null) + bitmap.Dispose(); + } } private int parseIntParam(string strInt) @@ -407,238 +422,285 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender { Point startPoint = new Point(0, 0); Point endPoint = new Point(0, 0); - Pen drawPen = new Pen(Color.Black, 7); - string fontName = m_fontName; - float fontSize = 14; - Font myFont = new Font(fontName, fontSize); - SolidBrush myBrush = new SolidBrush(Color.Black); - - char[] lineDelimiter = {dataDelim}; - char[] partsDelimiter = {','}; - string[] lines = data.Split(lineDelimiter); + Pen drawPen = null; + Font myFont = null; + SolidBrush myBrush = null; - foreach (string line in lines) + try { - string nextLine = line.Trim(); - //replace with switch, or even better, do some proper parsing - if (nextLine.StartsWith("MoveTo")) - { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); - startPoint.X = (int) x; - startPoint.Y = (int) y; - } - else if (nextLine.StartsWith("LineTo")) - { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); - endPoint.X = (int) x; - endPoint.Y = (int) y; - graph.DrawLine(drawPen, startPoint, endPoint); - startPoint.X = endPoint.X; - startPoint.Y = endPoint.Y; - } - else if (nextLine.StartsWith("Text")) - { - nextLine = nextLine.Remove(0, 4); - nextLine = nextLine.Trim(); - graph.DrawString(nextLine, myFont, myBrush, startPoint); - } - else if (nextLine.StartsWith("Image")) + drawPen = new Pen(Color.Black, 7); + string fontName = m_fontName; + float fontSize = 14; + myFont = new Font(fontName, fontSize); + myBrush = new SolidBrush(Color.Black); + + char[] lineDelimiter = {dataDelim}; + char[] partsDelimiter = {','}; + string[] lines = data.Split(lineDelimiter); + + foreach (string line in lines) { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); - endPoint.X = (int) x; - endPoint.Y = (int) y; - Image image = ImageHttpRequest(nextLine); - if (image != null) + string nextLine = line.Trim(); + //replace with switch, or even better, do some proper parsing + if (nextLine.StartsWith("MoveTo")) { - graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); + startPoint.X = (int) x; + startPoint.Y = (int) y; } - else + else if (nextLine.StartsWith("LineTo")) { - graph.DrawString("URL couldn't be resolved or is", new Font(m_fontName,6), - myBrush, startPoint); - graph.DrawString("not an image. Please check URL.", new Font(m_fontName, 6), - myBrush, new Point(startPoint.X, 12 + startPoint.Y)); - graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 6, ref x, ref y); + endPoint.X = (int) x; + endPoint.Y = (int) y; + graph.DrawLine(drawPen, startPoint, endPoint); + startPoint.X = endPoint.X; + startPoint.Y = endPoint.Y; } - startPoint.X += endPoint.X; - startPoint.Y += endPoint.Y; - } - else if (nextLine.StartsWith("Rectangle")) - { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); - endPoint.X = (int) x; - endPoint.Y = (int) y; - graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); - startPoint.X += endPoint.X; - startPoint.Y += endPoint.Y; - } - else if (nextLine.StartsWith("FillRectangle")) - { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); - endPoint.X = (int) x; - endPoint.Y = (int) y; - graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); - startPoint.X += endPoint.X; - startPoint.Y += endPoint.Y; - } - else if (nextLine.StartsWith("FillPolygon")) - { - PointF[] points = null; - GetParams(partsDelimiter, ref nextLine, 11, ref points); - graph.FillPolygon(myBrush, points); - } - else if (nextLine.StartsWith("Polygon")) - { - PointF[] points = null; - GetParams(partsDelimiter, ref nextLine, 7, ref points); - graph.DrawPolygon(drawPen, points); - } - else if (nextLine.StartsWith("Ellipse")) - { - float x = 0; - float y = 0; - GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); - endPoint.X = (int)x; - endPoint.Y = (int)y; - graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); - startPoint.X += endPoint.X; - startPoint.Y += endPoint.Y; - } - else if (nextLine.StartsWith("FontSize")) - { - nextLine = nextLine.Remove(0, 8); - nextLine = nextLine.Trim(); - fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); - myFont = new Font(fontName, fontSize); - } - else if (nextLine.StartsWith("FontProp")) - { - nextLine = nextLine.Remove(0, 8); - nextLine = nextLine.Trim(); - - string[] fprops = nextLine.Split(partsDelimiter); - foreach (string prop in fprops) + else if (nextLine.StartsWith("Text")) + { + nextLine = nextLine.Remove(0, 4); + nextLine = nextLine.Trim(); + graph.DrawString(nextLine, myFont, myBrush, startPoint); + } + else if (nextLine.StartsWith("Image")) { + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 5, ref x, ref y); + endPoint.X = (int) x; + endPoint.Y = (int) y; - switch (prop) + using (Image image = ImageHttpRequest(nextLine)) { - case "B": - if (!(myFont.Bold)) - myFont = new Font(myFont, myFont.Style | FontStyle.Bold); - break; - case "I": - if (!(myFont.Italic)) - myFont = new Font(myFont, myFont.Style | FontStyle.Italic); - break; - case "U": - if (!(myFont.Underline)) - myFont = new Font(myFont, myFont.Style | FontStyle.Underline); - break; - case "S": - if (!(myFont.Strikeout)) - myFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); - break; - case "R": - myFont = new Font(myFont, FontStyle.Regular); - break; + if (image != null) + { + graph.DrawImage(image, (float)startPoint.X, (float)startPoint.Y, x, y); + } + else + { + using (Font errorFont = new Font(m_fontName,6)) + { + graph.DrawString("URL couldn't be resolved or is", errorFont, + myBrush, startPoint); + graph.DrawString("not an image. Please check URL.", errorFont, + myBrush, new Point(startPoint.X, 12 + startPoint.Y)); + } + + graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); + } } + + startPoint.X += endPoint.X; + startPoint.Y += endPoint.Y; } - } - else if (nextLine.StartsWith("FontName")) - { - nextLine = nextLine.Remove(0, 8); - fontName = nextLine.Trim(); - myFont = new Font(fontName, fontSize); - } - else if (nextLine.StartsWith("PenSize")) - { - nextLine = nextLine.Remove(0, 7); - nextLine = nextLine.Trim(); - float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); - drawPen.Width = size; - } - else if (nextLine.StartsWith("PenCap")) - { - bool start = true, end = true; - nextLine = nextLine.Remove(0, 6); - nextLine = nextLine.Trim(); - string[] cap = nextLine.Split(partsDelimiter); - if (cap[0].ToLower() == "start") - end = false; - else if (cap[0].ToLower() == "end") - start = false; - else if (cap[0].ToLower() != "both") - return; - string type = cap[1].ToLower(); - - if (end) + else if (nextLine.StartsWith("Rectangle")) { - switch (type) - { - case "arrow": - drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; - break; - case "round": - drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; - break; - case "diamond": - drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; - break; - case "flat": - drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat; - break; - } + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 9, ref x, ref y); + endPoint.X = (int) x; + endPoint.Y = (int) y; + graph.DrawRectangle(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); + startPoint.X += endPoint.X; + startPoint.Y += endPoint.Y; + } + else if (nextLine.StartsWith("FillRectangle")) + { + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 13, ref x, ref y); + endPoint.X = (int) x; + endPoint.Y = (int) y; + graph.FillRectangle(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); + startPoint.X += endPoint.X; + startPoint.Y += endPoint.Y; + } + else if (nextLine.StartsWith("FillPolygon")) + { + PointF[] points = null; + GetParams(partsDelimiter, ref nextLine, 11, ref points); + graph.FillPolygon(myBrush, points); } - if (start) + else if (nextLine.StartsWith("Polygon")) { - switch (type) + PointF[] points = null; + GetParams(partsDelimiter, ref nextLine, 7, ref points); + graph.DrawPolygon(drawPen, points); + } + else if (nextLine.StartsWith("Ellipse")) + { + float x = 0; + float y = 0; + GetParams(partsDelimiter, ref nextLine, 7, ref x, ref y); + endPoint.X = (int)x; + endPoint.Y = (int)y; + graph.DrawEllipse(drawPen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y); + startPoint.X += endPoint.X; + startPoint.Y += endPoint.Y; + } + else if (nextLine.StartsWith("FontSize")) + { + nextLine = nextLine.Remove(0, 8); + nextLine = nextLine.Trim(); + fontSize = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); + + myFont.Dispose(); + myFont = new Font(fontName, fontSize); + } + else if (nextLine.StartsWith("FontProp")) + { + nextLine = nextLine.Remove(0, 8); + nextLine = nextLine.Trim(); + + string[] fprops = nextLine.Split(partsDelimiter); + foreach (string prop in fprops) { - case "arrow": - drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; - break; - case "round": - drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; - break; - case "diamond": - drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; - break; - case "flat": - drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat; - break; + + switch (prop) + { + case "B": + if (!(myFont.Bold)) + { + Font newFont = new Font(myFont, myFont.Style | FontStyle.Bold); + myFont.Dispose(); + myFont = newFont; + } + break; + case "I": + if (!(myFont.Italic)) + { + Font newFont = new Font(myFont, myFont.Style | FontStyle.Italic); + myFont.Dispose(); + myFont = newFont; + } + break; + case "U": + if (!(myFont.Underline)) + { + Font newFont = new Font(myFont, myFont.Style | FontStyle.Underline); + myFont.Dispose(); + myFont = newFont; + } + break; + case "S": + if (!(myFont.Strikeout)) + { + Font newFont = new Font(myFont, myFont.Style | FontStyle.Strikeout); + myFont.Dispose(); + myFont = newFont; + } + break; + case "R": + Font newFont = new Font(myFont, FontStyle.Regular); + myFont.Dispose(); + myFont = newFont; + break; + } } } - } - else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor")) - { - nextLine = nextLine.Remove(0, 9); - nextLine = nextLine.Trim(); - int hex = 0; - - Color newColor; - if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) + else if (nextLine.StartsWith("FontName")) { - newColor = Color.FromArgb(hex); + nextLine = nextLine.Remove(0, 8); + fontName = nextLine.Trim(); + myFont.Dispose(); + myFont = new Font(fontName, fontSize); } - else + else if (nextLine.StartsWith("PenSize")) { - // this doesn't fail, it just returns black if nothing is found - newColor = Color.FromName(nextLine); + nextLine = nextLine.Remove(0, 7); + nextLine = nextLine.Trim(); + float size = Convert.ToSingle(nextLine, CultureInfo.InvariantCulture); + drawPen.Width = size; } + else if (nextLine.StartsWith("PenCap")) + { + bool start = true, end = true; + nextLine = nextLine.Remove(0, 6); + nextLine = nextLine.Trim(); + string[] cap = nextLine.Split(partsDelimiter); + if (cap[0].ToLower() == "start") + end = false; + else if (cap[0].ToLower() == "end") + start = false; + else if (cap[0].ToLower() != "both") + return; + string type = cap[1].ToLower(); + + if (end) + { + switch (type) + { + case "arrow": + drawPen.EndCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; + break; + case "round": + drawPen.EndCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; + break; + case "diamond": + drawPen.EndCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; + break; + case "flat": + drawPen.EndCap = System.Drawing.Drawing2D.LineCap.Flat; + break; + } + } + if (start) + { + switch (type) + { + case "arrow": + drawPen.StartCap = System.Drawing.Drawing2D.LineCap.ArrowAnchor; + break; + case "round": + drawPen.StartCap = System.Drawing.Drawing2D.LineCap.RoundAnchor; + break; + case "diamond": + drawPen.StartCap = System.Drawing.Drawing2D.LineCap.DiamondAnchor; + break; + case "flat": + drawPen.StartCap = System.Drawing.Drawing2D.LineCap.Flat; + break; + } + } + } + else if (nextLine.StartsWith("PenColour") || nextLine.StartsWith("PenColor")) + { + nextLine = nextLine.Remove(0, 9); + nextLine = nextLine.Trim(); + int hex = 0; + + Color newColor; + if (Int32.TryParse(nextLine, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out hex)) + { + newColor = Color.FromArgb(hex); + } + else + { + // this doesn't fail, it just returns black if nothing is found + newColor = Color.FromName(nextLine); + } - myBrush.Color = newColor; - drawPen.Color = newColor; + myBrush.Color = newColor; + drawPen.Color = newColor; + } } } + finally + { + if (drawPen != null) + drawPen.Dispose(); + + if (myFont != null) + myFont.Dispose(); + + if (myBrush != null) + myBrush.Dispose(); + } } private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) @@ -691,7 +753,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender { try { - WebRequest request = HttpWebRequest.Create(url); + WebRequest request = HttpWebRequest.Create(url); //Ckrinke: Comment out for now as 'str' is unused. Bring it back into play later when it is used. //Ckrinke Stream str = null; HttpWebResponse response = (HttpWebResponse)(request).GetResponse(); @@ -702,7 +764,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } } catch { } + return null; } } -} +} \ No newline at end of file -- cgit v1.1 From 0cd698d82bc8f0fca4444a2691cd43147deb02a5 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Aug 2012 00:23:03 +0100 Subject: Delete old blank SOGSpamTest --- .../Region/CoreModules/World/Tests/SOGSpamTest.cs | 37 ---------------------- 1 file changed, 37 deletions(-) delete mode 100644 OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs b/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs deleted file mode 100644 index 53d775e..0000000 --- a/OpenSim/Region/CoreModules/World/Tests/SOGSpamTest.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.CoreModules.World.Tests -{ - class SOGSpamTest - { - } -} -- cgit v1.1 From 293d0cc6291550b1892bd9ac27b8e4ba8dcd4f5a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Aug 2012 00:23:56 +0100 Subject: minor: Comment out "Deleting asset" log messages for now --- OpenSim/Services/AssetService/AssetService.cs | 3 ++- OpenSim/Services/AssetService/XAssetService.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs index 137a9b0..b1f0f7e 100644 --- a/OpenSim/Services/AssetService/AssetService.cs +++ b/OpenSim/Services/AssetService/AssetService.cs @@ -191,7 +191,8 @@ namespace OpenSim.Services.AssetService public virtual bool Delete(string id) { - m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id); +// m_log.DebugFormat("[ASSET SERVICE]: Deleting asset {0}", id); + UUID assetID; if (!UUID.TryParse(id, out assetID)) return false; diff --git a/OpenSim/Services/AssetService/XAssetService.cs b/OpenSim/Services/AssetService/XAssetService.cs index 05eb125..e62bcb5 100644 --- a/OpenSim/Services/AssetService/XAssetService.cs +++ b/OpenSim/Services/AssetService/XAssetService.cs @@ -188,7 +188,8 @@ namespace OpenSim.Services.AssetService public virtual bool Delete(string id) { - m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id); +// m_log.DebugFormat("[XASSET SERVICE]: Deleting asset {0}", id); + UUID assetID; if (!UUID.TryParse(id, out assetID)) return false; -- cgit v1.1 From 8b04e8a297054a2c16978a1ee3c92460c11eaccc Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Thu, 2 Aug 2012 16:30:23 -0700 Subject: BulletSim: Debugging log statements added. Reduced size of updata buffer trying to find a corrupted memory problem. Update DLL and SO. --- OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs | 4 +++- OpenSim/Region/Physics/BulletSPlugin/BSScene.cs | 29 ++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index a4ab702..ebfd85b 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -1331,13 +1331,15 @@ public sealed class BSPrim : PhysicsActor base.RequestPhysicsterseUpdate(); } + /* else { - // For debugging, we can also report the movement of children + // For debugging, we also report the movement of children DetailLog("{0},UpdateProperties,child,pos={1},orient={2},vel={3},accel={4},rotVel={5}", LocalID, entprop.Position, entprop.Rotation, entprop.Velocity, entprop.Acceleration, entprop.RotationalVelocity); } + */ } // I've collided with something diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index 28d5cb5..011033c 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -390,9 +390,9 @@ public class BSScene : PhysicsScene, IPhysicsParameters // Simulate one timestep public override float Simulate(float timeStep) { - int updatedEntityCount; + int updatedEntityCount = 0; IntPtr updatedEntitiesPtr; - int collidersCount; + int collidersCount = 0; IntPtr collidersPtr; LastSimulatedTimestep = timeStep; @@ -411,8 +411,21 @@ public class BSScene : PhysicsScene, IPhysicsParameters // step the physical world one interval m_simulationStep++; - int numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep, - out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); + int numSubSteps = 0; + try + { + numSubSteps = BulletSimAPI.PhysicsStep(m_worldID, timeStep, m_maxSubSteps, m_fixedTimeStep, + out updatedEntityCount, out updatedEntitiesPtr, out collidersCount, out collidersPtr); + DetailLog("{0},Simulate,call, substeps={1}, updates={2}, colliders={3}", "0000000000", numSubSteps, updatedEntityCount, collidersCount); + } + catch (Exception e) + { + m_log.WarnFormat("{0},PhysicsStep Exception: substeps={1}, updates={2}, colliders={3}, e={4}", LogHeader, numSubSteps, updatedEntityCount, collidersCount, e); + DetailLog("{0},PhysicsStepException,call, substeps={1}, updates={2}, colliders={3}", "0000000000", numSubSteps, updatedEntityCount, collidersCount); + // updatedEntityCount = 0; + collidersCount = 0; + } + // Don't have to use the pointers passed back since we know it is the same pinned memory we passed in @@ -711,7 +724,7 @@ public class BSScene : PhysicsScene, IPhysicsParameters return true; } - // The calls to the PhysicsActors can't directly call into the physics engine + // Calls to the PhysicsActors can't directly call into the physics engine // because it might be busy. We delay changes to a known time. // We rely on C#'s closure to save and restore the context for the delegate. public void TaintedObject(TaintCallback callback) @@ -1275,5 +1288,11 @@ public class BSScene : PhysicsScene, IPhysicsParameters #endregion Runtime settable parameters + // Invoke the detailed logger and output something if it's enabled. + private void DetailLog(string msg, params Object[] args) + { + PhysicsLogging.Write(msg, args); + } + } } -- cgit v1.1 From 72075e68c7209afee10f365fc14b1fabffcc66a3 Mon Sep 17 00:00:00 2001 From: Kevin Cozens Date: Sun, 29 Jul 2012 17:02:10 -0400 Subject: Save membership fee to the database when a group is created. --- .../XmlRpcGroupsServicesConnectorModule.cs | 50 +++++++++++----------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs index 61aaf04..d412cd1 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/XmlRpcGroupsServicesConnectorModule.cs @@ -54,12 +54,12 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups private bool m_debugEnabled = false; - public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | - GroupPowers.Accountable | - GroupPowers.JoinChat | - GroupPowers.AllowVoiceChat | - GroupPowers.ReceiveNotices | - GroupPowers.StartProposal | + public const GroupPowers m_DefaultEveryonePowers = GroupPowers.AllowSetHome | + GroupPowers.Accountable | + GroupPowers.JoinChat | + GroupPowers.AllowVoiceChat | + GroupPowers.ReceiveNotices | + GroupPowers.StartProposal | GroupPowers.VoteOnProposal; private bool m_connectorEnabled = false; @@ -201,8 +201,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups /// /// Create a Group, including Everyone and Owners Role, place FounderID in both groups, select Owner as selected role, and newly created group as agent's active role. /// - public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, - int membershipFee, bool openEnrollment, bool allowPublish, + public UUID CreateGroup(UUID requestingAgentID, string name, string charter, bool showInList, UUID insigniaID, + int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish, UUID founderID) { UUID GroupID = UUID.Random(); @@ -214,7 +214,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups param["Charter"] = charter; param["ShowInList"] = showInList == true ? 1 : 0; param["InsigniaID"] = insigniaID.ToString(); - param["MembershipFee"] = 0; + param["MembershipFee"] = membershipFee; param["OpenEnrollment"] = openEnrollment == true ? 1 : 0; param["AllowPublish"] = allowPublish == true ? 1 : 0; param["MaturePublish"] = maturePublish == true ? 1 : 0; @@ -285,8 +285,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return UUID.Parse((string)respData["GroupID"]); } - public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, - UUID insigniaID, int membershipFee, bool openEnrollment, + public void UpdateGroup(UUID requestingAgentID, UUID groupID, string charter, bool showInList, + UUID insigniaID, int membershipFee, bool openEnrollment, bool allowPublish, bool maturePublish) { Hashtable param = new Hashtable(); @@ -302,7 +302,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestingAgentID, "groups.updateGroup", param); } - public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, + public void AddGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers) { Hashtable param = new Hashtable(); @@ -325,7 +325,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups XmlRpcCall(requestingAgentID, "groups.removeRoleFromGroup", param); } - public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, + public void UpdateGroupRole(UUID requestingAgentID, UUID groupID, UUID roleID, string name, string description, string title, ulong powers) { Hashtable param = new Hashtable(); @@ -580,7 +580,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups memberships.Add(HashTableToGroupMembershipData((Hashtable)membership)); } } - + return memberships; } @@ -800,9 +800,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups public bool hasAgentDroppedGroupChatSession(UUID agentID, UUID groupID) { - // If we're tracking drops for this group, + // If we're tracking drops for this group, // and we find them, well... then they've dropped - return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) + return m_groupsAgentsDroppedFromChatSession.ContainsKey(groupID) && m_groupsAgentsDroppedFromChatSession[groupID].Contains(agentID); } @@ -888,7 +888,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups return group; } - + private static GroupMembershipData HashTableToGroupMembershipData(Hashtable respData) { GroupMembershipData data = new GroupMembershipData(); @@ -921,7 +921,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups data.MembershipFee = int.Parse((string)respData["MembershipFee"]); data.OpenEnrollment = ((string)respData["OpenEnrollment"] == "1"); data.ShowInList = ((string)respData["ShowInList"] == "1"); - + return data; } @@ -958,7 +958,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups m_memoryCache.TryGetValue(CacheKey, out resp); } } - + if (resp == null) { if (m_debugEnabled) @@ -967,7 +967,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups string UserService; UUID SessionID; GetClientGroupRequestID(requestingAgentID, out UserService, out SessionID); - + param.Add("RequestingAgentID", requestingAgentID.ToString()); param.Add("RequestingAgentUserService", UserService); param.Add("RequestingSessionID", SessionID.ToString()); @@ -992,9 +992,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups catch (Exception e) { m_log.ErrorFormat( - "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", + "[XMLRPC-GROUPS-CONNECTOR]: An error has occured while attempting to access the XmlRpcGroups server method {0} at {1}", function, m_groupsServerURI); - + m_log.ErrorFormat("[XMLRPC-GROUPS-CONNECTOR]: {0}{1}", e.Message, e.StackTrace); foreach (string ResponseLine in req.RequestResponse.Split(new string[] { Environment.NewLine }, StringSplitOptions.None)) @@ -1061,9 +1061,9 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } } } - + /// - /// Group Request Tokens are an attempt to allow the groups service to authenticate + /// Group Request Tokens are an attempt to allow the groups service to authenticate /// requests. /// TODO: This broke after the big grid refactor, either find a better way, or discard this /// @@ -1103,7 +1103,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups } */ } - + } } -- cgit v1.1 From 0588f27d1886970e44765166714f24114d399fce Mon Sep 17 00:00:00 2001 From: Oren Hurvitz Date: Mon, 16 Jul 2012 10:30:38 +0300 Subject: Fixed a rare bug that caused Save OAR to fail because it thought it had timed-out The bug manifested as follows: a large world was saved. All the assets were found. But for some unknown reason, the timeout timer was restarted. So after 1 minute it closed the Archive Writer, because it didn't receive any more assets during that minute. That caused the OAR to become corrupted because ArchiveWriteRequestExecution.Save() was still running. --- .../Region/CoreModules/World/Archiver/AssetsRequest.cs | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs index 55110dc..a073cb9 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs @@ -154,6 +154,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args) { + bool close = true; + try { lock (this) @@ -161,7 +163,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver // Take care of the possibilty that this thread started but was paused just outside the lock before // the final request came in (assuming that such a thing is possible) if (m_requestState == RequestState.Completed) + { + close = false; return; + } m_requestState = RequestState.Aborted; } @@ -208,7 +213,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver } finally { - m_assetsArchiver.ForceClose(); + if (close) + m_assetsArchiver.ForceClose(); } } @@ -242,11 +248,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_requestCallbackTimer.Stop(); - if (m_requestState == RequestState.Aborted) + if ((m_requestState == RequestState.Aborted) || (m_requestState == RequestState.Completed)) { m_log.WarnFormat( - "[ARCHIVER]: Received information about asset {0} after archive save abortion. Ignoring.", - id); + "[ARCHIVER]: Received information about asset {0} while in state {1}. Ignoring.", + id, m_requestState); return; } @@ -268,7 +274,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver m_notFoundAssetUuids.Add(new UUID(id)); } - if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count == m_repliesRequired) + if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired) { m_requestState = RequestState.Completed; -- cgit v1.1 From cd9fd77e2cf94b0f782ada2c925c1d77bee3a425 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Wed, 1 Aug 2012 16:34:00 +0100 Subject: ImprovedTerseObjectUpdate packet does not support shape updates, thus scheduling terse updates will not (and does not) update shape information in the viewer --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4b2fede..4c87639 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2467,7 +2467,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Schedule a terse update for this prim. Terse updates only send position, - /// rotation, velocity, rotational velocity and shape information. + /// rotation, velocity and rotational velocity information. /// public void ScheduleTerseUpdate() { -- cgit v1.1 From 08ec18f8a3959c7326cea634258c0c04d2170b36 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Aug 2012 02:08:04 +0100 Subject: Don't bothre setting RezzingObjectID to UUID.Zero in SOG constructor - this is already its default value as it's a struct. --- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 13cc5cd..890971d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -642,7 +642,6 @@ namespace OpenSim.Region.Framework.Scenes /// public SceneObjectGroup() { - RezzingObjectID = UUID.Zero; } /// @@ -650,7 +649,8 @@ namespace OpenSim.Region.Framework.Scenes /// The original SceneObjectPart will be used rather than a copy, preserving /// its existing localID and UUID. /// - public SceneObjectGroup(SceneObjectPart part) : this() + /// Root part for this scene object. + public SceneObjectGroup(SceneObjectPart part) { SetRootPart(part); } @@ -658,7 +658,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// Constructor. This object is added to the scene later via AttachToScene() /// - public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) :this(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)) + public SceneObjectGroup(UUID ownerID, Vector3 pos, Quaternion rot, PrimitiveBaseShape shape) + :this(new SceneObjectPart(ownerID, shape, pos, rot, Vector3.Zero)) { } -- cgit v1.1 From 513b77b78d8990b1f7edd0f91625f286286e131d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Aug 2012 02:26:54 +0100 Subject: refactor: rename SOG.RezzingObjectID to SOG.FromPartID to match FromFolderID, FromItemID and to reflect that it's a SOP ID rather than a SOG ID. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index a2016da..7e31d60 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2132,7 +2132,7 @@ namespace OpenSim.Region.Framework.Scenes sourcePart.Inventory.RemoveInventoryItem(item.ItemID); } - group.RezzingObjectID = sourcePart.UUID; + group.FromPartID = sourcePart.UUID; AddNewSceneObject(group, true, pos, rot, vel); // We can only call this after adding the scene object, since the scene object references the scene diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 890971d..7b284ae 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -617,7 +617,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// If not applicable will be UUID.Zero /// - public UUID RezzingObjectID { get; set; } + public UUID FromPartID { get; set; } /// /// The folder ID that this object was rezzed from, if applicable. diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e5a4fe8..bcd1a6f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3320,7 +3320,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osGetRezzingObject"); m_host.AddScriptLPS(1); - return new LSL_Key(m_host.ParentGroup.RezzingObjectID.ToString()); + return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); } } } \ No newline at end of file -- cgit v1.1 From b8ba224b4f920a1c5f89acb13100d6568cbc3d1c Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 15:33:30 +0200 Subject: Remove another superflouous IsActive set --- OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 2 -- 1 file changed, 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 1410cf6..8cac731 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -551,8 +551,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP OutPacket(disable, ThrottleOutPacketType.Unknown); } -// IsActive = false; - // Shutdown the image manager ImageManager.Close(); -- cgit v1.1 From 83deb4603204c01fd6fc6b0a0e04afbeeae73771 Mon Sep 17 00:00:00 2001 From: Melanie Date: Fri, 3 Aug 2012 16:03:40 +0200 Subject: Make WaitGetScenePresence wait for up to 20 seconds --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c260fb2..3db7c7d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4255,7 +4255,7 @@ namespace OpenSim.Region.Framework.Scenes /// protected virtual ScenePresence WaitGetScenePresence(UUID agentID) { - int ntimes = 10; + int ntimes = 20; ScenePresence sp = null; while ((sp = GetScenePresence(agentID)) == null && (ntimes-- > 0)) Thread.Sleep(1000); -- cgit v1.1