From ed365f6220afd4a3bb7d77ef44f6ecf673b46266 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Thu, 26 Jan 2017 19:43:00 +0000 Subject: [PATCH] remove SOP.AttachPoint, redundant( and incoerent) with SOG.AttachmentPoint --- .../Avatar/Attachments/AttachmentsModule.cs | 42 +++++++------------ .../InventoryAccess/InventoryAccessModule.cs | 14 ++----- .../Framework/Scenes/SceneObjectPart.cs | 11 +++-- .../Shared/Api/Implementation/LSL_Api.cs | 2 - 4 files changed, 25 insertions(+), 44 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index a900a2a723..cf188aacd3 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -481,14 +481,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // "[ATTACHMENTS MODULE]: Attaching object {0} {1} to {2} point {3} from ground (silent = {4})", // group.Name, group.LocalId, sp.Name, attachmentPt, silent); - if (sp.GetAttachments().Contains(group)) - { -// m_log.WarnFormat( -// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", -// group.Name, group.LocalId, sp.Name, AttachmentPt); - - return false; - } if (group.GetSittingAvatarsCount() != 0) { @@ -500,6 +492,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return false; } + List attachments = sp.GetAttachments(attachmentPt); + if (attachments.Contains(group)) + { +// if (DebugLevel > 0) +// m_log.WarnFormat( +// "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", +// group.Name, group.LocalId, sp.Name, attachmentPt); + + return false; + } + Vector3 attachPos = group.AbsolutePosition; // TODO: this short circuits multiple attachments functionality in LL viewer 2.1+ and should @@ -533,7 +536,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { attachmentPt = (uint)group.RootPart.Shape.LastAttachPoint; attachPos = group.RootPart.AttachedPos; - group.HasGroupChanged = true; } // if we still didn't find a suitable attachment point....... @@ -544,18 +546,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments attachPos = Vector3.Zero; } - List attachments = sp.GetAttachments(attachmentPt); - - if (attachments.Contains(group)) - { - if (DebugLevel > 0) - m_log.WarnFormat( - "[ATTACHMENTS MODULE]: Ignoring request to attach {0} {1} to {2} on {3} since it's already attached", - group.Name, group.LocalId, sp.Name, attachmentPt); - - return false; - } - // If we already have 5, remove the oldest until only 4 are left. Skip over temp ones while (attachments.Count >= 5) { @@ -579,7 +569,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments lock (sp.AttachmentsSyncLock) { group.AttachmentPoint = attachmentPt; - group.AbsolutePosition = attachPos; + group.RootPart.AttachedPos = attachPos; if (addToInventory && sp.PresenceType != PresenceType.Npc) UpdateUserInventoryWithAttachment(sp, group, attachmentPt, append); @@ -956,7 +946,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments m_scene.DeleteFromStorage(so.UUID); m_scene.EventManager.TriggerParcelPrimCountTainted(); - so.AttachedAvatar = sp.UUID; foreach (SceneObjectPart part in so.Parts) { @@ -969,11 +958,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } } - so.AbsolutePosition = attachOffset; - so.RootPart.AttachedPos = attachOffset; - so.IsAttachment = true; so.RootPart.SetParentLocalId(sp.LocalId); + so.AttachedAvatar = sp.UUID; so.AttachmentPoint = attachmentpoint; + so.RootPart.AttachedPos = attachOffset; + so.AbsolutePosition = attachOffset; + so.IsAttachment = true; sp.AddAttachment(so); diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index a73906c21a..67c847b21d 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -427,20 +427,14 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess originalRotations[objectGroup.UUID] = inventoryStoredRotation; // Restore attachment data after trip through the sim - if (objectGroup.RootPart.AttachPoint > 0) + if (objectGroup.AttachmentPoint > 0) { inventoryStoredPosition = objectGroup.RootPart.AttachedPos; inventoryStoredRotation = objectGroup.RootPart.AttachRotation; - } + if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree && + objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree) + objectGroup.RootPart.Shape.LastAttachPoint = (byte)objectGroup.AttachmentPoint; - // Trees could be attached and it's been done, but it makes - // no sense. State must be preserved because it's the tree type - if (objectGroup.RootPart.Shape.PCode != (byte) PCode.Tree && - objectGroup.RootPart.Shape.PCode != (byte) PCode.NewTree) - { - objectGroup.RootPart.Shape.State = objectGroup.RootPart.AttachPoint; - if (objectGroup.RootPart.AttachPoint > 0) - objectGroup.RootPart.Shape.LastAttachPoint = objectGroup.RootPart.AttachPoint; } objectGroup.AbsolutePosition = inventoryStoredPosition; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 0544696164..bf0e31b673 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -244,11 +244,6 @@ namespace OpenSim.Region.Framework.Scenes public uint TimeStampTerse; - // The following two are to hold the attachment data - // while an object is inworld - [XmlIgnore] - public byte AttachPoint = 0; - [XmlIgnore] public Quaternion AttachRotation = Quaternion.Identity; @@ -277,7 +272,11 @@ namespace OpenSim.Region.Framework.Scenes public scriptEvents AggregateScriptEvents; - public Vector3 AttachedPos; + public Vector3 AttachedPos + { + get; + set; + } // rotation locks on local X,Y and or Z axis bit flags // bits are as in llSetStatus defined in SceneObjectGroup.axisSelect enum diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 226ad6c412..3f2e321a21 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7972,7 +7972,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { return 0; } - } public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) @@ -15867,7 +15866,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return; } - group.RootPart.AttachPoint = group.RootPart.Shape.State; group.RootPart.AttachedPos = group.AbsolutePosition; group.ResetIDs();