From 01b00ad0d57d828028379875a382965b44073497 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 5 May 2012 00:29:14 +0100 Subject: Fire the scripting changed event with CHANGED_OWNER when an object that has changed owners is rezzed. This needs to occur after the script is resumed rather than before, when the event is just dropped. Addresses http://opensimulator.org/mantis/view.php?id=5890 and http://opensimulator.org/mantis/view.php?id=5952 --- OpenSim/Framework/TaskInventoryItem.cs | 16 +++++++++++++--- .../Avatar/Attachments/AttachmentsModule.cs | 18 +++++++++--------- .../Region/CoreModules/World/Land/PrimCountModule.cs | 1 - .../Framework/Scenes/SceneObjectPartInventory.cs | 10 ++++++++-- 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/OpenSim/Framework/TaskInventoryItem.cs b/OpenSim/Framework/TaskInventoryItem.cs index d4bbbfb..362d365 100644 --- a/OpenSim/Framework/TaskInventoryItem.cs +++ b/OpenSim/Framework/TaskInventoryItem.cs @@ -26,6 +26,8 @@ */ using System; +using System.Reflection; +using log4net; using OpenMetaverse; namespace OpenSim.Framework @@ -35,6 +37,8 @@ namespace OpenSim.Framework /// public class TaskInventoryItem : ICloneable { +// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// /// XXX This should really be factored out into some constants class. /// @@ -331,12 +335,18 @@ namespace OpenSim.Framework } } - public bool OwnerChanged { - get { + public bool OwnerChanged + { + get + { return _ownerChanged; } - set { + set + { _ownerChanged = value; +// m_log.DebugFormat( +// "[TASK INVENTORY ITEM]: Owner changed set {0} for {1} {2} owned by {3}", +// _ownerChanged, Name, ItemID, OwnerID); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 7200c4b..2e1948d 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -527,9 +527,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private void AttachToAgent( IScenePresence sp, SceneObjectGroup so, uint attachmentpoint, Vector3 attachOffset, bool silent) { - // m_log.DebugFormat( - // "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", - // so.Name, avatar.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Adding attachment {0} to avatar {1} in pt {2} pos {3} {4}", +// so.Name, sp.Name, attachmentpoint, attachOffset, so.RootPart.AttachedPos); so.DetachFromBackup(); @@ -788,9 +788,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments /// private void ShowAttachInUserInventory(IScenePresence sp, uint AttachmentPt, UUID itemID, SceneObjectGroup att) { - // m_log.DebugFormat( - // "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", - // att.Name, sp.Name, AttachmentPt, itemID); +// m_log.DebugFormat( +// "[USER INVENTORY]: Updating attachment {0} for {1} at {2} using item ID {3}", +// att.Name, sp.Name, AttachmentPt, itemID); if (UUID.Zero == itemID) { @@ -853,9 +853,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments private void Client_OnObjectAttach(IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, bool silent) { - // m_log.DebugFormat( - // "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", - // objectLocalID, remoteClient.Name, AttachmentPt, silent); +// m_log.DebugFormat( +// "[ATTACHMENTS MODULE]: Attaching object local id {0} to {1} point {2} from ground (silent = {3})", +// objectLocalID, remoteClient.Name, AttachmentPt, silent); if (!Enabled) return; diff --git a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs index efede5c..b2f71d1 100644 --- a/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/PrimCountModule.cs @@ -126,7 +126,6 @@ namespace OpenSim.Region.CoreModules.World.Land // m_log.DebugFormat( // "[PRIM COUNT MODULE]: Ignoring OnParcelPrimCountAdd() for {0} on {1} since count is tainted", // obj.Name, m_Scene.RegionInfo.RegionName); - } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index aacad98..3734e03 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -1219,13 +1219,19 @@ namespace OpenSim.Region.Framework.Scenes { if (engine != null) { +// m_log.DebugFormat( +// "[PRIM INVENTORY]: Resuming script {0} {1} for {2}, OwnerChanged {3}", +// item.Name, item.ItemID, item.OwnerID, item.OwnerChanged); + + engine.ResumeScript(item.ItemID); + if (item.OwnerChanged) engine.PostScriptEvent(item.ItemID, "changed", new Object[] { (int)Changed.OWNER }); + item.OwnerChanged = false; - engine.ResumeScript(item.ItemID); } } } } } -} +} \ No newline at end of file -- cgit v1.1