From a17f0a0ea1c55c8576d70216f2e0e645050802a2 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 31 May 2011 16:23:06 -0700 Subject: [PATCH] Fixed the problem that notecard updating was not propagated -- now syned across actors, bit viewers may not always get the correct update. --- .../Framework/Scenes/SceneObjectPart.cs | 50 +++++++++++++++++-- .../Scenes/SceneObjectPartInventory.cs | 29 ++++++++--- .../Shared/Api/Implementation/LSL_Api.cs | 3 +- 3 files changed, 70 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 766747569e..73f7692443 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -302,8 +302,8 @@ namespace OpenSim.Region.Framework.Scenes { get { return m_inventory; } } - //protected SceneObjectPartInventory m_inventory; - protected SceneObjectPartInventoryBase m_inventory; + protected SceneObjectPartInventory m_inventory; + //protected SceneObjectPartInventoryBase m_inventory; public bool Undoing; @@ -405,7 +405,7 @@ namespace OpenSim.Region.Framework.Scenes Rezzed = DateTime.UtcNow; //m_inventory = new SceneObjectPartInventory(this); - m_inventory = new SceneObjectPartInventoryBase(this); + //m_inventory = new SceneObjectPartInventoryBase(this); } /// @@ -457,7 +457,7 @@ namespace OpenSim.Region.Framework.Scenes //m_undo = new UndoStack(ParentGroup.GetSceneMaxUndo()); //m_inventory = new SceneObjectPartInventory(this); - m_inventory = new SceneObjectPartInventoryBase(this); + //m_inventory = new SceneObjectPartInventoryBase(this); } #endregion Constructors @@ -5056,6 +5056,7 @@ namespace OpenSim.Region.Framework.Scenes public SceneObjectPart() : base() { + m_inventory = new SceneObjectPartInventory(this); } public SceneObjectPart( @@ -5063,6 +5064,7 @@ namespace OpenSim.Region.Framework.Scenes Quaternion rotationOffset, Vector3 offsetPosition) : base(ownerID, shape, groupPosition, rotationOffset, offsetPosition) { + m_inventory = new SceneObjectPartInventory(this); } private static string m_localActorID = ""; @@ -5176,6 +5178,35 @@ namespace OpenSim.Region.Framework.Scenes #endregion SceneObjectPartSyncProperties categorization + /* + #region overridden SOPBase members + public new IEntityInventory Inventory + { + get { return m_inventory; } + } + protected new SceneObjectPartInventory m_inventory; + + /// + /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes + /// + public new uint InventorySerial + { + get { return m_inventory.Serial; } + set { m_inventory.Serial = value; } + } + + /// + /// Access should be via Inventory directly - this property temporarily remains for xml serialization purposes + /// + public new TaskInventoryDictionary TaskInventory + { + get { return m_inventory.Items; } + set { m_inventory.Items = value; } + } + + #endregion //overridden SOPBase members + */ + #region overridden SOPBase functions //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket //based synchronization @@ -5218,6 +5249,17 @@ namespace OpenSim.Region.Framework.Scenes base.ScheduleTerseUpdate(updatedProperties); } + public void ScheduleSyncUpdate(List updatedProperties) + { + if (updatedProperties != null && updatedProperties.Count > 0) + { + if (m_parentGroup != null && m_parentGroup.Scene != null && m_parentGroup.Scene.RegionSyncModule != null) + { + m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); + } + } + } + #endregion overridden SOPBase functions #region DSG SYNC supporting functions diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index f77251e81d..1ce7076e07 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -41,8 +41,8 @@ using OpenSim.Region.Framework.Scenes.Serialization; namespace OpenSim.Region.Framework.Scenes { - //public class SceneObjectPartInventory : IEntityInventory - public class SceneObjectPartInventoryBase : IEntityInventory + public class SceneObjectPartInventory : IEntityInventory + //public class SceneObjectPartInventoryBase : IEntityInventory { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -53,8 +53,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// The part to which the inventory belongs. /// - //private SceneObjectPart m_part; - private SceneObjectPartBase m_part; + private SceneObjectPart m_part; + //private SceneObjectPartBase m_part; /// /// Serial count for inventory file , used to tell if inventory has changed @@ -100,8 +100,8 @@ namespace OpenSim.Region.Framework.Scenes /// /// A /// - //public SceneObjectPartInventory(SceneObjectPart part) - public SceneObjectPartInventoryBase(SceneObjectPartBase part) + public SceneObjectPartInventory(SceneObjectPart part) + //public SceneObjectPartInventoryBase(SceneObjectPartBase part) { m_part = part; } @@ -695,7 +695,8 @@ namespace OpenSim.Region.Framework.Scenes return UpdateInventoryItem(item, fireScriptEvents, true); } - public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) + //public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) + public virtual bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) { TaskInventoryItem it = GetInventoryItem(item.ItemID); if (it != null) @@ -1183,6 +1184,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion REGION SYNC } + /* #region DSG SYNC public class SceneObjectPartInventory : SceneObjectPartInventoryBase { @@ -1200,6 +1202,19 @@ namespace OpenSim.Region.Framework.Scenes base.Serial = value; } } + + public override bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents, bool considerChanged) + { + if (base.UpdateInventoryItem(item, fireScriptEvents, considerChanged)) + { + m_part.ScheduleSyncUpdate(new List() { SceneObjectPartSyncProperties.TaskInventory, SceneObjectPartSyncProperties.InventorySerial }); + return true; + } + else + return false; + } } + #endregion + * */ } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fef80e0b0b..2ee682af4b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -5415,7 +5415,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.Name = name!=null?name:String.Empty; //DSG SYNC - m_host.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Name }); + //m_host.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Name }); + m_host.ScheduleSyncUpdate(new List() { SceneObjectPartSyncProperties.Name }); } public LSL_String llGetDate()