diff options
author | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-08-27 00:15:21 +0100 |
commit | 33a894f3d2cc95a7a512b86f39f3c6a6afabb015 (patch) | |
tree | 064edbd623ea0bd7bb85c29dc28d2348feb8454b /OpenSim/Region/CoreModules | |
parent | refactor: simplify SOP.AttachedAvatar into SOG.AttachedAvatar (diff) | |
download | opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.zip opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.gz opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.bz2 opensim-SC-33a894f3d2cc95a7a512b86f39f3c6a6afabb015.tar.xz |
refactor: move SOP.IsAttachment and AttachmentPoint up into SOG to avoid pointless duplication of identical values
Diffstat (limited to 'OpenSim/Region/CoreModules')
4 files changed, 17 insertions, 18 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 3e1cb02..b976020 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -369,11 +369,11 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
369 | SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt) | 369 | SceneObjectGroup att, ScenePresence sp, UUID itemID, uint AttachmentPt) |
370 | { | 370 | { |
371 | // m_log.DebugFormat( | 371 | // m_log.DebugFormat( |
372 | // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} (item ID {2})", | 372 | // "[ATTACHMENTS MODULE]: Updating inventory of {0} to show attachment of {1} {2} (item ID {3}) at {4}", |
373 | // remoteClient.Name, att.Name, itemID); | 373 | // sp.Name, att.Name, att.LocalId, itemID, AttachmentPt); |
374 | 374 | ||
375 | if (!att.IsDeleted) | 375 | if (!att.IsDeleted) |
376 | AttachmentPt = att.RootPart.AttachmentPoint; | 376 | AttachmentPt = att.AttachmentPoint; |
377 | 377 | ||
378 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); | 378 | InventoryItemBase item = new InventoryItemBase(itemID, sp.UUID); |
379 | item = m_scene.InventoryService.GetItem(item); | 379 | item = m_scene.InventoryService.GetItem(item); |
@@ -547,7 +547,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
547 | ); | 547 | ); |
548 | 548 | ||
549 | group.RootPart.SetParentLocalId(0); | 549 | group.RootPart.SetParentLocalId(0); |
550 | group.RootPart.IsAttachment = false; | 550 | group.IsAttachment = false; |
551 | group.AbsolutePosition = group.RootPart.AttachedPos; | 551 | group.AbsolutePosition = group.RootPart.AttachedPos; |
552 | 552 | ||
553 | UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); | 553 | UpdateKnownItem(sp.ControllingClient, group, group.GetFromItemID(), group.OwnerID); |
@@ -569,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
569 | // Finally, we restore the object's attachment status. | 569 | // Finally, we restore the object's attachment status. |
570 | byte attachmentPoint = sog.GetAttachmentPoint(); | 570 | byte attachmentPoint = sog.GetAttachmentPoint(); |
571 | sog.UpdateGroupPosition(pos); | 571 | sog.UpdateGroupPosition(pos); |
572 | sog.RootPart.IsAttachment = false; | 572 | sog.IsAttachment = false; |
573 | sog.AbsolutePosition = sog.RootPart.AttachedPos; | 573 | sog.AbsolutePosition = sog.RootPart.AttachedPos; |
574 | sog.SetAttachmentPoint(attachmentPoint); | 574 | sog.SetAttachmentPoint(attachmentPoint); |
575 | sog.HasGroupChanged = true; | 575 | sog.HasGroupChanged = true; |
@@ -666,8 +666,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
666 | 666 | ||
667 | so.AbsolutePosition = attachOffset; | 667 | so.AbsolutePosition = attachOffset; |
668 | so.RootPart.AttachedPos = attachOffset; | 668 | so.RootPart.AttachedPos = attachOffset; |
669 | so.RootPart.IsAttachment = true; | 669 | so.IsAttachment = true; |
670 | |||
671 | so.RootPart.SetParentLocalId(avatar.LocalId); | 670 | so.RootPart.SetParentLocalId(avatar.LocalId); |
672 | so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); | 671 | so.SetAttachmentPoint(Convert.ToByte(attachmentpoint)); |
673 | 672 | ||
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs index b7d21fd..790a651 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs | |||
@@ -110,6 +110,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
110 | Assert.That(attachments.Count, Is.EqualTo(1)); | 110 | Assert.That(attachments.Count, Is.EqualTo(1)); |
111 | SceneObjectGroup attSo = attachments[0]; | 111 | SceneObjectGroup attSo = attachments[0]; |
112 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 112 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
113 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
113 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | 114 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); |
114 | Assert.That(attSo.IsAttachment); | 115 | Assert.That(attSo.IsAttachment); |
115 | Assert.That(attSo.UsesPhysics, Is.False); | 116 | Assert.That(attSo.UsesPhysics, Is.False); |
@@ -132,9 +133,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
132 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 133 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
133 | string attName = "att"; | 134 | string attName = "att"; |
134 | 135 | ||
135 | InventoryItemBase attItem | 136 | UserInventoryHelpers.CreateInventoryItem( |
136 | = UserInventoryHelpers.CreateInventoryItem( | 137 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); |
137 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
138 | 138 | ||
139 | m_attMod.RezSingleAttachmentFromInventory( | 139 | m_attMod.RezSingleAttachmentFromInventory( |
140 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 140 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
@@ -145,6 +145,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
145 | Assert.That(attachments.Count, Is.EqualTo(1)); | 145 | Assert.That(attachments.Count, Is.EqualTo(1)); |
146 | SceneObjectGroup attSo = attachments[0]; | 146 | SceneObjectGroup attSo = attachments[0]; |
147 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 147 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
148 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
148 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | 149 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); |
149 | Assert.That(attSo.IsAttachment); | 150 | Assert.That(attSo.IsAttachment); |
150 | Assert.That(attSo.UsesPhysics, Is.False); | 151 | Assert.That(attSo.UsesPhysics, Is.False); |
@@ -166,9 +167,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
166 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 167 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
167 | string attName = "att"; | 168 | string attName = "att"; |
168 | 169 | ||
169 | InventoryItemBase attItem | 170 | UserInventoryHelpers.CreateInventoryItem( |
170 | = UserInventoryHelpers.CreateInventoryItem( | 171 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); |
171 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
172 | 172 | ||
173 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( | 173 | UUID attSoId = m_attMod.RezSingleAttachmentFromInventory( |
174 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 174 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
@@ -198,9 +198,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
198 | UUID attAssetId = TestHelpers.ParseTail(0x3); | 198 | UUID attAssetId = TestHelpers.ParseTail(0x3); |
199 | string attName = "att"; | 199 | string attName = "att"; |
200 | 200 | ||
201 | InventoryItemBase attItem | 201 | UserInventoryHelpers.CreateInventoryItem( |
202 | = UserInventoryHelpers.CreateInventoryItem( | 202 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); |
203 | scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); | ||
204 | 203 | ||
205 | m_attMod.RezSingleAttachmentFromInventory( | 204 | m_attMod.RezSingleAttachmentFromInventory( |
206 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); | 205 | m_presence.ControllingClient, attItemId, (uint)AttachmentPoint.Chest); |
@@ -242,6 +241,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests | |||
242 | Assert.That(attachments.Count, Is.EqualTo(1)); | 241 | Assert.That(attachments.Count, Is.EqualTo(1)); |
243 | SceneObjectGroup attSo = attachments[0]; | 242 | SceneObjectGroup attSo = attachments[0]; |
244 | Assert.That(attSo.Name, Is.EqualTo(attName)); | 243 | Assert.That(attSo.Name, Is.EqualTo(attName)); |
244 | Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest)); | ||
245 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); | 245 | Assert.That(attSo.GetAttachmentPoint(), Is.EqualTo((byte)AttachmentPoint.Chest)); |
246 | Assert.That(attSo.IsAttachment); | 246 | Assert.That(attSo.IsAttachment); |
247 | Assert.That(attSo.UsesPhysics, Is.False); | 247 | Assert.That(attSo.UsesPhysics, Is.False); |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f5d49c5..7963e53 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -1782,7 +1782,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
1782 | // Set the parent localID to 0 so it transfers over properly. | 1782 | // Set the parent localID to 0 so it transfers over properly. |
1783 | gobj.RootPart.SetParentLocalId(0); | 1783 | gobj.RootPart.SetParentLocalId(0); |
1784 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; | 1784 | gobj.AbsolutePosition = gobj.RootPart.AttachedPos; |
1785 | gobj.RootPart.IsAttachment = false; | 1785 | gobj.IsAttachment = false; |
1786 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); | 1786 | //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); |
1787 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); | 1787 | m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); |
1788 | CrossPrimGroupIntoNewRegion(destination, gobj, silent); | 1788 | CrossPrimGroupIntoNewRegion(destination, gobj, silent); |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 65ba87b..fcb7eea 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -841,7 +841,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
841 | if (attachment) | 841 | if (attachment) |
842 | { | 842 | { |
843 | group.RootPart.Flags |= PrimFlags.Phantom; | 843 | group.RootPart.Flags |= PrimFlags.Phantom; |
844 | group.RootPart.IsAttachment = true; | 844 | group.IsAttachment = true; |
845 | } | 845 | } |
846 | 846 | ||
847 | // If we're rezzing an attachment then don't ask | 847 | // If we're rezzing an attachment then don't ask |