From c1e19ead74197a980d5d71f0158cf5d11ad01c8e Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 12 Jan 2011 17:20:17 -0800 Subject: [PATCH 1/2] Added ScheduleFullUpdate() in SceneObjectPart.AddInventoryItem(), to enable synchronization across actors. --- .../Framework/Scenes/Scene.Inventory.cs | 21 +++++++++++++++++++ .../Scenes/SceneObjectPartInventory.cs | 3 +++ 2 files changed, 24 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 900b19ce2f..2c6ab2ee6b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -376,6 +376,17 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectPart part = GetSceneObjectPart(primID); SceneObjectGroup group = part.ParentGroup; + + if (null == group) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: " + + "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", + itemID, primID); + + return new ArrayList(); + } + if (isScriptRunning) { m_log.Debug("To RemoveScriptInstance"); @@ -385,6 +396,16 @@ namespace OpenSim.Region.Framework.Scenes // Retrieve item TaskInventoryItem item = group.GetInventoryItem(part.LocalId, itemID); + if (null == item) + { + m_log.ErrorFormat( + "[PRIM INVENTORY]: Tried to retrieve item ID {0} from prim {1}, {2} for caps script update " + + " but the item does not exist in this inventory", + itemID, part.Name, part.UUID); + + return new ArrayList(); + } + // Update item with new asset item.AssetID = newAssetID; group.UpdateInventoryItem(item); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 7a0cc5a8fe..d3d2d73979 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -539,6 +539,9 @@ namespace OpenSim.Region.Framework.Scenes //m_inventorySerial += 2; HasInventoryChanged = true; m_part.ParentGroup.HasGroupChanged = true; + + //SYMMETRIC SYNC: add ScheduleFullUpdate to enable synchronization across actors + m_part.ScheduleFullUpdate(); } /// From 0be2fe7f1341ad744378005c8c2f32ef4345cc3a Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Thu, 13 Jan 2011 15:36:44 -0800 Subject: [PATCH 2/2] Changed the way RemoveObject is handled: now Scene.DeleteSceneObject() calls RegionSyncModule to send RemovedObject message to other actors for synchronization. --- .../SymmetricSync/RegionSyncModule.cs | 5 +++-- .../Framework/Interfaces/IRegionSyncModule.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 16 +++++++++++++--- .../Region/Framework/Scenes/SceneObjectGroup.cs | 3 ++- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 52212d87d5..860b80b708 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Register for local Scene events m_scene.EventManager.OnPostSceneCreation += OnPostSceneCreation; - m_scene.EventManager.OnObjectBeingRemovedFromScene += new EventManager.ObjectBeingRemovedFromScene(RegionSyncModule_OnObjectBeingRemovedFromScene); + //m_scene.EventManager.OnObjectBeingRemovedFromScene += new EventManager.ObjectBeingRemovedFromScene(RegionSyncModule_OnObjectBeingRemovedFromScene); } @@ -1273,7 +1273,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// only be triggered by an object removal that is initiated locally. /// /// - private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) + //private void RegionSyncModule_OnObjectBeingRemovedFromScene(SceneObjectGroup sog) + public void SendDeleteObject(SceneObjectGroup sog) { //m_log.DebugFormat("RegionSyncModule_OnObjectBeingRemovedFromScene called at time {0}:{1}:{2}", DateTime.Now.Minute, DateTime.Now.Second, DateTime.Now.Millisecond); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 8733f8ec6d..8709d4cd46 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -63,7 +63,7 @@ namespace OpenSim.Region.Framework.Interfaces //void SendUpdatesToSynchronizeState(List sog); void SendSceneUpdates(); void SendTerrainUpdates(string lastUpdateActorID); - //void SendDeleteObject(SceneObjectGroup sog); + void SendDeleteObject(SceneObjectGroup sog); //For propogating scene events to other actors void PublishSceneEvent(EventManager.EventNames ev, Object[] evArgs); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 07c5d70d6c..721feda63d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -662,8 +662,7 @@ namespace OpenSim.Region.Framework.Scenes if (UnlinkSceneObject(group, false)) { - //For object removals caused by remote events (by other actors), do not trigger local event ObjectBeingRemovedFromScene - //EventManager.TriggerObjectBeingRemovedFromScene(group); + EventManager.TriggerObjectBeingRemovedFromScene(group); EventManager.TriggerParcelPrimCountTainted(); } @@ -2430,8 +2429,16 @@ namespace OpenSim.Region.Framework.Scenes { part.SyncInfoUpdate(); } - //end of SYMMETRIC SYNC + * * */ + + //Propagate the RemovedObject message + if (RegionSyncModule != null) + { + RegionSyncModule.SendDeleteObject(group); + } + //end of SYMMETRIC SYNC + } /// @@ -3592,9 +3599,12 @@ namespace OpenSim.Region.Framework.Scenes ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); + //SYMMETRIC SYNC: object remove should be handled through RegionSyncModule // REGION SYNC + /* if( IsSyncedServer() ) RegionSyncServerModule.DeleteObject(m_regionHandle, localID, part); + * */ } #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 2a8f2990b6..1b0c0fcd7b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1163,7 +1163,8 @@ namespace OpenSim.Region.Framework.Scenes Scene.RegionSyncServerModule.DeleteObject(part.RegionHandle, part.LocalId, part); //return; } - * */ + * */ + //end of SYMMETRIC SYNC Scene.ForEachScenePresence(delegate(ScenePresence avatar) {