diff options
author | Melanie | 2010-11-16 21:01:56 +0000 |
---|---|---|
committer | Melanie | 2010-11-16 21:01:56 +0000 |
commit | 7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b (patch) | |
tree | b73a2aa9f04e9c34281fb38512da3eb800396769 /OpenSim/Region/Framework/Scenes | |
parent | Fix osTeleportAgent for hypergrid destinations. (diff) | |
download | opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.zip opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.gz opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.bz2 opensim-SC_OLD-7bb005b0d1a5ae63ca94a3a3f8ad98e0388ea76b.tar.xz |
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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 40 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 20 |
5 files changed, 60 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a4cc66d..96a9f99 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3152,7 +3152,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3152 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); | 3152 | List<ulong> regions = new List<ulong>(avatar.KnownChildRegionHandles); |
3153 | regions.Remove(RegionInfo.RegionHandle); | 3153 | regions.Remove(RegionInfo.RegionHandle); |
3154 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); | 3154 | m_sceneGridService.SendCloseChildAgentConnections(agentID, regions); |
3155 | |||
3156 | } | 3155 | } |
3157 | m_eventManager.TriggerClientClosed(agentID, this); | 3156 | m_eventManager.TriggerClientClosed(agentID, this); |
3158 | } | 3157 | } |
@@ -3164,6 +3163,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
3164 | 3163 | ||
3165 | m_eventManager.TriggerOnRemovePresence(agentID); | 3164 | m_eventManager.TriggerOnRemovePresence(agentID); |
3166 | 3165 | ||
3166 | if (avatar != null && (!avatar.IsChildAgent)) | ||
3167 | avatar.SaveChangedAttachments(); | ||
3168 | |||
3167 | ForEachClient( | 3169 | ForEachClient( |
3168 | delegate(IClientAPI client) | 3170 | delegate(IClientAPI client) |
3169 | { | 3171 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 24d7334..032c859 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -259,7 +259,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
259 | protected internal bool AddRestoredSceneObject( | 259 | protected internal bool AddRestoredSceneObject( |
260 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) | 260 | SceneObjectGroup sceneObject, bool attachToBackup, bool alreadyPersisted, bool sendClientUpdates) |
261 | { | 261 | { |
262 | if (!alreadyPersisted) | 262 | if (attachToBackup && (!alreadyPersisted)) |
263 | { | 263 | { |
264 | sceneObject.ForceInventoryPersistence(); | 264 | sceneObject.ForceInventoryPersistence(); |
265 | sceneObject.HasGroupChanged = true; | 265 | sceneObject.HasGroupChanged = true; |
@@ -282,8 +282,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
282 | /// </returns> | 282 | /// </returns> |
283 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) | 283 | protected internal bool AddNewSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) |
284 | { | 284 | { |
285 | // Ensure that we persist this new scene object | 285 | // Ensure that we persist this new scene object if it's not an |
286 | sceneObject.HasGroupChanged = true; | 286 | // attachment |
287 | if (attachToBackup) | ||
288 | sceneObject.HasGroupChanged = true; | ||
287 | 289 | ||
288 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); | 290 | return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); |
289 | } | 291 | } |
@@ -1279,8 +1281,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1279 | { | 1281 | { |
1280 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) | 1282 | if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) |
1281 | { | 1283 | { |
1282 | if (m_parentScene.AttachmentsModule != null) | 1284 | // Set the new attachment point data in the object |
1283 | m_parentScene.AttachmentsModule.UpdateAttachmentPosition(remoteClient, group, pos); | 1285 | byte attachmentPoint = group.GetAttachmentPoint(); |
1286 | group.UpdateGroupPosition(pos); | ||
1287 | group.RootPart.IsAttachment = false; | ||
1288 | group.AbsolutePosition = group.RootPart.AttachedPos; | ||
1289 | group.SetAttachmentPoint(attachmentPoint); | ||
1290 | group.HasGroupChanged = true; | ||
1284 | } | 1291 | } |
1285 | else | 1292 | else |
1286 | { | 1293 | { |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5f00f84..c2810b2 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -491,13 +491,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
491 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); | 491 | XmlNodeList nodes = doc.GetElementsByTagName("SavedScriptState"); |
492 | if (nodes.Count > 0) | 492 | if (nodes.Count > 0) |
493 | { | 493 | { |
494 | m_savedScriptState = new Dictionary<UUID, string>(); | 494 | if (m_savedScriptState == null) |
495 | m_savedScriptState = new Dictionary<UUID, string>(); | ||
495 | foreach (XmlNode node in nodes) | 496 | foreach (XmlNode node in nodes) |
496 | { | 497 | { |
497 | if (node.Attributes["UUID"] != null) | 498 | if (node.Attributes["UUID"] != null) |
498 | { | 499 | { |
499 | UUID itemid = new UUID(node.Attributes["UUID"].Value); | 500 | UUID itemid = new UUID(node.Attributes["UUID"].Value); |
500 | m_savedScriptState.Add(itemid, node.InnerXml); | 501 | if (itemid != UUID.Zero) |
502 | m_savedScriptState[itemid] = node.InnerXml; | ||
501 | } | 503 | } |
502 | } | 504 | } |
503 | } | 505 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 0c5e62d..6a204c3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -127,8 +127,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
127 | if (0 == m_items.Count) | 127 | if (0 == m_items.Count) |
128 | return; | 128 | return; |
129 | 129 | ||
130 | HasInventoryChanged = true; | ||
131 | m_part.ParentGroup.HasGroupChanged = true; | ||
132 | IList<TaskInventoryItem> items = GetInventoryItems(); | 130 | IList<TaskInventoryItem> items = GetInventoryItems(); |
133 | m_items.Clear(); | 131 | m_items.Clear(); |
134 | 132 | ||
@@ -144,17 +142,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
144 | { | 142 | { |
145 | lock (Items) | 143 | lock (Items) |
146 | { | 144 | { |
147 | if (Items.Count == 0) | ||
148 | { | ||
149 | return; | ||
150 | } | ||
151 | |||
152 | HasInventoryChanged = true; | ||
153 | if (m_part.ParentGroup != null) | ||
154 | { | ||
155 | m_part.ParentGroup.HasGroupChanged = true; | ||
156 | } | ||
157 | |||
158 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); | 145 | IList<TaskInventoryItem> items = new List<TaskInventoryItem>(Items.Values); |
159 | Items.Clear(); | 146 | Items.Clear(); |
160 | 147 | ||
@@ -208,8 +195,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | } | 195 | } |
209 | } | 196 | } |
210 | 197 | ||
211 | HasInventoryChanged = true; | 198 | // Don't let this set the HasGroupChanged flag for attachments |
212 | m_part.ParentGroup.HasGroupChanged = true; | 199 | // as this happens during rez and we don't want a new asset |
200 | // for each attachment each time | ||
201 | if (!m_part.ParentGroup.RootPart.IsAttachment) | ||
202 | { | ||
203 | HasInventoryChanged = true; | ||
204 | m_part.ParentGroup.HasGroupChanged = true; | ||
205 | } | ||
206 | |||
213 | List<TaskInventoryItem> items = GetInventoryItems(); | 207 | List<TaskInventoryItem> items = GetInventoryItems(); |
214 | foreach (TaskInventoryItem item in items) | 208 | foreach (TaskInventoryItem item in items) |
215 | { | 209 | { |
@@ -674,13 +668,19 @@ namespace OpenSim.Region.Framework.Scenes | |||
674 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 668 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
675 | public bool UpdateInventoryItem(TaskInventoryItem item) | 669 | public bool UpdateInventoryItem(TaskInventoryItem item) |
676 | { | 670 | { |
677 | return UpdateInventoryItem(item, true); | 671 | return UpdateInventoryItem(item, true, true); |
678 | } | 672 | } |
679 | 673 | ||
680 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | 674 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) |
681 | { | 675 | { |
676 | return UpdateInventoryItem(item, fireScriptEvents, true); | ||
677 | } | ||
678 | |||
679 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) | ||
680 | { | ||
682 | TaskInventoryItem it = GetInventoryItem(item.ItemID); | 681 | TaskInventoryItem it = GetInventoryItem(item.ItemID); |
683 | if (it != null) | 682 | if (it != null) |
683 | |||
684 | { | 684 | { |
685 | item.ParentID = m_part.UUID; | 685 | item.ParentID = m_part.UUID; |
686 | item.ParentPartID = m_part.UUID; | 686 | item.ParentPartID = m_part.UUID; |
@@ -702,9 +702,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
702 | 702 | ||
703 | if (fireScriptEvents) | 703 | if (fireScriptEvents) |
704 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | 704 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); |
705 | 705 | if (considerChanged) | |
706 | HasInventoryChanged = true; | 706 | { |
707 | m_part.ParentGroup.HasGroupChanged = true; | 707 | HasInventoryChanged = true; |
708 | m_part.ParentGroup.HasGroupChanged = true; | ||
709 | } | ||
708 | return true; | 710 | return true; |
709 | } | 711 | } |
710 | else | 712 | else |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 34d1c39..bfc1bd6 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3746,5 +3746,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
3746 | m_reprioritization_called = false; | 3746 | m_reprioritization_called = false; |
3747 | } | 3747 | } |
3748 | } | 3748 | } |
3749 | |||
3750 | public void SaveChangedAttachments() | ||
3751 | { | ||
3752 | // Need to copy this list because DetachToInventoryPrep mods it | ||
3753 | List<SceneObjectGroup> attachments = new List<SceneObjectGroup>(Attachments.ToArray()); | ||
3754 | |||
3755 | IAttachmentsModule attachmentsModule = m_scene.AttachmentsModule; | ||
3756 | if (attachmentsModule != null) | ||
3757 | { | ||
3758 | foreach (SceneObjectGroup grp in attachments) | ||
3759 | { | ||
3760 | if (grp.HasGroupChanged) // Resizer scripts? | ||
3761 | { | ||
3762 | grp.DetachToInventoryPrep(); | ||
3763 | attachmentsModule.UpdateKnownItem(ControllingClient, | ||
3764 | grp, grp.GetFromItemID(), grp.OwnerID); | ||
3765 | } | ||
3766 | } | ||
3767 | } | ||
3768 | } | ||
3749 | } | 3769 | } |
3750 | } | 3770 | } |