From 2ae8917c2e10f131021899833956514c4a413e19 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 4 Feb 2011 15:01:38 -0800 Subject: [PATCH] Modified/added set functions for SOP properties: "AllowedDrop" to "Material", as listed in SceneObjectSerializer(). --- .../Framework/Scenes/SceneObjectPart.cs | 56 ++++++++++++++-- .../Scenes/SceneObjectPartInventory.cs | 67 +++++++++++++++++-- 2 files changed, 114 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index e4c65a3ff4..093bd0b75c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -511,9 +511,16 @@ namespace OpenSim.Region.Framework.Scenes } set { - _creatorID = value; + SetCreatorID(value); + UpdateBucketSyncInfo("CreatorID"); + //_creatorID = value; } } + //SYMMETRIC SYNC + public void SetCreatorID(UUID value) + { + _creatorID = value; + } /// /// Data about the creator in the form profile_url;name @@ -521,7 +528,17 @@ namespace OpenSim.Region.Framework.Scenes public string CreatorData { get { return m_creatorData; } - set { m_creatorData = value; } + set + { + SetCreatorData(value); + UpdateBucketSyncInfo("CreatorData"); + //m_creatorData = value; + } + } + //SYMMETRIC SYNC + public void SetCreatorData(string value) + { + m_creatorData = value; } /// @@ -637,11 +654,22 @@ namespace OpenSim.Region.Framework.Scenes get { return m_name; } set { + /* m_name = value; if (PhysActor != null) { PhysActor.SOPName = value; } + * */ + } + } + //SYMMETRIC SYNC + public void SetName(string value) + { + m_name = value; + if (PhysActor != null) + { + PhysActor.SOPName = value; } } @@ -650,13 +678,27 @@ namespace OpenSim.Region.Framework.Scenes get { return (byte) m_material; } set { + SetMaterial(value); + UpdateBucketSyncInfo("Material"); + /* m_material = (Material)value; if (PhysActor != null) { PhysActor.SetMaterial((int)value); } + * */ } } + //SYMMETRIC SYNC + public void SetMaterial(byte value) + { + m_material = (Material)value; + if (PhysActor != null) + { + PhysActor.SetMaterial((int)value); + } + } + public bool PassTouches { @@ -3060,6 +3102,10 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; ScheduleFullUpdate(); + + //SYMMETRIC SYNC + //Make sure we record down the timestamp info for synchronization purpose + UpdateBucketSyncInfo("Scale"); } public void RotLookAt(Quaternion target, float strength, float damping) @@ -5558,7 +5604,7 @@ namespace OpenSim.Region.Framework.Scenes SetAngularVelocity(updatedPart.AngularVelocity); SetRotationOffset(updatedPart.RotationOffset); - //implementation in PhysicsActor + //properties in Physics bucket whose update processors are in PhysicsActor /* "Position": "Size": @@ -5595,7 +5641,7 @@ namespace OpenSim.Region.Framework.Scenes { string bucketName = m_propertyBucketNames[i]; - //If the object is created by de-serialization, then it already has m_bucketSyncInfoList populated with the right number of buckets. + //If the object is created by de-serialization, then it may already have m_bucketSyncInfoList populated with the right number of buckets. //If the deserilaization is due to receiving a sync message, then m_bucketSyncInfoList should already be filled with sync info. if (!m_bucketSyncInfoList.ContainsKey(bucketName)) { @@ -5619,7 +5665,7 @@ namespace OpenSim.Region.Framework.Scenes /// Update the timestamp and actorID information of the bucket the given property belongs to. /// /// Name of the property. Make sure the spelling is consistent with what are defined in PropertyList - private void UpdateBucketSyncInfo(string propertyName) + public void UpdateBucketSyncInfo(string propertyName) { if (m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count>0) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 67de34e1b0..69df8ec153 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -76,7 +76,19 @@ namespace OpenSim.Region.Framework.Scenes protected internal uint Serial { get { return m_inventorySerial; } - set { m_inventorySerial = value; } + set + { + SetSerial(value); + m_part.UpdateBucketSyncInfo("InventorySerial"); + //m_inventorySerial = value; + } + } + + //SYMMETRIC SYNC + protected void SetSerial(uint value) + { + m_inventorySerial = value; + } /// @@ -87,10 +99,19 @@ namespace OpenSim.Region.Framework.Scenes get { return m_items; } set { - m_items = value; - m_inventorySerial++; + SetItems(value); + m_part.UpdateBucketSyncInfo("TaskInventory"); + m_part.UpdateBucketSyncInfo("InventorySerial"); + //m_items = value; + //m_inventorySerial++; } } + //SYMMETRIC SYNC + protected void SetItems(TaskInventoryDictionary value) + { + m_items = value; + m_inventorySerial++; + } /// /// Constructor @@ -136,6 +157,10 @@ namespace OpenSim.Region.Framework.Scenes item.ResetIDs(m_part.UUID); m_items.Add(item.ItemID, item); } + + //SYMMETRIC SYNC + //No need to trigger UpdateBucketSyncInfo, as callers eventually will call SOG.AttachToScene and init BucketSyncInfo + } } @@ -152,6 +177,9 @@ namespace OpenSim.Region.Framework.Scenes item.ParentID = m_part.UUID; Items.Add(item.ItemID, item); } + + //SYMMETRIC SYNC + //No need to trigger UpdateBucketSyncInfo, this is called only when SOP.UUID is written, which is assumed not to change after being created. } } @@ -182,6 +210,9 @@ namespace OpenSim.Region.Framework.Scenes item.PermsGranter = UUID.Zero; } } + + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); } /// @@ -213,6 +244,12 @@ namespace OpenSim.Region.Framework.Scenes if (groupID != item.GroupID) item.GroupID = groupID; } + + //SYMMETRIC SYNC: need to test if we need to take different actions when this is attachment or not + //if (!m_part.ParentGroup.RootPart.IsAttachment) + //{ + m_part.UpdateBucketSyncInfo("TaskInventory"); + } /// @@ -543,7 +580,11 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.HasGroupChanged = true; //SYMMETRIC SYNC: add ScheduleFullUpdate to enable synchronization across actors - m_part.ScheduleFullUpdate(); + //m_part.ScheduleFullUpdate(); + + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); + m_part.UpdateBucketSyncInfo("InventorySerial"); //m_inventorySerial is also changed, } /// @@ -564,6 +605,9 @@ namespace OpenSim.Region.Framework.Scenes } m_inventorySerial++; } + + //SYMMETRIC SYNC: no UpdateBucketSyncInfo called here, since this function is called by loading objects from DB, and UpdateBucketSyncInfo + //will be called after all objects are loaded. } /// @@ -722,6 +766,10 @@ namespace OpenSim.Region.Framework.Scenes HasInventoryChanged = true; m_part.ParentGroup.HasGroupChanged = true; } + + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); + m_part.UpdateBucketSyncInfo("InventorySerial"); return true; } else @@ -765,6 +813,10 @@ namespace OpenSim.Region.Framework.Scenes m_part.ScheduleFullUpdate(); + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); + m_part.UpdateBucketSyncInfo("InventorySerial"); + return type; } @@ -1019,6 +1071,9 @@ namespace OpenSim.Region.Framework.Scenes item.OwnerChanged = true; item.PermsMask = 0; item.PermsGranter = UUID.Zero; + + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); } } } @@ -1035,6 +1090,10 @@ namespace OpenSim.Region.Framework.Scenes } m_inventorySerial++; HasInventoryChanged = true; + + //SYMMETRIC SYNC + m_part.UpdateBucketSyncInfo("TaskInventory"); + m_part.UpdateBucketSyncInfo("InventorySerial"); } public bool ContainsScripts()