From 846198bb9ef6aec8a3f351de8ef4393d6b7f35bd Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 9 Nov 2010 23:54:08 +0000 Subject: [PATCH 01/13] Although the Allow Voice setting is per estate rather than per region, apparently it is required in the region handshake to let the client enable parcel voice controls. So, send it. --- .../Region/CoreModules/World/Estate/EstateManagementModule.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1bf0d67497..6844c6024a 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs @@ -1098,12 +1098,14 @@ namespace OpenSim.Region.CoreModules.World.Estate if (m_scene.RegionInfo.RegionSettings.AllowLandJoinDivide) flags |= RegionFlags.AllowParcelChanges; if (m_scene.RegionInfo.RegionSettings.BlockShowInSearch) - flags |= (RegionFlags)(1 << 29); + flags |= RegionFlags.BlockParcelSearch; if (m_scene.RegionInfo.RegionSettings.FixedSun) flags |= RegionFlags.SunFixed; if (m_scene.RegionInfo.RegionSettings.Sandbox) flags |= RegionFlags.Sandbox; + if (m_scene.RegionInfo.EstateSettings.AllowVoice) + flags |= RegionFlags.AllowVoice; // Fudge these to always on, so the menu options activate // From ff3e466000f31f76bfbae66bf29f5c4bb030529c Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 10 Nov 2010 01:17:40 +0000 Subject: [PATCH 02/13] Remove a debug spam --- OpenSim/Region/CoreModules/World/Sound/SoundModule.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs index 8df645dd32..abd28c87a9 100644 --- a/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs +++ b/OpenSim/Region/CoreModules/World/Sound/SoundModule.cs @@ -97,7 +97,6 @@ namespace OpenSim.Region.CoreModules.World.Sound else gain = (float)((double)gain * ((radius - dis) / radius)); - m_log.DebugFormat("Play sound, gain {0}", gain); sp.ControllingClient.SendPlayAttachedSound(soundID, objectID, ownerID, (float)gain, flags); }); } From bfc128529ca29525751fc3c8edd25859446a2954 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 10 Nov 2010 16:22:55 +0100 Subject: [PATCH 03/13] Prevent teleporting to a region when the egent is banned in all parcels --- OpenSim/Region/Framework/Scenes/Scene.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c5396d5741..a4cc66d760 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3761,6 +3761,13 @@ namespace OpenSim.Region.Framework.Scenes // We have to wait until the viewer contacts this region after receiving EAC. // That calls AddNewClient, which finally creates the ScenePresence + ILandObject nearestParcel = GetNearestAllowedParcel(cAgentData.AgentID, Constants.RegionSize / 2, Constants.RegionSize / 2); + if (nearestParcel == null) + { + m_log.DebugFormat("[SCENE]: Denying root agent entry to {0}: no allowed parcel", cAgentData.AgentID); + return false; + } + ScenePresence childAgentUpdate = WaitGetScenePresence(cAgentData.AgentID); if (childAgentUpdate != null) { From 00b0f521fa6c2a99f7878a7eb36e8e7b8df01e31 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Mon, 8 Nov 2010 12:15:20 -0500 Subject: [PATCH 04/13] Add PARCEL_DETAILS_ID to LSL --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 3 +++ .../Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 1 + 2 files changed, 4 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1a13deae5a..c251a49ccb 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9882,6 +9882,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case "4": ret = ret + new LSL_List(land.Area); break; + case "5": + ret = ret + new LSL_List(land.GlobalID); + break; default: ret = ret + new LSL_List(0); break; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index b96e977539..b3c4d95c48 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs @@ -507,6 +507,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase public const int PARCEL_DETAILS_OWNER = 2; public const int PARCEL_DETAILS_GROUP = 3; public const int PARCEL_DETAILS_AREA = 4; + public const int PARCEL_DETAILS_ID = 5; // constants for llSetClickAction public const int CLICK_ACTION_NONE = 0; From 672ee2a88888438c964279d367feb273080d6f3e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Tue, 9 Nov 2010 17:19:38 -0500 Subject: [PATCH 05/13] Prebuild fix Make prebuild fix for monodevelop. Needed path to reference legacy Mono.Data.SQLite in ./bin/Mono.Data.SQLite.dll. --- prebuild.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prebuild.xml b/prebuild.xml index c6eb65a790..9df820e2b2 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2155,7 +2155,7 @@ - + @@ -2503,7 +2503,7 @@ - + From 9c8680cd693e7d54635150c07587f9ed1d4ff04e Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 12 Nov 2010 07:40:36 -0500 Subject: [PATCH 06/13] Fix prebubild.exe for Nant add missing "/" fixes Nant builds --- prebuild.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prebuild.xml b/prebuild.xml index 9df820e2b2..e77d5c1fd2 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -2155,7 +2155,7 @@ - + From 1e7334d9859e20ba6bc5652f9d61ce9d0bff8906 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Fri, 12 Nov 2010 23:20:07 +0000 Subject: [PATCH 07/13] provide avatar name in log if an exception ends up at the top of an async packet processing stack --- OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 4aa19d1009..8d85d1a34f 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -651,8 +651,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP catch (Exception e) { // Make sure that we see any exception caused by the asynchronous operation. - m_log.Error( - string.Format("[LLCLIENTVIEW]: Caught exception while processing {0}", packetObject.Pack), e); + m_log.ErrorFormat( + "[LLCLIENTVIEW]: Caught exception while processing {0} for {1}, {2} {3}", + packetObject.Pack, Name, e.Message, e.StackTrace); } } From 2368aab534a9534f5f2806d5a4ffeb75950fdafd Mon Sep 17 00:00:00 2001 From: Marck Date: Thu, 11 Nov 2010 11:08:57 +0100 Subject: [PATCH 08/13] Fix: Write asset data into Asset.db when using SQLite --- bin/config-include/storage/SQLiteLegacyStandalone.ini | 3 +++ bin/config-include/storage/SQLiteStandalone.ini | 3 +++ 2 files changed, 6 insertions(+) diff --git a/bin/config-include/storage/SQLiteLegacyStandalone.ini b/bin/config-include/storage/SQLiteLegacyStandalone.ini index facbbd6bcd..ffe9a70ca8 100644 --- a/bin/config-include/storage/SQLiteLegacyStandalone.ini +++ b/bin/config-include/storage/SQLiteLegacyStandalone.ini @@ -4,6 +4,9 @@ StorageProvider = "OpenSim.Data.SQLiteLegacy.dll" ConnectionString = "URI=file:OpenSim.db,version=3,UseUTF16Encoding=True" +[AssetService] + ConnectionString = "URI=file:Asset.db,version=3" + [AvatarService] ConnectionString = "URI=file:avatars.db,version=3" diff --git a/bin/config-include/storage/SQLiteStandalone.ini b/bin/config-include/storage/SQLiteStandalone.ini index 10e6991954..c1de71aa21 100644 --- a/bin/config-include/storage/SQLiteStandalone.ini +++ b/bin/config-include/storage/SQLiteStandalone.ini @@ -4,6 +4,9 @@ StorageProvider = "OpenSim.Data.SQLite.dll" ConnectionString = "URI=file:OpenSim.db,version=3,UseUTF16Encoding=True" +[AssetService] + ConnectionString = "URI=file:Asset.db,version=3" + [InventoryService] ;ConnectionString = "URI=file:inventory.db,version=3" ; if you have a legacy inventory store use the connection string below From 98ba079e95ef0c967f138ac49c5e8f3c0961c848 Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 01:33:24 +0100 Subject: [PATCH 09/13] Diva needs a spanking! Serializing OldItemID breaks script state persistence in agent inventory. --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 7f37878cda..fb4ef28050 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -735,7 +735,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader) { - item.OldItemID = ReadUUID(reader, "OldItemID"); + ReadUUID(reader, "OldItemID"); + // On deserialization, the old item id MUST BE UUID.Zero!!!!! + // Setting this to the saved value will BREAK script persistence! + // item.OldItemID = ReadUUID(reader, "OldItemID"); } private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader) From 5329e3b9b71237b298550590fa3812ff4759ec2a Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 01:37:44 +0100 Subject: [PATCH 10/13] Can't detach an object from within the script thread because it will throw. Use FireAndForget for that. --- .../Shared/Api/Implementation/LSL_Api.cs | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c251a49ccb..cc3cf17b27 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2983,17 +2983,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if ((item.PermsMask & ScriptBaseClass.PERMISSION_ATTACH) != 0) { - SceneObjectGroup grp = m_host.ParentGroup; - UUID itemID = grp.GetFromItemID(); - - ScenePresence presence = World.GetScenePresence(m_host.OwnerID); - IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; if (attachmentsModule != null) - attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); + Util.FireAndForget(DetachWrapper, m_host); } } + private void DetachWrapper(object o) + { + SceneObjectPart host = (SceneObjectPart)o; + + SceneObjectGroup grp = host.ParentGroup; + UUID itemID = grp.GetFromItemID(); + ScenePresence presence = World.GetScenePresence(host.OwnerID); + + IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule; + if (attachmentsModule != null) + attachmentsModule.ShowDetachInUserInventory(itemID, presence.ControllingClient); + } + public void llTakeCamera(string avatar) { m_host.AddScriptLPS(1); From 50202bab7c76782af782949922a4c6b73868ec54 Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 15 Nov 2010 19:52:39 +0100 Subject: [PATCH 11/13] Add osTeleportOwner. This provides the same functionality as osTeleportAgent but without the griefing potential. Region owners need not be concerned about the use of this function because it only allows to do what is already possible with the world map. The intended use is with HUDs. For example, a list of (hypergrid) destinations could be made available for quick access. Signed-off-by: Melanie --- .../Shared/Api/Implementation/OSSL_Api.cs | 32 +++++++++++++++++-- .../Shared/Api/Interface/IOSSL_Api.cs | 3 ++ .../Shared/Api/Runtime/OSSL_Stub.cs | 15 +++++++++ 3 files changed, 48 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 8a98be74bc..0b787d87cc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -639,6 +639,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); + TeleportAgent(agent, regionName, position, lookat); + } + + private void TeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { m_host.AddScriptLPS(1); UUID agentId = new UUID(); if (UUID.TryParse(agent, out agentId)) @@ -651,7 +656,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api == World.LandChannel.GetLandObject( presence.AbsolutePosition.X, presence.AbsolutePosition.Y).LandData.OwnerID) { - // Check for hostname , attempt to make a hglink // and convert the regionName to the target region if (regionName.Contains(".") && regionName.Contains(":")) @@ -674,13 +678,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - // Teleport functions public void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) { // High because there is no security check. High griefer potential // CheckThreatLevel(ThreatLevel.High, "osTeleportAgent"); + TeleportAgent(agent, regionX, regionY, position, lookat); + } + + private void TeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { ulong regionHandle = Util.UIntsToLong(((uint)regionX * (uint)Constants.RegionSize), ((uint)regionY * (uint)Constants.RegionSize)); m_host.AddScriptLPS(1); @@ -709,6 +717,26 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api osTeleportAgent(agent, World.RegionInfo.RegionName, position, lookat); } + public void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { + // Threat level None because this is what can already be done with the World Map in the viewer + CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); + + TeleportAgent(m_host.OwnerID.ToString(), regionName, position, lookat); + } + + public void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { + osTeleportOwner(World.RegionInfo.RegionName, position, lookat); + } + + public void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat) + { + CheckThreatLevel(ThreatLevel.None, "osTeleportOwner"); + + TeleportAgent(m_host.OwnerID.ToString(), regionX, regionY, position, lookat); + } + // Functions that get information from the agent itself. // // osGetAgentIP - this is used to determine the IP address of diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index 630821b15c..c9a24f613b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -86,6 +86,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void osTeleportAgent(string agent, string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); void osTeleportAgent(string agent, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportOwner(string regionName, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportOwner(int regionX, int regionY, LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); + void osTeleportOwner(LSL_Types.Vector3 position, LSL_Types.Vector3 lookat); // Animation commands void osAvatarPlayAnimation(string avatar, string animation); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e289554dfc..370bf1d4e6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -227,6 +227,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_OSSL_Functions.osTeleportAgent(agent, position, lookat); } + public void osTeleportOwner(string regionName, vector position, vector lookat) + { + m_OSSL_Functions.osTeleportOwner(regionName, position, lookat); + } + + public void osTeleportOwner(int regionX, int regionY, vector position, vector lookat) + { + m_OSSL_Functions.osTeleportOwner(regionX, regionY, position, lookat); + } + + public void osTeleportOwner(vector position, vector lookat) + { + m_OSSL_Functions.osTeleportOwner(position, lookat); + } + // Avatar info functions public string osGetAgentIP(string agent) { From 56bd42b438d93469f1c120cdf5ebf5238756453e Mon Sep 17 00:00:00 2001 From: Marck Date: Mon, 15 Nov 2010 19:50:38 +0100 Subject: [PATCH 12/13] Fix osTeleportAgent for hypergrid destinations. Signed-off-by: Melanie --- .../ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 0b787d87cc..e6a323eebc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -665,7 +665,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (regions != null && regions.Count > 0) { GridRegion regInfo = regions[0]; - regionName = regInfo.RegionName; + string[] parts = regInfo.RegionName.Split(new char[] { ':' }); + if (parts.Length > 2) + regionName = parts[2]; + else + regionName = parts[0]; } } World.RequestTeleportLocation(presence.ControllingClient, regionName, From 7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b Mon Sep 17 00:00:00 2001 From: Melanie Date: Tue, 16 Nov 2010 21:01:56 +0000 Subject: [PATCH 13/13] Change the way attachments are persisted. Editing a worn attachment will now save properly, as will the results of a resizer script working. Attachment positions are no longer saved on each move, but instead are saved once on logout. Attachment script states are saved as part of the attachment now when detaching. --- OpenSim/Framework/ISceneObject.cs | 1 + .../Avatar/Attachments/AttachmentsModule.cs | 34 ++++++---------- .../InventoryAccess/InventoryAccessModule.cs | 18 ++++++--- .../Interfaces/IAttachmentsModule.cs | 21 +++++++--- .../Framework/Interfaces/IEntityInventory.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 +++++--- .../Framework/Scenes/SceneObjectGroup.cs | 6 ++- .../Scenes/SceneObjectPartInventory.cs | 40 ++++++++++--------- .../Region/Framework/Scenes/ScenePresence.cs | 20 ++++++++++ .../Handlers/Simulation/ObjectHandlers.cs | 7 +++- .../Simulation/SimulationServiceConnector.cs | 1 + 12 files changed, 109 insertions(+), 61 deletions(-) diff --git a/OpenSim/Framework/ISceneObject.cs b/OpenSim/Framework/ISceneObject.cs index 51479014cd..18631f17b1 100644 --- a/OpenSim/Framework/ISceneObject.cs +++ b/OpenSim/Framework/ISceneObject.cs @@ -39,5 +39,6 @@ namespace OpenSim.Framework void ExtraFromXmlString(string xmlstr); string GetStateSnapshot(); void SetState(string xmlstr, IScene s); + bool HasGroupChanged { get; set; } } } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 348b8b909d..1744fb3754 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -273,6 +273,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (objatt != null) { + // Loading the inventory from XML will have set this, but + // there is no way the object could have changed yet, + // since scripts aren't running yet. So, clear it here. + objatt.HasGroupChanged = false; bool tainted = false; if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint()) tainted = true; @@ -470,6 +474,13 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); group.DetachToInventoryPrep(); m_log.Debug("[ATTACHMENTS MODULE]: Saving attachpoint: " + ((uint)group.GetAttachmentPoint()).ToString()); + + // If an item contains scripts, it's always changed. + // This ensures script state is saved on detach + foreach (SceneObjectPart p in group.Parts) + if (p.Inventory.ContainsScripts()) + group.HasGroupChanged = true; + UpdateKnownItem(remoteClient, group, group.GetFromItemID(), group.OwnerID); m_scene.DeleteSceneObject(group, false); return; @@ -478,25 +489,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - public void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos) - { - // If this is an attachment, then we need to save the modified - // object back into the avatar's inventory. First we save the - // attachment point information, then we update the relative - // positioning (which caused this method to get driven in the - // first place. Then we have to mark the object as NOT an - // attachment. This is necessary in order to correctly save - // and retrieve GroupPosition information for the attachment. - // Then we save the asset back into the appropriate inventory - // entry. Finally, we restore the object's attachment status. - byte attachmentPoint = sog.GetAttachmentPoint(); - sog.UpdateGroupPosition(pos); - sog.RootPart.IsAttachment = false; - sog.AbsolutePosition = sog.RootPart.AttachedPos; - UpdateKnownItem(client, sog, sog.GetFromItemID(), sog.OwnerID); - sog.SetAttachmentPoint(attachmentPoint); - } - /// /// Update the attachment asset for the new sog details if they have changed. /// @@ -508,7 +500,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// /// /// - protected void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) + public void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID) { if (grp != null) { @@ -523,7 +515,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments grp.UUID, grp.GetAttachmentPoint()); string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); - InventoryItemBase item = new InventoryItemBase(itemID, remoteClient.AgentId); item = m_scene.InventoryService.GetItem(item); @@ -617,7 +608,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // In case it is later dropped again, don't let // it get cleaned up so.RootPart.RemFlag(PrimFlags.TemporaryOnRez); - so.HasGroupChanged = false; } } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 7a175ea362..ef21834600 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -569,12 +569,20 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess { group.RootPart.Flags |= PrimFlags.Phantom; group.RootPart.IsAttachment = true; - } - // If we're rezzing an attachment then don't ask AddNewSceneObject() to update the client since - // we'll be doing that later on. Scheduling more than one full update during the attachment - // process causes some clients to fail to display the attachment properly. - m_Scene.AddNewSceneObject(group, true, false); + // If we're rezzing an attachment then don't ask + // AddNewSceneObject() to update the client since + // we'll be doing that later on. Scheduling more + // than one full update during the attachment + // process causes some clients to fail to display + // the attachment properly. + // Also, don't persist attachments. + m_Scene.AddNewSceneObject(group, false, false); + } + else + { + m_Scene.AddNewSceneObject(group, true, false); + } // m_log.InfoFormat("ray end point for inventory rezz is {0} {1} {2} ", RayEnd.X, RayEnd.Y, RayEnd.Z); // if attachment we set it's asset id so object updates can reflect that diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs index 24e481b2bd..b3576c5c73 100644 --- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs @@ -122,11 +122,20 @@ namespace OpenSim.Region.Framework.Interfaces void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); /// - /// Update the position of an attachment + /// Update the user inventory with a changed attachment /// - /// - /// - /// - void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos); + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + /// + /// A + /// + void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID); } -} \ No newline at end of file +} diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2e6faa08a1..64664ab033 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs @@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Interfaces /// false if the item did not exist, true if the update occurred successfully bool UpdateInventoryItem(TaskInventoryItem item); bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); + bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged); /// /// Remove an item from this entity's inventory diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a4cc66d760..96a9f998c3 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3152,7 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes List regions = new List(avatar.KnownChildRegionHandles); regions.Remove(RegionInfo.RegionHandle); m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); - } m_eventManager.TriggerClientClosed(agentID, this); } @@ -3164,6 +3163,9 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnRemovePresence(agentID); + if (avatar != null && (!avatar.IsChildAgent)) + avatar.SaveChangedAttachments(); + ForEachClient( delegate(IClientAPI client) { diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 24d73346ff..032c859b6b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes protected internal bool AddRestoredSceneObject( SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) { - if (!alreadyPersisted) + if (attachToBackup && (!alreadyPersisted)) { sceneObject.ForceInventoryPersistence(); sceneObject.HasGroupChanged = true; @@ -282,8 +282,10 @@ namespace OpenSim.Region.Framework.Scenes /// protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) { - // Ensure that we persist this new scene object - sceneObject.HasGroupChanged = true; + // Ensure that we persist this new scene object if it's not an + // attachment + if (attachToBackup) + sceneObject.HasGroupChanged = true; return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); } @@ -1279,8 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes { if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) { - if (m_parentScene.AttachmentsModule != null) - m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos); + // Set the new attachment point data in the object + byte attachmentPoint = group.GetAttachmentPoint(); + group.UpdateGroupPosition(pos); + group.RootPart.IsAttachment = false; + group.AbsolutePosition = group.RootPart.AttachedPos; + group.SetAttachmentPoint(attachmentPoint); + group.HasGroupChanged = true; } else { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5f00f846e4..c2810b2cc1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -491,13 +491,15 @@ namespace OpenSim.Region.Framework.Scenes XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); if (nodes.Count > 0) { - m_savedScriptState = new Dictionary(); + if (m_savedScriptState == null) + m_savedScriptState = new Dictionary(); foreach (XmlNode node in nodes) { if (node.Attributes["UUID"] != null) { UUID itemid = new UUID(node.Attributes["UUID"].Value); - m_savedScriptState.Add(itemid, node.InnerXml); + if (itemid != UUID.Zero) + m_savedScriptState[itemid] = node.InnerXml; } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 0c5e62d11a..6a204c3413 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -127,8 +127,6 @@ namespace OpenSim.Region.Framework.Scenes if (0 == m_items.Count) return; - HasInventoryChanged = true; - m_part.ParentGroup.HasGroupChanged = true; IList items = GetInventoryItems(); m_items.Clear(); @@ -144,17 +142,6 @@ namespace OpenSim.Region.Framework.Scenes { lock (Items) { - if (Items.Count == 0) - { - return; - } - - HasInventoryChanged = true; - if (m_part.ParentGroup != null) - { - m_part.ParentGroup.HasGroupChanged = true; - } - IList items = new List(Items.Values); Items.Clear(); @@ -208,8 +195,15 @@ namespace OpenSim.Region.Framework.Scenes } } - HasInventoryChanged = true; - m_part.ParentGroup.HasGroupChanged = true; + // Don't let this set the HasGroupChanged flag for attachments + // as this happens during rez and we don't want a new asset + // for each attachment each time + if (!m_part.ParentGroup.RootPart.IsAttachment) + { + HasInventoryChanged = true; + m_part.ParentGroup.HasGroupChanged = true; + } + List items = GetInventoryItems(); foreach (TaskInventoryItem item in items) { @@ -674,13 +668,19 @@ namespace OpenSim.Region.Framework.Scenes /// false if the item did not exist, true if the update occurred successfully public bool UpdateInventoryItem(TaskInventoryItem item) { - return UpdateInventoryItem(item, true); + return UpdateInventoryItem(item, true, true); } public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) + { + return UpdateInventoryItem(item, fireScriptEvents, true); + } + + public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) { TaskInventoryItem it = GetInventoryItem(item.ItemID); if (it != null) + { item.ParentID = m_part.UUID; item.ParentPartID = m_part.UUID; @@ -702,9 +702,11 @@ namespace OpenSim.Region.Framework.Scenes if (fireScriptEvents) m_part.TriggerScriptChangedEvent(Changed.INVENTORY); - - HasInventoryChanged = true; - m_part.ParentGroup.HasGroupChanged = true; + if (considerChanged) + { + HasInventoryChanged = true; + m_part.ParentGroup.HasGroupChanged = true; + } return true; } else diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 34d1c39332..bfc1bd60e7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3746,5 +3746,25 @@ namespace OpenSim.Region.Framework.Scenes m_reprioritization_called = false; } } + + public void SaveChangedAttachments() + { + // Need to copy this list because DetachToInventoryPrep mods it + List attachments = new List(Attachments.ToArray()); + + IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule; + if (attachmentsModule != null) + { + foreach (SceneObjectGroup grp in attachments) + { + if (grp.HasGroupChanged) // Resizer scripts? + { + grp.DetachToInventoryPrep(); + attachmentsModule.UpdateKnownItem(ControllingClient, + grp, grp.GetFromItemID(), grp.OwnerID); + } + } + } + } } } diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index 33e5aa6b05..04ff83f9f3 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -162,6 +162,11 @@ namespace OpenSim.Server.Handlers.Simulation return; } + if (args.ContainsKey("modified")) + sog.HasGroupChanged = args["modified"].AsBoolean(); + else + sog.HasGroupChanged = false; + if ((args["state"] != null) && s.AllowScriptCrossings) { stateXmlStr = args["state"].AsString(); @@ -243,4 +248,4 @@ namespace OpenSim.Server.Handlers.Simulation } } -} \ No newline at end of file +} diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 502fc824e0..67647ee2a2 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -549,6 +549,7 @@ namespace OpenSim.Services.Connectors.Simulation OSDMap args = new OSDMap(2); args["sog"] = OSD.FromString(sog.ToXml2()); args["extra"] = OSD.FromString(sog.ExtraToXmlString()); + args["modified"] = OSD.FromBoolean(sog.HasGroupChanged); string state = sog.GetStateSnapshot(); if (state.Length > 0) args["state"] = OSD.FromString(state);