aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs21
-rw-r--r--OpenSim/Region/Framework/Interfaces/IEntityInventory.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs17
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs40
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs23
7 files changed, 79 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 24e481b..b3576c5 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -122,11 +122,20 @@ namespace OpenSim.Region.Framework.Interfaces
122 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient); 122 void ShowDetachInUserInventory(UUID itemID, IClientAPI remoteClient);
123 123
124 /// <summary> 124 /// <summary>
125 /// Update the position of an attachment 125 /// Update the user inventory with a changed attachment
126 /// </summary> 126 /// </summary>
127 /// <param name="client"></param> 127 /// <param name="remoteClient">
128 /// <param name="sog"></param> 128 /// A <see cref="IClientAPI"/>
129 /// <param name="pos"></param> 129 /// </param>
130 void UpdateAttachmentPosition(IClientAPI client, SceneObjectGroup sog, Vector3 pos); 130 /// <param name="grp">
131 /// A <see cref="SceneObjectGroup"/>
132 /// </param>
133 /// <param name="itemID">
134 /// A <see cref="UUID"/>
135 /// </param>
136 /// <param name="agentID">
137 /// A <see cref="UUID"/>
138 /// </param>
139 void UpdateKnownItem(IClientAPI remoteClient, SceneObjectGroup grp, UUID itemID, UUID agentID);
131 } 140 }
132} \ No newline at end of file 141}
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 2e6faa0..64664ab 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Interfaces
183 /// <returns>false if the item did not exist, true if the update occurred successfully</returns> 183 /// <returns>false if the item did not exist, true if the update occurred successfully</returns>
184 bool UpdateInventoryItem(TaskInventoryItem item); 184 bool UpdateInventoryItem(TaskInventoryItem item);
185 bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); 185 bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents);
186 bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged);
186 187
187 /// <summary> 188 /// <summary>
188 /// Remove an item from this entity's inventory 189 /// 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 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..db69093 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3746,5 +3746,28 @@ 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.RootPart.IsAttachment = false;
3763 grp.AbsolutePosition = grp.RootPart.AttachedPos;
3764// grp.DetachToInventoryPrep();
3765 attachmentsModule.UpdateKnownItem(ControllingClient,
3766 grp, grp.GetFromItemID(), grp.OwnerID);
3767 grp.RootPart.IsAttachment = true;
3768 }
3769 }
3770 }
3771 }
3749 } 3772 }
3750} 3773}