From e9b831b8f4d1339be777b1bf988242e15660ff67 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 7 Feb 2011 17:16:26 -0800 Subject: [PATCH] 1. Updated SOP.InventorySerial and SOP.TaskInventory set functions, to make sure only local write accesses trigger UpdateBucketSyncInfo(). 2. LinkObjectsBySync(), DelinkObjectsBySync(), and functions they call into, all updated to set properties via calling SetXXX instead of by "XXX=", so that the set operations won't trigger UpdateBucketSyncInfo(). --- .../SymmetricSync/RegionSyncModule.cs | 4 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 7 ++- .../Framework/Scenes/SceneObjectGroup.cs | 29 ++++++++--- .../Framework/Scenes/SceneObjectPart.cs | 49 ++++++++++++++----- .../Scenes/SceneObjectPartInventory.cs | 8 +-- 5 files changed, 71 insertions(+), 26 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index d289b0c913..4e5c358f37 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -978,6 +978,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //save script state and stop script instances m_scene.EventManager.TriggerOnSymmetricSyncStop(); } + m_synced = true; } else { @@ -1059,11 +1060,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { syncConnector.StartCommThreads(); AddSyncConnector(syncConnector); + m_synced = true; } } - m_synced = true; - return true; } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 74cabc011c..d698e9eb42 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2145,8 +2145,11 @@ namespace OpenSim.Region.Framework.Scenes // Make sure no child prim is set for sale // So that, on delink, no prims are unwittingly // left for sale and sold off - child.RootPart.ObjectSaleType = 0; - child.RootPart.SalePrice = 10; + //SYMMETRIC SYNC: need to copy value w/o trigger UpdateBucketSyncInfo + //child.RootPart.ObjectSaleType = 0; + //child.RootPart.SalePrice = 10; + child.RootPart.SetObjectSaleType(0); + child.RootPart.SetSalePrice(10); childGroups.Add(child); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3a95d4356d..236a17f1d6 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3694,6 +3694,9 @@ namespace OpenSim.Region.Framework.Scenes } //Similar actions with DelinkFromGroup, except that m_scene.AddNewSceneObjectBySync is called + //!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!! + //All SOP properties below is set through calling SetXXX(value) instead of by "XXX=value", as such a value is being changed due to sync ( + //i.e. triggered by remote operation instead of by local operation public SceneObjectGroup DelinkFromGroupBySync(SceneObjectPart linkPart, bool sendEvents) { // m_log.DebugFormat( @@ -3714,7 +3717,8 @@ namespace OpenSim.Region.Framework.Scenes if (parts.Length == 1 && RootPart != null) { // Single prim left - RootPart.LinkNum = 0; + //RootPart.LinkNum = 0; + RootPart.SetLinkNum(0); } else { @@ -3722,13 +3726,18 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; if (part.LinkNum > linkPart.LinkNum) - part.LinkNum--; + { + //part.LinkNum--; + part.SetLinkNum(part.LinkNum--); + } } } } - linkPart.ParentID = 0; - linkPart.LinkNum = 0; + //linkPart.ParentID = 0; + //linkPart.LinkNum = 0; + linkPart.SetParentID(0); + linkPart.SetLinkNum(0); if (linkPart.PhysActor != null) { @@ -3742,11 +3751,15 @@ namespace OpenSim.Region.Framework.Scenes Vector3 axPos = linkPart.OffsetPosition; axPos *= parentRot; - linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z); - linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; - linkPart.OffsetPosition = new Vector3(0, 0, 0); + //linkPart.OffsetPosition = new Vector3(axPos.X, axPos.Y, axPos.Z); + //linkPart.GroupPosition = AbsolutePosition + linkPart.OffsetPosition; + //linkPart.OffsetPosition = new Vector3(0, 0, 0); + //linkPart.RotationOffset = worldRot; - linkPart.RotationOffset = worldRot; + linkPart.SetOffsetPosition(new Vector3(axPos.X, axPos.Y, axPos.Z)); + linkPart.SetGroupPosition(AbsolutePosition + linkPart.OffsetPosition); + linkPart.SetOffsetPosition(new Vector3(0, 0, 0)); + linkPart.SetRotationOffset(worldRot); SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index af9d853f16..ccfded4752 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -608,12 +608,18 @@ namespace OpenSim.Region.Framework.Scenes public uint InventorySerial { get { return m_inventory.Serial; } - set { m_inventory.Serial = value; } + set + { + SetInventorySerial(value); + UpdateBucketSyncInfo("InventorySerial"); + //m_inventory.Serial = value; + } } - //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Serial" set function will trigger UpdateBucketSyncInfo if appropriate + //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Serial" set function will trigger UpdateBucketSyncInfo, + //hence in SetInventorySerial we will call m_inventory.SetSerial to avoid triggering UpdateBucketSyncInfo(). public void SetInventorySerial(uint value) { - m_inventory.Serial = value; + m_inventory.SetSerial(value); } /// @@ -622,12 +628,18 @@ namespace OpenSim.Region.Framework.Scenes public TaskInventoryDictionary TaskInventory { get { return m_inventory.Items; } - set { m_inventory.Items = value; } + set + { + //SetTaskInventory(value); + //UpdateBucketSyncInfo("TaskInventory"); + //SYMMETRIC SYNC: "m_inventory.Items" set function will trigger UpdateBucketSyncInfo if appropriate + m_inventory.Items = value; + } } - //SYMMETRIC SYNC: implemented to be consistent with other properties. "m_inventory.Items" set function will trigger UpdateBucketSyncInfo if appropriate + //SYMMETRIC SYNC: implemented to be consistent with updating values of other properties (w/o triggering UpdateBucketSyncInfo); public void SetTaskInventory(TaskInventoryDictionary value) { - m_inventory.Items = value; + m_inventory.SetItems(value); } /// @@ -776,7 +788,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetScriptAccessPin(value); - //UpdateBucketSyncInfo("ScriptAccessPin"); + UpdateBucketSyncInfo("ScriptAccessPin"); //m_scriptAccessPin = (int)value; } } @@ -1317,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetTouchName(value); - //UpdateBucketSyncInfo("TouchName"); + UpdateBucketSyncInfo("TouchName"); //m_touchName = value; } } @@ -1349,7 +1361,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetClickAction(value); - UpdateBucketSyncInfo("ClickAction"); + //UpdateBucketSyncInfo("ClickAction"); //m_clickAction = value; } } @@ -1574,6 +1586,11 @@ namespace OpenSim.Region.Framework.Scenes get { return _parentID; } set { _parentID = value; } } + //SYMMETRIC SYNC: defined for consistency, for calling SetXXX in sync operations + public void SetParentID(uint value) + { + _parentID = value; + } public int CreationDate { @@ -5917,8 +5934,18 @@ namespace OpenSim.Region.Framework.Scenes SetMaterial(updatedPart.Material); SetPassTouches(updatedPart.PassTouches); //RegionHandle skipped - - + SetScriptAccessPin(updatedPart.ScriptAccessPin); + + //SetAcceleration(updatedPart.Acceleration); + //SetDescription(updatedPart.Description); + //SetColor(updatedPart.Color); + //SetText(updatedPart.Text); + //SetSitName(updatedPart.SitName); + + SetTouchName(updatedPart.TouchName); + SetLinkNum(updatedPart.LinkNum); + //SetClickAction(updatedPart.ClickAction); + SetShape(updatedPart.Shape); m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 69df8ec153..3a87dda99f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -85,7 +85,7 @@ namespace OpenSim.Region.Framework.Scenes } //SYMMETRIC SYNC - protected void SetSerial(uint value) + public void SetSerial(uint value) { m_inventorySerial = value; @@ -100,6 +100,7 @@ namespace OpenSim.Region.Framework.Scenes set { SetItems(value); + m_inventorySerial++; m_part.UpdateBucketSyncInfo("TaskInventory"); m_part.UpdateBucketSyncInfo("InventorySerial"); //m_items = value; @@ -107,10 +108,11 @@ namespace OpenSim.Region.Framework.Scenes } } //SYMMETRIC SYNC - protected void SetItems(TaskInventoryDictionary value) + //This is inparticular for updating properties + public void SetItems(TaskInventoryDictionary value) { m_items = value; - m_inventorySerial++; + //m_inventorySerial++; } ///