From 663bfbb372218af6e2a854a011152c9efdb82eaa Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:18:36 +0100 Subject: although the attachmentPoint argument is a uint, zero is not a valid attachment point --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5bf69ad..22d3289 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3418,7 +3418,9 @@ namespace OpenSim.Region.Framework.Scenes public List GetAttachments(uint attachmentPoint) { List attachments = new List(); - + + if (attachmentPoint >= 0) + { lock (m_attachments) { foreach (SceneObjectGroup so in m_attachments) @@ -3427,6 +3429,7 @@ namespace OpenSim.Region.Framework.Scenes attachments.Add(so); } } + } return attachments; } -- cgit v1.1 From 8d431c63594b7576fe295d50658531e81df2ac4e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:20:07 +0100 Subject: formatting --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 22d3289..1222ac6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3421,15 +3421,15 @@ namespace OpenSim.Region.Framework.Scenes if (attachmentPoint >= 0) { - lock (m_attachments) - { - foreach (SceneObjectGroup so in m_attachments) + lock (m_attachments) { - if (attachmentPoint == so.AttachmentPoint) - attachments.Add(so); + foreach (SceneObjectGroup so in m_attachments) + { + if (attachmentPoint == so.AttachmentPoint) + attachments.Add(so); + } } } - } return attachments; } -- cgit v1.1 From a858c5daee64223355de04b77746142be0f5795f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:39:49 +0100 Subject: implementing a function to get the number of attachments worn --- .../Shared/Api/Implementation/OSSL_Api.cs | 38 ++++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 10 ++++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 7 ++++ 3 files changed, 55 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index e245684..57f1e65 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3313,6 +3313,44 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api ((LSL_Api)m_LSL_Api).DetachFromAvatar(); } + public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints) + { + CheckThreatLevel(ThreatLevel.Moderate, "osGetNumberOfAttachments"); + + m_host.AddScriptLPS(1); + + UUID targetUUID; + ScenePresence target; + LSL_List resp = new LSL_List(); + + if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) + { + foreach (object point in attachmentPoints.Data) + { + LSL_Integer ipoint = new LSL_Integer( + (point is LSL_Integer || point is int || point is uint) ? + (int)point : + 0 + ); + resp.Add(ipoint); + if (ipoint == 0) + { + // indicates zero attachments + resp.Add(new LSL_Integer(0)); + } + else + { + // gets the number of attachments on the attachment point + resp.Add(new LSL_Integer(target.GetAttachments((uint)ipoint).Count)); + } + } + } + + return resp; + } + + #endregion + /// /// Checks if thing is a UUID. /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 06729ab..6db6443 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -192,6 +192,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// Nothing happens if the object is not attached. void osForceDetachFromAvatar(); + /// + /// Returns a strided list of the specified attachment points and the number of attachments on those points. + /// + /// avatar UUID + /// list of ATTACH_* constants + /// + LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints); + + #endregion + //texture draw functions string osMovePen(string drawList, int x, int y); string osDrawLine(string drawList, int startX, int startY, int endX, int endY); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index ba1ade2..230c378 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -311,6 +311,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osForceDetachFromAvatar(); } + public LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints) + { + return m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints); + } + + #endregion + // Texture Draw functions public string osMovePen(string drawList, int x, int y) -- cgit v1.1 From d4b8a13a1d63c950feba694eca53df06f2cc5792 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:43:04 +0100 Subject: refactoring the grunt work of MessageObject into a private method with a UUID argument --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 57f1e65..82114b3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1673,6 +1673,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } + MessageObject(objUUID, message); + } + + private void MessageObject(UUID objUUID, string message) + { object[] resobj = new object[] { new LSL_Types.LSLString(m_host.UUID.ToString()), new LSL_Types.LSLString(message) }; SceneObjectPart sceneOP = World.GetSceneObjectPart(objUUID); -- cgit v1.1 From ff867b59cf59fdab19413cd46f3dd04058fbf3c7 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:44:11 +0100 Subject: Implementing functing to send messages directly to attachments --- .../Shared/Api/Implementation/OSSL_Api.cs | 131 +++++++++++++++++++++ .../ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 13 ++ .../Shared/Api/Runtime/LSL_Constants.cs | 52 ++++++++ .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 + 4 files changed, 201 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 82114b3..8e80b4c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3354,6 +3354,137 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return resp; } + public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int options) + { + CheckThreatLevel(ThreatLevel.Moderate, "osMessageAttachments"); + m_host.AddScriptLPS(1); + + UUID targetUUID; + ScenePresence target; + + if (attachmentPoints.Length >= 1 && UUID.TryParse(avatar.ToString(), out targetUUID) && World.TryGetScenePresence(targetUUID, out target)) + { + List aps = new List(); + foreach (object point in attachmentPoints.Data) + { + int ipoint; + if (int.TryParse(point.ToString(), out ipoint)) + { + aps.Add(ipoint); + } + } + + List attachments = new List(); + + bool msgAll = aps.Contains(ScriptBaseClass.OS_ATTACH_MSG_ALL); + bool invertPoints = (options & ScriptBaseClass.OS_ATTACH_MSG_INVERT_POINTS) != 0; + + if (msgAll && invertPoints) + { + return; + } + else if (msgAll || invertPoints) + { + attachments = target.GetAttachments(); + } + else + { + foreach (int point in aps) + { + if (point > 0) + { + attachments.AddRange(target.GetAttachments((uint)point)); + } + } + } + + // if we have no attachments at this point, exit now + if (attachments.Count == 0) + { + return; + } + + List ignoreThese = new List(); + + if (invertPoints) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (aps.Contains((int)attachment.AttachmentPoint)) + { + ignoreThese.Add(attachment); + } + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if inverting removed all attachments to check, exit now + if (attachments.Count < 1) + { + return; + } + + if ((options & ScriptBaseClass.OS_ATTACH_MSG_OBJECT_CREATOR) != 0) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (attachment.RootPart.CreatorID != m_host.CreatorID) + { + ignoreThese.Add(attachment); + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if filtering by same object creator removed all + // attachments to check, exit now + if (attachments.Count == 0) + { + return; + } + } + + if ((options & ScriptBaseClass.OS_ATTACH_MSG_SCRIPT_CREATOR) != 0) + { + foreach (SceneObjectGroup attachment in attachments) + { + if (attachment.RootPart.CreatorID != m_item.CreatorID) + { + ignoreThese.Add(attachment); + } + } + + foreach (SceneObjectGroup attachment in ignoreThese) + { + attachments.Remove(attachment); + } + ignoreThese.Clear(); + + // if filtering by object creator must match originating + // script creator removed all attachments to check, + // exit now + if (attachments.Count == 0) + { + return; + } + } + + foreach (SceneObjectGroup attachment in attachments) + { + MessageObject(attachment.RootPart.UUID, message); + } + } + } + #endregion /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 6db6443..bde7a8e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -200,6 +200,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces /// LSL_List osGetNumberOfAttachments(LSL_Key avatar, LSL_List attachmentPoints); + /// + /// Sends a specified message to the specified avatar's attachments on + /// the specified attachment points. + /// + /// + /// Behaves as osMessageObject(), without the sending script needing to know the attachment keys in advance. + /// + /// avatar UUID + /// message string + /// list of ATTACH_* constants, or -1 for all attachments. If -1 is specified and OS_ATTACH_MSG_INVERT_POINTS is present in flags, no action is taken. + /// flags further constraining the attachments to deliver the message to. + void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags); + #endregion //texture draw functions diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index cad8518..60a7e14 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -237,6 +237,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int ATTACH_HUD_BOTTOM = 37; public const int ATTACH_HUD_BOTTOM_RIGHT = 38; + #region osMessageAttachments constants + + /// + /// Instructs osMessageAttachements to send the message to attachments + /// on every point. + /// + /// + /// One might expect this to be named OS_ATTACH_ALL, but then one might + /// also expect functions designed to attach or detach or get + /// attachments to work with it too. Attaching a no-copy item to + /// many attachments could be dangerous. + /// when combined with OS_ATTACH_MSG_INVERT_POINTS, will prevent the + /// message from being sent. + /// if combined with OS_ATTACH_MSG_OBJECT_CREATOR or + /// OS_ATTACH_MSG_SCRIPT_CREATOR, could result in no message being + /// sent- this is expected behaviour. + /// + public const int OS_ATTACH_MSG_ALL = -65535; + + /// + /// Instructs osMessageAttachements to invert how the attachment points + /// list should be treated (e.g. go from inclusive operation to + /// exclusive operation). + /// + /// + /// This might be used if you want to deliver a message to one set of + /// attachments and a different message to everything else. With + /// this flag, you only need to build one explicit list for both calls. + /// + public const int OS_ATTACH_MSG_INVERT_POINTS = 1; + + /// + /// Instructs osMessageAttachments to only send the message to + /// attachments with a CreatorID that matches the host object CreatorID + /// + /// + /// This would be used if distributed in an object vendor/updater server. + /// + public const int OS_ATTACH_MSG_OBJECT_CREATOR = 2; + + /// + /// Instructs osMessageAttachments to only send the message to + /// attachments with a CreatorID that matches the sending script CreatorID + /// + /// + /// This might be used if the script is distributed independently of a + /// containing object. + /// + public const int OS_ATTACH_MSG_SCRIPT_CREATOR = 4; + + #endregion + public const int LAND_LEVEL = 0; public const int LAND_RAISE = 1; public const int LAND_LOWER = 2; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 230c378..08ebfd6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -316,6 +316,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetNumberOfAttachments(avatar, attachmentPoints); } + public void osMessageAttachments(LSL_Key avatar, string message, LSL_List attachmentPoints, int flags) + { + m_OSSL_Functions.osMessageAttachments(avatar, message, attachmentPoints, flags); + } + #endregion // Texture Draw functions -- cgit v1.1 From 07dbe46ba3c2b949c9da34eaa80d7e1afd68fece Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Sat, 1 Sep 2012 02:45:07 +0100 Subject: wrapping attachment functions in a region --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 2 ++ OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | 2 +- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 8e80b4c..2e1e5b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -3229,6 +3229,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } + #region Attachment commands + public void osForceAttachToAvatar(int attachmentPoint) { CheckThreatLevel(ThreatLevel.High, "osForceAttachToAvatar"); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index bde7a8e..3985e66 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -157,7 +157,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osAvatarPlayAnimation(string avatar, string animation); void osAvatarStopAnimation(string avatar, string animation); - // Attachment commands + #region Attachment commands /// /// Attach the object containing this script to the avatar that owns it without asking for PERMISSION_ATTACH diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 08ebfd6..52ca3da 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -289,7 +289,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osAvatarStopAnimation(avatar, animation); } - // Avatar functions + #region Attachment commands public void osForceAttachToAvatar(int attachmentPoint) { -- cgit v1.1 From 641b08aa781fcf4c1bf6d8425c98a302f96a8b88 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Wed, 5 Sep 2012 09:13:16 -0700 Subject: Enables cast from int to float for MOD* functions; Thanks SignpostMarv! --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs index 84cf6ca..cde2d9f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/MOD_Api.cs @@ -310,7 +310,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // ---------- Integer ---------- else if (lslparm is LSL_Integer) { - if (type == typeof(int)) + if (type == typeof(int) || type == typeof(float)) return (int)(LSL_Integer)lslparm; } -- cgit v1.1 From a0d0c9f751f45d54772af2e33866b27c9be33511 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 6 Sep 2012 00:11:47 +0100 Subject: If the GetTexture capability receives a request for a range of data beyond that of an otherwise valid asset, return HTTP PartialContent rather than RequestedRangeNotSatisfiable. This is because recent viewers (3.2.1, 3.3.4) and probably earlier ones using the http GetTexture capability will sometimes make such invalid range requests. This appears to happen if the viewer's estimate of texture sizes at discard levels > 0 (chiefly 2) exceeds the total texture size. I believe this does not normally happen but can occur for dynamic textures with are large but mainly blank. If this happens, returning a RequestedRangeNotSatisfiable will cause the viewer to not render the texture at the final resolution. However, returning a PartialContent (or OK) even with 0 data will allow the viewer to render the final texture. --- .../Scripting/DynamicTexture/DynamicTextureModule.cs | 16 +++++++++++++--- .../Scripting/VectorRender/VectorRenderModule.cs | 20 ++++++++++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 3eedf49..e09f1a9 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture { public class DynamicTextureModule : IRegionModule, IDynamicTextureManager { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private const int ALL_SIDES = -1; @@ -249,10 +249,18 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } } +// m_log.DebugFormat( +// "[DYNAMIC TEXTURE MODULE]: Requesting generation of new dynamic texture for {0} in {1}", +// part.Name, part.ParentGroup.Scene.Name); + RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams); } else { +// m_log.DebugFormat( +// "[DYNAMIC TEXTURE MODULE]: Reusing cached texture {0} for {1} in {2}", +// objReusableTextureUUID, part.Name, part.ParentGroup.Scene.Name); + // No need to add to updaters as the texture is always the same. Not that this functionality // apppears to be implemented anyway. updater.UpdatePart(part, (UUID)objReusableTextureUUID); @@ -448,8 +456,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); if (cacheLayerDecode != null) { - cacheLayerDecode.Decode(asset.FullID, asset.Data); - cacheLayerDecode = null; + if (!cacheLayerDecode.Decode(asset.FullID, asset.Data)) + m_log.WarnFormat( + "[DYNAMIC TEXTURE MODULE]: Decoding of dynamically generated asset {0} for {1} in {2} failed", + asset.ID, part.Name, part.ParentGroup.Scene.Name); } UUID oldID = UpdatePart(part, asset.FullID); diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 4268f2e..0e7051e 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -46,6 +46,11 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender { public class VectorRenderModule : IRegionModule, IDynamicTextureRender { + // These fields exist for testing purposes, please do not remove. +// private static bool s_flipper; +// private static byte[] s_asset1Data; +// private static byte[] s_asset2Data; + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; @@ -161,6 +166,13 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender { m_textureManager.RegisterRender(GetContentType(), this); } + + // This code exists for testing purposes, please do not remove. +// s_asset1Data = m_scene.AssetService.Get("00000000-0000-1111-9999-000000000001").Data; +// s_asset1Data = m_scene.AssetService.Get("9f4acf0d-1841-4e15-bdb8-3a12efc9dd8f").Data; + + // Terrain dirt - smallest bin/assets file (6004 bytes) +// s_asset2Data = m_scene.AssetService.Get("b8d3965a-ad78-bf43-699b-bff8eca6c975").Data; } public void Close() @@ -364,6 +376,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender } byte[] imageJ2000 = new byte[0]; + + // This code exists for testing purposes, please do not remove. +// if (s_flipper) +// imageJ2000 = s_asset1Data; +// else +// imageJ2000 = s_asset2Data; +// +// s_flipper = !s_flipper; try { -- cgit v1.1 From 5eb2526e889cd49d1c77e6e057f847cfd990268f Mon Sep 17 00:00:00 2001 From: BlueWall Date: Thu, 6 Sep 2012 05:13:10 -0400 Subject: 0006270: Warp3D leaks memory on mono based systems Thanks Hiro Lecker for a patch to reduce memory useage with Warp3D map module --- OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index 9002a9f..ed9b127 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -208,6 +208,9 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap bitmap = ImageUtils.ResizeImage(origBitmap, viewport.Width, viewport.Height); } + GC.Collect(); + m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); + return bitmap; } @@ -673,4 +676,4 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap return result; } } -} \ No newline at end of file +} -- cgit v1.1 From d2e79e26d7ea99b222a9c432b3727c558cd39f6e Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:40:37 +0100 Subject: adding utility method for getting SceneObjectPart from scene Signed-off-by: BlueWall --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2b4dea4..1771bf9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4613,6 +4613,18 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Attempt to get a prim via its UUID + /// + /// + /// + /// + public bool TryGetSceneObjectPart(UUID fullID, out SceneObjectPart sop) + { + sop = GetSceneObjectPart(fullID); + return sop != null; + } + + /// /// Get a scene object group that contains the prim with the given local id /// /// -- cgit v1.1 From 4215877b4848bd185ec20b50118b36b53cbfd604 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Thu, 6 Sep 2012 10:40:26 +0100 Subject: adding utility method for getting SceneObjectGroup from scene Signed-off-by: BlueWall --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1771bf9..a2d553d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4582,6 +4582,18 @@ namespace OpenSim.Region.Framework.Scenes } /// + /// Attempt to get the SOG via its UUID + /// + /// + /// + /// + public bool TryGetSceneObjectGroup(UUID fullID, out SceneObjectGroup sog) + { + sog = GetSceneObjectGroup(fullID); + return sog != null; + } + + /// /// Get a prim by name from the scene (will return the first /// found, if there are more than one prim with the same name) /// -- cgit v1.1 From 8f02fd926e14dfad7f5eb77a67a6701f449511e0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 6 Sep 2012 22:12:05 +0100 Subject: If reusing dynamic textures, do not reuse small data length textures that fall below current viewer discard level 2 thresholds. Viewer LL 3.3.4 and before sometimes fail to properly redisplay dynamic textures that have a small data length compared to pixel size when pulled from cache. This appears to happen when the data length is smaller than the estimate discard level 2 size the viewer uses when making this GetTexture request. This commit works around this by always regenerating dynamic textures that fall below this threshold rather than reusing them if ReuseDynamicTextures = true This can be controlled by the [Textures] ReuseDynamicLowDataTextures config setting which defaults to false. --- .../DynamicTexture/DynamicTextureModule.cs | 59 ++++++++++++++++++---- .../Scripting/LoadImageURL/LoadImageURLModule.cs | 41 +++++++++------ .../VectorRender/Tests/VectorRenderModuleTests.cs | 42 +++++++++++++++ .../Scripting/VectorRender/VectorRenderModule.cs | 24 ++++----- .../Grid/Tests/GridConnectorsTests.cs | 2 +- .../World/Archiver/Tests/ArchiverTests.cs | 2 +- .../Framework/Interfaces/IDynamicTextureManager.cs | 57 +++++++++++++++++++-- 7 files changed, 181 insertions(+), 46 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index e09f1a9..1f340df 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -42,7 +42,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture { public class DynamicTextureModule : IRegionModule, IDynamicTextureManager { -// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private const int ALL_SIDES = -1; @@ -54,6 +54,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture /// public bool ReuseTextures { get; set; } + /// + /// If false, then textures which have a low data size are not reused when ReuseTextures = true. + /// + /// + /// LL viewers 3.3.4 and before appear to not fully render textures pulled from the viewer cache if those + /// textures have a relatively high pixel surface but a small data size. Typically, this appears to happen + /// if the data size is smaller than the viewer's discard level 2 size estimate. So if this is setting is + /// false, textures smaller than the calculation in IsSizeReuseable are always regenerated rather than reused + /// to work around this problem. + public bool ReuseLowDataTextures { get; set; } + private Dictionary RegisteredScenes = new Dictionary(); private Dictionary RenderPlugins = @@ -83,18 +94,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture /// /// Called by code which actually renders the dynamic texture to supply texture data. /// - /// - /// - /// True if the data generated can be reused for subsequent identical requests - public void ReturnData(UUID id, byte[] data, bool isReuseable) + /// + /// + public void ReturnData(UUID updaterId, IDynamicTexture texture) { DynamicTextureUpdater updater = null; lock (Updaters) { - if (Updaters.ContainsKey(id)) + if (Updaters.ContainsKey(updaterId)) { - updater = Updaters[id]; + updater = Updaters[updaterId]; } } @@ -103,11 +113,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture if (RegisteredScenes.ContainsKey(updater.SimUUID)) { Scene scene = RegisteredScenes[updater.SimUUID]; - UUID newTextureID = updater.DataReceived(data, scene); + UUID newTextureID = updater.DataReceived(texture.Data, scene); - if (ReuseTextures && isReuseable && !updater.BlendWithOldTexture) + if (ReuseTextures + && !updater.BlendWithOldTexture + && texture.IsReuseable + && (ReuseLowDataTextures || IsDataSizeReuseable(texture))) + { m_reuseableDynamicTextures.Store( - GenerateReusableTextureKey(updater.BodyData, updater.Params), newTextureID); + GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID); + } } } @@ -123,6 +138,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } } + /// + /// Determines whether the texture is reuseable based on its data size. + /// + /// + /// This is a workaround for a viewer bug where very small data size textures relative to their pixel size + /// are not redisplayed properly when pulled from cache. The calculation here is based on the typical discard + /// level of 2, a 'rate' of 0.125 and 4 components (which makes for a factor of 0.5). + /// + /// + private bool IsDataSizeReuseable(IDynamicTexture texture) + { +// Console.WriteLine("{0} {1}", texture.Size.Width, texture.Size.Height); + int discardLevel2DataThreshold = (int)Math.Ceiling((texture.Size.Width >> 2) * (texture.Size.Height >> 2) * 0.5); + +// m_log.DebugFormat( +// "[DYNAMIC TEXTURE MODULE]: Discard level 2 threshold {0}, texture data length {1}", +// discardLevel2DataThreshold, texture.Data.Length); + + return discardLevel2DataThreshold < texture.Data.Length; + } + public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, int updateTimer) { @@ -293,7 +329,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture { IConfig texturesConfig = config.Configs["Textures"]; if (texturesConfig != null) + { ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false); + ReuseLowDataTextures = texturesConfig.GetBoolean("ReuseDynamicLowDataTextures", false); + } if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) { diff --git a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs index 2b3a0f2..45e6527 100644 --- a/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/LoadImageURL/LoadImageURLModule.cs @@ -32,6 +32,7 @@ using System.Net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; +using OpenSim.Region.CoreModules.Scripting.DynamicTexture; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; @@ -73,12 +74,12 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL // return false; // } - public byte[] ConvertUrl(string url, string extraParams) + public IDynamicTexture ConvertUrl(string url, string extraParams) { return null; } - public byte[] ConvertData(string bodyData, string extraParams) + public IDynamicTexture ConvertData(string bodyData, string extraParams) { return null; } @@ -171,11 +172,11 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL private void HttpRequestReturn(IAsyncResult result) { - RequestState state = (RequestState) result.AsyncState; WebRequest request = (WebRequest) state.Request; Stream stream = null; byte[] imageJ2000 = new byte[0]; + Size newSize = new Size(0, 0); try { @@ -188,37 +189,43 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL try { Bitmap image = new Bitmap(stream); - Size newsize; // TODO: make this a bit less hard coded if ((image.Height < 64) && (image.Width < 64)) { - newsize = new Size(32, 32); + newSize.Width = 32; + newSize.Height = 32; } else if ((image.Height < 128) && (image.Width < 128)) { - newsize = new Size(64, 64); + newSize.Width = 64; + newSize.Height = 64; } else if ((image.Height < 256) && (image.Width < 256)) { - newsize = new Size(128, 128); + newSize.Width = 128; + newSize.Height = 128; } else if ((image.Height < 512 && image.Width < 512)) { - newsize = new Size(256, 256); + newSize.Width = 256; + newSize.Height = 256; } else if ((image.Height < 1024 && image.Width < 1024)) { - newsize = new Size(512, 512); + newSize.Width = 512; + newSize.Height = 512; } else { - newsize = new Size(1024, 1024); + newSize.Width = 1024; + newSize.Height = 1024; } - Bitmap resize = new Bitmap(image, newsize); - - imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); + using (Bitmap resize = new Bitmap(image, newSize)) + { + imageJ2000 = OpenJPEG.EncodeFromImage(resize, true); + } } catch (Exception) { @@ -233,7 +240,6 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL } catch (WebException) { - } finally { @@ -243,10 +249,13 @@ namespace OpenSim.Region.CoreModules.Scripting.LoadImageURL } } - m_log.DebugFormat("[LOADIMAGEURLMODULE] Returning {0} bytes of image data for request {1}", + m_log.DebugFormat("[LOADIMAGEURLMODULE]: Returning {0} bytes of image data for request {1}", imageJ2000.Length, state.RequestID); - m_textureManager.ReturnData(state.RequestID, imageJ2000, false); + m_textureManager.ReturnData( + state.RequestID, + new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( + request.RequestUri, null, imageJ2000, newSize, false)); } #region Nested type: RequestState diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs index b50c0bd..41baccc 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs @@ -57,6 +57,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests m_dtm = new DynamicTextureModule(); m_dtm.ReuseTextures = reuseTextures; +// m_dtm.ReuseLowDataTextures = reuseTextures; m_vrm = new VectorRenderModule(); @@ -201,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests public void TestRepeatSameDrawReusingTexture() { TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; @@ -228,6 +230,46 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); } + /// + /// Test a low data dynamically generated texture such that it is treated as a low data texture that causes + /// problems for current viewers. + /// + /// + /// As we do not set DynamicTextureModule.ReuseLowDataTextures = true in this test, it should not reuse the + /// texture + /// + [Test] + public void TestRepeatSameDrawLowDataTexture() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + string dtText = "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;"; + + SetupScene(true); + SceneObjectGroup so = SceneHelpers.AddSceneObject(m_scene); + + m_dtm.AddDynamicTextureData( + m_scene.RegionInfo.RegionID, + so.UUID, + m_vrm.GetContentType(), + dtText, + "1024", + 0); + + UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; + + m_dtm.AddDynamicTextureData( + m_scene.RegionInfo.RegionID, + so.UUID, + m_vrm.GetContentType(), + dtText, + "1024", + 0); + + Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); + } + [Test] public void TestRepeatSameDrawDifferentExtraParamsReusingTexture() { diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs index 0e7051e..d82551e 100644 --- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs @@ -35,6 +35,7 @@ using System.Net; using Nini.Config; using OpenMetaverse; using OpenMetaverse.Imaging; +using OpenSim.Region.CoreModules.Scripting.DynamicTexture; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes; using log4net; @@ -85,20 +86,14 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender // return lines.Any((str, r) => str.StartsWith("Image")); // } - public byte[] ConvertUrl(string url, string extraParams) + public IDynamicTexture ConvertUrl(string url, string extraParams) { return null; } - public byte[] ConvertData(string bodyData, string extraParams) + public IDynamicTexture ConvertData(string bodyData, string extraParams) { - bool reuseable; - return Draw(bodyData, extraParams, out reuseable); - } - - private byte[] ConvertData(string bodyData, string extraParams, out bool reuseable) - { - return Draw(bodyData, extraParams, out reuseable); + return Draw(bodyData, extraParams); } public bool AsyncConvertUrl(UUID id, string url, string extraParams) @@ -109,10 +104,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender public bool AsyncConvertData(UUID id, string bodyData, string extraParams) { // XXX: This isn't actually being done asynchronously! - bool reuseable; - byte[] data = ConvertData(bodyData, extraParams, out reuseable); - - m_textureManager.ReturnData(id, data, reuseable); + m_textureManager.ReturnData(id, ConvertData(bodyData, extraParams)); return true; } @@ -191,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender #endregion - private byte[] Draw(string data, string extraParams, out bool reuseable) + private IDynamicTexture Draw(string data, string extraParams) { // We need to cater for old scripts that didnt use extraParams neatly, they use either an integer size which represents both width and height, or setalpha // we will now support multiple comma seperated params in the form width:256,height:512,alpha:255 @@ -334,6 +326,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender Bitmap bitmap = null; Graphics graph = null; + bool reuseable = false; try { @@ -396,7 +389,8 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender e.Message, e.StackTrace); } - return imageJ2000; + return new OpenSim.Region.CoreModules.Scripting.DynamicTexture.DynamicTexture( + data, extraParams, imageJ2000, new Size(width, height), reuseable); } finally { diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs index b286d17..57ae549 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/Tests/GridConnectorsTests.cs @@ -43,7 +43,7 @@ using OpenSim.Tests.Common; namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid.Tests { [TestFixture] - public class GridConnectorsTests + public class GridConnectorsTests : OpenSimTestCase { LocalGridServicesConnector m_LocalConnector; private void SetUp() diff --git a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs index 5deaf52..904110e 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/Tests/ArchiverTests.cs @@ -51,7 +51,7 @@ using RegionSettings = OpenSim.Framework.RegionSettings; namespace OpenSim.Region.CoreModules.World.Archiver.Tests { [TestFixture] - public class ArchiverTests + public class ArchiverTests : OpenSimTestCase { private Guid m_lastRequestId; private string m_lastErrorMessage; diff --git a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs index 1a3bcbb..6df5cc2 100644 --- a/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs +++ b/OpenSim/Region/Framework/Interfaces/IDynamicTextureManager.cs @@ -25,6 +25,8 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +using System; +using System.Drawing; using System.IO; using OpenMetaverse; @@ -33,7 +35,14 @@ namespace OpenSim.Region.Framework.Interfaces public interface IDynamicTextureManager { void RegisterRender(string handleType, IDynamicTextureRender render); - void ReturnData(UUID id, byte[] data, bool isReuseable); + + /// + /// Used by IDynamicTextureRender implementations to return renders + /// + /// + /// + /// + void ReturnData(UUID id, IDynamicTexture texture); UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, string extraParams, int updateTimer); @@ -125,11 +134,53 @@ namespace OpenSim.Region.Framework.Interfaces // /// // bool AlwaysIdenticalConversion(string bodyData, string extraParams); - byte[] ConvertUrl(string url, string extraParams); - byte[] ConvertData(string bodyData, string extraParams); + IDynamicTexture ConvertUrl(string url, string extraParams); + IDynamicTexture ConvertData(string bodyData, string extraParams); + bool AsyncConvertUrl(UUID id, string url, string extraParams); bool AsyncConvertData(UUID id, string bodyData, string extraParams); + void GetDrawStringSize(string text, string fontName, int fontSize, out double xSize, out double ySize); } + + public interface IDynamicTexture + { + /// + /// Input commands used to generate this data. + /// + /// + /// Null if input commands were not used. + /// + string InputCommands { get; } + + /// + /// Uri used to generate this data. + /// + /// + /// Null if a uri was not used. + /// + Uri InputUri { get; } + + /// + /// Extra input params used to generate this data. + /// + string InputParams { get; } + + /// + /// Texture data. + /// + byte[] Data { get; } + + /// + /// Size of texture. + /// + Size Size { get; } + + /// + /// Signal whether the texture is reuseable (i.e. whether the same input data will always generate the same + /// texture). + /// + bool IsReuseable { get; } + } } -- cgit v1.1 From d2b00749ef71729555d393da7fef1dcdb84f5cbc Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 6 Sep 2012 23:14:48 +0100 Subject: Add missing DynamicTexture.cs file from last commit --- .../Scripting/DynamicTexture/DynamicTexture.cs | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTexture.cs (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTexture.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTexture.cs new file mode 100644 index 0000000..fce9490 --- /dev/null +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTexture.cs @@ -0,0 +1,61 @@ +/* + * 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.Drawing; +using OpenSim.Region.Framework.Interfaces; + +namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture +{ + public class DynamicTexture : IDynamicTexture + { + public string InputCommands { get; private set; } + public Uri InputUri { get; private set; } + public string InputParams { get; private set; } + public byte[] Data { get; private set; } + public Size Size { get; private set; } + public bool IsReuseable { get; private set; } + + public DynamicTexture(string inputCommands, string inputParams, byte[] data, Size size, bool isReuseable) + { + InputCommands = inputCommands; + InputParams = inputParams; + Data = data; + Size = size; + IsReuseable = isReuseable; + } + + public DynamicTexture(Uri inputUri, string inputParams, byte[] data, Size size, bool isReuseable) + { + InputUri = inputUri; + InputParams = inputParams; + Data = data; + Size = size; + IsReuseable = isReuseable; + } + } +} \ No newline at end of file -- cgit v1.1 From 288baaecaf4933568c53fc052314599d1520bbed Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 7 Sep 2012 00:46:24 +0100 Subject: Add warning chevrons around the GC.Collect added to Warp3DImageModule in commit 5eb2526 Manually calling GC.Collect() really shouldnt' be necessary and is generally regarded as a bad idea. A GC should occur anyway pretty shortly afterwards. However, can leave this in development code for now to see if it does actually make a significant difference rather than simply doing a GC a little earlier. --- OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs index ed9b127..2d762fb 100644 --- a/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs +++ b/OpenSim/Region/CoreModules/World/Warp3DMap/Warp3DImageModule.cs @@ -208,6 +208,10 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap bitmap = ImageUtils.ResizeImage(origBitmap, viewport.Width, viewport.Height); } + // XXX: It shouldn't really be necesary to force a GC here as one should occur anyway pretty shortly + // afterwards. It's generally regarded as a bad idea to manually GC. If Warp3D is using lots of memory + // then this may be some issue with the Warp3D code itself, though it's also quite possible that generating + // this map tile simply takes a lot of memory. GC.Collect(); m_log.Debug("[WARP 3D IMAGE MODULE]: GC.Collect()"); -- cgit v1.1 From 2ec34580ce3807cede97539488237040e1a8a6cc Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 7 Sep 2012 10:13:51 -0400 Subject: Move addin information to CoreModulePlugin.addin.xml Move the addin information from attributes in the source file to the CoreModulePlugin.xml, which is the standard. This will help us automate addin version dependency information when we make new OpenSim releases. --- OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs | 6 +----- OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs | 2 +- OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs index fab489d..4bce416 100644 --- a/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs +++ b/OpenSim/Region/CoreModules/Asset/FlotsamAssetCache.cs @@ -49,12 +49,8 @@ using OpenSim.Region.Framework.Scenes; using OpenSim.Services.Interfaces; -[assembly: Addin("FlotsamAssetCache", "1.1")] -[assembly: AddinDependency("OpenSim", "0.5")] - -namespace Flotsam.RegionModules.AssetCache +namespace OpenSim.Region.CoreModules.Asset { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class FlotsamAssetCache : ISharedRegionModule, IImprovedAssetCache, IAssetService { private static readonly ILog m_log = diff --git a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs index c91b25f..9276d1a 100644 --- a/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs +++ b/OpenSim/Region/CoreModules/Asset/Tests/FlotsamAssetCacheTests.cs @@ -35,7 +35,7 @@ using Nini.Config; using NUnit.Framework; using OpenMetaverse; using OpenMetaverse.Assets; -using Flotsam.RegionModules.AssetCache; +using OpenSim.Region.CoreModules.Asset; using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Region.Framework.Scenes.Serialization; diff --git a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml index 424e0ab..a09945e 100644 --- a/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml +++ b/OpenSim/Region/CoreModules/Resources/CoreModulePlugin.addin.xml @@ -34,6 +34,7 @@ + -- cgit v1.1 From 1f18ce516fe203aaa7a51d3f70d7fff5f6c8a423 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 7 Sep 2012 11:04:00 -0400 Subject: Move addin information to RegionCombinerModule.addin.xml Move addin information from attributes to RegionCombinerModule.addin.xml to aid in automation of addin dependency tracking. --- .../Region/RegionCombinerModule/RegionCombinerModule.cs | 4 +--- .../Resources/RegionCombinerModule.addin.xml | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 3144d76..7a49cd8 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -39,11 +39,9 @@ using OpenSim.Framework.Console; using OpenSim.Region.Physics.Manager; using Mono.Addins; -[assembly: Addin("RegionCombinerModule", "0.1")] -[assembly: AddinDependency("OpenSim", "0.5")] + namespace OpenSim.Region.RegionCombinerModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml new file mode 100644 index 0000000..6101e63 --- /dev/null +++ b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + -- cgit v1.1 From 550f6c4ad22b28f7d1722a92472827c199152893 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 7 Sep 2012 11:39:30 -0400 Subject: Revert "Move addin information to RegionCombinerModule.addin.xml" This reverts commit ab446bc692782b75fd27105fc3370a16b4fc17d8. Need to look into this --- .../Region/RegionCombinerModule/RegionCombinerModule.cs | 4 +++- .../Resources/RegionCombinerModule.addin.xml | 14 -------------- 2 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 7a49cd8..3144d76 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -39,9 +39,11 @@ using OpenSim.Framework.Console; using OpenSim.Region.Physics.Manager; using Mono.Addins; - +[assembly: Addin("RegionCombinerModule", "0.1")] +[assembly: AddinDependency("OpenSim", "0.5")] namespace OpenSim.Region.RegionCombinerModule { + [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml deleted file mode 100644 index 6101e63..0000000 --- a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - -- cgit v1.1 From 717b11856ed61b9322503fcb6700e3c66d3a697e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 7 Sep 2012 12:54:12 -0400 Subject: Move addin attributes to RegionCombinerModule.addin.xml Will help in automation of setting version info for addin dependencies. --- .../Region/RegionCombinerModule/RegionCombinerModule.cs | 3 --- .../Resources/RegionCombinerModule.addin.xml | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs index 3144d76..190fca0 100644 --- a/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs +++ b/OpenSim/Region/RegionCombinerModule/RegionCombinerModule.cs @@ -39,11 +39,8 @@ using OpenSim.Framework.Console; using OpenSim.Region.Physics.Manager; using Mono.Addins; -[assembly: Addin("RegionCombinerModule", "0.1")] -[assembly: AddinDependency("OpenSim", "0.5")] namespace OpenSim.Region.RegionCombinerModule { - [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule")] public class RegionCombinerModule : ISharedRegionModule, IRegionCombinerModule { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); diff --git a/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml new file mode 100644 index 0000000..13cb8b6 --- /dev/null +++ b/OpenSim/Region/RegionCombinerModule/Resources/RegionCombinerModule.addin.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + -- cgit v1.1