diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 9395233262..ae5cbfff55 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -4271,7 +4271,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP block.OwnerID = sop.OwnerID; block.ItemID = sop.FromUserInventoryItemID; - block.FolderID = UUID.Zero; // sop.FromFolderID ?? + block.FolderID = UUID.Zero; // sog.FromFolderID ?? block.FromTaskID = UUID.Zero; // ??? block.InventorySerial = (short)sop.InventorySerial; @@ -4957,7 +4957,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP update.MediaURL = Utils.EmptyBytes; // FIXME: Support this in OpenSim if (data.ParentGroup.IsAttachment) { - update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.FromItemID); + update.NameValue = Util.StringToBytes256("AttachItemID STRING RW SV " + data.ParentGroup.FromItemID); update.State = (byte)((data.ParentGroup.AttachmentPoint % 16) * 16 + (data.ParentGroup.AttachmentPoint / 16)); } else diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7086e6c331..faa413e811 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 // At the moment we can only deal with a single attachment if (attachments.Count != 0) { - UUID oldAttachmentItemID = attachments[0].GetFromItemID(); + UUID oldAttachmentItemID = attachments[0].FromItemID; if (oldAttachmentItemID != UUID.Zero) DetachSingleAttachmentToInvInternal(sp, oldAttachmentItemID); @@ -250,7 +250,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Add the new attachment to inventory if we don't already have it. - UUID newAttachmentItemID = group.GetFromItemID(); + UUID newAttachmentItemID = group.FromItemID; if (newAttachmentItemID == UUID.Zero) newAttachmentItemID = AddSceneObjectAsNewAttachmentInInv(sp, group).ID; @@ -285,7 +285,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments List existingAttachments = sp.GetAttachments(); foreach (SceneObjectGroup so in existingAttachments) { - if (so.GetFromItemID() == itemID) + if (so.FromItemID == itemID) { alreadyOn = true; break; @@ -342,7 +342,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (so.AttachedAvatar != sp.UUID) return; - UUID inventoryID = so.GetFromItemID(); + UUID inventoryID = so.FromItemID; // m_log.DebugFormat( // "[ATTACHMENTS MODULE]: In DetachSingleAttachmentToGround(), object is {0} {1}, associated item is {2}", @@ -359,9 +359,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); sp.RemoveAttachment(so); + so.FromItemID = UUID.Zero; SceneObjectPart rootPart = so.RootPart; - rootPart.FromItemID = UUID.Zero; so.AbsolutePosition = sp.AbsolutePosition; so.AttachedAvatar = UUID.Zero; rootPart.SetParentLocalId(0); @@ -475,7 +475,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments string sceneObjectXml = SceneObjectSerializer.ToOriginalXmlFormat(grp); - InventoryItemBase item = new InventoryItemBase(grp.GetFromItemID(), sp.UUID); + InventoryItemBase item = new InventoryItemBase(grp.FromItemID, sp.UUID); item = m_scene.InventoryService.GetItem(item); if (item != null) @@ -647,7 +647,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments item.CreationDate = Util.UnixTimeSinceEpoch(); // sets itemID so client can show item as 'attached' in inventory - grp.SetFromItemID(item.ID); + grp.FromItemID = item.ID; if (m_scene.AddInventoryItem(item)) { @@ -683,7 +683,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (entity is SceneObjectGroup) { group = (SceneObjectGroup)entity; - if (group.GetFromItemID() == itemID) + if (group.FromItemID == itemID) { m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); sp.RemoveAttachment(group); @@ -889,7 +889,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Calls attach with a Zero position if (AttachObject(sp, part.ParentGroup, AttachmentPt, false)) { - m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId); + m_scene.EventManager.TriggerOnAttach(objectLocalID, part.ParentGroup.FromItemID, remoteClient.AgentId); // Save avatar attachment information m_log.Debug( @@ -912,7 +912,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments ScenePresence sp = m_scene.GetScenePresence(remoteClient.AgentId); SceneObjectGroup group = m_scene.GetGroupByPrim(objectLocalID); if (sp != null && group != null) - DetachSingleAttachmentToInv(sp, group.GetFromItemID()); + DetachSingleAttachmentToInv(sp, group.FromItemID); } 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 86cfb324dc..bfe5e4a37f 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 Assert.That(attSo.IsTemporary, Is.False); // Check item status - Assert.That(m_presence.Appearance.GetAttachpoint( - attSo.GetFromItemID()), Is.EqualTo((int)AttachmentPoint.Chest)); + Assert.That( + m_presence.Appearance.GetAttachpoint(attSo.FromItemID), + Is.EqualTo((int)AttachmentPoint.Chest)); } [Test] diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 4dd89d2e88..8171487545 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -654,9 +654,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess // if (action == DeRezAction.Take || action == DeRezAction.TakeCopy) { - if (so.RootPart.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) + if (so.FromFolderID != UUID.Zero && userID == remoteClient.AgentId) { - InventoryFolderBase f = new InventoryFolderBase(so.RootPart.FromFolderID, userID); + InventoryFolderBase f = new InventoryFolderBase(so.FromFolderID, userID); folder = m_Scene.InventoryService.GetFolder(f); } } @@ -962,7 +962,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.SalePrice = item.SalePrice; } - rootPart.FromFolderID = item.Folder; + so.FromFolderID = item.Folder; // Console.WriteLine("rootPart.OwnedID {0}, item.Owner {1}, item.CurrentPermissions {2:X}", // rootPart.OwnerID, item.Owner, item.CurrentPermissions); @@ -1008,7 +1008,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.TrimPermissions(); if (isAttachment) - so.SetFromItemID(item.ID); + so.FromItemID = item.ID; } return true; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d8cac66637..e488fe151a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2566,7 +2566,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup grp = sceneObject; m_log.DebugFormat( - "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.GetFromItemID(), grp.UUID); + "[ATTACHMENT]: Received attachment {0}, inworld asset id {1}", grp.FromItemID, grp.UUID); m_log.DebugFormat( "[ATTACHMENT]: Attach to avatar {0} at position {1}", sp.UUID, grp.AbsolutePosition); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 87fdc41d73..17f3be7d83 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -571,7 +571,9 @@ namespace OpenSim.Region.Framework.Scenes set { m_LoopSoundSlavePrims = value; } } - // The UUID for the Region this Object is in. + /// + /// The UUID for the region this object is in. + /// public UUID RegionUUID { get @@ -584,6 +586,22 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// The item ID that this object was rezzed from, if applicable. + /// + /// + /// If not applicable will be UUID.Zero + /// + public UUID FromItemID { get; set; } + + /// + /// The folder ID that this object was rezzed from, if applicable. + /// + /// + /// If not applicable will be UUID.Zero + /// + public UUID FromFolderID { get; set; } + #endregion // ~SceneObjectGroup() @@ -646,18 +664,6 @@ namespace OpenSim.Region.Framework.Scenes } } - public void SetFromItemID(UUID AssetId) - { - SceneObjectPart[] parts = m_parts.GetArray(); - for (int i = 0; i < parts.Length; i++) - parts[i].FromItemID = AssetId; - } - - public UUID GetFromItemID() - { - return m_rootPart.FromItemID; - } - /// /// Hooks this object up to the backup event so that it is persisted to the database when the update thread executes. /// @@ -2687,6 +2693,7 @@ namespace OpenSim.Region.Framework.Scenes { m_rootPart.AttachedPos = pos; } + if (RootPart.GetStatusSandbox()) { if (Util.GetDistanceTo(RootPart.StatusSandboxPos, pos) > 10) @@ -2697,8 +2704,8 @@ namespace OpenSim.Region.Framework.Scenes ChatTypeEnum.DebugChannel, 0x7FFFFFFF, RootPart.AbsolutePosition, Name, UUID, false); } } - AbsolutePosition = pos; + AbsolutePosition = pos; HasGroupChanged = true; } @@ -3270,7 +3277,7 @@ namespace OpenSim.Region.Framework.Scenes public virtual string ExtraToXmlString() { - return "" + GetFromItemID().ToString() + ""; + return "" + FromItemID.ToString() + ""; } public virtual void ExtraFromXmlString(string xmlstr) @@ -3282,7 +3289,7 @@ namespace OpenSim.Region.Framework.Scenes UUID uuid = UUID.Zero; UUID.TryParse(id, out uuid); - SetFromItemID(uuid); + FromItemID = uuid; } #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 2fcce1c520..046553ba6a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -181,10 +181,6 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampLastActivity; // Will be used for AutoReturn public uint TimeStampTerse; - - public UUID FromItemID; - - public UUID FromFolderID; public int STATUS_ROTATE_X; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 8223d95484..291f52e496 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3080,7 +3080,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectPart host = (SceneObjectPart)o; SceneObjectGroup grp = host.ParentGroup; - UUID itemID = grp.GetFromItemID(); + UUID itemID = grp.FromItemID; ScenePresence presence = World.GetScenePresence(host.OwnerID); IAttachmentsModule attachmentsModule = m_ScriptEngine.World.AttachmentsModule;