From b2021cf83a532cf61d2f42ad5448d03307876072 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Aug 2016 11:28:49 +0100 Subject: mantis: 8006 remove duplication of attach script events. This is a temporary fix because TriggerOnAttach will not be trigger on attachment from inventory, (for now only Xengine connects to it on core). --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 8f03a0a..fe341c2 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -595,7 +595,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments } // Do this last so that event listeners have access to all the effects of the attachment - m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); + // this can't be done + // scripts do internal enqueue of attach even + // and not all scripts are loaded at this point +// m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } return true; @@ -1318,7 +1321,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments AttachmentPt &= 0x7f; // Calls attach with a Zero position - if (AttachObject(sp, part.ParentGroup, AttachmentPt, false, true, append)) + SceneObjectGroup group = part.ParentGroup; + if (AttachObject(sp, group , AttachmentPt, false, true, append)) { if (DebugLevel > 0) m_log.Debug( @@ -1327,6 +1331,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); + m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } } catch (Exception e) -- cgit v1.1 From 832758df2bfc161ebca97a25125a85a3a2636617 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 Aug 2016 10:03:06 +0100 Subject: mantis: 8006 restrict the suspention of Trigger OnAttach to the problematic case where scripts are created, and not always as i incorrectly did before. This is still a temporary fix, other modules will not get the notification in that case. But that needs a deeper fix possible in xengine --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index fe341c2..9a6fce9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -594,11 +594,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments group.ResumeScripts(); } + else // Do this last so that event listeners have access to all the effects of the attachment - // this can't be done - // scripts do internal enqueue of attach even + // this can't be done when creating scripts: + // scripts do internal enqueue of attach event // and not all scripts are loaded at this point -// m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); + m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } return true; @@ -1331,7 +1332,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // Save avatar attachment information m_scene.AvatarFactory.QueueAppearanceSave(sp.UUID); - m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } } catch (Exception e) -- cgit v1.1 From a4bf78fa191b62e71ccd7cd0c2330879a56b5eaf Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 Aug 2016 11:53:07 +0100 Subject: mantis 8006: AttachmentModule triggered OnAttach by SOG xengine expects by SOP --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 9a6fce9..1563f26 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -599,7 +599,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // this can't be done when creating scripts: // scripts do internal enqueue of attach event // and not all scripts are loaded at this point - m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); +// m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); + TriggerGroupOnAttach(group, sp.UUID); } return true; @@ -759,7 +760,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ControllingClient.SendRemoveInventoryItem(inventoryID); } - m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); + //m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); + TriggerGroupOnAttach(so, UUID.Zero); // Attach (NULL) stops scripts. We don't want that. Resume them. so.ResumeScripts(); @@ -1056,8 +1058,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { if (fireDetachEvent) { - m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); - +// m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); + TriggerGroupOnAttach(grp, UUID.Zero); // Allow detach event time to do some work before stopping the script Thread.Sleep(2); } @@ -1383,6 +1385,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments DetachSingleAttachmentToGround(sp, soLocalId); } + private void TriggerGroupOnAttach(SceneObjectGroup grp, UUID avatarID) + { + UUID item = grp.FromItemID; // this maybe wrong but xengine ignores it + foreach(SceneObjectPart part in grp.Parts) + m_scene.EventManager.TriggerOnAttach(part.LocalId, item, avatarID); + } #endregion } } -- cgit v1.1 From d96c05a1219a60183f5076f6c6f0bdd320611fd5 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 Aug 2016 12:18:01 +0100 Subject: change my previus fix, change xengine to expect SOG and not attachments module, this way not breaking other script engines or modules out there for no valid reason --- .../CoreModules/Avatar/Attachments/AttachmentsModule.cs | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 1563f26..d227974 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -599,8 +599,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments // this can't be done when creating scripts: // scripts do internal enqueue of attach event // and not all scripts are loaded at this point -// m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); - TriggerGroupOnAttach(group, sp.UUID); + m_scene.EventManager.TriggerOnAttach(group.LocalId, group.FromItemID, sp.UUID); } return true; @@ -760,8 +759,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments sp.ControllingClient.SendRemoveInventoryItem(inventoryID); } - //m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); - TriggerGroupOnAttach(so, UUID.Zero); + m_scene.EventManager.TriggerOnAttach(so.LocalId, so.UUID, UUID.Zero); // Attach (NULL) stops scripts. We don't want that. Resume them. so.ResumeScripts(); @@ -1058,8 +1056,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments { if (fireDetachEvent) { -// m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); - TriggerGroupOnAttach(grp, UUID.Zero); + m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero); // Allow detach event time to do some work before stopping the script Thread.Sleep(2); } @@ -1384,13 +1381,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments if (sp != null) DetachSingleAttachmentToGround(sp, soLocalId); } - - private void TriggerGroupOnAttach(SceneObjectGroup grp, UUID avatarID) - { - UUID item = grp.FromItemID; // this maybe wrong but xengine ignores it - foreach(SceneObjectPart part in grp.Parts) - m_scene.EventManager.TriggerOnAttach(part.LocalId, item, avatarID); - } #endregion } } -- cgit v1.1 From ed555801a4e91af69f4074b18bae4d851527fcc2 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 29 Aug 2016 19:41:26 +0100 Subject: mantis 8013: change attachment group to active group on attach from inventory --- .../Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs') diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index d227974..d5c81ce 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -1118,13 +1118,15 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments SceneObjectGroup objatt; + UUID rezGroupID = sp.ControllingClient.ActiveGroupId; + if (itemID != UUID.Zero) objatt = m_invAccessModule.RezObject(sp.ControllingClient, - itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, + itemID, rezGroupID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, sp.UUID, true); else - objatt = m_invAccessModule.RezObject(sp.ControllingClient, - null, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, + objatt = m_invAccessModule.RezObject(sp.ControllingClient, + null, rezGroupID, assetID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true, false, false, sp.UUID, true); if (objatt == null) -- cgit v1.1