From cd325fdf021be20876340c85201efbd8e918028a Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 21:36:20 +0100 Subject: [PATCH 01/13] Pass the "attachToBackup" bool given to SceneGraph.AddNewSceneObject() down into the 3-parameter AddNewSceneObject() method instead of always hardcoding true. This doesn't affect any core OpenSimulator code since all callers were passing true anyway But it allows region modules to create objects that are never persisted. --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index b6339fb636..209a770396 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -300,7 +300,7 @@ namespace OpenSim.Region.Framework.Scenes public bool AddNewSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, Vector3? pos, Quaternion? rot, Vector3 vel) { - AddNewSceneObject(sceneObject, true, false); + AddNewSceneObject(sceneObject, attachToBackup, false); if (pos != null) sceneObject.AbsolutePosition = (Vector3)pos; From 476996bee86702227eedd3c953000891027faac4 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 22:38:07 +0100 Subject: [PATCH 02/13] If a connecting scene presence is replacing an existing scene presence then bypass close checks. --- OpenSim/Region/Framework/Scenes/Scene.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ad7418970c..2b4dea4a4a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3562,7 +3562,7 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Existing root scene presence detected for {0} {1} in {2} when connecting. Removing existing presence.", sp.Name, sp.UUID, RegionInfo.RegionName); - sp.ControllingClient.Close(); + sp.ControllingClient.Close(true); sp = null; } From ba58331b29225ead620087ca4ff3bae4a905994d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 24 Aug 2012 22:56:05 +0100 Subject: [PATCH 03/13] Extend "Restarting scripts in attachments" debug log message to show actual name of user and the region they are in --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 65d526fd4e..5bf69ad64e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -891,7 +891,9 @@ namespace OpenSim.Region.Framework.Scenes { if (wasChild && HasAttachments()) { - m_log.DebugFormat("[SCENE PRESENCE]: Restarting scripts in attachments..."); + m_log.DebugFormat( + "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); + // Resume scripts foreach (SceneObjectGroup sog in m_attachments) { From f3a5e3a02b5422fad607695aac0bffd17152434b Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 00:42:32 +0100 Subject: [PATCH 04/13] Log initial script startup info notice when xengine actually starts to do this for debugging purposes, rather than before it actually starts to do this. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 2 +- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 675c64dabe..3b59dc4866 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -93,7 +93,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void StartScripts() { - m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); +// m_log.InfoFormat("[SCENE]: Starting scripts in {0}, please wait.", RegionInfo.RegionName); IScriptModule[] engines = RequestModuleInterfaces(); diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 5a3f002c53..0460f22b6a 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -923,6 +923,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine // This delay exists to stop mono problems where script compilation and startup would stop the sim // working properly for the session. System.Threading.Thread.Sleep(m_StartDelay); + + m_log.InfoFormat("[XEngine]: Performing initial script startup on {0}", m_Scene.Name); } object[] o; @@ -938,13 +940,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine if (m_InitialStartup) if (scriptsStarted % 50 == 0) m_log.InfoFormat( - "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.Name); } } if (m_InitialStartup) m_log.InfoFormat( - "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); + "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.Name); // NOTE: Despite having a lockless queue, this lock is required // to make sure there is never no compile thread while there From e04047152f2d3ea7f52f746ab2ddac3328c8e97d Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 00:49:38 +0100 Subject: [PATCH 05/13] minor: Fix bad log message for failure to create an inventory folder --- OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 2701d6ef8a..6e53951003 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -468,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes if (!InventoryService.AddFolder(folder)) { m_log.WarnFormat( - "[AGENT INVENTORY]: Failed to move create folder for user {0} {1}", + "[AGENT INVENTORY]: Failed to create folder for user {0} {1}", remoteClient.Name, remoteClient.AgentId); } } From f8a89a79eb8ae8cc2bfdcbbf2cb498e5293162c3 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 01:09:12 +0100 Subject: [PATCH 06/13] Allow multiple calling card type inventory folders to be created. Modern viewers want to create Friends and All folders of this type inside the root Calling Cards folder. --- OpenSim/Services/InventoryService/XInventoryService.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index 7518b86f0b..e10e0be82c 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -311,6 +311,7 @@ namespace OpenSim.Services.InventoryService if (folder.Type == (short)AssetType.Folder || folder.Type == (short)AssetType.Unknown || folder.Type == (short)AssetType.OutfitFolder + || folder.Type == (short)AssetType.CallingCard || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) { XInventoryFolder xFolder = ConvertFromOpenSim(folder); From a0d178b284050df64d0eb5b9728565fd72615c22 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Sat, 25 Aug 2012 02:00:17 +0100 Subject: [PATCH 07/13] Following on from f8a89a79, do not allow more than one 'type' folder (e.g. calling cards) to be created in the base "My Inventory" user folder. This is to accomodate situations where viewers will create more than one 'type' subfolder (e.g. calling cards) But at the same time to prevent multiple such 'system' folders (those in the base "My Inventory" user folder). This also makes GetFolderForType() only return a folder in the base "My Inventory" folder, if such a type folder exists --- .../InventoryService/XInventoryService.cs | 65 ++++++++++++++----- 1 file changed, 49 insertions(+), 16 deletions(-) diff --git a/OpenSim/Services/InventoryService/XInventoryService.cs b/OpenSim/Services/InventoryService/XInventoryService.cs index e10e0be82c..deacd5a4b4 100644 --- a/OpenSim/Services/InventoryService/XInventoryService.cs +++ b/OpenSim/Services/InventoryService/XInventoryService.cs @@ -229,10 +229,28 @@ namespace OpenSim.Services.InventoryService public virtual InventoryFolderBase GetFolderForType(UUID principalID, AssetType type) { // m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); + + InventoryFolderBase rootFolder = GetRootFolder(principalID); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in GetFolderForType() when looking for {1}", + principalID, type); + + return null; + } + + return GetSystemFolderForType(rootFolder, type); + } + + private InventoryFolderBase GetSystemFolderForType(InventoryFolderBase rootFolder, AssetType type) + { +// m_log.DebugFormat("[XINVENTORY SERVICE]: Getting folder type {0} for user {1}", type, principalID); XInventoryFolder[] folders = m_Database.GetFolders( - new string[] { "agentID", "type"}, - new string[] { principalID.ToString(), ((int)type).ToString() }); + new string[] { "agentID", "parentFolderID", "type"}, + new string[] { rootFolder.Owner.ToString(), rootFolder.ID.ToString(), ((int)type).ToString() }); if (folders.Length == 0) { @@ -308,23 +326,38 @@ namespace OpenSim.Services.InventoryService if (check != null) return false; - if (folder.Type == (short)AssetType.Folder - || folder.Type == (short)AssetType.Unknown - || folder.Type == (short)AssetType.OutfitFolder - || folder.Type == (short)AssetType.CallingCard - || GetFolderForType(folder.Owner, (AssetType)(folder.Type)) == null) + if (folder.Type != (short)AssetType.Folder || folder.Type != (short)AssetType.Unknown) { - XInventoryFolder xFolder = ConvertFromOpenSim(folder); - return m_Database.StoreFolder(xFolder); - } - else - { - m_log.WarnFormat( - "[XINVENTORY]: Folder of type {0} already exists when tried to add {1} to {2} for {3}", - folder.Type, folder.Name, folder.ParentID, folder.Owner); + InventoryFolderBase rootFolder = GetRootFolder(folder.Owner); + + if (rootFolder == null) + { + m_log.WarnFormat( + "[XINVENTORY]: Found no root folder for {0} in AddFolder() when looking for {1}", + folder.Owner, folder.Type); + + return false; + } + + // Check we're not trying to add this as a system folder. + if (folder.ParentID == rootFolder.ID) + { + InventoryFolderBase existingSystemFolder + = GetSystemFolderForType(rootFolder, (AssetType)folder.Type); + + if (existingSystemFolder != null) + { + m_log.WarnFormat( + "[XINVENTORY]: System folder of type {0} already exists when tried to add {1} to {2} for {3}", + folder.Type, folder.Name, folder.ParentID, folder.Owner); + + return false; + } + } } - return false; + XInventoryFolder xFolder = ConvertFromOpenSim(folder); + return m_Database.StoreFolder(xFolder); } public virtual bool UpdateFolder(InventoryFolderBase folder) From 3d504261b0e189f8111912a3fff9d45579c04eed Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:35:59 +0100 Subject: [PATCH 08/13] renaming to be similar to equivalent Set command --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 10 +++++----- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2bfb9b3e40..c706f48fd0 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetLinkPrimitiveParams(m_host, rules); + return GetPrimParams(m_host, rules); } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,14 +7923,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (var part in parts) { - LSL_List partRes = GetLinkPrimitiveParams(part, rules); + LSL_List partRes = GetPrimParams(part, rules); res += partRes; } return res; } - public LSL_List GetLinkPrimitiveParams(SceneObjectPart part, LSL_List rules) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) { LSL_List res = new LSL_List(); int idx=0; @@ -10752,7 +10752,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules) + public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); if (obj == null) @@ -10761,7 +10761,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj.OwnerID != m_host.OwnerID) return new LSL_List(); - return GetLinkPrimitiveParams(obj, rules); + return GetPrimParams(obj, rules); } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 5e7c2d98ab..c277708d18 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetLinkPrimitiveParams(part, rules); + retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); } return retVal; } @@ -2965,7 +2965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); InitLSL(); - return m_LSL_Api.GetLinkPrimitiveParamsEx(prim, rules); + return m_LSL_Api.GetPrimitiveParamsEx(prim, rules); } public void osSetPrimitiveParams(LSL_Key prim, LSL_List rules) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 3fb463b766..cd58614b58 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -425,6 +425,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void print(string str); void SetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); - LSL_List GetLinkPrimitiveParamsEx(LSL_Key prim, LSL_List rules); + LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules); } } From a8044999fb056de0a815093953f82b33d540dd6f Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 16:41:43 +0100 Subject: [PATCH 09/13] use SceneObjectPart instead of var --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c706f48fd0..03b5982706 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5828,7 +5828,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetTextureAnim(part, mode, face, sizex, sizey, start, length, rate); } @@ -6190,7 +6190,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { SetParticleSystem(part, rules); } @@ -7921,7 +7921,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List res = new LSL_List(); - foreach (var part in parts) + foreach (SceneObjectPart part in parts) { LSL_List partRes = GetPrimParams(part, rules); res += partRes; From 2a2e120470ea530ea0a6f035c5cf28247f94532c Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:02:13 +0100 Subject: [PATCH 10/13] since we will be making the Get return type the remaining ruleset as with the Set return type, we need to move the original return type to a ref param --- .../Shared/Api/Implementation/LSL_Api.cs | 38 ++++++++++--------- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 2 files changed, 22 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 03b5982706..6e4699246a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7910,7 +7910,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List llGetPrimitiveParams(LSL_List rules) { m_host.AddScriptLPS(1); - return GetPrimParams(m_host, rules); + + LSL_List result = new LSL_List(); + + GetPrimParams(m_host, rules, ref result); + + return result; } public LSL_List llGetLinkPrimitiveParams(int linknumber, LSL_List rules) @@ -7923,16 +7928,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) { - LSL_List partRes = GetPrimParams(part, rules); - res += partRes; + GetPrimParams(part, rules, ref res); } return res; } - public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules) + public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { - LSL_List res = new LSL_List(); int idx=0; while (idx < rules.Length) { @@ -8077,7 +8080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return res; + return; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8117,7 +8120,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8146,7 +8149,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8177,7 +8180,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8219,7 +8222,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8260,7 +8263,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return res; + return; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8314,7 +8317,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } - return res; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10755,13 +10757,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_List GetPrimitiveParamsEx(LSL_Key prim, LSL_List rules) { SceneObjectPart obj = World.GetSceneObjectPart(new UUID(prim)); - if (obj == null) - return new LSL_List(); - if (obj.OwnerID != m_host.OwnerID) - return new LSL_List(); + LSL_List result = new LSL_List(); - return GetPrimParams(obj, rules); + if (obj != null && obj.OwnerID != m_host.OwnerID) + { + GetPrimParams(obj, rules, ref result); + } + + return result; } public void print(string str) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c277708d18..a391b73bf9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,7 +2250,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - retVal += ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules); + ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); } return retVal; } From 5203665bb2d68c6a4e0ea3180334b607db6ab1ce Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:25:37 +0100 Subject: [PATCH 11/13] refactoring to local variable for cleaner code --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index a391b73bf9..927f37c6f2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2246,11 +2246,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osGetLinkPrimitiveParams"); m_host.AddScriptLPS(1); InitLSL(); + // One needs to cast m_LSL_Api because we're using functions not + // on the ILSL_Api interface. + LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); - List parts = ((LSL_Api)m_LSL_Api).GetLinkParts(linknumber); + List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - ((LSL_Api)m_LSL_Api).GetPrimParams(part, rules, ref retVal); + LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; } From 58714b0aca71ce026226c6f76753905877792caf Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:28 +0100 Subject: [PATCH 12/13] minor formatting --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 6e4699246a..0f0eac6b9e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7238,10 +7238,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) remaining = SetPrimParams(part, rules); - while(remaining != null && remaining.Length > 2) + while (remaining != null && remaining.Length > 2) { linknumber = remaining.GetLSLIntegerItem(0); - rules = remaining.GetSublist(1,-1); + rules = remaining.GetSublist(1, -1); parts = GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) From 6e86b230120776a7da4727dd1aedeca6b91e3169 Mon Sep 17 00:00:00 2001 From: SignpostMarv Date: Fri, 24 Aug 2012 17:44:39 +0100 Subject: [PATCH 13/13] implementing PRIM_LINK_TARGET on GetPrimParams ala SetPrimParams --- .../Shared/Api/Implementation/LSL_Api.cs | 58 +++++++++++++++---- .../Shared/Api/Implementation/OSSL_Api.cs | 13 ++++- 2 files changed, 60 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0f0eac6b9e..b001c51606 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7913,7 +7913,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api LSL_List result = new LSL_List(); - GetPrimParams(m_host, rules, ref result); + LSL_List remaining = GetPrimParams(m_host, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } return result; } @@ -7925,16 +7935,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api List parts = GetLinkParts(linknumber); LSL_List res = new LSL_List(); + LSL_List remaining = null; foreach (SceneObjectPart part in parts) { - GetPrimParams(part, rules, ref res); + remaining = GetPrimParams(part, rules, ref res); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref res); } return res; } - public void GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) + public LSL_List GetPrimParams(SceneObjectPart part, LSL_List rules, ref LSL_List res) { int idx=0; while (idx < rules.Length) @@ -8080,7 +8101,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXTURE: if (remain < 1) - return; + return null; int face = (int)rules.GetLSLIntegerItem(idx++); Primitive.TextureEntry tex = part.Shape.Textures; @@ -8120,7 +8141,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_COLOR: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8149,7 +8170,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_BUMP_SHINY: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8180,7 +8201,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_FULLBRIGHT: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8222,7 +8243,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_TEXGEN: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8263,7 +8284,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case (int)ScriptBaseClass.PRIM_GLOW: if (remain < 1) - return; + return null; face=(int)rules.GetLSLIntegerItem(idx++); @@ -8315,8 +8336,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api 0 )); break; + case (int)ScriptBaseClass.PRIM_LINK_TARGET: + if(remain < 3) + return null; + + return rules.GetSublist(idx, -1); } } + + return null; } public LSL_List llGetPrimMediaParams(int face, LSL_List rules) @@ -10762,7 +10790,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (obj != null && obj.OwnerID != m_host.OwnerID) { - GetPrimParams(obj, rules, ref result); + LSL_List remaining = GetPrimParams(obj, rules, ref result); + + while (remaining != null && remaining.Length > 2) + { + int linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + List parts = GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = GetPrimParams(part, rules, ref result); + } } return result; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 927f37c6f2..1afa4fbc20 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2250,10 +2250,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // on the ILSL_Api interface. LSL_Api LSL_Api = (LSL_Api)m_LSL_Api; LSL_List retVal = new LSL_List(); + LSL_List remaining = null; List parts = LSL_Api.GetLinkParts(linknumber); foreach (SceneObjectPart part in parts) { - LSL_Api.GetPrimParams(part, rules, ref retVal); + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); + } + + while (remaining != null && remaining.Length > 2) + { + linknumber = remaining.GetLSLIntegerItem(0); + rules = remaining.GetSublist(1, -1); + parts = LSL_Api.GetLinkParts(linknumber); + + foreach (SceneObjectPart part in parts) + remaining = LSL_Api.GetPrimParams(part, rules, ref retVal); } return retVal; }