diff options
author | Justin Clark-Casey (justincc) | 2012-04-07 00:33:02 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-04-07 00:33:02 +0100 |
commit | 7d8bb33c5b2420d4e744269f67a25dd2b9746a35 (patch) | |
tree | 53e2c0d0258e81c4e87ae78521e85d98d115becc /OpenSim/Region/CoreModules | |
parent | refactor: Eliminate unnecessary SOP.m_physActor (diff) | |
download | opensim-SC_OLD-7d8bb33c5b2420d4e744269f67a25dd2b9746a35.zip opensim-SC_OLD-7d8bb33c5b2420d4e744269f67a25dd2b9746a35.tar.gz opensim-SC_OLD-7d8bb33c5b2420d4e744269f67a25dd2b9746a35.tar.bz2 opensim-SC_OLD-7d8bb33c5b2420d4e744269f67a25dd2b9746a35.tar.xz |
Store FromItemID for attachments once on SOG instead of on every SOP and only ever using the root part entry.
This eliminates some pointless memory use.
Diffstat (limited to 'OpenSim/Region/CoreModules')
3 files changed, 14 insertions, 13 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7086e6c..faa413e 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -239,7 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
239 | // At the moment we can only deal with a single attachment | 239 | // At the moment we can only deal with a single attachment |
240 | if (attachments.Count != 0) | 240 | if (attachments.Count != 0) |
241 | { | 241 | { |
242 | UUID oldAttachmentItemID = attachments[0].GetFromItemID(); | 242 | UUID oldAttachmentItemID = attachments[0].FromItemID; |
243 | 243 | ||
244 | if (oldAttachmentItemID != UUID.Zero) | 244 | if (oldAttachmentItemID != UUID.Zero) |
245 | DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID); | 245 | DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID); |
@@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
250 | } | 250 | } |
251 | 251 | ||
252 | // Add the new attachment to inventory if we don't already have it. | 252 | // Add the new attachment to inventory if we don't already have it. |
253 | UUID newAttachmentItemID = group.GetFromItemID(); | 253 | UUID newAttachmentItemID = group.FromItemID; |
254 | if (newAttachmentItemID == UUID.Zero) | 254 | if (newAttachmentItemID == UUID.Zero) |
255 | newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; | 255 | newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; |
256 | 256 | ||
@@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
285 | List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); | 285 | List<SceneObjectGroup> existingAttachments = sp.GetAttachments(); |
286 | foreach (SceneObjectGroup so in existingAttachments) | 286 | foreach (SceneObjectGroup so in existingAttachments) |
287 | { | 287 | { |
288 | if (so.GetFromItemID() == itemID) | 288 | if (so.FromItemID == itemID) |
289 | { | 289 | { |
290 | alreadyOn = true; | 290 | alreadyOn = true; |
291 | break; | 291 | break; |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
342 | if (so.AttachedAvatar != sp.UUID) | 342 | if (so.AttachedAvatar != sp.UUID) |
343 | return; | 343 | return; |
344 | 344 | ||
345 | UUID inventoryID = so.GetFromItemID(); | 345 | UUID inventoryID = so.FromItemID; |
346 | 346 | ||
347 | // m_log.DebugFormat( | 347 | // m_log.DebugFormat( |
348 | // "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", | 348 | // "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", |
@@ -359,9 +359,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
359 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); | 359 | m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); |
360 | 360 | ||
361 | sp.RemoveAttachment(so); | 361 | sp.RemoveAttachment(so); |
362 | so.FromItemID = UUID.Zero; | ||
362 | 363 | ||
363 | SceneObjectPart rootPart = so.RootPart; | 364 | SceneObjectPart rootPart = so.RootPart; |
364 | rootPart.FromItemID = UUID.Zero; | ||
365 | so.AbsolutePosition = sp.AbsolutePosition; | 365 | so.AbsolutePosition = sp.AbsolutePosition; |
366 | so.AttachedAvatar = UUID.Zero; | 366 | so.AttachedAvatar = UUID.Zero; |
367 | rootPart.SetParentLocalId(0); | 367 | rootPart.SetParentLocalId(0); |
@@ -475,7 +475,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
475 | 475 | ||
476 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); | 476 | string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); |
477 | 477 | ||
478 | InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID); | 478 | InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); |
479 | item = m_scene.InventoryService.GetItem(item); | 479 | item = m_scene.InventoryService.GetItem(item); |
480 | 480 | ||
481 | if (item != null) | 481 | if (item != null) |
@@ -647,7 +647,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
647 | item.CreationDate = Util.UnixTimeSinceEpoch(); | 647 | item.CreationDate = Util.UnixTimeSinceEpoch(); |
648 | 648 | ||
649 | // sets itemID so client can show item as 'attached' in inventory | 649 | // sets itemID so client can show item as 'attached' in inventory |
650 | grp.SetFromItemID(item.ID); | 650 | grp.FromItemID = item.ID; |
651 | 651 | ||
652 | if (m_scene.AddInventoryItem(item)) | 652 | if (m_scene.AddInventoryItem(item)) |
653 | { | 653 | { |
@@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
683 | if (entity is SceneObjectGroup) | 683 | if (entity is SceneObjectGroup) |
684 | { | 684 | { |
685 | group = (SceneObjectGroup)entity; | 685 | group = (SceneObjectGroup)entity; |
686 | if (group.GetFromItemID() == itemID) | 686 | if (group.FromItemID == itemID) |
687 | { | 687 | { |
688 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); | 688 | m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); |
689 | sp.RemoveAttachment(group); | 689 | sp.RemoveAttachment(group); |
@@ -889,7 +889,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
889 | // Calls attach with a Zero position | 889 | // Calls attach with a Zero position |
890 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) | 890 | if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) |
891 | { | 891 | { |
892 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); | 892 | m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); |
893 | 893 | ||
894 | // Save avatar attachment information | 894 | // Save avatar attachment information |
895 | m_log.Debug( | 895 | m_log.Debug( |
@@ -912,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
912 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); | 912 | ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); |
913 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); | 913 | SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); |
914 | if (sp != null && group != null) | 914 | if (sp != null && group != null) |
915 | DetachSingleAttachmentToInv(sp, group.GetFromItemID()); | 915 | DetachSingleAttachmentToInv(sp, group.FromItemID); |
916 | } | 916 | } |
917 | 917 | ||
918 | private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient) | 918 | private void Client_OnDetachAttachmentIntoInv(UUID itemID, IClientAPI remoteClient) |
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index 86cfb32..bfe5e4a 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -120,8 +120,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
120 | Assert.That(attSo.IsTemporary, Is.False); | 120 | Assert.That(attSo.IsTemporary, Is.False); |
121 | 121 | ||
122 | // Check item status | 122 | // Check item status |
123 | Assert.That(m_presence.Appearance.GetAttachpoint( | 123 | Assert.That( |
124 | attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); | 124 | m_presence.Appearance.GetAttachpoint(attSo.FromItemID), |
125 | Is.EqualTo((int)AttachmentPoint.Chest)); | ||
125 | } | 126 | } |
126 | 127 | ||
127 | [Test] | 128 | [Test] |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 4dd89d2..88c21af 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -1008,7 +1008,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
1008 | rootPart.TrimPermissions(); | 1008 | rootPart.TrimPermissions(); |
1009 | 1009 | ||
1010 | if (isAttachment) | 1010 | if (isAttachment) |
1011 | so.SetFromItemID(item.ID); | 1011 | so.FromItemID = item.ID; |
1012 | } | 1012 | } |
1013 | 1013 | ||
1014 | return true; | 1014 | return true; |