From 2bea8bb4bc19c8b2d840bc3eb20a621b3a5e51c3 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 6 Apr 2011 12:23:04 -0700 Subject: [PATCH 01/36] Added class PropertySyncInfo and PrimSyncInfo in RegionSyncModule. --- .../SymmetricSync/RegionSyncModule.cs | 282 ++++++++++-------- .../Framework/Interfaces/IRegionSyncModule.cs | 5 +- 2 files changed, 166 insertions(+), 121 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 10a510d96a..184bd4e000 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -130,27 +130,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Called after AddRegion() has been called for all region modules of the scene public void RegionLoaded(Scene scene) { - //m_log.Warn(LogHeader + " RegionLoaded() called"); - - /* - //If this one is configured to start a listener so that other actors can connect to form a overlay, start the listener. - //For now, we use the star topology, and ScenePersistence actor is always the one to start the listener. - if (m_isSyncListenerLocal) - { - StartLocalSyncListener(); - } - else - { - //Start connecting to the remote listener. TO BE IMPLEMENTED. - //For now, the connection will be started by manually typing in "sync start". - - } - * */ - - //Start symmetric synchronization initialization automatically - //SyncStart(null); - - // connect to statistics system SyncStatisticCollector.Register(this); } @@ -182,24 +161,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Synchronization related members and functions, exposed through IRegionSyncModule interface /////////////////////////////////////////////////////////////////////////////////////////////////// - private DSGActorTypes m_actorType = DSGActorTypes.Unknown; - /// - /// The type of the actor running locally. This value will be set by an ActorSyncModule, so that - /// no hard code needed in RegionSyncModule to recoganize the actor's type, thus make it easier - /// to add new ActorSyncModules w/o chaning the code in RegionSyncModule. - /// - public DSGActorTypes DSGActorType - { - get { return m_actorType; } - set { m_actorType = value; } - } - + //ActorID might not be in use anymore. Rather, SyncID should be used. + //(Synchronization is sync node centric, not actor centric.) private string m_actorID; public string ActorID { get { return m_actorID; } } + private string m_syncID; + public string SyncID + { + get { return m_syncID; } + } + private bool m_active = false; public bool Active { @@ -228,12 +203,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (string bucketName in m_propertyBucketNames) { - //if (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName)) if(!part.ParentGroup.IsDeleted && HaveUpdatesToSendoutForSync(part, bucketName)) { lock (m_primUpdateLocks[bucketName]) { - //m_log.Debug("Queueing to bucket " + bucketName + " with part " + part.Name + ", " + part.UUID+" at pos "+part.GroupPosition.ToString()); m_primUpdates[bucketName][part.UUID] = part; } } @@ -250,8 +223,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } - + //SendSceneUpdates put each update into an outgoing queue of each SyncConnector + /// + /// Send updates to other sync nodes. So far we only handle object updates. + /// public void SendSceneUpdates() { if (!IsSyncingWithOtherSyncNodes()) @@ -271,7 +247,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } - //List primUpdates=null; Dictionary> primUpdates = new Dictionary>(); bool updated = false; @@ -304,18 +279,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - List presenceUpdates = new List(); - /* - if (m_presenceUpdates.Count > 0) - { - lock (m_updateScenePresenceLock) - { - updated = true; - presenceUpdates = new List(m_presenceUpdates.Values); - m_presenceUpdates.Clear(); - } - } - */ if (updated) { @@ -337,48 +300,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule primUpdates[bucketName].Clear(); } } - foreach (ScenePresence presence in presenceUpdates) - { - try - { - if (!presence.IsDeleted) - { - /* - OSDMap data = new OSDMap(10); - data["id"] = OSD.FromUUID(presence.UUID); - // Do not include offset for appearance height. That will be handled by RegionSyncClient before sending to viewers - if(presence.AbsolutePosition.IsFinite()) - data["pos"] = OSD.FromVector3(presence.AbsolutePosition); - else - data["pos"] = OSD.FromVector3(Vector3.Zero); - if(presence.Velocity.IsFinite()) - data["vel"] = OSD.FromVector3(presence.Velocity); - else - data["vel"] = OSD.FromVector3(Vector3.Zero); - data["rot"] = OSD.FromQuaternion(presence.Rotation); - data["fly"] = OSD.FromBoolean(presence.Flying); - data["flags"] = OSD.FromUInteger((uint)presence.AgentControlFlags); - data["anim"] = OSD.FromString(presence.Animator.CurrentMovementAnimation); - // needed for a full update - if (presence.ParentID != presence.lastSentParentID) - { - data["coll"] = OSD.FromVector4(presence.CollisionPlane); - data["off"] = OSD.FromVector3(presence.OffsetPosition); - data["pID"] = OSD.FromUInteger(presence.ParentID); - presence.lastSentParentID = presence.ParentID; - } - - RegionSyncMessage rsm = new RegionSyncMessage(RegionSyncMessage.MsgType.UpdatedAvatar, OSDParser.SerializeJsonString(data)); - m_server.EnqueuePresenceUpdate(presence.UUID, rsm.ToBytes()); - */ - - } - } - catch (Exception e) - { - m_log.ErrorFormat("[REGION SYNC MODULE] Caught exception sending presence updates for {0}: {1}", presence.Name, e); - } - } // Indicate that the current batch of updates has been completed Interlocked.Exchange(ref m_sendingUpdates, 0); @@ -583,21 +504,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OnLocalScriptReset((uint)evArgs[0], (UUID)evArgs[1]); return; case EventManager.EventNames.ChatFromClient: - /*if (evArgs.Length < 2) - { - m_log.Error(LogHeader + " not enough event args for ChatFromClient"); - return; - } - OnLocalChatFromClient(evArgs[0], (OSChatMessage)evArgs[1]); - return;*/ - case EventManager.EventNames.ChatFromWorld: - /*if (evArgs.Length < 2) - { - m_log.Error(LogHeader + " not enough event args for ChatFromWorld"); - return; - } - OnLocalChatFromWorld(evArgs[0], (OSChatMessage)evArgs[1]); - return;*/ + case EventManager.EventNames.ChatFromWorld: case EventManager.EventNames.ChatBroadcast: if (evArgs.Length < 2) { @@ -699,9 +606,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #region RegionSyncModule members and functions - ///////////////////////////////////////////////////////////////////////////////////////// - // Synchronization related functions, NOT exposed through IRegionSyncModule interface - ///////////////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////////////// + // Memeber variables + /////////////////////////////////////////////////////////////////////// private static int PortUnknown = -1; private static string IPAddrUnknown = String.Empty; @@ -740,9 +647,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private RegionSyncListener m_localSyncListener = null; private bool m_synced = false; - // Lock is used to synchronize access to the update status and update queues - //private object m_updateSceneObjectPartLock = new object(); - //private Dictionary m_primUpdates = new Dictionary(); + /////////////////////////////////////////////////////////////////////// + // Memeber variables for per-property timestamp + /////////////////////////////////////////////////////////////////////// + + + + /////////////////////////////////////////////////////////////////////// + // Legacy members for bucket-based sync, + /////////////////////////////////////////////////////////////////////// + private Dictionary m_primUpdateLocks = new Dictionary(); private Dictionary> m_primUpdates = new Dictionary>(); @@ -771,6 +685,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private int m_maxNumOfPropertyBuckets; + ///////////////////////////////////////////////////////////////////////////////////////// + // Synchronization related functions, NOT exposed through IRegionSyncModule interface + ///////////////////////////////////////////////////////////////////////////////////////// + private void StatsTimerElapsed(object source, System.Timers.ElapsedEventArgs e) { //TO BE IMPLEMENTED @@ -1690,7 +1608,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.Error(LogHeader + "interface Scene.ActorSyncModule has not been set yet"); return; } - m_actorType = m_scene.ActorSyncModule.ActorType; + //m_actorType = m_scene.ActorSyncModule.ActorType; } //Start symmetric synchronization initialization automatically @@ -1800,12 +1718,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Start SyncListener if a listener is supposed to run on this actor; Otherwise, initiate connections to remote listeners. private void SyncStart(Object[] args) { - if (m_actorType == DSGActorTypes.Unknown) - { - m_log.Error(LogHeader + ": SyncStart -- ActorType not set yet. Either it's not defined in config file (DSGActorType), or the ActorSyncModule (ScenePersistenceSyncModule, ScriptEngineSyncModule etc) has not defined it."); - return; - } - if (m_isSyncListenerLocal) { if (m_localSyncListener!=null && m_localSyncListener.IsListening) @@ -3400,5 +3312,137 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + + /////////////////////////////////////////////////////////////////////////// + // + /////////////////////////////////////////////////////////////////////////// + + public enum PropertyUpdateSource + { + Local, + BySync + } + + public class PropertySyncInfo + { + private ulong m_lastUpdateTimeStamp; + public ulong LastUpdateTimeStamp + { + get { return m_lastUpdateTimeStamp; } + } + + private string m_lastUpdateSyncID; + public string LastUpdateSyncID + { + get { return m_lastUpdateSyncID; } + } + + /// + /// The value of the most recent value sent/received by Sync Module. + /// For property with simple types, the value is copied directly. + /// For property with complex data structures, the value (values of + /// subproperties) is serialized and stored. + /// + private Object m_lastUpdateValue; + public Object LastUpdateValue + { + get { return m_lastUpdateValue; } + } + + /// + /// Record the time the last sync message about this property is received. + /// This value is only meaninful when m_lastUpdateSource==BySync + /// + private ulong m_lastSyncUpdateRecvTime; + public ulong LastSyncUpdateRecvTime + { + get { return m_lastSyncUpdateRecvTime; } + set { m_lastSyncUpdateRecvTime = value; } + } + + private PropertyUpdateSource m_lastUpdateSource; + public PropertyUpdateSource LastUpdateSource + { + get { return m_lastUpdateSource; } + } + + private Object m_syncInfoLock = new Object(); + + /// + /// Update SyncInfo when the property is updated locally. + /// + /// the time + /// + public void UpdateSyncInfoLocally(ulong ts, string syncID, Object pValue) + { + lock (m_syncInfoLock) + { + m_lastUpdateValue = pValue; + m_lastUpdateTimeStamp = ts; + m_lastUpdateSyncID = syncID; + m_lastUpdateSource = PropertyUpdateSource.Local; + } + } + + /// + /// Update SyncInfo when the property is updated by receiving a sync + /// message. + /// + /// + /// + public void UpdateSyncInfoBySync(ulong ts, string syncID, ulong recvTS, Object pValue) + { + lock (m_syncInfoLock) + { + m_lastUpdateValue = pValue; + m_lastUpdateTimeStamp = ts; + m_lastUpdateSyncID = syncID; + m_lastSyncUpdateRecvTime = recvTS; + m_lastUpdateSource = PropertyUpdateSource.BySync; + } + } + } + + public class PrimSyncInfo + { + #region Members + public static long TimeOutThreshold; + + private Dictionary m_propertiesSyncInfo; + public Dictionary PropertiesSyncInfo + { + get { return m_propertiesSyncInfo; } + } + + private ulong m_PrimLastUpdateTime; + public ulong PrimLastUpdateTime + { + get { return m_PrimLastUpdateTime; } + } + #endregion //Members + + #region Constructor + public PrimSyncInfo() + { + m_propertiesSyncInfo = new Dictionary(); + + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + PropertySyncInfo syncInfo = new PropertySyncInfo(); + m_propertiesSyncInfo.Add(property, syncInfo); + } + } + #endregion //Constructor + + public void UpdatePropertySyncInfoLocally(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue) + { + m_propertiesSyncInfo[property].UpdateSyncInfoLocally(lastUpdateTS, syncID, pValue); + } + + public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, ulong recvTS) + { + m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); + } + } } diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 891e6761fd..667bf46276 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -52,8 +52,9 @@ namespace OpenSim.Region.Framework.Interfaces public interface IRegionSyncModule { bool Active { get; } //if true, this RegionSyncModule is connected into the synchronization overlay - string ActorID { get; } - DSGActorTypes DSGActorType { get; set; } + string ActorID { get; } //might be phased out soon + string SyncID { get; } + //DSGActorTypes DSGActorType { get; set; } bool IsSyncRelay { get; } /// From fe3d4ec9a89914f99274c70ac3fa52e2cf772479 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 6 Apr 2011 14:38:14 -0700 Subject: [PATCH 02/36] Re-implemented SOP.ScheduleFullUpdate and SOP.ScheduleTerseUpdate, calling RecordPrimUpdatesByLocal to record updated values and timestamp of SOP's updated properties. Also, removed some code that had been commented out before. --- .../SymmetricSync/RegionSyncModule.cs | 181 ++---------------- .../Framework/Interfaces/IRegionSyncModule.cs | 4 +- .../Framework/Scenes/SceneObjectPart.cs | 66 ++++--- 3 files changed, 55 insertions(+), 196 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 184bd4e000..ade7b4e829 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -604,8 +604,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #endregion Console Command Interface - #region RegionSyncModule members and functions - /////////////////////////////////////////////////////////////////////// // Memeber variables /////////////////////////////////////////////////////////////////////// @@ -1263,21 +1261,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { return part.HasPropertyUpdatedLocally(bucketName); } - - //return (m_isSyncRelay || part.HasPropertyUpdatedLocallyInGivenBucket(bucketName)); - - /* - if (!m_isSyncRelay) - { - return part.HasPropertyUpdatedLocallyInGivenBucket(bucketName); - } - - //if this is a relay node, forward out the updates that have not been sent out since lastUpdateSentTime - if (m_lastUpdateSentTime[bucketName] <= part.BucketSyncInfoList[bucketName].LastUpdateTimeStamp) - return true; - else - return false; - * */ } //by default, there are two property buckets: the "General" bucket and the "Physics" bucket. @@ -2020,6 +2003,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + #region Sync message handlers /// @@ -2042,30 +2026,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } case SymmetricSyncMessage.MsgType.Terrain: { - /* - m_scene.Heightmap.LoadFromXmlString(Encoding.ASCII.GetString(msg.Data, 0, msg.Length)); - //Inform the terrain module that terrain has been updated - m_scene.RequestModuleInterface().TaintTerrain(); - m_log.Debug(LogHeader+": Synchronized terrain"); - * */ HandleTerrainUpdateMessage(msg, senderActorID); return; } case SymmetricSyncMessage.MsgType.GetObjects: { - /* - EntityBase[] entities = m_scene.GetEntities(); - foreach (EntityBase e in entities) - { - if (e is SceneObjectGroup) - { - //string sogxml = SceneObjectSerializer.ToXml2Format((SceneObjectGroup)e); - //SendSyncMessage(SymmetricSyncMessage.MsgType.NewObject, sogxml); - SceneObjectGroup sog = (SceneObjectGroup)e; - HandleGetObjectRequest(syncConnector, sog); - } - } - * */ HandleGetObjectRequest(syncConnector); return; } @@ -2497,6 +2462,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); } + #endregion //Sync message handlers + + #region Remote Event handlers /// /// The common actions for handling remote events (event initiated at other actors and propogated here) @@ -2644,58 +2612,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.EventManager.TriggerScriptResetLocally(part.LocalId, itemID); } - /* - /// - /// Special actions for remote event ChatFromClient - /// - /// OSDMap data of event args - private void HandleRemoteEvent_OnChatFromClient(string actorID, ulong evSeqNum, OSDMap data) - { - //m_log.Debug(LogHeader + ": received ChatFromClient from "+actorID+", seq "+evSeqNum); - - OSChatMessage args = new OSChatMessage(); - args.Channel = data["channel"].AsInteger(); - args.Message = data["msg"].AsString(); - args.Position = data["pos"].AsVector3(); - args.From = data["name"].AsString(); - UUID id = data["id"].AsUUID(); - args.Scene = m_scene; - //args.Type = ChatTypeEnum.Say; - args.Type = (ChatTypeEnum) data["type"].AsInteger(); - ScenePresence sp; - m_scene.TryGetScenePresence(id, out sp); - - m_scene.EventManager.TriggerOnChatFromClientLocally(sp, args); //Let WorldCommModule and other modules to catch the event - m_scene.EventManager.TriggerOnChatFromWorldLocally(sp, args); //This is to let ChatModule to get the event and deliver it to avatars - } - - private void HandleRemoteEvent_OnChatFromWorld(string actorID, ulong evSeqNum, OSDMap data) - { - //m_log.Debug(LogHeader + ", " + m_actorID + ": received ChatFromWorld from " + actorID + ", seq " + evSeqNum); - - OSChatMessage args = new OSChatMessage(); - args.Channel = data["channel"].AsInteger(); - args.Message = data["msg"].AsString(); - args.Position = data["pos"].AsVector3(); - args.From = data["name"].AsString(); - UUID id = data["id"].AsUUID(); - args.Scene = m_scene; - //args.Type = ChatTypeEnum.Say; - args.Type = (ChatTypeEnum)data["type"].AsInteger(); - //ScenePresence sp; - //m_scene.TryGetScenePresence(id, out sp); - - m_log.Debug(LogHeader + " TriggerOnChatFromWorldLocally "); - - m_scene.EventManager.TriggerOnChatFromWorldLocally(m_scene, args); - } - - private void HandleRemoteEvent_OnChatBroadcast(string actorID, ulong evSeqNum, OSDMap data) - { - - } - * */ - /// /// Handlers for remote chat events: ChatFromClient, ChatFromWorld, ChatBroadcast /// @@ -2957,42 +2873,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSceneEvent(SymmetricSyncMessage.MsgType.ScriptReset, data); } - /* - private void OnLocalChatFromClient(Object sender, OSChatMessage chat) - { - ScenePresence avatar = m_scene.GetScenePresence(chat.SenderUUID); - - if (avatar == null) - { - m_log.Warn(LogHeader + "avatar " + chat.SenderUUID + " not exist locally, NOT sending out ChatFromClient"); - return; - } - - OSDMap data = new OSDMap(); - data["channel"] = OSD.FromInteger(chat.Channel); - data["msg"] = OSD.FromString(chat.Message); - data["pos"] = OSD.FromVector3(chat.Position); - data["name"] = OSD.FromString(avatar.Name); //note this is different from OnLocalChatFromWorld - data["id"] = OSD.FromUUID(chat.SenderUUID); - data["type"] = OSD.FromInteger((int)chat.Type); - SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromClient, data); - } - - - private void OnLocalChatFromWorld(Object sender, OSChatMessage chat) - { - - OSDMap data = new OSDMap(); - data["channel"] = OSD.FromInteger(chat.Channel); - data["msg"] = OSD.FromString(chat.Message); - data["pos"] = OSD.FromVector3(chat.Position); - data["name"] = OSD.FromString(chat.From); //note this is different from OnLocalChatFromClient - data["id"] = OSD.FromUUID(chat.SenderUUID); - data["type"] = OSD.FromInteger((int)chat.Type); - SendSceneEvent(SymmetricSyncMessage.MsgType.ChatFromWorld, data); - } - * */ - private void OnLocalChatBroadcast(Object sender, OSChatMessage chat) { @@ -3049,49 +2929,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void OnLocalGrabObject(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { - /* - //we will use the prim's UUID as the identifier, not the localID, to publish the event for the prim - SceneObjectPart part = m_scene.GetSceneObjectPart(localID); - if (part == null) - { - m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); - return; - } - - //this seems to be useful if the prim touched and the prim handling the touch event are different: - //i.e. a child part is touched, pass the event to root, and root handles the event. then root is the "part", - //and the child part is the "originalPart" - SceneObjectPart originalPart = null; - if (originalID != 0) - { - originalPart = m_scene.GetSceneObjectPart(originalID); - if (originalPart == null) - { - m_log.Warn(LogHeader + ": part with localID " + localID + " not exist"); - return; - } - } - - OSDMap data = new OSDMap(); - data["agentID"] = OSD.FromUUID(remoteClient.AgentId); - data["primID"] = OSD.FromUUID(part.UUID); - if (originalID != 0) - { - data["originalPrimID"] = OSD.FromUUID(originalPart.UUID); - } - else - { - data["originalPrimID"] = OSD.FromUUID(UUID.Zero); - } - data["offsetPos"] = OSD.FromVector3(offsetPos); - - data["binormal"] = OSD.FromVector3(surfaceArgs.Binormal); - data["faceIndex"] = OSD.FromInteger(surfaceArgs.FaceIndex); - data["normal"] = OSD.FromVector3(surfaceArgs.Normal); - data["position"] = OSD.FromVector3(surfaceArgs.Position); - data["stCoord"] = OSD.FromVector3(surfaceArgs.STCoord); - data["uvCoord"] = OSD.FromVector3(surfaceArgs.UVCoord); - * */ OSDMap data = PrepareObjectGrabArgs(localID, originalID, offsetPos, remoteClient, surfaceArgs); SendSceneEvent(SymmetricSyncMessage.MsgType.ObjectGrab, data); } @@ -3174,8 +3011,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { return m_eventSeq++; } + #endregion //Remote Event handlers + + #region Per Property SyncInfo management + public void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) + { + + } + + #endregion //Per Property SyncInfo management - #endregion //RegionSyncModule members and functions #region ISyncStatistics private object m_stats = new object(); diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 667bf46276..f9ff9be050 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -67,9 +67,11 @@ namespace OpenSim.Region.Framework.Interfaces List PropertyBucketDescription { get; } //Enqueue updates for scene-objects and scene-presences + //Legacy interface, used in Bucket-sync void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueScenePresenceForTerseUpdate(ScenePresence presence); - //void QueueSceneObjectGroupForUpdate(SceneObjectGroup sog); + + void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector void SendSceneUpdates(); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index f700c9be8d..c49b0fd62d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3203,10 +3203,15 @@ namespace OpenSim.Region.Framework.Scenes ClearUpdateSchedule(); //SYMMETRIC SYNC + //KittyL: 04/06/2011, No longer calling QueueSceneObjectPartForUpdate + //from here. Local updates are now recorded by calling + //IRegionSyncModule.RecordPrimUpdatesByLocal. + /* if (m_parentGroup.Scene.RegionSyncModule != null) { m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this); } + * */ //end of SYMMETRIC SYNC } @@ -5937,6 +5942,9 @@ namespace OpenSim.Region.Framework.Scenes return partUpdateResult; } + //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket + //based synchronization + /* public override void ScheduleFullUpdate(List updatedProperties) { if (updatedProperties != null && updatedProperties.Count > 0) @@ -5964,6 +5972,36 @@ namespace OpenSim.Region.Framework.Scenes base.ScheduleTerseUpdate(updatedProperties); //TaintBucketSyncInfo(property); } + * */ + + //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket + //based synchronization + public override void ScheduleFullUpdate(List updatedProperties) + { + if (updatedProperties != null && updatedProperties.Count > 0) + { + if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + { + m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + } + } + + base.ScheduleTerseUpdate(updatedProperties); + } + + public override void ScheduleTerseUpdate(List updatedProperties) + { + if (updatedProperties != null && updatedProperties.Count > 0) + { + if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + { + m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + } + } + + base.ScheduleTerseUpdate(updatedProperties); + } + /// /// Schedules this prim for a full update, without changing the timestamp or actorID (info on when and who modified any property). @@ -5971,33 +6009,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ScheduleFullUpdate_SyncInfoUnchanged() { - //m_log.DebugFormat("[SCENE OBJECT PART]: ScheduleFullUpdate_SyncInfoUnchanged for {0} {1}", Name, LocalId); - - if (m_parentGroup != null) - { - m_parentGroup.QueueForUpdateCheck(); - } - - int timeNow = Util.UnixTimeSinceEpoch(); - - // If multiple updates are scheduled on the same second, we still need to perform all of them - // So we'll force the issue by bumping up the timestamp so that later processing sees these need - // to be performed. - if (timeNow <= TimeStampFull) - { - TimeStampFull += 1; - } - else - { - TimeStampFull = (uint)timeNow; - } - - m_updateFlag = 2; - - // m_log.DebugFormat( - // "[SCENE OBJECT PART]: Scheduling full update for {0}, {1} at {2}", - // UUID, Name, TimeStampFull); - + base.ScheduleFullUpdate(null); } private bool UpdateCollisionSound(UUID updatedCollisionSound) From 2f17a9d2241a4ceb3c74ff53798c4cf353422284 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Thu, 7 Apr 2011 15:34:09 -0700 Subject: [PATCH 03/36] Added more functions to PrimSyncInfo, and added class PrimSyncInfoManager. Also, commented out a few not sync-relavent properties from SceneObjectPartProperties. --- .../SymmetricSync/RegionSyncModule.cs | 373 +++++++++++++++++- .../Framework/Scenes/SceneObjectPart.cs | 7 +- 2 files changed, 366 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index ade7b4e829..b7d5b03402 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -3194,6 +3194,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_lastUpdateValue; } } + private string m_lastUpdateValueHash; + /// /// Record the time the last sync message about this property is received. /// This value is only meaninful when m_lastUpdateSource==BySync @@ -3246,13 +3248,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_lastUpdateSource = PropertyUpdateSource.BySync; } } + + public bool IsHashValueEqual(string hashValue) + { + return m_lastUpdateValueHash.Equals(hashValue); + } + + public bool IsValueEqual(Object pValue) + { + return m_lastUpdateValue.Equals(pValue); + } } public class PrimSyncInfo { #region Members public static long TimeOutThreshold; - + private Dictionary m_propertiesSyncInfo; public Dictionary PropertiesSyncInfo { @@ -3264,20 +3276,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { get { return m_PrimLastUpdateTime; } } + + private ILog m_log; + private Object m_primSyncInfoLock = new Object(); + #endregion //Members - #region Constructor + #region Constructors public PrimSyncInfo() { - m_propertiesSyncInfo = new Dictionary(); - - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) - { - PropertySyncInfo syncInfo = new PropertySyncInfo(); - m_propertiesSyncInfo.Add(property, syncInfo); - } + InitPropertiesSyncInfo(); } - #endregion //Constructor + + public PrimSyncInfo(ILog log) + { + InitPropertiesSyncInfo(); + + m_log = log; + } + #endregion //Constructors public void UpdatePropertySyncInfoLocally(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue) { @@ -3288,6 +3305,342 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); } + + //Triggered when a set of local writes just happened, and ScheduleFullUpdate + //or ScheduleTerseUpdate has been called. + /// + /// Update copies of the given list of properties in this SyncModule, + /// by copying property values from SOP's data and set the timestamp + /// and syncID. + /// + /// + /// + /// + /// + public void UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, ulong lastUpdateTS, string syncID) + { + if (part == null) return; + + lock (m_primSyncInfoLock) + { + foreach (SceneObjectPartProperties property in updatedProperties) + { + bool isLocalValueDifferent = false; + bool isFullUpdate = false; + //Compare if the value of the property in this SyncModule is + //different than the value in SOP + switch (property) + { + case SceneObjectPartProperties.None: + break; + case SceneObjectPartProperties.FullUpdate: + //The caller indicates a FullUpdate. Compare values of all + //properties and update if needed. + break; + case SceneObjectPartProperties.Shape: + case SceneObjectPartProperties.TaskInventory: + //Convert the value of complex properties to string and hash + isLocalValueDifferent = CompareHashedValues(part, property); + break; + default: + isLocalValueDifferent = CompareValues(part, property); + break; + } + + if (isFullUpdate) + { + //We should have executed a full update operation above. + //Break the For loop. + break; + } + + if (isLocalValueDifferent) + { + Object pLocalValue = GetPropertyLocalValue(part, property); + UpdatePropertySyncInfoLocally(property, lastUpdateTS, syncID, pLocalValue); + } + } + } + } + + private void InitPropertiesSyncInfo() + { + m_propertiesSyncInfo = new Dictionary(); + + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + PropertySyncInfo syncInfo = new PropertySyncInfo(); + m_propertiesSyncInfo.Add(property, syncInfo); + } + } + + private bool CompareHashedValues(SceneObjectPart part, SceneObjectPartProperties property) + { + bool isLocalValueDifferent = false; + switch (property) + { + case SceneObjectPartProperties.Shape: + break; + case SceneObjectPartProperties.TaskInventory: + break; + } + return isLocalValueDifferent; + } + + private bool CompareValues(SceneObjectPart part, SceneObjectPartProperties property) + { + bool isLocalValueDifferent = false; + switch (property) + { + //SOP properties + case SceneObjectPartProperties.AggregateScriptEvents: + return part.AggregateScriptEvents.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.AllowedDrop: + return part.AllowedDrop.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.AngularVelocity: + return part.AngularVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.AttachedAvatar: + return part.AttachedAvatar.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.AttachedPos: + return part.AttachedPos.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.AttachmentPoint: + return part.AttachmentPoint.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.BaseMask: + return part.BaseMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + //PhysActor properties + case SceneObjectPartProperties.Buoyancy: + if(part.PhysActor==null){ + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Buoyancy, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Buoyancy.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Category: + return part.Category.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.ClickAction: + return part.ClickAction.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.CollisionSound: + return part.CollisionSound.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.CollisionSoundVolume: + return part.CollisionSoundVolume.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Color: + return part.Color.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.CreationDate: + return part.CreationDate.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.CreatorData: + return part.CreatorData.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.CreatorID: + return part.CreatorID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Description: + return part.Description.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.EveryoneMask: + return part.EveryoneMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Flags: + return part.Flags.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Flying: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Flying, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Flying.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.FolderID: + return part.FolderID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Force: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Force, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Force.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly + case SceneObjectPartProperties.GroupID: + return part.GroupID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.GroupMask: + return part.GroupMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.GroupPosition: + return part.GroupPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.InventorySerial: + return part.InventorySerial.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.IsAttachment: + return part.IsAttachment.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.IsColliding: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsColliding, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.IsColliding.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + /* case SceneObjectPartProperties.IsCollidingGround: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsCollidingGround, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + * */ + case SceneObjectPartProperties.IsPhysical: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsPhysical, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.IsPhysical.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + //SOG properties + case SceneObjectPartProperties.IsSelected: + return part.ParentGroup.IsSelected.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Kinematic: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Kinematic, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Kinematic.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.LastOwnerID: + return part.LastOwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.LinkNum: + return part.LinkNum.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Material: + return part.Material.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.MediaUrl: + return part.MediaUrl.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Name: + return part.Name.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.NextOwnerMask: + return part.NextOwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.ObjectSaleType: + return part.ObjectSaleType.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.OffsetPosition: + return part.OffsetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Orientation: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Orientation, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Orientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.OwnerID: + return part.OwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.OwnerMask: + return part.OwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.OwnershipCost: + return part.OwnershipCost.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.PA_Acceleration: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of PA.Acceleration, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.ParticleSystem: + //return part.ParticleSystem.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + return ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.PassTouches: + return part.PassTouches.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Position: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of PA.Position, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Position.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.RotationalVelocity: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of RotationalVelocity, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.RotationalVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.RotationOffset: + return part.RotationOffset.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SalePrice: + return part.SalePrice.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Scale: + return part.Scale.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.ScriptAccessPin: + return part.ScriptAccessPin.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues + case SceneObjectPartProperties.SitName: + return part.SitName.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SitTargetOrientation: + return part.SitTargetOrientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SitTargetOrientationLL: + return part.SitTargetOrientationLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SitTargetPosition: + return part.SitTargetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SitTargetPositionLL: + return part.SitTargetPositionLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Size: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Size, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Size.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.SOP_Acceleration: + return part.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Sound: + return part.Sound.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues + case SceneObjectPartProperties.Text: + return part.Text.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.TextureAnimation: + return ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Torque: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Comparing Values of Torque, yet SOP's PhysActor no longer exsits."); + return true; + } + return part.PhysActor.Torque.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.TouchName: + return part.TouchName.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.UpdateFlag: + return part.UpdateFlag.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.Velocity: + return part.Velocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); + + } + + return isLocalValueDifferent; + } + + private bool ByteArrayEquals(Byte[] a, Byte[] b) + { + if (a.Length != b.Length) + return false; + for (int i = 0; i < a.Length; i++) + { + if (a[i] != b[i]) + return false; + } + return true; + } + + private Object GetPropertyLocalValue(SceneObjectPart part, SceneObjectPartProperties property) + { + if (part == null) return null; + + return null; + } + } + + public class PrimSyncInfoManager + { + private Dictionary m_primsInSync; + public Dictionary PrimsInSync + { + get { return m_primsInSync; } + } + + public PrimSyncInfoManager() + { + m_primsInSync = new Dictionary(); + } + + public void UpdatePrimSyncInfo(SceneObjectPart part, List updatedProperties) + { + + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index c49b0fd62d..b684b7d0f8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3204,8 +3204,7 @@ namespace OpenSim.Region.Framework.Scenes //SYMMETRIC SYNC //KittyL: 04/06/2011, No longer calling QueueSceneObjectPartForUpdate - //from here. Local updates are now recorded by calling - //IRegionSyncModule.RecordPrimUpdatesByLocal. + //from here. Local updates are now recorded by calling IRegionSyncModule.RecordPrimUpdatesByLocal(). /* if (m_parentGroup.Scene.RegionSyncModule != null) { @@ -5171,7 +5170,7 @@ namespace OpenSim.Region.Framework.Scenes Name, Material, PassTouches, - RegionHandle, + //RegionHandle, ScriptAccessPin, GroupPosition, OffsetPosition, @@ -5194,7 +5193,7 @@ namespace OpenSim.Region.Framework.Scenes SitTargetPosition, SitTargetPositionLL, SitTargetOrientationLL, - ParentID, + //ParentID, CreationDate, Category, SalePrice, From 2dccc3205d3f72064ce47a2ef1cabc1f4960de66 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 8 Apr 2011 15:08:56 -0700 Subject: [PATCH 04/36] Implemente PrimSyncInfo.CompareAndUpdateHashedValueByLocal, updated UpdatePropertiesByLocal and a few update related functions in PrimSyncInfo. --- .../SymmetricSync/RegionSyncModule.cs | 1597 ++++++++++++++--- .../Framework/Scenes/SceneObjectPart.cs | 2 +- .../Serialization/SceneObjectSerializer.cs | 8 +- 3 files changed, 1357 insertions(+), 250 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index b7d5b03402..f9c576d21c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1314,7 +1314,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartProperties.Flying: case SceneObjectPartProperties.Kinematic: case SceneObjectPartProperties.Buoyancy: - case SceneObjectPartProperties.IsCollidingGround: + case SceneObjectPartProperties.CollidingGround: case SceneObjectPartProperties.IsColliding: m_primPropertyBucketMap.Add(property, m_physicsBucketName); break; @@ -1457,7 +1457,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectPart part in sog.Parts) { /* - if (part.LastUpdateActorID.Equals(m_actorID)) + if (!part.LastUpdateActorID.Equals(m_actorID)) { return true; } @@ -3192,6 +3192,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public Object LastUpdateValue { get { return m_lastUpdateValue; } + //set { m_lastUpdateValue = value; } } private string m_lastUpdateValueHash; @@ -3216,11 +3217,35 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private Object m_syncInfoLock = new Object(); /// - /// Update SyncInfo when the property is updated locally. + /// Update SyncInfo when the property is updated locally. This interface + /// is for complex properties that need hashValue for fast comparison, + /// such as Shape and TaskInventory. /// - /// the time + /// /// - public void UpdateSyncInfoLocally(ulong ts, string syncID, Object pValue) + /// + /// This is only meaningful for complex properties: + /// Shape & TaskInventory. For other properties, it is ignore. + public void UpdateSyncInfoByLocal(ulong ts, string syncID, Object pValue, string pHashedValue) + { + lock (m_syncInfoLock) + { + m_lastUpdateValue = pValue; + m_lastUpdateTimeStamp = ts; + m_lastUpdateSyncID = syncID; + m_lastUpdateSource = PropertyUpdateSource.Local; + m_lastUpdateValueHash = pHashedValue; + } + } + + /// + /// Update SyncInfo when the property is updated locally. This interface + /// is for properties of simple types. + /// + /// + /// + /// + public void UpdateSyncInfoByLocal(ulong ts, string syncID, Object pValue) { lock (m_syncInfoLock) { @@ -3296,12 +3321,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } #endregion //Constructors - public void UpdatePropertySyncInfoLocally(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, string pHashedValue) { - m_propertiesSyncInfo[property].UpdateSyncInfoLocally(lastUpdateTS, syncID, pValue); + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue, pHashedValue); } - public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, ulong recvTS) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue); + } + + public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, Object pHashedValue, ulong recvTS) { m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); } @@ -3321,44 +3351,65 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (part == null) return; + //first, see if there are physics properties updated but PhysActor + //does not exist + foreach (SceneObjectPartProperties property in updatedProperties) + { + switch (property) + { + case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + case SceneObjectPartProperties.Orientation: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); + return; + } + break; + case SceneObjectPartProperties.FullUpdate: + //Caller indicated many properties have changed. Handle + //this case specially. + + //compare and update all properties + + return; + case SceneObjectPartProperties.None: + //do nothing + break; + } + } + + //Second, for each updated property in the list, compare the value + //maintained here and the value in SOP. If different, update the + //value here and set the timestamp and syncID lock (m_primSyncInfoLock) { foreach (SceneObjectPartProperties property in updatedProperties) { - bool isLocalValueDifferent = false; - bool isFullUpdate = false; + bool updated = false; //Compare if the value of the property in this SyncModule is //different than the value in SOP switch (property) { - case SceneObjectPartProperties.None: - break; - case SceneObjectPartProperties.FullUpdate: - //The caller indicates a FullUpdate. Compare values of all - //properties and update if needed. - break; case SceneObjectPartProperties.Shape: case SceneObjectPartProperties.TaskInventory: //Convert the value of complex properties to string and hash - isLocalValueDifferent = CompareHashedValues(part, property); + updated = CompareAndUpdateHashedValueByLocal(part, property, lastUpdateTS, syncID); break; default: - isLocalValueDifferent = CompareValues(part, property); + updated = CompareAndUpdateValueByLocal(part, property, lastUpdateTS, syncID); break; } - - if (isFullUpdate) - { - //We should have executed a full update operation above. - //Break the For loop. - break; - } - - if (isLocalValueDifferent) - { - Object pLocalValue = GetPropertyLocalValue(part, property); - UpdatePropertySyncInfoLocally(property, lastUpdateTS, syncID, pLocalValue); - } } } } @@ -3374,237 +3425,1129 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - private bool CompareHashedValues(SceneObjectPart part, SceneObjectPartProperties property) + private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, ulong lastUpdateTS, string syncID) { bool isLocalValueDifferent = false; switch (property) { case SceneObjectPartProperties.Shape: + string primShapeString = SerializePrimPropertyShape(part); + string primShapeStringHash = Util.Md5Hash(primShapeString); + //primShapeString.GetHashCode + if (!m_propertiesSyncInfo[property].IsHashValueEqual(primShapeStringHash)) + { + UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); + } break; case SceneObjectPartProperties.TaskInventory: + string primTaskInventoryString = SerializePrimPropertyTaskInventory(part); + string primTaskInventoryStringHash = Util.Md5Hash(primTaskInventoryString); + if (!m_propertiesSyncInfo[property].IsHashValueEqual(primTaskInventoryStringHash)) + { + UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); + } + break; + default: break; } return isLocalValueDifferent; } - private bool CompareValues(SceneObjectPart part, SceneObjectPartProperties property) + private string SerializePrimPropertyShape(SceneObjectPart part) { - bool isLocalValueDifferent = false; - switch (property) + string serializedShape; + using (StringWriter sw = new StringWriter()) { - //SOP properties - case SceneObjectPartProperties.AggregateScriptEvents: - return part.AggregateScriptEvents.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.AllowedDrop: - return part.AllowedDrop.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.AngularVelocity: - return part.AngularVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.AttachedAvatar: - return part.AttachedAvatar.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.AttachedPos: - return part.AttachedPos.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.AttachmentPoint: - return part.AttachmentPoint.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.BaseMask: - return part.BaseMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - //PhysActor properties - case SceneObjectPartProperties.Buoyancy: - if(part.PhysActor==null){ - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Buoyancy, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Buoyancy.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Category: - return part.Category.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.ClickAction: - return part.ClickAction.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.CollisionSound: - return part.CollisionSound.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.CollisionSoundVolume: - return part.CollisionSoundVolume.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Color: - return part.Color.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.CreationDate: - return part.CreationDate.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.CreatorData: - return part.CreatorData.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.CreatorID: - return part.CreatorID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Description: - return part.Description.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.EveryoneMask: - return part.EveryoneMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Flags: - return part.Flags.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Flying: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Flying, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Flying.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.FolderID: - return part.FolderID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Force: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Force, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Force.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly - case SceneObjectPartProperties.GroupID: - return part.GroupID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.GroupMask: - return part.GroupMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.GroupPosition: - return part.GroupPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.InventorySerial: - return part.InventorySerial.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.IsAttachment: - return part.IsAttachment.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.IsColliding: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsColliding, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.IsColliding.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - /* case SceneObjectPartProperties.IsCollidingGround: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsCollidingGround, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - * */ - case SceneObjectPartProperties.IsPhysical: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of IsPhysical, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.IsPhysical.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - //SOG properties - case SceneObjectPartProperties.IsSelected: - return part.ParentGroup.IsSelected.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Kinematic: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Kinematic, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Kinematic.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.LastOwnerID: - return part.LastOwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.LinkNum: - return part.LinkNum.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Material: - return part.Material.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.MediaUrl: - return part.MediaUrl.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Name: - return part.Name.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.NextOwnerMask: - return part.NextOwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.ObjectSaleType: - return part.ObjectSaleType.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.OffsetPosition: - return part.OffsetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Orientation: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Orientation, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Orientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.OwnerID: - return part.OwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.OwnerMask: - return part.OwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.OwnershipCost: - return part.OwnershipCost.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.PA_Acceleration: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of PA.Acceleration, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.ParticleSystem: - //return part.ParticleSystem.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - return ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.PassTouches: - return part.PassTouches.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Position: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of PA.Position, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Position.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.RotationalVelocity: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of RotationalVelocity, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.RotationalVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.RotationOffset: - return part.RotationOffset.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SalePrice: - return part.SalePrice.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Scale: - return part.Scale.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.ScriptAccessPin: - return part.ScriptAccessPin.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues - case SceneObjectPartProperties.SitName: - return part.SitName.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SitTargetOrientation: - return part.SitTargetOrientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SitTargetOrientationLL: - return part.SitTargetOrientationLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SitTargetPosition: - return part.SitTargetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SitTargetPositionLL: - return part.SitTargetPositionLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Size: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Size, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Size.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.SOP_Acceleration: - return part.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Sound: - return part.Sound.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues - case SceneObjectPartProperties.Text: - return part.Text.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.TextureAnimation: - return ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Torque: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Comparing Values of Torque, yet SOP's PhysActor no longer exsits."); - return true; - } - return part.PhysActor.Torque.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.TouchName: - return part.TouchName.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.UpdateFlag: - return part.UpdateFlag.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - case SceneObjectPartProperties.Velocity: - return part.Velocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue); - + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + SceneObjectSerializer.WriteShape(writer, part.Shape, new Dictionary()); + } + serializedShape = sw.ToString(); } - - return isLocalValueDifferent; + return serializedShape; } - private bool ByteArrayEquals(Byte[] a, Byte[] b) + private string SerializePrimPropertyTaskInventory(SceneObjectPart part) + { + string serializedTaskInventory; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + SceneObjectSerializer.WriteTaskInventory(writer, part.TaskInventory, new Dictionary(), part.ParentGroup.Scene); + } + serializedTaskInventory = sw.ToString(); + } + return serializedTaskInventory; + } + + + + /// + /// Compare the value (not "reference") of the given property. + /// Assumption: the caller has already checked if PhysActor exists + /// if there are physics properties updated. + /// If the value maintained here is different from that in SOP data, + /// synchronize the two: + /// (1) if the value here has a timestamp newer than lastUpdateByLocalTS + /// (e.g. due to clock drifts among different sync nodes, a remote + /// write might have a newer timestamp than the local write), + /// overwrite the SOP's property with the value here (effectively + /// disvalidate the local write operation that just happened). + /// (2) otherwise, copy SOP's data and update timestamp and syncID + /// as indicated by "lastUpdateByLocalTS" and "syncID". + /// + /// + /// + /// + /// + /// Return true if the property's value maintained in this + /// RegionSyncModule is replaced by SOP's data. + private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, ulong lastUpdateByLocalTS, string syncID) + { + bool propertyUpdatedByLocal = false; + + //First, check if the value maintained here is different from that + //in SOP's. If different, next check if the timestamp in SyncInfo is + //bigger (newer) than lastUpdateByLocalTS; if so (although ideally + //should not happen, but due to things likc clock not so perfectly + //sync'ed, it might happen), overwrite SOP's value with what's maintained + //in SyncInfo; otherwise, copy SOP's data to SyncInfo. + + //Note: for properties handled in this + //function, they are mainly value types (int, bool, struct, etc). + //So they are copied by value, not by reference. + //For a few properties, we copy by clone. + switch (property) + { + /////////////////////// + //SOP properties + /////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + if (!part.AggregateScriptEvents.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //copy from SOP's data + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AggregateScriptEvents); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AggregateScriptEvents = (scriptEvents) m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.AllowedDrop: + if (!part.AllowedDrop.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AllowedDrop); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AllowedDrop = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.AngularVelocity: + if (!part.AngularVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AngularVelocity); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AngularVelocity = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.AttachedAvatar: + if (!part.AttachedAvatar.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AttachedAvatar); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AttachedAvatar = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.AttachedPos: + if (!part.AttachedPos.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AttachedPos); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AttachedPos = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.AttachmentPoint: + if (!part.AttachmentPoint.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AttachmentPoint); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.AttachmentPoint = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.BaseMask: + if (!part.BaseMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.BaseMask); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.BaseMask = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Category: + if (!part.Category.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Category); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Category = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.ClickAction: + if (!part.ClickAction.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.ClickAction); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.ClickAction = (byte)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CollisionSound: + if (!part.CollisionSound.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.CollisionSound); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.CollisionSound = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CollisionSoundVolume: + if (!part.CollisionSoundVolume.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.CollisionSoundVolume); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.CollisionSoundVolume = (float)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Color: + if (!part.Color.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Color); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Color = (System.Drawing.Color)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CreationDate: + if (!part.CreationDate.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.CreationDate); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.CreationDate = (int)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CreatorData: + if (!part.CreatorData.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.CreatorData.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.CreatorData = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CreatorID: + if (!part.CreatorID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.CreatorID); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.CreatorID = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Description: + if (!part.Description.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Description.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Description = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.EveryoneMask: + if (!part.EveryoneMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.EveryoneMask); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.EveryoneMask = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Flags: + if (!part.Flags.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Flags); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Flags = (PrimFlags)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.FolderID: + if (!part.FolderID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.FolderID); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.FolderID = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly + case SceneObjectPartProperties.GroupID: + if (!part.GroupID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.GroupID); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.GroupID = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.GroupMask: + if (!part.GroupMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.GroupMask); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.GroupMask = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.GroupPosition: + if (!part.GroupPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.GroupPosition); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.GroupPosition = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.InventorySerial: + if (!part.InventorySerial.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.InventorySerial); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.InventorySerial = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.IsAttachment: + if (!part.IsAttachment.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.IsAttachment); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.IsAttachment = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.LastOwnerID: + if (!part.LastOwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.LastOwnerID); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.LastOwnerID = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.LinkNum: + if (!part.LinkNum.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.LinkNum); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.LinkNum = (int)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Material: + if (!part.Material.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Material); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Material = (byte)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.MediaUrl: + if (!part.MediaUrl.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.MediaUrl.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.MediaUrl = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Name: + if (!part.Name.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Name.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Name = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.NextOwnerMask: + if (!part.NextOwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.NextOwnerMask); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.NextOwnerMask = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.ObjectSaleType: + if (!part.ObjectSaleType.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.ObjectSaleType); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.ObjectSaleType = (byte)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.OffsetPosition: + if (!part.OffsetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.OffsetPosition); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.OffsetPosition = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.OwnerID: + if (!part.OwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.OwnerID); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.OwnerID = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.OwnerMask: + if (!part.OwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.OwnerMask); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.OwnerMask = (uint)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.OwnershipCost: + if (!part.OwnershipCost.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.OwnershipCost); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.OwnershipCost = (int)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.ParticleSystem: + if (!ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, part.ParticleSystem.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + byte[] pValue = (byte[])m_propertiesSyncInfo[property].LastUpdateValue; + part.ParticleSystem = (byte[])pValue.Clone(); + } + } + break; + case SceneObjectPartProperties.PassTouches: + if (!part.PassTouches.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PassTouches); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.PassTouches = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.RotationOffset: + if (!part.RotationOffset.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.RotationOffset); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.RotationOffset = (Quaternion)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SalePrice: + if (!part.SalePrice.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SalePrice); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SalePrice = (int)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Scale: + if (!part.Scale.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Scale); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Scale = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.ScriptAccessPin: + if (!part.ScriptAccessPin.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.ScriptAccessPin); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.ScriptAccessPin = (int)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues + case SceneObjectPartProperties.SitName: + if (!part.SitName.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SitName.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SitName = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SitTargetOrientation: + if (!part.SitTargetOrientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SitTargetOrientation); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SitTargetOrientation = (Quaternion)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SitTargetOrientationLL: + if (!part.SitTargetOrientationLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SitTargetOrientationLL); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SitTargetOrientationLL = (Quaternion)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SitTargetPosition: + if (!part.SitTargetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SitTargetPosition); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SitTargetOrientation = (Quaternion)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SitTargetPositionLL: + if (!part.SitTargetPositionLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.SitTargetPositionLL); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.SitTargetPosition = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.SOP_Acceleration: + if (!part.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Acceleration); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Acceleration = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Sound: + if (!part.Sound.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Sound); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Sound = (UUID)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues + case SceneObjectPartProperties.Text: + if (!part.Text.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Text.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Text = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.TextureAnimation: + if (!ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, part.TextureAnimation.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + byte[] pValue = (byte[])m_propertiesSyncInfo[property].LastUpdateValue; + part.TextureAnimation = (byte[])pValue.Clone(); + } + } + break; + case SceneObjectPartProperties.TouchName: + if (!part.TouchName.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.TouchName.Clone()); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.TouchName = (string)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.UpdateFlag: + if (!part.UpdateFlag.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.UpdateFlag); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.UpdateFlag = (byte)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Velocity: + if (!part.Velocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.Velocity); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.Velocity = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + + /////////////////////// + //PhysActor properties + /////////////////////// + case SceneObjectPartProperties.Buoyancy: + if (!part.PhysActor.Buoyancy.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Buoyancy); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Buoyancy = (float)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Flying: + if (!part.PhysActor.Flying.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Flying); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Flying = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Force: + if (!part.PhysActor.Force.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Force); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Force = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.IsColliding: + if (!part.PhysActor.IsColliding.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.IsColliding); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.IsColliding = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.CollidingGround: + if (!part.PhysActor.CollidingGround.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.CollidingGround); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.CollidingGround = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.IsPhysical: + if (!part.PhysActor.IsPhysical.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.IsPhysical); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.IsPhysical = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Kinematic: + if (!part.PhysActor.Kinematic.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Kinematic); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Kinematic = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Orientation: + if (!part.PhysActor.Orientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Orientation); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Orientation = (Quaternion)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.PA_Acceleration: + if (!part.PhysActor.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Acceleration); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Acceleration = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Position: + if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Position); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Position = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.RotationalVelocity: + if (!part.PhysActor.RotationalVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.RotationalVelocity); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.RotationalVelocity = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Size: + if (!part.PhysActor.Size.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Size); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Size = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + case SceneObjectPartProperties.Torque: + if (!part.PhysActor.Torque.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Torque); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.PhysActor.Torque = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + if (!part.ParentGroup.IsSelected.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.ParentGroup.IsSelected); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite PhysActor's data + part.ParentGroup.IsSelected = (bool)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; + } + + return propertyUpdatedByLocal; + } + + private bool ByteArrayEquals(byte[] a, byte[] b) { if (a.Length != b.Length) return false; @@ -3616,11 +4559,171 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return true; } - private Object GetPropertyLocalValue(SceneObjectPart part, SceneObjectPartProperties property) + private Object GetSOPPropertyValue(SceneObjectPart part, SceneObjectPartProperties property) { if (part == null) return null; - return null; + Object pValue = null; + switch (property) + { + case SceneObjectPartProperties.Shape: + return (Object)SerializePrimPropertyShape(part); + break; + case SceneObjectPartProperties.TaskInventory: + return (Object)SerializePrimPropertyTaskInventory(part); + break; + + /////////////////////// + //SOP properties + /////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + return (Object)part.AggregateScriptEvents; + case SceneObjectPartProperties.AllowedDrop: + return (Object)part.AllowedDrop; + case SceneObjectPartProperties.AngularVelocity: + return (Object)part.AngularVelocity; + case SceneObjectPartProperties.AttachedAvatar: + return (Object)part.AttachedAvatar; + case SceneObjectPartProperties.AttachedPos: + return (Object)part.AttachedPos; + case SceneObjectPartProperties.AttachmentPoint: + return (Object)part.AttachmentPoint; + case SceneObjectPartProperties.BaseMask: + return (Object)part.BaseMask; + case SceneObjectPartProperties.Category: + return (Object)part.Category; + case SceneObjectPartProperties.ClickAction: + return (Object)part.ClickAction; + case SceneObjectPartProperties.CollisionSound: + return (Object)part.CollisionSound; + case SceneObjectPartProperties.CollisionSoundVolume: + return (Object)part.CollisionSoundVolume; + case SceneObjectPartProperties.Color: + return (Object)part.Color; + case SceneObjectPartProperties.CreationDate: + return (Object)part.CreationDate; + case SceneObjectPartProperties.CreatorData: + return (Object)part.CreatorData; + case SceneObjectPartProperties.CreatorID: + return (Object)part.CreatorID; + case SceneObjectPartProperties.Description: + return (Object)part.Description; + case SceneObjectPartProperties.EveryoneMask: + return (Object)part.EveryoneMask; + case SceneObjectPartProperties.Flags: + return (Object)part.Flags; + case SceneObjectPartProperties.FolderID: + return (Object)part.FolderID; + //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly + case SceneObjectPartProperties.GroupID: + return (Object)part.GroupID; + case SceneObjectPartProperties.GroupMask: + return (Object)part.GroupMask; + case SceneObjectPartProperties.GroupPosition: + return (Object)part.GroupPosition; + case SceneObjectPartProperties.InventorySerial: + return (Object)part.InventorySerial; + case SceneObjectPartProperties.IsAttachment: + return (Object)part.IsAttachment; + case SceneObjectPartProperties.LastOwnerID: + return (Object)part.LastOwnerID; + case SceneObjectPartProperties.LinkNum: + return (Object)part.LinkNum; + case SceneObjectPartProperties.Material: + return (Object)part.Material; + case SceneObjectPartProperties.MediaUrl: + return (Object)part.MediaUrl; + case SceneObjectPartProperties.Name: + return (Object)part.Name; + case SceneObjectPartProperties.NextOwnerMask: + return (Object)part.NextOwnerMask; + case SceneObjectPartProperties.ObjectSaleType: + return (Object)part.ObjectSaleType; + case SceneObjectPartProperties.OffsetPosition: + return (Object)part.OffsetPosition; + case SceneObjectPartProperties.OwnerID: + return (Object)part.OwnerID; + case SceneObjectPartProperties.OwnerMask: + return (Object)part.OwnerMask; + case SceneObjectPartProperties.OwnershipCost: + return (Object)part.OwnershipCost; + case SceneObjectPartProperties.ParticleSystem: + return ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.PassTouches: + return (Object)part.PassTouches; + case SceneObjectPartProperties.RotationOffset: + return (Object)part.RotationOffset; + case SceneObjectPartProperties.SalePrice: + return (Object)part.SalePrice; + case SceneObjectPartProperties.Scale: + return (Object)part.Scale; + case SceneObjectPartProperties.ScriptAccessPin: + return (Object)part.ScriptAccessPin; + //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues + case SceneObjectPartProperties.SitName: + return (Object)part.SitName; + case SceneObjectPartProperties.SitTargetOrientation: + return (Object)part.SitTargetOrientation; + case SceneObjectPartProperties.SitTargetOrientationLL: + return (Object)part.SitTargetOrientationLL; + case SceneObjectPartProperties.SitTargetPosition: + return (Object)part.SitTargetPosition; + case SceneObjectPartProperties.SitTargetPositionLL: + return (Object)part.SitTargetPositionLL; + case SceneObjectPartProperties.SOP_Acceleration: + return (Object)part.Acceleration; + case SceneObjectPartProperties.Sound: + return (Object)part.Sound; + //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues + case SceneObjectPartProperties.Text: + return (Object)part.Text; + case SceneObjectPartProperties.TextureAnimation: + return ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + case SceneObjectPartProperties.TouchName: + return (Object)part.TouchName; + case SceneObjectPartProperties.UpdateFlag: + return (Object)part.UpdateFlag; + case SceneObjectPartProperties.Velocity: + return (Object)part.Velocity; + + /////////////////////// + //PhysActor properties + /////////////////////// + case SceneObjectPartProperties.Buoyancy: + return (Object)part.PhysActor.Buoyancy; + case SceneObjectPartProperties.Flying: + return (Object)part.PhysActor.Flying; + case SceneObjectPartProperties.Force: + return (Object)part.PhysActor.Force; + case SceneObjectPartProperties.IsColliding: + return (Object)part.PhysActor.IsColliding; + case SceneObjectPartProperties.CollidingGround: + return (Object)part.PhysActor.CollidingGround; + case SceneObjectPartProperties.IsPhysical: + return (Object)part.PhysActor.IsPhysical; + case SceneObjectPartProperties.Kinematic: + return (Object)part.PhysActor.Kinematic; + case SceneObjectPartProperties.Orientation: + return (Object)part.PhysActor.Orientation; + case SceneObjectPartProperties.PA_Acceleration: + return (Object)part.PhysActor.Acceleration; + case SceneObjectPartProperties.Position: + return (Object)part.PhysActor.Position; + case SceneObjectPartProperties.RotationalVelocity: + return (Object)part.PhysActor.RotationalVelocity; + case SceneObjectPartProperties.Size: + return (Object)part.PhysActor.Size; + case SceneObjectPartProperties.Torque: + return (Object)part.PhysActor.Torque; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + return (Object)part.ParentGroup.IsSelected; + } + + return pValue; } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b684b7d0f8..5222888814 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5226,7 +5226,7 @@ namespace OpenSim.Region.Framework.Scenes Flying, Buoyancy, Kinematic, - IsCollidingGround, + CollidingGround, IsColliding, //TODO!!!! To be handled in serialization/deserizaltion for synchronization AggregateScriptEvents, diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 588ffc7dae..f316a63523 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1369,7 +1369,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString(name, flagsStr.Replace(",", "")); } - static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) + //DSG SYNC: make it a public function, so that we can call serialization of TaskInventory from other places + //static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) + public static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary options, Scene scene) { if (tinv.Count > 0) // otherwise skip this { @@ -1423,7 +1425,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) + //DSG SYNC: make it a public function, so that we can call serialization of Shape from other places + //static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) + public static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary options) { if (shp != null) { From 7c033f9d088792a0e5ab4ae900fc183ed1b4d316 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 8 Apr 2011 15:16:39 -0700 Subject: [PATCH 05/36] Added calling ScheduleFullUpdate() after SendFullUpdateToAllClients() is called in several places in LSL_Api.cs. --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a3bd4cad64..2ba7d400bd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1388,6 +1388,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api tmp.Z = (float)scale.z; part.Scale = tmp; part.SendFullUpdateToAllClients(); + + //DSG SYNC + part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.Scale }); } public LSL_Vector llGetScale() @@ -5677,6 +5680,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.AddTextureAnimation(pTexAnim); part.SendFullUpdateToAllClients(); part.ParentGroup.HasGroupChanged = true; + + //DSG SYNC + part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.TextureAnimation }); } public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, @@ -6189,6 +6195,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ParentGroup.HasGroupChanged = true; } part.SendFullUpdateToAllClients(); + + //DSG SYNC + part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.ParticleSystem }); } public void llGroundRepel(double height, int water, double tau) From 2f41b216d36420fc053ebe49f26fd87551a84b37 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 8 Apr 2011 15:55:40 -0700 Subject: [PATCH 06/36] Updated PrimSyncInfo.CompareAndUpdateHashedValueByLocal, to overwrite SOP's properties Shape and TaskInventory if PrimSyncInfo's value has newer timestamp. --- .../SymmetricSync/RegionSyncModule.cs | 42 ++++++++++++++++--- .../Serialization/SceneObjectSerializer.cs | 8 +++- 2 files changed, 43 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index f9c576d21c..10ef34f665 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -3427,7 +3427,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, ulong lastUpdateTS, string syncID) { - bool isLocalValueDifferent = false; + bool updated = false; switch (property) { case SceneObjectPartProperties.Shape: @@ -3436,7 +3436,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //primShapeString.GetHashCode if (!m_propertiesSyncInfo[property].IsHashValueEqual(primShapeStringHash)) { - UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); + if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); + updated = true; + } + else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + PrimitiveBaseShape shape = DeSerializeShape((string)m_propertiesSyncInfo[property].LastUpdateValue); + part.Shape = shape; + } + } break; case SceneObjectPartProperties.TaskInventory: @@ -3444,13 +3454,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule string primTaskInventoryStringHash = Util.Md5Hash(primTaskInventoryString); if (!m_propertiesSyncInfo[property].IsHashValueEqual(primTaskInventoryStringHash)) { - UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); + if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); + updated = true; + } + else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + TaskInventoryDictionary taskInv = DeSerializeTaskInventory((string)m_propertiesSyncInfo[property].LastUpdateValue); + part.TaskInventory = taskInv; + } } break; default: break; } - return isLocalValueDifferent; + return updated; } private string SerializePrimPropertyShape(SceneObjectPart part) @@ -3467,6 +3486,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return serializedShape; } + //TO BE TESTED + private PrimitiveBaseShape DeSerializeShape(string shapeString) + { + StringReader sr = new StringReader(shapeString); + XmlTextReader reader = new XmlTextReader(sr); + return SceneObjectSerializer.ReadShape(reader, "Shape"); + } + private string SerializePrimPropertyTaskInventory(SceneObjectPart part) { string serializedTaskInventory; @@ -3481,7 +3508,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return serializedTaskInventory; } - + private TaskInventoryDictionary DeSerializeTaskInventory(string taskInvString) + { + StringReader sr = new StringReader(taskInvString); + XmlTextReader reader = new XmlTextReader(sr); + return SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); + } /// /// Compare the value (not "reference") of the given property. diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index f316a63523..eec6f7b466 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -1600,7 +1600,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return obj; } - static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) + //DSG SYNC: make it public to be called outside + //static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) + public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) { TaskInventoryDictionary tinv = new TaskInventoryDictionary(); @@ -1639,7 +1641,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization return tinv; } - static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name) + //DSG SYNC: make it public to be called outside + //static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name) + public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name) { PrimitiveBaseShape shape = new PrimitiveBaseShape(); From a06ddb9e88bb6e524be1cffd3f671389a08b59a7 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 8 Apr 2011 17:10:09 -0700 Subject: [PATCH 07/36] Started to link RegionSyncModule.RecordPrimUpdatesByLocal with functions in PrimSyncInfoManager. To to finished. --- .../SymmetricSync/RegionSyncModule.cs | 139 +++++++++++++----- 1 file changed, 104 insertions(+), 35 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 10ef34f665..07da4b866f 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -100,6 +100,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SyncStatisticCollector.LogInterval = m_sysConfig.GetInt("SyncLogInterval", 5000); SyncStatisticCollector.LogMaxFileTimeMin = m_sysConfig.GetInt("SyncLogMaxFileTimeMin", 5); SyncStatisticCollector.LogFileHeader = m_sysConfig.GetString("SyncLogFileHeader", "sync-"); + + //initialize PrimSyncInfoManager + int syncInfoAgeOutSeconds = m_sysConfig.GetInt("PrimSyncInfoAgeOutSeconds", 300); //unit of seconds + TimeSpan tSpan = new TimeSpan(0, 0, syncInfoAgeOutSeconds); + m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks, m_log); } //Called after Initialise() @@ -3014,9 +3019,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #endregion //Remote Event handlers #region Per Property SyncInfo management + + private PrimSyncInfoManager m_primSyncInfoManager; public void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { + List propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); + OSDMap propertiesToSync = m_primSyncInfoManager.EncodePrimProperties(part, propertiesWithSyncInfoUpdated); + //TODO: Send out sync message with propertiesToSync } #endregion //Per Property SyncInfo management @@ -3170,8 +3180,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public class PropertySyncInfo { - private ulong m_lastUpdateTimeStamp; - public ulong LastUpdateTimeStamp + private long m_lastUpdateTimeStamp; + public long LastUpdateTimeStamp { get { return m_lastUpdateTimeStamp; } } @@ -3201,8 +3211,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// Record the time the last sync message about this property is received. /// This value is only meaninful when m_lastUpdateSource==BySync /// - private ulong m_lastSyncUpdateRecvTime; - public ulong LastSyncUpdateRecvTime + private long m_lastSyncUpdateRecvTime; + public long LastSyncUpdateRecvTime { get { return m_lastSyncUpdateRecvTime; } set { m_lastSyncUpdateRecvTime = value; } @@ -3216,6 +3226,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private Object m_syncInfoLock = new Object(); + public PropertySyncInfo(Object initValue, long initTS, string syncID) + { + m_lastUpdateValue = initValue; + m_lastUpdateTimeStamp = initTS; + m_lastUpdateSyncID = syncID; + //m_lastSyncUpdateRecvTime == ?? + } + /// /// Update SyncInfo when the property is updated locally. This interface /// is for complex properties that need hashValue for fast comparison, @@ -3226,7 +3244,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// This is only meaningful for complex properties: /// Shape & TaskInventory. For other properties, it is ignore. - public void UpdateSyncInfoByLocal(ulong ts, string syncID, Object pValue, string pHashedValue) + public void UpdateSyncInfoByLocal(long ts, string syncID, Object pValue, string pHashedValue) { lock (m_syncInfoLock) { @@ -3245,7 +3263,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public void UpdateSyncInfoByLocal(ulong ts, string syncID, Object pValue) + public void UpdateSyncInfoByLocal(long ts, string syncID, Object pValue) { lock (m_syncInfoLock) { @@ -3262,7 +3280,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public void UpdateSyncInfoBySync(ulong ts, string syncID, ulong recvTS, Object pValue) + public void UpdateSyncInfoBySync(long ts, string syncID, long recvTS, Object pValue) { lock (m_syncInfoLock) { @@ -3296,8 +3314,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_propertiesSyncInfo; } } - private ulong m_PrimLastUpdateTime; - public ulong PrimLastUpdateTime + private long m_PrimLastUpdateTime; + public long PrimLastUpdateTime { get { return m_PrimLastUpdateTime; } } @@ -3308,30 +3326,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #endregion //Members #region Constructors - public PrimSyncInfo() - { - InitPropertiesSyncInfo(); - } - public PrimSyncInfo(ILog log) + public PrimSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID, ILog log) { - InitPropertiesSyncInfo(); + InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); m_log = log; } #endregion //Constructors - public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, string pHashedValue) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue, pHashedValue); } - public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue); } - public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, ulong lastUpdateTS, string syncID, Object pValue, Object pHashedValue, ulong recvTS) + public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) { m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); } @@ -3339,17 +3353,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Triggered when a set of local writes just happened, and ScheduleFullUpdate //or ScheduleTerseUpdate has been called. /// - /// Update copies of the given list of properties in this SyncModule, - /// by copying property values from SOP's data and set the timestamp - /// and syncID. + /// Update copies of the given list of properties in the prim's SyncInfo. /// /// /// /// /// - public void UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, ulong lastUpdateTS, string syncID) + public List UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) { - if (part == null) return; + List propertiesWithSyncInfoUpdated = new List(); + if (part == null) return propertiesWithSyncInfoUpdated; //first, see if there are physics properties updated but PhysActor //does not exist @@ -3373,7 +3386,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (part.PhysActor == null) { m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); - return; + return propertiesWithSyncInfoUpdated; } break; case SceneObjectPartProperties.FullUpdate: @@ -3382,7 +3395,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //compare and update all properties - return; + return propertiesWithSyncInfoUpdated; case SceneObjectPartProperties.None: //do nothing break; @@ -3410,22 +3423,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule updated = CompareAndUpdateValueByLocal(part, property, lastUpdateTS, syncID); break; } + + if (updated) + { + propertiesWithSyncInfoUpdated.Add(property); + } } } + return propertiesWithSyncInfoUpdated; } - private void InitPropertiesSyncInfo() + private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo = new Dictionary(); foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) { - PropertySyncInfo syncInfo = new PropertySyncInfo(); + Object initValue = GetSOPPropertyValue(part, property); + PropertySyncInfo syncInfo = new PropertySyncInfo(initValue, initUpdateTimestamp, syncID); m_propertiesSyncInfo.Add(property, syncInfo); } } - private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, ulong lastUpdateTS, string syncID) + private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateTS, string syncID) { bool updated = false; switch (property) @@ -3535,7 +3555,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// Return true if the property's value maintained in this /// RegionSyncModule is replaced by SOP's data. - private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, ulong lastUpdateByLocalTS, string syncID) + private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateByLocalTS, string syncID) { bool propertyUpdatedByLocal = false; @@ -4600,10 +4620,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { case SceneObjectPartProperties.Shape: return (Object)SerializePrimPropertyShape(part); - break; case SceneObjectPartProperties.TaskInventory: return (Object)SerializePrimPropertyTaskInventory(part); - break; /////////////////////// //SOP properties @@ -4680,7 +4698,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartProperties.OwnershipCost: return (Object)part.OwnershipCost; case SceneObjectPartProperties.ParticleSystem: - return ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + //byte[], return a cloned copy + return (Object)part.ParticleSystem.Clone(); case SceneObjectPartProperties.PassTouches: return (Object)part.PassTouches; case SceneObjectPartProperties.RotationOffset: @@ -4710,7 +4729,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartProperties.Text: return (Object)part.Text; case SceneObjectPartProperties.TextureAnimation: - return ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue); + //byte[], return a cloned copy + return part.TextureAnimation.Clone(); case SceneObjectPartProperties.TouchName: return (Object)part.TouchName; case SceneObjectPartProperties.UpdateFlag: @@ -4762,19 +4782,68 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public class PrimSyncInfoManager { private Dictionary m_primsInSync; + private RegionSyncModule m_regionSyncModule; + private ILog m_log; + + + /// + /// The max time for a SOP's SyncInfo to sit in record + /// w/o being updated either locally or bySync. + /// + private long m_ageOutThreshold; + public Dictionary PrimsInSync { get { return m_primsInSync; } } - public PrimSyncInfoManager() + public PrimSyncInfoManager(RegionSyncModule syncModule, long ageOutTh, ILog log) { m_primsInSync = new Dictionary(); + m_regionSyncModule = syncModule; + m_ageOutThreshold = ageOutTh; + m_log = log; } - public void UpdatePrimSyncInfo(SceneObjectPart part, List updatedProperties) + /// + /// For each property in updatedProperties, (1) if the value in SOP's + /// data is different than that in PrimSyncInfo, and what's in PrimSyncInfo + /// has an older timestamp, then update that property's value and syncInfo + /// in PrimSyncInfo; (2) otherwise, skip the property and do nothing. + /// + /// + /// + /// The list properties among updatedProperties whose value + /// have been copied over to PrimSyncInfo. + public List UpdatePrimSyncInfoByLocal(SceneObjectPart part, List updatedProperties) { + long currentTime = DateTime.Now.Ticks; + if (m_primsInSync.ContainsKey(part.UUID)) + { + return m_primsInSync[part.UUID].UpdatePropertiesByLocal(part, updatedProperties, currentTime, m_regionSyncModule.SyncID); + } + else + { + //The SOP's SyncInfo is no longer in my record, may due to + //TimeOut or something. Add it back. Assume the properties + //were "AgeOut" seconds old. + PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, currentTime, m_regionSyncModule.SyncID, m_log); + m_primsInSync.Add(part.UUID, primSyncInfo); + return updatedProperties; + } + } + + public OSDMap EncodePrimProperties(SceneObjectPart part, List updatedProperties) + { + OSDMap data = new OSDMap(); + data["primUUID"] = OSDMap.FromUUID(part.UUID); + foreach (SceneObjectPartProperties property in updatedProperties) + { + // data[property.ToString()] = + } + + return data; } } From a06dad37fdb856ec87d28042f81c72828fb69b79 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 11 Apr 2011 14:36:38 -0700 Subject: [PATCH 08/36] Added ProcessAndEnqueuePrimUpdateByLocal and SyncOutPrimUpdates to RegionSyncModule, and PrimSyncInfo.PropertyToOSD. --- .../SymmetricSync/RegionSyncModule.cs | 368 +++++++++++++++++- .../Framework/Interfaces/IRegionSyncModule.cs | 7 +- OpenSim/Region/Framework/Scenes/Scene.cs | 3 +- .../Framework/Scenes/SceneObjectPart.cs | 4 +- 4 files changed, 365 insertions(+), 17 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 07da4b866f..322c3450fc 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -654,7 +654,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Memeber variables for per-property timestamp /////////////////////////////////////////////////////////////////////// - + private Object m_primPropertyUpdateLock = new Object(); + private Dictionary> m_primPropertyUpdates = new Dictionary>(); + private int m_sendingPrimPropertyUpdates = 0; /////////////////////////////////////////////////////////////////////// // Legacy members for bucket-based sync, @@ -3018,18 +3020,104 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } #endregion //Remote Event handlers - #region Per Property SyncInfo management + #region Prim Property Sync management private PrimSyncInfoManager m_primSyncInfoManager; - public void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) + //private + /// + /// Triggered when some properties in an SOP have been updated. + /// Sync the properties' values in this sync module with those in + /// SOP, and update timestamp accordingly. + /// + /// + /// + public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { - List propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); - OSDMap propertiesToSync = m_primSyncInfoManager.EncodePrimProperties(part, propertiesWithSyncInfoUpdated); + //Sync values with SOP's data and update timestamp according, to + //obtain the list of properties that really have been updated + //and should be propogated to other sync nodes. + HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); - //TODO: Send out sync message with propertiesToSync + //Enqueue the prim with the set of updated properties + if (propertiesWithSyncInfoUpdated.Count > 0) + { + lock (m_primPropertyUpdateLock) + { + if (m_primPropertyUpdates.ContainsKey(part.UUID)) + { + foreach (SceneObjectPartProperties property in propertiesWithSyncInfoUpdated) + { + //Include the "property" into the list of updated properties. + //HashSet's Add function should handle it correctly whether the property + //is or is not in the set. + m_primPropertyUpdates[part.UUID].Add(property); + } + } + else + { + m_primPropertyUpdates[part.UUID] = propertiesWithSyncInfoUpdated; + } + } + } } - #endregion //Per Property SyncInfo management + /// + /// Triggered periodically to send out sync messages that include + /// prim-properties that have been updated since last SyncOut. + /// + public void SyncOutPrimUpdates() + { + if (!IsSyncingWithOtherSyncNodes()) + { + //no SyncConnector connected. clear update queues and return. + m_primPropertyUpdates.Clear(); + return; + } + + //If no prim has been updated since last SyncOut, simply return. + if (m_primPropertyUpdates.Count == 0) + return; + + // Existing value of 1 indicates that updates are currently being sent so skip updates this pass + if (Interlocked.Exchange(ref m_sendingPrimPropertyUpdates, 1) == 1) + { + m_log.DebugFormat("{0} SyncOutPrimUpdates(): An update thread is already running.", LogHeader); + return; + } + + //copy the updated prim property list, and clear m_primPropertyUpdates immediately for future use + Dictionary> primPropertyUpdates = new Dictionary>(); + lock (m_primPropertyUpdateLock) + { + foreach (KeyValuePair> updatedPrimProperties in m_primPropertyUpdates) + { + UUID primUUID = updatedPrimProperties.Key; + SceneObjectPart prim = m_scene.GetSceneObjectPart(primUUID); + //Skip if the prim is on longer in the local Scene Graph + if (prim == null) + { + m_log.WarnFormat("{0}: in SyncOutPrimUpdates, prim {1} no longer in local SceneGraph", LogHeader, primUUID); + continue; + } + //Skip if the object group is being deleted + if (prim.ParentGroup.IsDeleted) + continue; + + primPropertyUpdates.Add(primUUID, updatedPrimProperties.Value); + } + m_primPropertyUpdates.Clear(); + } + + //Enqueue sync message for sending out + if (primPropertyUpdates.Count > 0) + { + //OSDMap propertiesToSync = m_primSyncInfoManager.EncodePrimProperties(part, propertiesWithSyncInfoUpdated); + + + } + } + + #endregion //Prim Property Sync management #region ISyncStatistics @@ -3359,9 +3447,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public List UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) + public HashSet UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) { - List propertiesWithSyncInfoUpdated = new List(); + HashSet propertiesWithSyncInfoUpdated = new HashSet(); if (part == null) return propertiesWithSyncInfoUpdated; //first, see if there are physics properties updated but PhysActor @@ -3433,6 +3521,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesWithSyncInfoUpdated; } + public OSDMap EncodeUpdatedProperties(HashSet propertiesToSync) + { + OSDMap propertyData = new OSDMap(); + + lock (m_primSyncInfoLock) + { + foreach (SceneObjectPartProperties property in propertiesToSync) + { + propertyData.Add(property.ToString(), PropertyToOSD(property)); + } + } + return propertyData; + } + private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo = new Dictionary(); @@ -3535,6 +3637,48 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); } + //Copy code from SceneObjectSerializer.SOPToXml2 + private string SerializeColor(System.Drawing.Color color) + { + string serializedColor; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + writer.WriteStartElement("Color"); + writer.WriteElementString("R", color.R.ToString(Utils.EnUsCulture)); + writer.WriteElementString("G", color.G.ToString(Utils.EnUsCulture)); + writer.WriteElementString("B", color.B.ToString(Utils.EnUsCulture)); + writer.WriteElementString("A", color.G.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + serializedColor = sw.ToString(); + } + return serializedColor; + } + + //Copy code from SceneObjectSerializer.ProcessColor + private System.Drawing.Color DeSerializeColor(string colorString) + { + StringReader sr = new StringReader(colorString); + XmlTextReader reader = new XmlTextReader(sr); + + System.Drawing.Color color = new System.Drawing.Color(); + + reader.ReadStartElement("Color"); + if (reader.Name == "R") + { + float r = reader.ReadElementContentAsFloat("R", String.Empty); + float g = reader.ReadElementContentAsFloat("G", String.Empty); + float b = reader.ReadElementContentAsFloat("B", String.Empty); + float a = reader.ReadElementContentAsFloat("A", String.Empty); + color = System.Drawing.Color.FromArgb((int)a, (int)r, (int)g, (int)b); + reader.ReadEndElement(); + } + return color; + } + + /// /// Compare the value (not "reference") of the given property. /// Assumption: the caller has already checked if PhysActor exists @@ -4777,6 +4921,208 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return pValue; } + + /// + /// Convert the value of the given property to OSD type. + /// + /// + /// + private OSD PropertyToOSD(SceneObjectPartProperties property) + { + OSDMap propertyData = new OSDMap(); + propertyData["LastUpdateTimeStamp"] = m_propertiesSyncInfo[property].LastUpdateTimeStamp; + propertyData["LastUpdateSyncID"] = m_propertiesSyncInfo[property].LastUpdateSyncID; + + switch (property) + { + /////////////////////////////////////// + //SOP properties with complex structure + /////////////////////////////////////// + case SceneObjectPartProperties.Shape: + case SceneObjectPartProperties.TaskInventory: + propertyData["Value"] = OSD.FromString((string)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, enum types + //////////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)m_propertiesSyncInfo[property].LastUpdateValue)); + break; + case SceneObjectPartProperties.Flags: + propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)m_propertiesSyncInfo[property].LastUpdateValue)); + break; + //////////////////////////// + //SOP properties, bool types + //////////////////////////// + case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartProperties.PassTouches: + propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Vector3 types + //////////////////////////// + case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartProperties.Scale: + case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartProperties.Velocity: + propertyData["Value"] = OSD.FromVector3((Vector3)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, UUID types + //////////////////////////// + case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartProperties.CreatorID: + case SceneObjectPartProperties.FolderID: + case SceneObjectPartProperties.GroupID: + case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartProperties.OwnerID: + case SceneObjectPartProperties.Sound: + propertyData["Value"] = OSD.FromUUID((UUID)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //case SceneObjectPartProperties.AttachedPos: + //////////////////////////// + //SOP properties, uint types + //////////////////////////// + case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartProperties.BaseMask: + case SceneObjectPartProperties.Category: + case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartProperties.GroupMask: + case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartProperties.OwnerMask: + propertyData["Value"] = OSD.FromUInteger((uint)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //case SceneObjectPartProperties.BaseMask: + //case SceneObjectPartProperties.Category: + + //////////////////////////// + //SOP properties, byte types + //////////////////////////// + case SceneObjectPartProperties.ClickAction: + case SceneObjectPartProperties.Material: + case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartProperties.UpdateFlag: + propertyData["Value"] = OSD.FromInteger((byte)m_propertiesSyncInfo[property].LastUpdateValue); + break; + //case SceneObjectPartProperties.CollisionSound: + + //////////////////////////// + //SOP properties, float types + //////////////////////////// + case SceneObjectPartProperties.CollisionSoundVolume: + propertyData["Value"] = OSD.FromReal((float)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Color(struct type) + //////////////////////////// + case SceneObjectPartProperties.Color: + propertyData["Value"] = OSD.FromString(SerializeColor((System.Drawing.Color)m_propertiesSyncInfo[property].LastUpdateValue)); + break; + + //////////////////////////// + //SOP properties, int types + //////////////////////////// + case SceneObjectPartProperties.CreationDate: + case SceneObjectPartProperties.LinkNum: + case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartProperties.SalePrice: + case SceneObjectPartProperties.ScriptAccessPin: + propertyData["Value"] = OSD.FromInteger((int)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, string types + //////////////////////////// + case SceneObjectPartProperties.CreatorData: + case SceneObjectPartProperties.Description: + case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartProperties.Name: + case SceneObjectPartProperties.SitName: + case SceneObjectPartProperties.Text: + case SceneObjectPartProperties.TouchName: + propertyData["Value"] = OSD.FromString((string)m_propertiesSyncInfo[property].LastUpdateValue); + break; + //////////////////////////// + //SOP properties, byte[] types + //////////////////////////// + case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartProperties.TextureAnimation: + propertyData["Value"] = OSD.FromBinary((byte[])m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Quaternion types + //////////////////////////// + case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartProperties.SitTargetOrientationLL: + propertyData["Value"] = OSD.FromQuaternion((Quaternion)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, float type + //////////////////////////////////// + case SceneObjectPartProperties.Buoyancy: + propertyData["Value"] = OSD.FromReal((float)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, bool type + //////////////////////////////////// + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, Vector3 type + //////////////////////////////////// + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + propertyData["Value"] = OSD.FromVector3((Vector3)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, Quaternion type + //////////////////////////////////// + case SceneObjectPartProperties.Orientation: + propertyData["Value"] = OSD.FromQuaternion((Quaternion)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); + break; + + default: + m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", property); + break; + } + return propertyData; + } } public class PrimSyncInfoManager @@ -4815,7 +5161,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// The list properties among updatedProperties whose value /// have been copied over to PrimSyncInfo. - public List UpdatePrimSyncInfoByLocal(SceneObjectPart part, List updatedProperties) + public HashSet UpdatePrimSyncInfoByLocal(SceneObjectPart part, List updatedProperties) { long currentTime = DateTime.Now.Ticks; if (m_primsInSync.ContainsKey(part.UUID)) @@ -4830,7 +5176,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, currentTime, m_regionSyncModule.SyncID, m_log); m_primsInSync.Add(part.UUID, primSyncInfo); - return updatedProperties; + return new HashSet(updatedProperties); } } diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index f9ff9be050..59bca17bf7 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -68,13 +68,14 @@ namespace OpenSim.Region.Framework.Interfaces //Enqueue updates for scene-objects and scene-presences //Legacy interface, used in Bucket-sync - void QueueSceneObjectPartForUpdate(SceneObjectPart part); + //void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueScenePresenceForTerseUpdate(ScenePresence presence); - void RecordPrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); + void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); + void SyncOutPrimUpdates(); //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector - void SendSceneUpdates(); + //void SendSceneUpdates(); void SendNewObject(SceneObjectGroup sog); void SendDeleteObject(SceneObjectGroup sog, bool softDelete); void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 603bae36ed..df3732c198 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1745,7 +1745,8 @@ namespace OpenSim.Region.Framework.Scenes //NOTE: If it is configured as symmetric sync in opensim.ini, the above IsSyncedServer() or IsSyncedClient() should all return false if (RegionSyncModule != null) { - RegionSyncModule.SendSceneUpdates(); + //RegionSyncModule.SendSceneUpdates(); + RegionSyncModule.SyncOutPrimUpdates(); } //end of SYMMETRIC SYNC diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5222888814..259a173c98 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5981,7 +5981,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) { - m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); } } @@ -5994,7 +5994,7 @@ namespace OpenSim.Region.Framework.Scenes { if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) { - m_parentGroup.Scene.RegionSyncModule.RecordPrimUpdatesByLocal(this, updatedProperties); + m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); } } From 9d3de471a5ad7ab55f6ebb8a509589530cba7c24 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 11 Apr 2011 15:43:58 -0700 Subject: [PATCH 09/36] SyncOutPrimUpdates linked with EncodePrimProperties and SendPrimUpdateToRelevantSyncConnectors. --- .../SymmetricSync/RegionSyncModule.cs | 50 ++++++++++++++++--- .../SymmetricSync/SyncConnector.cs | 12 ++++- 2 files changed, 55 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 322c3450fc..6759363f77 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -3108,12 +3108,47 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_primPropertyUpdates.Clear(); } - //Enqueue sync message for sending out if (primPropertyUpdates.Count > 0) { - //OSDMap propertiesToSync = m_primSyncInfoManager.EncodePrimProperties(part, propertiesWithSyncInfoUpdated); + //Starting a new thread to prepare sync message and enqueue it to SyncConnectors + System.Threading.ThreadPool.QueueUserWorkItem(delegate + { + //OSDMap syncData = new OSDMap(); + //syncData["primCount"] = OSD.FromInteger(primPropertyUpdates.Count); + //OSDArray primDataArray = new OSDArray(); + //syncData["primData"] = (OSD)primDataArray; - + foreach (KeyValuePair> updatedPrimProperties in primPropertyUpdates) + { + UUID primUUID = updatedPrimProperties.Key; + HashSet updatedProperties = updatedPrimProperties.Value; + OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); + + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData)); + SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); + } + + // Indicate that the current batch of updates has been completed + Interlocked.Exchange(ref m_sendingPrimPropertyUpdates, 0); + }); + } + else + { + Interlocked.Exchange(ref m_sendingPrimPropertyUpdates, 0); + } + } + + //Object updates are sent by enqueuing into each connector's outQueue. + private void SendPrimUpdateToRelevantSyncConnectors(UUID primUUID, SymmetricSyncMessage syncMsg) + { + SceneObjectPart updatedPart = m_scene.GetSceneObjectPart(primUUID); + if (updatedPart == null) + return; + + HashSet syncConnectors = GetSyncConnectorsForPrimUpdates(updatedPart); + foreach (SyncConnector connector in syncConnectors) + { + connector.EnqueueOutgoingUpdate(updatedPart.UUID, syncMsg.ToBytes()); } } @@ -5180,13 +5215,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - public OSDMap EncodePrimProperties(SceneObjectPart part, List updatedProperties) + public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) { OSDMap data = new OSDMap(); - data["primUUID"] = OSDMap.FromUUID(part.UUID); + data["primUUID"] = OSDMap.FromUUID(primUUID); + OSDArray propertyData = new OSDArray(); + data["propertyData"] = propertyData; + foreach (SceneObjectPartProperties property in updatedProperties) { - // data[property.ToString()] = + propertyData.Add(m_primsInSync[primUUID].EncodeUpdatedProperties(updatedProperties)); } return data; diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs index 5299e0b4ca..e5c0586c26 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs @@ -32,6 +32,12 @@ using OpenMetaverse; namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { + public enum SyncConnectorState + { + Idle, //not connected + Initialization, //initializing local copy of Scene + Syncing, //done initialization, in normal process of syncing terrain, objects, etc + } // For implementations, a lot was copied from RegionSyncClientView, especially the SendLoop/ReceiveLoop. public class SyncConnector : ISyncStatistics { @@ -53,11 +59,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private long bytesIn=0; private long bytesOut=0; private DateTime lastStatTime; + // A queue for outgoing traffic. private BlockingUpdateQueue m_outQ = new BlockingUpdateQueue(); - + private RegionSyncModule m_regionSyncModule = null; + //members for keeping track of state of this connector + private SyncConnectorState m_syncState = SyncConnectorState.Idle; + // unique connector number across all regions private static int m_connectorNum = 0; public int ConnectorNum From c244bbe143ae754a4568016ba0cd0b41b4b21f90 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 12 Apr 2011 15:05:51 -0700 Subject: [PATCH 10/36] Majority of SOP encoding/decoding (per property and SyncInfo based) functions are in place. Need testing. --- .../SymmetricSync/RegionSyncModule.cs | 1132 ++++++++++++----- 1 file changed, 815 insertions(+), 317 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 6759363f77..cb1ab183dc 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -563,12 +563,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule Command cmdSyncStatus = new Command("status", CommandIntentions.COMMAND_HAZARDOUS, SyncStatus, "Displays synchronization status."); - //for debugging purpose + //for test and debugging purpose Command cmdSyncDebug = new Command("debug", CommandIntentions.COMMAND_HAZARDOUS, SyncDebug, "Trigger some debugging functions"); //for sync state comparison, Command cmdSyncStateReport = new Command("state", CommandIntentions.COMMAND_HAZARDOUS, SyncStateReport, "Trigger synchronization state comparision functions"); + m_commander.RegisterCommand("start", cmdSyncStart); m_commander.RegisterCommand("stop", cmdSyncStop); m_commander.RegisterCommand("status", cmdSyncStatus); @@ -803,6 +804,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return sog; } + /////////////////////////////////////////////////////////////////////// + //Legacy implementation of NewObject encoder/decoder for bucket-based + //sync protocol. + /////////////////////////////////////////////////////////////////////// + /// /// Encode all properties of an object. Assumption: no matter how many /// buckets are designed, there is always a "General" bucket that contains @@ -821,13 +827,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //convert the coordinates if necessary Vector3 globalPos = sog.AbsolutePosition; - /* - if (CoordinatesConversionHandler != null) - { - bool inComingMsg = false; - globalPos = CoordinatesConversionHandler(globalPos, inComingMsg); - } - * */ data["GroupPosition"] = OSDMap.FromVector3(globalPos); foreach (string bucketName in m_propertyBucketNames) @@ -863,13 +862,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Convert the coordinates if necessary Vector3 localPos = globalPos; - /* - if (CoordinatesConversionHandler != null) - { - bool inComingMsg = true; - localPos = CoordinatesConversionHandler(globalPos, inComingMsg); - } - * */ + sog.AbsolutePosition = localPos; //TEMP DEBUG @@ -1820,6 +1813,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (entity is SceneObjectGroup) { + //Legacy serialization/deserialization for bucket based sync + /* //first test serialization StringWriter sw = new StringWriter(); XmlTextWriter writer = new XmlTextWriter(sw); @@ -1837,6 +1832,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule XmlTextReader reader = new XmlTextReader(new StringReader(xmlString)); SceneObjectPart part = new SceneObjectPart(); SceneObjectSerializer.ProcessBucketSyncInfo(part, reader); + * */ + + SceneObjectGroup sog = (SceneObjectGroup)entity; + //first test serialization + OSDMap sogData = SceneObjectEncoder(sog); + + //second, test de-serialization + SceneObjectGroup group; + Dictionary primsSyncInfo; + SceneObjectDecoder(sogData, out group, out primsSyncInfo); + break; } } @@ -3033,6 +3039,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { + m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal called. Simply return for now. More testing later."); + return; + //Sync values with SOP's data and update timestamp according, to //obtain the list of properties that really have been updated //and should be propogated to other sync nodes. @@ -3152,6 +3161,110 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /// + /// Encode a SOG. Values of each part's properties are copied from + /// PrimSyncInfo, instead of from SOP's data. + /// + /// + /// + private OSDMap SceneObjectEncoder(SceneObjectGroup sog) + { + OSDMap data = new OSDMap(); + data["UUID"] = OSD.FromUUID(sog.UUID); + + Vector3 globalPos = sog.AbsolutePosition; + /* + if (CoordinatesConversionHandler != null) + { + bool inComingMsg = false; + globalPos = CoordinatesConversionHandler(globalPos, inComingMsg); + } + * */ + data["GroupPosition"] = OSDMap.FromVector3(globalPos); + + HashSet fullPropertyList = new HashSet() { SceneObjectPartProperties.FullUpdate }; + data["RootPart"] = m_primSyncInfoManager.EncodePrimProperties(sog.RootPart.UUID, fullPropertyList); + + //int otherPartsCount = sog.Parts.Length - 1; + //data["OtherPartsCount"] = OSD.FromInteger(otherPartsCount); + OSDArray otherPartsArray = new OSDArray(); + foreach (SceneObjectPart part in sog.Parts) + { + if (!part.UUID.Equals(sog.RootPart.UUID)) + { + OSDMap partData = m_primSyncInfoManager.EncodePrimProperties(part.UUID, fullPropertyList); + otherPartsArray.Add(partData); + } + } + data["OtherParts"] = otherPartsArray; + + //string sogxml = SceneObjectSerializer.ToXml2Format(sog); + //SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(data)); + + return data; + } + + + private void SceneObjectDecoder(OSDMap data, out SceneObjectGroup sog, out Dictionary partsPrimSyncInfo) + { + sog = new SceneObjectGroup(); + partsPrimSyncInfo = new Dictionary(); + + if(data.ContainsKey("UUID")){ + sog.UUID = data["UUID"].AsUUID(); + } + + if(!data.ContainsKey("RootPart")){ + m_log.WarnFormat("{0}: SceneObjectDecoder, no RootPart found in the OSDMap"); + return; + } + + OSDMap rootData = (OSDMap)data["RootPart"]; + //Decode and copy to the list of PrimSyncInfo + PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodePrimProperties(rootData); + SceneObjectPart root = primSyncInfo.PrimSyncInfoToSOP(); + + if (root != null) + { + sog.SetRootPart(root); + partsPrimSyncInfo.Add(root.UUID, primSyncInfo); + } + else + return; + + if (sog.UUID == UUID.Zero) + sog.UUID = sog.RootPart.UUID; + + //Decode the remaining parts and add them to the object group + if(data.ContainsKey("OtherParts")){ + //int otherPartsCount = data["OtherPartsCount"].AsInteger(); + OSDArray otherPartsArray = (OSDArray) data["OtherParts"]; + for(int i=0; i + /// Initialize from data in given OSDMap. + /// + /// + /// + public PropertySyncInfo(SceneObjectPartProperties property, OSDMap syncData) + { + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + m_property = property; + FromOSDMap(syncData); } /// @@ -3424,6 +3567,538 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { return m_lastUpdateValue.Equals(pValue); } + + public void SetLog(ILog log) + { + m_log = log; + } + + /// + /// Convert the value of the given property to OSD type. + /// + /// + /// + public OSDMap ToOSDMap() + { + OSDMap propertyData = new OSDMap(); + propertyData["LastUpdateTimeStamp"] = LastUpdateTimeStamp; + propertyData["LastUpdateSyncID"] = LastUpdateSyncID; + + switch (m_property) + { + /////////////////////////////////////// + //SOP properties with complex structure + /////////////////////////////////////// + case SceneObjectPartProperties.Shape: + case SceneObjectPartProperties.TaskInventory: + propertyData["Value"] = OSD.FromString((string)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, enum types + //////////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); + break; + case SceneObjectPartProperties.Flags: + propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); + break; + //////////////////////////// + //SOP properties, bool types + //////////////////////////// + case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartProperties.PassTouches: + propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Vector3 types + //////////////////////////// + case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartProperties.Scale: + case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartProperties.Velocity: + propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, UUID types + //////////////////////////// + case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartProperties.CreatorID: + case SceneObjectPartProperties.FolderID: + case SceneObjectPartProperties.GroupID: + case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartProperties.OwnerID: + case SceneObjectPartProperties.Sound: + propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); + break; + + //case SceneObjectPartProperties.AttachedPos: + //////////////////////////// + //SOP properties, uint types + //////////////////////////// + case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartProperties.BaseMask: + case SceneObjectPartProperties.Category: + case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartProperties.GroupMask: + case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartProperties.OwnerMask: + propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); + break; + + //case SceneObjectPartProperties.BaseMask: + //case SceneObjectPartProperties.Category: + + //////////////////////////// + //SOP properties, byte types + //////////////////////////// + case SceneObjectPartProperties.ClickAction: + case SceneObjectPartProperties.Material: + case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartProperties.UpdateFlag: + propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); + break; + //case SceneObjectPartProperties.CollisionSound: + + //////////////////////////// + //SOP properties, float types + //////////////////////////// + case SceneObjectPartProperties.CollisionSoundVolume: + propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Color(struct type) + //////////////////////////// + case SceneObjectPartProperties.Color: + propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); + break; + + //////////////////////////// + //SOP properties, int types + //////////////////////////// + case SceneObjectPartProperties.CreationDate: + case SceneObjectPartProperties.LinkNum: + case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartProperties.SalePrice: + case SceneObjectPartProperties.ScriptAccessPin: + propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, string types + //////////////////////////// + case SceneObjectPartProperties.CreatorData: + case SceneObjectPartProperties.Description: + case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartProperties.Name: + case SceneObjectPartProperties.SitName: + case SceneObjectPartProperties.Text: + case SceneObjectPartProperties.TouchName: + propertyData["Value"] = OSD.FromString((string)LastUpdateValue); + break; + //////////////////////////// + //SOP properties, byte[] types + //////////////////////////// + case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartProperties.TextureAnimation: + propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Quaternion types + //////////////////////////// + case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartProperties.SitTargetOrientationLL: + propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, float type + //////////////////////////////////// + case SceneObjectPartProperties.Buoyancy: + propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, bool type + //////////////////////////////////// + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, Vector3 type + //////////////////////////////////// + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + break; + + //////////////////////////////////// + //PhysActor properties, Quaternion type + //////////////////////////////////// + case SceneObjectPartProperties.Orientation: + propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + break; + + default: + m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); + break; + } + return propertyData; + } + + private void FromOSDMap(OSDMap propertyData) + { + if (!propertyData.ContainsKey("LastUpdateTimeStamp")) + { + m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateTimeStamp"); + }else{ + m_lastUpdateTimeStamp = propertyData["LastUpdateTimeStamp"].AsLong(); + } + + if (!propertyData.ContainsKey("LastUpdateSyncID")) + { + m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); + }else{ + m_lastUpdateSyncID = propertyData["LastUpdateSyncID"].AsString(); + } + + if (!propertyData.ContainsKey("Value")) + { + m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); + } + else + { + switch (m_property) + { + /////////////////////////////////////// + //SOP properties with complex structure + /////////////////////////////////////// + case SceneObjectPartProperties.Shape: + case SceneObjectPartProperties.TaskInventory: + m_lastUpdateValue = (Object)propertyData["Value"].AsString(); + break; + + //////////////////////////// + //SOP properties, enum types + //////////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + scriptEvents sEvents = (scriptEvents)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)sEvents; + //propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); + break; + case SceneObjectPartProperties.Flags: + PrimFlags flags = (PrimFlags)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)flags; + //propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); + break; + //////////////////////////// + //SOP properties, bool types + //////////////////////////// + case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartProperties.PassTouches: + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + break; + + //////////////////////////// + //SOP properties, Vector3 types + //////////////////////////// + case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartProperties.Scale: + case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartProperties.Velocity: + //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); + break; + + //////////////////////////// + //SOP properties, UUID types + //////////////////////////// + case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartProperties.CreatorID: + case SceneObjectPartProperties.FolderID: + case SceneObjectPartProperties.GroupID: + case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartProperties.OwnerID: + case SceneObjectPartProperties.Sound: + //propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsUUID()); + break; + + //case SceneObjectPartProperties.AttachedPos: + //////////////////////////// + //SOP properties, uint types + //////////////////////////// + case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartProperties.BaseMask: + case SceneObjectPartProperties.Category: + case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartProperties.GroupMask: + case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartProperties.OwnerMask: + //propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsUInteger()); + break; + + //case SceneObjectPartProperties.BaseMask: + //case SceneObjectPartProperties.Category: + + //////////////////////////// + //SOP properties, byte types + //////////////////////////// + case SceneObjectPartProperties.ClickAction: + case SceneObjectPartProperties.Material: + case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartProperties.UpdateFlag: + //propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); + byte pValue = (byte)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)pValue; + break; + //case SceneObjectPartProperties.CollisionSound: + + //////////////////////////// + //SOP properties, float types + //////////////////////////// + case SceneObjectPartProperties.CollisionSoundVolume: + //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsReal()); + break; + + //////////////////////////// + //SOP properties, Color(struct type) + //////////////////////////// + case SceneObjectPartProperties.Color: + //propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); + System.Drawing.Color cValue = PropertySerializer.DeSerializeColor(propertyData["Value"].AsString()); + m_lastUpdateValue = (Object)cValue; + break; + + //////////////////////////// + //SOP properties, int types + //////////////////////////// + case SceneObjectPartProperties.CreationDate: + case SceneObjectPartProperties.LinkNum: + case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartProperties.SalePrice: + case SceneObjectPartProperties.ScriptAccessPin: + //propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsInteger()); + break; + + //////////////////////////// + //SOP properties, string types + //////////////////////////// + case SceneObjectPartProperties.CreatorData: + case SceneObjectPartProperties.Description: + case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartProperties.Name: + case SceneObjectPartProperties.SitName: + case SceneObjectPartProperties.Text: + case SceneObjectPartProperties.TouchName: + //propertyData["Value"] = OSD.FromString((string)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsString()); + break; + //////////////////////////// + //SOP properties, byte[] types + //////////////////////////// + case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartProperties.TextureAnimation: + //propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBinary()); + break; + + //////////////////////////// + //SOP properties, Quaternion types + //////////////////////////// + case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartProperties.SitTargetOrientationLL: + //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); + break; + + //////////////////////////////////// + //PhysActor properties, float type + //////////////////////////////////// + case SceneObjectPartProperties.Buoyancy: + //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsReal()); + break; + + //////////////////////////////////// + //PhysActor properties, bool type + //////////////////////////////////// + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + break; + + //////////////////////////////////// + //PhysActor properties, Vector3 type + //////////////////////////////////// + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); + break; + + //////////////////////////////////// + //PhysActor properties, Quaternion type + //////////////////////////////////// + case SceneObjectPartProperties.Orientation: + //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + break; + + default: + m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); + break; + + } + } + } + } + + public class PropertySerializer + { + //TO BE TESTED + + public static string SerializeShape(SceneObjectPart part) + { + string serializedShape; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + SceneObjectSerializer.WriteShape(writer, part.Shape, new Dictionary()); + } + serializedShape = sw.ToString(); + } + return serializedShape; + } + + public static PrimitiveBaseShape DeSerializeShape(string shapeString) + { + StringReader sr = new StringReader(shapeString); + XmlTextReader reader = new XmlTextReader(sr); + return SceneObjectSerializer.ReadShape(reader, "Shape"); + } + + public static string SerializeTaskInventory(SceneObjectPart part) + { + string serializedTaskInventory; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + SceneObjectSerializer.WriteTaskInventory(writer, part.TaskInventory, new Dictionary(), part.ParentGroup.Scene); + } + serializedTaskInventory = sw.ToString(); + } + return serializedTaskInventory; + } + + public static TaskInventoryDictionary DeSerializeTaskInventory(string taskInvString) + { + StringReader sr = new StringReader(taskInvString); + XmlTextReader reader = new XmlTextReader(sr); + return SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); + } + + //Copy code from SceneObjectSerializer.SOPToXml2 + public static string SerializeColor(System.Drawing.Color color) + { + string serializedColor; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + writer.WriteStartElement("Color"); + writer.WriteElementString("R", color.R.ToString(Utils.EnUsCulture)); + writer.WriteElementString("G", color.G.ToString(Utils.EnUsCulture)); + writer.WriteElementString("B", color.B.ToString(Utils.EnUsCulture)); + writer.WriteElementString("A", color.G.ToString(Utils.EnUsCulture)); + writer.WriteEndElement(); + } + serializedColor = sw.ToString(); + } + return serializedColor; + } + + //Copy code from SceneObjectSerializer.ProcessColor + public static System.Drawing.Color DeSerializeColor(string colorString) + { + StringReader sr = new StringReader(colorString); + XmlTextReader reader = new XmlTextReader(sr); + + System.Drawing.Color color = new System.Drawing.Color(); + + reader.ReadStartElement("Color"); + if (reader.Name == "R") + { + float r = reader.ReadElementContentAsFloat("R", String.Empty); + float g = reader.ReadElementContentAsFloat("G", String.Empty); + float b = reader.ReadElementContentAsFloat("B", String.Empty); + float a = reader.ReadElementContentAsFloat("A", String.Empty); + color = System.Drawing.Color.FromArgb((int)a, (int)r, (int)g, (int)b); + reader.ReadEndElement(); + } + return color; + } + } public class PrimSyncInfo @@ -3450,12 +4125,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #region Constructors - public PrimSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID, ILog log) + public PrimSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); - m_log = log; + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } + + public PrimSyncInfo() + { + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + } + + public PrimSyncInfo(OSDMap primSyncInfoData) + { + DecodeAndSetProperiesSyncInfo(primSyncInfoData); + } + #endregion //Constructors public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) @@ -3556,20 +4242,64 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesWithSyncInfoUpdated; } - public OSDMap EncodeUpdatedProperties(HashSet propertiesToSync) + /// + /// Encode the SyncInfo of each property, including its current value + /// maintained in this SyncModule, its timestamp and syncID. + /// + /// The list of properties to be encoded. + /// If FullUpdate is included, then encode all properties. + /// + public OSDMap EncodePropertiesSyncInfo(HashSet propertiesToSync) { OSDMap propertyData = new OSDMap(); + //Lock first, so that we effectively freeze the record and take a snapshot lock (m_primSyncInfoLock) { - foreach (SceneObjectPartProperties property in propertiesToSync) + if (propertiesToSync.Contains(SceneObjectPartProperties.FullUpdate)) { - propertyData.Add(property.ToString(), PropertyToOSD(property)); + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + } + } + else + { + foreach (SceneObjectPartProperties property in propertiesToSync) + { + propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + } } } return propertyData; } + /// + /// Decode PropertySyncInfo for each property and insert into m_propertiesSyncInfo. + /// This is called to initialize this PrimSyncInfo by decoding from OSDMap. + /// + /// + public void DecodeAndSetProperiesSyncInfo(OSDMap primSyncInfoData) + { + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + if (primSyncInfoData.ContainsKey(property.ToString())) + { + //PropertySyncInfo propertySyncInfo = OSDMapToPropertySyncInfo((OSDMap)primSyncInfoData[property.ToString()]); + PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); + m_propertiesSyncInfo.Add(property, propertySyncInfo); + }else{ + m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap"); + } + } + } + + public SceneObjectPart PrimSyncInfoToSOP() + { + SceneObjectPart sop = new SceneObjectPart(); + return sop; + } + private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo = new Dictionary(); @@ -3577,18 +4307,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) { Object initValue = GetSOPPropertyValue(part, property); - PropertySyncInfo syncInfo = new PropertySyncInfo(initValue, initUpdateTimestamp, syncID); + PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); m_propertiesSyncInfo.Add(property, syncInfo); } } + //Assumption: the caller already locks the access lock, and no need to lock here private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateTS, string syncID) { bool updated = false; switch (property) { case SceneObjectPartProperties.Shape: - string primShapeString = SerializePrimPropertyShape(part); + string primShapeString = PropertySerializer.SerializeShape(part); string primShapeStringHash = Util.Md5Hash(primShapeString); //primShapeString.GetHashCode if (!m_propertiesSyncInfo[property].IsHashValueEqual(primShapeStringHash)) @@ -3600,14 +4331,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { - PrimitiveBaseShape shape = DeSerializeShape((string)m_propertiesSyncInfo[property].LastUpdateValue); + PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((string)m_propertiesSyncInfo[property].LastUpdateValue); part.Shape = shape; } } break; case SceneObjectPartProperties.TaskInventory: - string primTaskInventoryString = SerializePrimPropertyTaskInventory(part); + string primTaskInventoryString = PropertySerializer.SerializeTaskInventory(part); string primTaskInventoryStringHash = Util.Md5Hash(primTaskInventoryString); if (!m_propertiesSyncInfo[property].IsHashValueEqual(primTaskInventoryStringHash)) { @@ -3618,7 +4349,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { - TaskInventoryDictionary taskInv = DeSerializeTaskInventory((string)m_propertiesSyncInfo[property].LastUpdateValue); + TaskInventoryDictionary taskInv = PropertySerializer.DeSerializeTaskInventory((string)m_propertiesSyncInfo[property].LastUpdateValue); part.TaskInventory = taskInv; } } @@ -3629,90 +4360,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return updated; } - private string SerializePrimPropertyShape(SceneObjectPart part) - { - string serializedShape; - using (StringWriter sw = new StringWriter()) - { - using (XmlTextWriter writer = new XmlTextWriter(sw)) - { - SceneObjectSerializer.WriteShape(writer, part.Shape, new Dictionary()); - } - serializedShape = sw.ToString(); - } - return serializedShape; - } - - //TO BE TESTED - private PrimitiveBaseShape DeSerializeShape(string shapeString) - { - StringReader sr = new StringReader(shapeString); - XmlTextReader reader = new XmlTextReader(sr); - return SceneObjectSerializer.ReadShape(reader, "Shape"); - } - - private string SerializePrimPropertyTaskInventory(SceneObjectPart part) - { - string serializedTaskInventory; - using (StringWriter sw = new StringWriter()) - { - using (XmlTextWriter writer = new XmlTextWriter(sw)) - { - SceneObjectSerializer.WriteTaskInventory(writer, part.TaskInventory, new Dictionary(), part.ParentGroup.Scene); - } - serializedTaskInventory = sw.ToString(); - } - return serializedTaskInventory; - } - - private TaskInventoryDictionary DeSerializeTaskInventory(string taskInvString) - { - StringReader sr = new StringReader(taskInvString); - XmlTextReader reader = new XmlTextReader(sr); - return SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); - } - - //Copy code from SceneObjectSerializer.SOPToXml2 - private string SerializeColor(System.Drawing.Color color) - { - string serializedColor; - using (StringWriter sw = new StringWriter()) - { - using (XmlTextWriter writer = new XmlTextWriter(sw)) - { - writer.WriteStartElement("Color"); - writer.WriteElementString("R", color.R.ToString(Utils.EnUsCulture)); - writer.WriteElementString("G", color.G.ToString(Utils.EnUsCulture)); - writer.WriteElementString("B", color.B.ToString(Utils.EnUsCulture)); - writer.WriteElementString("A", color.G.ToString(Utils.EnUsCulture)); - writer.WriteEndElement(); - } - serializedColor = sw.ToString(); - } - return serializedColor; - } - - //Copy code from SceneObjectSerializer.ProcessColor - private System.Drawing.Color DeSerializeColor(string colorString) - { - StringReader sr = new StringReader(colorString); - XmlTextReader reader = new XmlTextReader(sr); - - System.Drawing.Color color = new System.Drawing.Color(); - - reader.ReadStartElement("Color"); - if (reader.Name == "R") - { - float r = reader.ReadElementContentAsFloat("R", String.Empty); - float g = reader.ReadElementContentAsFloat("G", String.Empty); - float b = reader.ReadElementContentAsFloat("B", String.Empty); - float a = reader.ReadElementContentAsFloat("A", String.Empty); - color = System.Drawing.Color.FromArgb((int)a, (int)r, (int)g, (int)b); - reader.ReadEndElement(); - } - return color; - } - /// /// Compare the value (not "reference") of the given property. @@ -4798,9 +5445,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule switch (property) { case SceneObjectPartProperties.Shape: - return (Object)SerializePrimPropertyShape(part); + return (Object)PropertySerializer.SerializeShape(part); case SceneObjectPartProperties.TaskInventory: - return (Object)SerializePrimPropertyTaskInventory(part); + return (Object)PropertySerializer.SerializeTaskInventory(part); /////////////////////// //SOP properties @@ -4957,211 +5604,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return pValue; } - /// - /// Convert the value of the given property to OSD type. - /// - /// - /// - private OSD PropertyToOSD(SceneObjectPartProperties property) - { - OSDMap propertyData = new OSDMap(); - propertyData["LastUpdateTimeStamp"] = m_propertiesSyncInfo[property].LastUpdateTimeStamp; - propertyData["LastUpdateSyncID"] = m_propertiesSyncInfo[property].LastUpdateSyncID; - - switch (property) - { - /////////////////////////////////////// - //SOP properties with complex structure - /////////////////////////////////////// - case SceneObjectPartProperties.Shape: - case SceneObjectPartProperties.TaskInventory: - propertyData["Value"] = OSD.FromString((string)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, enum types - //////////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: - propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)m_propertiesSyncInfo[property].LastUpdateValue)); - break; - case SceneObjectPartProperties.Flags: - propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)m_propertiesSyncInfo[property].LastUpdateValue)); - break; - //////////////////////////// - //SOP properties, bool types - //////////////////////////// - case SceneObjectPartProperties.AllowedDrop: - case SceneObjectPartProperties.IsAttachment: - case SceneObjectPartProperties.PassTouches: - propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, Vector3 types - //////////////////////////// - case SceneObjectPartProperties.AngularVelocity: - case SceneObjectPartProperties.AttachedPos: - case SceneObjectPartProperties.GroupPosition: - case SceneObjectPartProperties.OffsetPosition: - case SceneObjectPartProperties.Scale: - case SceneObjectPartProperties.SitTargetPosition: - case SceneObjectPartProperties.SitTargetPositionLL: - case SceneObjectPartProperties.SOP_Acceleration: - case SceneObjectPartProperties.Velocity: - propertyData["Value"] = OSD.FromVector3((Vector3)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, UUID types - //////////////////////////// - case SceneObjectPartProperties.AttachedAvatar: - case SceneObjectPartProperties.CollisionSound: - case SceneObjectPartProperties.CreatorID: - case SceneObjectPartProperties.FolderID: - case SceneObjectPartProperties.GroupID: - case SceneObjectPartProperties.LastOwnerID: - case SceneObjectPartProperties.OwnerID: - case SceneObjectPartProperties.Sound: - propertyData["Value"] = OSD.FromUUID((UUID)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //case SceneObjectPartProperties.AttachedPos: - //////////////////////////// - //SOP properties, uint types - //////////////////////////// - case SceneObjectPartProperties.AttachmentPoint: - case SceneObjectPartProperties.BaseMask: - case SceneObjectPartProperties.Category: - case SceneObjectPartProperties.EveryoneMask: - case SceneObjectPartProperties.GroupMask: - case SceneObjectPartProperties.InventorySerial: - case SceneObjectPartProperties.NextOwnerMask: - case SceneObjectPartProperties.OwnerMask: - propertyData["Value"] = OSD.FromUInteger((uint)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //case SceneObjectPartProperties.BaseMask: - //case SceneObjectPartProperties.Category: - - //////////////////////////// - //SOP properties, byte types - //////////////////////////// - case SceneObjectPartProperties.ClickAction: - case SceneObjectPartProperties.Material: - case SceneObjectPartProperties.ObjectSaleType: - case SceneObjectPartProperties.UpdateFlag: - propertyData["Value"] = OSD.FromInteger((byte)m_propertiesSyncInfo[property].LastUpdateValue); - break; - //case SceneObjectPartProperties.CollisionSound: - - //////////////////////////// - //SOP properties, float types - //////////////////////////// - case SceneObjectPartProperties.CollisionSoundVolume: - propertyData["Value"] = OSD.FromReal((float)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, Color(struct type) - //////////////////////////// - case SceneObjectPartProperties.Color: - propertyData["Value"] = OSD.FromString(SerializeColor((System.Drawing.Color)m_propertiesSyncInfo[property].LastUpdateValue)); - break; - - //////////////////////////// - //SOP properties, int types - //////////////////////////// - case SceneObjectPartProperties.CreationDate: - case SceneObjectPartProperties.LinkNum: - case SceneObjectPartProperties.OwnershipCost: - case SceneObjectPartProperties.SalePrice: - case SceneObjectPartProperties.ScriptAccessPin: - propertyData["Value"] = OSD.FromInteger((int)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, string types - //////////////////////////// - case SceneObjectPartProperties.CreatorData: - case SceneObjectPartProperties.Description: - case SceneObjectPartProperties.MediaUrl: - case SceneObjectPartProperties.Name: - case SceneObjectPartProperties.SitName: - case SceneObjectPartProperties.Text: - case SceneObjectPartProperties.TouchName: - propertyData["Value"] = OSD.FromString((string)m_propertiesSyncInfo[property].LastUpdateValue); - break; - //////////////////////////// - //SOP properties, byte[] types - //////////////////////////// - case SceneObjectPartProperties.ParticleSystem: - case SceneObjectPartProperties.TextureAnimation: - propertyData["Value"] = OSD.FromBinary((byte[])m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////// - //SOP properties, Quaternion types - //////////////////////////// - case SceneObjectPartProperties.RotationOffset: - case SceneObjectPartProperties.SitTargetOrientation: - case SceneObjectPartProperties.SitTargetOrientationLL: - propertyData["Value"] = OSD.FromQuaternion((Quaternion)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////////////// - //PhysActor properties, float type - //////////////////////////////////// - case SceneObjectPartProperties.Buoyancy: - propertyData["Value"] = OSD.FromReal((float)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////////////// - //PhysActor properties, bool type - //////////////////////////////////// - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: - propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////////////// - //PhysActor properties, Vector3 type - //////////////////////////////////// - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: - propertyData["Value"] = OSD.FromVector3((Vector3)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - //////////////////////////////////// - //PhysActor properties, Quaternion type - //////////////////////////////////// - case SceneObjectPartProperties.Orientation: - propertyData["Value"] = OSD.FromQuaternion((Quaternion)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - /////////////////////// - //SOG properties - /////////////////////// - case SceneObjectPartProperties.IsSelected: - propertyData["Value"] = OSD.FromBoolean((bool)m_propertiesSyncInfo[property].LastUpdateValue); - break; - - default: - m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", property); - break; - } - return propertyData; - } } public class PrimSyncInfoManager { + /// + /// Lock for write-accessing m_primsInSync. We assume accesses to m_primsInSync + /// are in the "many reads, a few writes" pattern. Writers needs to lock on it. + /// Readers who interate through m_primsInSync need to copy a reference to + /// m_primsInSync and operate on the reference, but no need to lock. (Readers who + /// just grabs reference to one item in m_primsInSync for further operation + /// might not even need to copy a reference to m_primsInSync initially???) + /// + private Object m_primsInSyncLock = new Object(); private Dictionary m_primsInSync; private RegionSyncModule m_regionSyncModule; private ILog m_log; @@ -5201,15 +5656,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule long currentTime = DateTime.Now.Ticks; if (m_primsInSync.ContainsKey(part.UUID)) { - return m_primsInSync[part.UUID].UpdatePropertiesByLocal(part, updatedProperties, currentTime, m_regionSyncModule.SyncID); + PrimSyncInfo primSyncInfo = m_primsInSync[part.UUID]; + return primSyncInfo.UpdatePropertiesByLocal(part, updatedProperties, currentTime, m_regionSyncModule.SyncID); } else { //The SOP's SyncInfo is no longer in my record, may due to //TimeOut or something. Add it back. Assume the properties //were "AgeOut" seconds old. - PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, currentTime, m_regionSyncModule.SyncID, m_log); - m_primsInSync.Add(part.UUID, primSyncInfo); + PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, currentTime, m_regionSyncModule.SyncID); + InsertPrimSyncInfo(part.UUID, primSyncInfo); return new HashSet(updatedProperties); } @@ -5224,11 +5680,53 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectPartProperties property in updatedProperties) { - propertyData.Add(m_primsInSync[primUUID].EncodeUpdatedProperties(updatedProperties)); + propertyData.Add(m_primsInSync[primUUID].EncodePropertiesSyncInfo(updatedProperties)); } return data; } + + public PrimSyncInfo DecodePrimProperties(OSDMap primData) + { + if (!primData.ContainsKey("primUUID") || !primData.ContainsKey("propertyData")) + { + m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing"); + return null; + } + UUID primUUID = primData["primUUID"]; + OSDArray propertyData = (OSDArray)primData["propertyData"]; + + PrimSyncInfo primSynInfo = new PrimSyncInfo(primData); + + return primSynInfo; + //InsertPrimSyncInfo(primUUID, ); + } + + /// + /// Insert a new PrimSyncInfo into local record. Implemented for access + /// pattern of many readers/a few writers. + /// + /// + /// + /// True if primSyncInfo is inserted; false if it is already in + /// but updated. + private bool InsertPrimSyncInfo(UUID primUUID, PrimSyncInfo primSyncInfo) + { + lock (m_primsInSyncLock) + { + if (m_primsInSync.ContainsKey(primUUID)) + { + m_primsInSync[primUUID] = primSyncInfo; + return false; + } + Dictionary newPrimsInSync = new Dictionary(m_primsInSync); + newPrimsInSync.Add(primUUID, primSyncInfo); + + m_primsInSync = newPrimsInSync; + } + return true; + } + } } From b9bfe6ba5112345dd5c2ec9fa64619c4c553b8a4 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 13 Apr 2011 13:43:25 -0700 Subject: [PATCH 11/36] Fixed bugs in encoding/decoding SOG and SOPs, with per property sync info. --- .../SymmetricSync/RegionSyncModule.cs | 189 ++++++++++++++---- .../Framework/Scenes/SceneObjectPart.cs | 22 ++ 2 files changed, 177 insertions(+), 34 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index cb1ab183dc..7f90fe9345 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -104,7 +104,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //initialize PrimSyncInfoManager int syncInfoAgeOutSeconds = m_sysConfig.GetInt("PrimSyncInfoAgeOutSeconds", 300); //unit of seconds TimeSpan tSpan = new TimeSpan(0, 0, syncInfoAgeOutSeconds); - m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks, m_log); + m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks); } //Called after Initialise() @@ -130,6 +130,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_scene.EventManager.OnObjectBeingRemovedFromScene += new EventManager.ObjectBeingRemovedFromScene(RegionSyncModule_OnObjectBeingRemovedFromScene); LogHeader += "-LocalRegion " + scene.RegionInfo.RegionName; + + m_syncID = GetSyncID(); } //Called after AddRegion() has been called for all region modules of the scene @@ -695,6 +697,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Synchronization related functions, NOT exposed through IRegionSyncModule interface ///////////////////////////////////////////////////////////////////////////////////////// + private string GetSyncID() + { + if (m_scene != null) + { + return m_scene.RegionInfo.RegionID.ToString(); + } + else + { + return String.Empty; + } + } + private void StatsTimerElapsed(object source, System.Timers.ElapsedEventArgs e) { //TO BE IMPLEMENTED @@ -1835,10 +1849,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule * */ SceneObjectGroup sog = (SceneObjectGroup)entity; - //first test serialization + + //First, create PrimSyncInfo for each part in SOG and insert + //into the local record + foreach (SceneObjectPart part in sog.Parts) + { + m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID); + } + + //Next test serialization OSDMap sogData = SceneObjectEncoder(sog); - //second, test de-serialization + //Next, test de-serialization SceneObjectGroup group; Dictionary primsSyncInfo; SceneObjectDecoder(sogData, out group, out primsSyncInfo); @@ -3028,6 +3050,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #region Prim Property Sync management + private PrimSyncInfoManager m_primSyncInfoManager; //private /// @@ -3133,8 +3156,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet updatedProperties = updatedPrimProperties.Value; OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); - SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData)); - SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); + if (syncData.Count > 0) + { + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData)); + SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); + } } // Indicate that the current batch of updates has been completed @@ -3163,7 +3189,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// Encode a SOG. Values of each part's properties are copied from - /// PrimSyncInfo, instead of from SOP's data. + /// PrimSyncInfo, instead of from SOP's data. If a part's PrimSyncInfo + /// is not maintained by PrimSyncInfoManager yet, add it first. /// /// /// @@ -3182,9 +3209,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule * */ data["GroupPosition"] = OSDMap.FromVector3(globalPos); - HashSet fullPropertyList = new HashSet() { SceneObjectPartProperties.FullUpdate }; + HashSet fullPropertyList = new HashSet() { SceneObjectPartProperties.FullUpdate }; + if (!m_primSyncInfoManager.IsPrimSyncInfoExist(sog.RootPart.UUID)) + { + m_log.WarnFormat("{0}: SceneObjectEncoder -- SOP {1},{2} not in PrimSyncInfoManager's record yet", LogHeader, sog.RootPart.Name, sog.RootPart.UUID); + //This should not happen, but we deal with it by inserting a newly created PrimSynInfo + m_primSyncInfoManager.InsertPrimSyncInfo(sog.RootPart, DateTime.Now.Ticks, m_syncID); + } data["RootPart"] = m_primSyncInfoManager.EncodePrimProperties(sog.RootPart.UUID, fullPropertyList); + //int otherPartsCount = sog.Parts.Length - 1; //data["OtherPartsCount"] = OSD.FromInteger(otherPartsCount); OSDArray otherPartsArray = new OSDArray(); @@ -3192,6 +3226,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (!part.UUID.Equals(sog.RootPart.UUID)) { + if (!m_primSyncInfoManager.IsPrimSyncInfoExist(part.UUID)) + { + m_log.WarnFormat("{0}: SceneObjectEncoder -- SOP {1},{2} not in PrimSyncInfoManager's record yet", LogHeader, part.Name, part.UUID); + //This should not happen, but we deal with it by inserting a newly created PrimSynInfo + m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID); + } OSDMap partData = m_primSyncInfoManager.EncodePrimProperties(part.UUID, fullPropertyList); otherPartsArray.Add(partData); } @@ -3210,9 +3250,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule sog = new SceneObjectGroup(); partsPrimSyncInfo = new Dictionary(); - if(data.ContainsKey("UUID")){ - sog.UUID = data["UUID"].AsUUID(); - } + //if(data.ContainsKey("UUID")){ + // sog.UUID = data["UUID"].AsUUID(); + //} if(!data.ContainsKey("RootPart")){ m_log.WarnFormat("{0}: SceneObjectDecoder, no RootPart found in the OSDMap"); @@ -4106,7 +4146,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #region Members public static long TimeOutThreshold; - private Dictionary m_propertiesSyncInfo; + private Dictionary m_propertiesSyncInfo = new Dictionary(); public Dictionary PropertiesSyncInfo { get { return m_propertiesSyncInfo; } @@ -4120,6 +4160,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private ILog m_log; private Object m_primSyncInfoLock = new Object(); + private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); #endregion //Members @@ -4130,6 +4171,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + //m_fullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); } public PrimSyncInfo() @@ -4139,7 +4181,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public PrimSyncInfo(OSDMap primSyncInfoData) { - DecodeAndSetProperiesSyncInfo(primSyncInfoData); + InitPropertiesSyncInfoFromOSDMap(primSyncInfoData); } #endregion //Constructors @@ -4173,6 +4215,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet propertiesWithSyncInfoUpdated = new HashSet(); if (part == null) return propertiesWithSyncInfoUpdated; + HashSet propertiesToBeSynced = new HashSet < SceneObjectPartProperties >(updatedProperties); //first, see if there are physics properties updated but PhysActor //does not exist foreach (SceneObjectPartProperties property in updatedProperties) @@ -4199,14 +4242,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; case SceneObjectPartProperties.FullUpdate: - //Caller indicated many properties have changed. Handle - //this case specially. - + //Caller indicated many properties have changed. We need to //compare and update all properties - + propertiesToBeSynced = FullSetPrimProperties; return propertiesWithSyncInfoUpdated; case SceneObjectPartProperties.None: - //do nothing + propertiesToBeSynced.Clear(); break; } } @@ -4216,7 +4257,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //value here and set the timestamp and syncID lock (m_primSyncInfoLock) { - foreach (SceneObjectPartProperties property in updatedProperties) + foreach (SceneObjectPartProperties property in propertiesToBeSynced) { bool updated = false; //Compare if the value of the property in this SyncModule is @@ -4258,7 +4299,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (propertiesToSync.Contains(SceneObjectPartProperties.FullUpdate)) { - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + foreach (SceneObjectPartProperties property in FullSetPrimProperties) { propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); } @@ -4281,19 +4322,27 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public void DecodeAndSetProperiesSyncInfo(OSDMap primSyncInfoData) { - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + foreach (SceneObjectPartProperties property in FullSetPrimProperties) { if (primSyncInfoData.ContainsKey(property.ToString())) { //PropertySyncInfo propertySyncInfo = OSDMapToPropertySyncInfo((OSDMap)primSyncInfoData[property.ToString()]); PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); - m_propertiesSyncInfo.Add(property, propertySyncInfo); + if (!m_propertiesSyncInfo.ContainsKey(property)) + { + m_propertiesSyncInfo.Add(property, propertySyncInfo); + } + else + { + m_propertiesSyncInfo[property] = propertySyncInfo; + } }else{ m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap"); } } } + //TO BE FINISHED public SceneObjectPart PrimSyncInfoToSOP() { SceneObjectPart sop = new SceneObjectPart(); @@ -4302,9 +4351,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { - m_propertiesSyncInfo = new Dictionary(); - - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + m_propertiesSyncInfo.Clear(); + foreach (SceneObjectPartProperties property in FullSetPrimProperties) { Object initValue = GetSOPPropertyValue(part, property); PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); @@ -4312,6 +4360,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /// + /// Decode PropertySyncInfo for each property and insert into m_propertiesSyncInfo. + /// This is called to initialize this PrimSyncInfo by decoding from OSDMap. + /// + /// + private void InitPropertiesSyncInfoFromOSDMap(OSDMap primSyncInfoData) + { + m_propertiesSyncInfo.Clear(); + foreach (SceneObjectPartProperties property in FullSetPrimProperties) + { + if (primSyncInfoData.ContainsKey(property.ToString())) + { + PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); + m_propertiesSyncInfo.Add(property, propertySyncInfo); + } + else + { + m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap"); + } + } + } + //Assumption: the caller already locks the access lock, and no need to lock here private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateTS, string syncID) { @@ -5633,12 +5703,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_primsInSync; } } - public PrimSyncInfoManager(RegionSyncModule syncModule, long ageOutTh, ILog log) + public PrimSyncInfoManager(RegionSyncModule syncModule, long ageOutTh) { m_primsInSync = new Dictionary(); m_regionSyncModule = syncModule; m_ageOutThreshold = ageOutTh; - m_log = log; + + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + } + + public bool IsPrimSyncInfoExist(UUID primUUID) + { + return m_primsInSync.ContainsKey(primUUID); } /// @@ -5674,15 +5750,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) { OSDMap data = new OSDMap(); - data["primUUID"] = OSDMap.FromUUID(primUUID); - OSDArray propertyData = new OSDArray(); - data["propertyData"] = propertyData; - - foreach (SceneObjectPartProperties property in updatedProperties) + if (!m_primsInSync.ContainsKey(primUUID)) { - propertyData.Add(m_primsInSync[primUUID].EncodePropertiesSyncInfo(updatedProperties)); + m_log.WarnFormat("EncodePrimProperties: {0} not in RegionSyncModule's PrimSyncInfo list yet", primUUID); + return data; } + data["primUUID"] = OSDMap.FromUUID(primUUID); + //OSDMap propertyData = new OSDMap(); + //data["propertyData"] = propertyData; + + //If SceneObjectPartProperties.FullUpdate is in updatedProperties, + //convert it to the full list of all properties + + HashSet propertiesToEncoded = updatedProperties; + if (updatedProperties.Contains(SceneObjectPartProperties.FullUpdate)) + { + propertiesToEncoded = SceneObjectPart.GetAllPrimProperties(); + } + + //foreach (SceneObjectPartProperties property in propertiesToEncoded) + //{ + //propertyData.Add(property.ToString(), m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded)); + //} + OSDMap propertyData = m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded); + data["propertyData"] = propertyData; + return data; } @@ -5694,9 +5787,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return null; } UUID primUUID = primData["primUUID"]; - OSDArray propertyData = (OSDArray)primData["propertyData"]; + OSDMap propertyData = (OSDMap)primData["propertyData"]; - PrimSyncInfo primSynInfo = new PrimSyncInfo(primData); + PrimSyncInfo primSynInfo = new PrimSyncInfo(propertyData); return primSynInfo; //InsertPrimSyncInfo(primUUID, ); @@ -5726,6 +5819,34 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } return true; } + + /// + /// For a new SOP, create a PrimSyncInfo for it. Assume the timestamp for + /// each property is at least T ticks old, T=m_ageOutThreshold. + /// + /// + /// + /// + /// + public bool InsertPrimSyncInfo(SceneObjectPart part, long syncInfoInitTime, string syncID) + { + long lastUpdateTimeStamp = syncInfoInitTime - m_ageOutThreshold; + + PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, lastUpdateTimeStamp, syncID); + lock (m_primsInSyncLock) + { + if (m_primsInSync.ContainsKey(part.UUID)) + { + m_primsInSync[part.UUID] = primSyncInfo; + return false; + } + Dictionary newPrimsInSync = new Dictionary(m_primsInSync); + newPrimsInSync.Add(part.UUID, primSyncInfo); + + m_primsInSync = newPrimsInSync; + } + return true; + } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 259a173c98..34d3e16c6a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5364,6 +5364,28 @@ namespace OpenSim.Region.Framework.Scenes }; * */ + /// + /// Return the list of all prim (SOP) properties, in enum type. + /// Excluding None, FullUpdate. + /// + /// + public static HashSet GetAllPrimProperties() + { + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + switch (property) + { + case SceneObjectPartProperties.None: + case SceneObjectPartProperties.FullUpdate: + break; + default: + allProperties.Add(property); + break; + } + } + return allProperties; + } public static void InitializePropertyBucketInfo(Dictionary propertyBucketMap, List bucketNames, string actorID) { From d0938f57eba6b957e77d81fcaa23ffcbce8a069c Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Thu, 14 Apr 2011 17:09:50 -0700 Subject: [PATCH 12/36] Added PrimSyncInfo.SetSOPPropertyValue(), and fixed bugs in decoding SOP (PhysActor properties). --- .../SymmetricSync/RegionSyncModule.cs | 474 ++++++++++++++++-- .../Framework/Scenes/SceneObjectPart.cs | 69 +++ 2 files changed, 507 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 7f90fe9345..407fd33219 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1865,6 +1865,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule Dictionary primsSyncInfo; SceneObjectDecoder(sogData, out group, out primsSyncInfo); + //Add the list of PrimSyncInfo to PrimSyncInfoManager's record. + m_primSyncInfoManager.InsertMultiPrimSyncInfo(primsSyncInfo); + + //Change each part's UUID so that we can add them to Scene and test the steps in AddNewSceneObjectByDecoding + foreach (SceneObjectPart part in group.Parts) + { + part.UUID = UUID.Random(); + } + + //Add the decoded object to Scene + Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(group); + + //Now the PhysActor of each part in sog have been created, let's + //set the PhysActor's properties + foreach (SceneObjectPart part in group.Parts) + { + primsSyncInfo[part.UUID].SetSOPPhyscActorProperties(part); + } + break; } } @@ -3244,7 +3263,42 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return data; } + private void AddNewSceneObjectByDecoding(OSDMap data) + { + SceneObjectGroup group; + Dictionary primsSyncInfo; + SceneObjectDecoder(data, out group, out primsSyncInfo); + + if (group == null) + { + m_log.WarnFormat("{0}: AddNewSceneObjectByDecoding, no valid SceneObjectGroup has been created", LogHeader); + return; + } + + //Add the list of PrimSyncInfo to PrimSyncInfoManager's record. + m_primSyncInfoManager.InsertMultiPrimSyncInfo(primsSyncInfo); + + //Add the decoded object to Scene + Scene.ObjectUpdateResult updateResult = m_scene.AddNewSceneObjectBySync(group); + + //Now the PhysActor of each part in sog have been created, let's + //set the PhysActor's properties + foreach (SceneObjectPart part in group.Parts) + { + primsSyncInfo[part.UUID].SetSOPPhyscActorProperties(part); + } + } + + /// + /// Decode & create a SOG data structure. Due to the fact that PhysActor + /// is only created when SOG.AttachToScene() is called, the returned SOG + /// here only have non PhysActor properties decoded and values set. The + /// PhysActor properties should be set later by the caller. + /// + /// + /// + /// private void SceneObjectDecoder(OSDMap data, out SceneObjectGroup sog, out Dictionary partsPrimSyncInfo) { sog = new SceneObjectGroup(); @@ -3283,8 +3337,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap partData = (OSDMap)otherPartsArray[i]; primSyncInfo = m_primSyncInfoManager.DecodePrimProperties(partData); SceneObjectPart part = primSyncInfo.PrimSyncInfoToSOP(); - if(part!=null) + if(part!=null){ sog.AddPart(part); + partsPrimSyncInfo.Add(part.UUID, primSyncInfo); + } } } @@ -3304,7 +3360,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } - #endregion //Prim Property Sync management @@ -3938,7 +3993,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// case SceneObjectPartProperties.CollisionSoundVolume: //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsReal()); + float csValue = (float)propertyData["Value"].AsReal(); + m_lastUpdateValue = (Object)(csValue); break; //////////////////////////// @@ -3999,7 +4055,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////////////// case SceneObjectPartProperties.Buoyancy: //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsReal()); + float bValue = (float)propertyData["Value"].AsReal(); + m_lastUpdateValue = (Object)(bValue); break; //////////////////////////////////// @@ -4072,9 +4129,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public static PrimitiveBaseShape DeSerializeShape(string shapeString) { + if (shapeString == null || shapeString == String.Empty || shapeString == "") + { + return null; + } StringReader sr = new StringReader(shapeString); XmlTextReader reader = new XmlTextReader(sr); - return SceneObjectSerializer.ReadShape(reader, "Shape"); + PrimitiveBaseShape shapeValue; + try + { + shapeValue = SceneObjectSerializer.ReadShape(reader, "Shape"); + } + catch (Exception e) + { + Console.WriteLine("DeSerializeShape: Error " + e.Message); + return null; + } + return shapeValue; } public static string SerializeTaskInventory(SceneObjectPart part) @@ -4093,9 +4164,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public static TaskInventoryDictionary DeSerializeTaskInventory(string taskInvString) { + if (taskInvString == null || taskInvString == String.Empty || taskInvString == "") + { + return null; + } StringReader sr = new StringReader(taskInvString); XmlTextReader reader = new XmlTextReader(sr); - return SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); + TaskInventoryDictionary taskVal; + try + { + taskVal = SceneObjectSerializer.ReadTaskInventory(reader, "TaskInventory"); + }catch(Exception e) + { + Console.WriteLine("DeSerializeTaskInventory: Error " + e.Message); + return null; + } + return taskVal; } //Copy code from SceneObjectSerializer.SOPToXml2 @@ -4158,9 +4242,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_PrimLastUpdateTime; } } + private UUID m_UUID; + public UUID UUID + { + get { return m_UUID; } + } private ILog m_log; private Object m_primSyncInfoLock = new Object(); private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); + private static HashSet PrimPhysActorProperties = SceneObjectPart.GetAllPhysActorProperties(); + private static HashSet GroupProperties = SceneObjectPart.GetGroupProperties(); #endregion //Members @@ -4168,6 +4259,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public PrimSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { + InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -4216,39 +4308,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (part == null) return propertiesWithSyncInfoUpdated; HashSet propertiesToBeSynced = new HashSet < SceneObjectPartProperties >(updatedProperties); - //first, see if there are physics properties updated but PhysActor - //does not exist + foreach (SceneObjectPartProperties property in updatedProperties) { - switch (property) + //first, see if there are physics properties updated but PhysActor + //does not exist + if (SceneObjectPart.GetAllPhysActorProperties().Contains(property)) { - case SceneObjectPartProperties.Buoyancy: - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: - case SceneObjectPartProperties.Orientation: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: - if (part.PhysActor == null) - { - m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); + if (part.PhysActor == null) + { + m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); + return propertiesWithSyncInfoUpdated; + } + } + else + { + switch (property) + { + case SceneObjectPartProperties.FullUpdate: + //Caller indicated many properties have changed. We need to + //compare and update all properties + propertiesToBeSynced = FullSetPrimProperties; return propertiesWithSyncInfoUpdated; - } - break; - case SceneObjectPartProperties.FullUpdate: - //Caller indicated many properties have changed. We need to - //compare and update all properties - propertiesToBeSynced = FullSetPrimProperties; - return propertiesWithSyncInfoUpdated; - case SceneObjectPartProperties.None: - propertiesToBeSynced.Clear(); - break; + case SceneObjectPartProperties.None: + propertiesToBeSynced.Clear(); + break; + } } } @@ -4346,9 +4431,31 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public SceneObjectPart PrimSyncInfoToSOP() { SceneObjectPart sop = new SceneObjectPart(); + foreach (SceneObjectPartProperties property in FullSetPrimProperties) + { + if (m_propertiesSyncInfo.ContainsKey(property)) + SetSOPPropertyValue(sop, property); + else + { + m_log.WarnFormat("PrimSyncInfoToSOP -- property {0} not in record.", property); + } + } return sop; } + public void SetSOPPhyscActorProperties(SceneObjectPart sop) + { + foreach (SceneObjectPartProperties property in PrimPhysActorProperties) + { + SetSOPPropertyValue(sop, property); + } + } + + public void SetGroupProperties(SceneObjectPart sop) + { + + } + private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo.Clear(); @@ -5674,6 +5781,265 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return pValue; } + private void SetSOPPropertyValue(SceneObjectPart part, SceneObjectPartProperties property) + { + if (part == null) return; + if (!m_propertiesSyncInfo.ContainsKey(property)){ + m_log.WarnFormat("SetSOPPropertyValue: property {0} not in record.", property.ToString()); + return; + } + PropertySyncInfo pSyncInfo = m_propertiesSyncInfo[property]; + + switch (property) + { + case SceneObjectPartProperties.Shape: + PrimitiveBaseShape shapeVal = PropertySerializer.DeSerializeShape((string)pSyncInfo.LastUpdateValue); + if (shapeVal != null) + part.Shape = shapeVal; + break; + case SceneObjectPartProperties.TaskInventory: + TaskInventoryDictionary taskVal = PropertySerializer.DeSerializeTaskInventory((string)pSyncInfo.LastUpdateValue); + if (taskVal != null) + part.TaskInventory = taskVal; + break; + + /////////////////////// + //SOP properties + /////////////////////// + case SceneObjectPartProperties.AggregateScriptEvents: + part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.AllowedDrop: + part.AllowedDrop = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.AngularVelocity: + part.AngularVelocity = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.AttachedAvatar: + part.AttachedAvatar = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.AttachedPos: + part.AttachedPos = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.AttachmentPoint: + part.AttachmentPoint = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.BaseMask: + part.BaseMask = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Category: + part.Category = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.ClickAction: + part.ClickAction = (byte)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CollisionSound: + part.CollisionSound = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CollisionSoundVolume: + part.CollisionSoundVolume = (float)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Color: + part.Color = (System.Drawing.Color)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CreationDate: + part.CreationDate = (int)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CreatorData: + part.CreatorData = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CreatorID: + part.CreatorID = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Description: + part.Description = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.EveryoneMask: + part.EveryoneMask = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Flags: + part.Flags = (PrimFlags)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.FolderID: + part.FolderID = (UUID)pSyncInfo.LastUpdateValue; + break; + //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly + case SceneObjectPartProperties.GroupID: + part.GroupID = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.GroupMask: + part.GroupMask = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.GroupPosition: + part.GroupPosition = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.InventorySerial: + part.InventorySerial = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.IsAttachment: + part.IsAttachment = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.LastOwnerID: + part.LastOwnerID = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.LinkNum: + part.LinkNum = (int)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Material: + part.Material = (byte)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.MediaUrl: + part.MediaUrl = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Name: + part.Name = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.NextOwnerMask: + part.NextOwnerMask = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.ObjectSaleType: + part.ObjectSaleType = (byte)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.OffsetPosition: + part.OffsetPosition = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.OwnerID: + part.OwnerID = (UUID)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.OwnerMask: + part.OwnerMask = (uint)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.OwnershipCost: + part.OwnershipCost = (int)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.ParticleSystem: + //byte[], return a cloned copy + byte[] pValue = (byte[])pSyncInfo.LastUpdateValue; + part.ParticleSystem = (byte[])pValue.Clone(); + break; + case SceneObjectPartProperties.PassTouches: + part.PassTouches = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.RotationOffset: + part.RotationOffset = (Quaternion)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SalePrice: + part.SalePrice = (int)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Scale: + part.Scale = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.ScriptAccessPin: + part.ScriptAccessPin = (int)pSyncInfo.LastUpdateValue; + break; + //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues + case SceneObjectPartProperties.SitName: + part.SitName = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SitTargetOrientation: + part.SitTargetOrientation = (Quaternion)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SitTargetOrientationLL: + part.SitTargetOrientationLL = (Quaternion)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SitTargetPosition: + part.SitTargetPosition = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SitTargetPositionLL: + part.SitTargetPositionLL = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.SOP_Acceleration: + part.Acceleration = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Sound: + part.Sound = (UUID)pSyncInfo.LastUpdateValue; + break; + //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues + case SceneObjectPartProperties.Text: + part.Text = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.TextureAnimation: + //byte[], return a cloned copy + byte[] tValue = (byte[])pSyncInfo.LastUpdateValue; + part.TextureAnimation = (byte[])tValue.Clone(); + break; + case SceneObjectPartProperties.TouchName: + part.TouchName = (string)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.UpdateFlag: + part.UpdateFlag = (byte)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Velocity: + part.Velocity = (Vector3)pSyncInfo.LastUpdateValue; + break; + + /////////////////////// + //PhysActor properties + /////////////////////// + case SceneObjectPartProperties.Buoyancy: + if (part.PhysActor != null) + part.PhysActor.Buoyancy = (float)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Flying: + if (part.PhysActor != null) + part.PhysActor.Flying = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Force: + if (part.PhysActor != null) + part.PhysActor.Force = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.IsColliding: + if (part.PhysActor != null) + part.PhysActor.IsColliding = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.CollidingGround: + if (part.PhysActor != null) + part.PhysActor.CollidingGround = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.IsPhysical: + if (part.PhysActor != null) + part.PhysActor.IsPhysical = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Kinematic: + if (part.PhysActor != null) + part.PhysActor.Kinematic = (bool)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Orientation: + if (part.PhysActor != null) + part.PhysActor.Orientation = (Quaternion)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.PA_Acceleration: + if (part.PhysActor != null) + part.PhysActor.Acceleration = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Position: + if (part.PhysActor != null) + part.PhysActor.Position = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.RotationalVelocity: + if (part.PhysActor != null) + part.PhysActor.RotationalVelocity = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Size: + if (part.PhysActor != null) + part.PhysActor.Size = (Vector3)pSyncInfo.LastUpdateValue; + break; + case SceneObjectPartProperties.Torque: + if (part.PhysActor != null) + part.PhysActor.Torque = (Vector3)pSyncInfo.LastUpdateValue; + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartProperties.IsSelected: + if (part.ParentGroup != null) + part.ParentGroup.IsSelected = (bool)pSyncInfo.LastUpdateValue; + break; + } + + } + } public class PrimSyncInfoManager @@ -5803,7 +6169,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// True if primSyncInfo is inserted; false if it is already in /// but updated. - private bool InsertPrimSyncInfo(UUID primUUID, PrimSyncInfo primSyncInfo) + public bool InsertPrimSyncInfo(UUID primUUID, PrimSyncInfo primSyncInfo) { lock (m_primsInSyncLock) { @@ -5812,9 +6178,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_primsInSync[primUUID] = primSyncInfo; return false; } + + //copy the items from the old list and insert the new record Dictionary newPrimsInSync = new Dictionary(m_primsInSync); newPrimsInSync.Add(primUUID, primSyncInfo); + //replace the old list m_primsInSync = newPrimsInSync; } return true; @@ -5848,6 +6217,39 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return true; } + public void InsertMultiPrimSyncInfo(Dictionary multiPrimsSyncInfo) + { + lock (m_primsInSyncLock) + { + //copy the old list, update the copied list + Dictionary newPrimsInSync = new Dictionary(m_primsInSync); + foreach (KeyValuePair valPair in multiPrimsSyncInfo) + { + UUID primUUID = valPair.Key; + PrimSyncInfo primSyncInfo = valPair.Value; + if (newPrimsInSync.ContainsKey(primUUID)) + { + newPrimsInSync[primUUID] = primSyncInfo; + continue; + } + newPrimsInSync.Add(primUUID, primSyncInfo); + } + + //replace the old list + m_primsInSync = newPrimsInSync; + } + } + + public PrimSyncInfo GetPrimSyncInfo(UUID primUUID) + { + if (m_primsInSync.ContainsKey(primUUID)) + { + return m_primsInSync[primUUID]; + } + else + return null; + } + } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 34d3e16c6a..ac8a5ce502 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5387,6 +5387,75 @@ namespace OpenSim.Region.Framework.Scenes return allProperties; } + public static HashSet GetAllPrimNonPhysActorProperties() + { + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + switch (property) + { + //Enum value that is not real properties + case SceneObjectPartProperties.None: + case SceneObjectPartProperties.FullUpdate: + //PhysActor properties + case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + case SceneObjectPartProperties.Orientation: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + break; + default: + allProperties.Add(property); + break; + } + } + return allProperties; + } + + public static HashSet GetAllPhysActorProperties() + { + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + { + switch (property) + { + //PhysActor properties + case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartProperties.Flying: + case SceneObjectPartProperties.Force: + case SceneObjectPartProperties.IsColliding: + case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartProperties.Kinematic: + case SceneObjectPartProperties.Orientation: + case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartProperties.Position: + case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartProperties.Size: + case SceneObjectPartProperties.Torque: + allProperties.Add(property); + break; + default: + break; + } + } + return allProperties; + } + + public static HashSet GetGroupProperties() + { + HashSet allProperties = new HashSet(){SceneObjectPartProperties.IsSelected}; + return allProperties; + } + public static void InitializePropertyBucketInfo(Dictionary propertyBucketMap, List bucketNames, string actorID) { m_primPropertyBucketMap = propertyBucketMap; From 9dfc0e92b88a931f9e3f8c22c303a0a9417c803a Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 15 Apr 2011 10:42:57 -0700 Subject: [PATCH 13/36] Changed Enum type SceneObjectPartProperties to SceneObjectPartSyncProperties, to indicate they are the properties synchronzed by the sync protocol. Also, added UUID to PrimSyncInfo. Encode/Decode SOP to/from OSDmap seems working fine now. --- .../Avatar/Attachments/AttachmentsModule.cs | 2 +- .../ObjectCaps/UploadObjectAssetModule.cs | 2 +- .../EntityTransfer/EntityTransferModule.cs | 2 +- .../InventoryAccess/InventoryAccessModule.cs | 4 +- .../SceneToScriptEngineConnector.cs | 2 +- .../SymmetricSync/RegionSyncModule.cs | 845 +++++++++--------- .../World/Media/Moap/MoapModule.cs | 6 +- .../World/Objects/BuySell/BuySellModule.cs | 2 +- .../Framework/Interfaces/IRegionSyncModule.cs | 4 +- .../Framework/Scenes/Scene.Inventory.cs | 4 +- .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 +- .../Framework/Scenes/SceneObjectGroup.cs | 32 +- .../Framework/Scenes/SceneObjectPart.cs | 134 +-- .../Scenes/SceneObjectPartInventory.cs | 8 +- OpenSim/Region/Framework/Scenes/UndoState.cs | 32 +- .../ContentManagementSystem/CMModel.cs | 2 +- .../TreePopulator/TreePopulatorModule.cs | 2 +- .../Shared/Api/Implementation/LSL_Api.cs | 38 +- .../Shared/Api/Implementation/OSSL_Api.cs | 2 +- 21 files changed, 570 insertions(+), 563 deletions(-) diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index 3e00c3ee8b..5e2b473ae0 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -612,7 +612,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments so.IsSelected = false; // fudge.... //so.ScheduleGroupForFullUpdate(); - so.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //just force it to sychronize all properties + so.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //just force it to sychronize all properties } // In case it is later dropped again, don't let diff --git a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs index ac5df368ca..fcac692969 100644 --- a/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/ObjectCaps/UploadObjectAssetModule.cs @@ -355,7 +355,7 @@ namespace OpenSim.Region.CoreModules.Avatar.ObjectCaps } //rootGroup.ScheduleGroupForFullUpdate(); - rootGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //seems like new object + rootGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //seems like new object pos = m_scene.GetNewRezLocation(Vector3.Zero, rootpos, UUID.Zero, rot, (byte)1, 1, true, allparts[0].GroupScale(), false); responsedata["int_response_code"] = 200; //501; //410; //404; diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 048f6f7086..5803cc4828 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1603,7 +1603,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer { grp.OffsetForNewRegion(oldGroupPosition); //grp.ScheduleGroupForFullUpdate(); - grp.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.Position}); + grp.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.Position}); } } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index e67c07dbea..bd316215d7 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -587,7 +587,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (!attachment) { //group.ScheduleGroupForFullUpdate(); - group.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //new object + group.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //new object float offsetHeight = 0; pos = m_Scene.GetNewRezLocation( @@ -708,7 +708,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.ParentGroup.ResumeScripts(); //rootPart.ScheduleFullUpdate(); - rootPart.ScheduleFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); + rootPart.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); } if (!m_Scene.Permissions.BypassPermissions()) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToScriptEngineConnector.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToScriptEngineConnector.cs index b961362720..7880ae4df5 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToScriptEngineConnector.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SceneToScriptEngineConnector.cs @@ -574,7 +574,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule primToUpdate.OffsetPosition = pos; parent.HasGroupChanged = true; //parent.ScheduleGroupForTerseUpdate(); - parent.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.OffsetPosition}); + parent.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.OffsetPosition}); } } diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 407fd33219..a4fb1e3ef2 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -194,8 +194,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_isSyncRelay; } } - private Dictionary m_primPropertyBucketMap = new Dictionary(); - public Dictionary PrimPropertyBucketMap + private Dictionary m_primPropertyBucketMap = new Dictionary(); + public Dictionary PrimPropertyBucketMap { get { return m_primPropertyBucketMap; } } @@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////////////////////////////////////////////////////// private Object m_primPropertyUpdateLock = new Object(); - private Dictionary> m_primPropertyUpdates = new Dictionary>(); + private Dictionary> m_primPropertyUpdates = new Dictionary>(); private int m_sendingPrimPropertyUpdates = 0; /////////////////////////////////////////////////////////////////////// @@ -1307,29 +1307,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_lastUpdateSentTime.Add("Physics", 0); //Mapping properties to buckets. - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + foreach (SceneObjectPartSyncProperties property in Enum.GetValues(typeof(SceneObjectPartSyncProperties))) { switch (property) { - case SceneObjectPartProperties.GroupPosition: - case SceneObjectPartProperties.OffsetPosition: - case SceneObjectPartProperties.Scale: - case SceneObjectPartProperties.AngularVelocity: - case SceneObjectPartProperties.RotationOffset: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.Velocity: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Torque: - case SceneObjectPartProperties.Orientation: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.Kinematic: - case SceneObjectPartProperties.Buoyancy: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsColliding: + case SceneObjectPartSyncProperties.GroupPosition: + case SceneObjectPartSyncProperties.OffsetPosition: + case SceneObjectPartSyncProperties.Scale: + case SceneObjectPartSyncProperties.AngularVelocity: + case SceneObjectPartSyncProperties.RotationOffset: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.Velocity: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Torque: + case SceneObjectPartSyncProperties.Orientation: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.Kinematic: + case SceneObjectPartSyncProperties.Buoyancy: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsColliding: m_primPropertyBucketMap.Add(property, m_physicsBucketName); break; default: @@ -1871,7 +1871,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Change each part's UUID so that we can add them to Scene and test the steps in AddNewSceneObjectByDecoding foreach (SceneObjectPart part in group.Parts) { + UUID oldUUID = part.UUID; part.UUID = UUID.Random(); + + PrimSyncInfo syncInfo = primsSyncInfo[oldUUID]; + primsSyncInfo.Add(part.UUID, syncInfo); } //Add the decoded object to Scene @@ -3079,7 +3083,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) + public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal called. Simply return for now. More testing later."); return; @@ -3087,7 +3091,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Sync values with SOP's data and update timestamp according, to //obtain the list of properties that really have been updated //and should be propogated to other sync nodes. - HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); + HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); //Enqueue the prim with the set of updated properties if (propertiesWithSyncInfoUpdated.Count > 0) @@ -3096,7 +3100,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (m_primPropertyUpdates.ContainsKey(part.UUID)) { - foreach (SceneObjectPartProperties property in propertiesWithSyncInfoUpdated) + foreach (SceneObjectPartSyncProperties property in propertiesWithSyncInfoUpdated) { //Include the "property" into the list of updated properties. //HashSet's Add function should handle it correctly whether the property @@ -3137,10 +3141,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } //copy the updated prim property list, and clear m_primPropertyUpdates immediately for future use - Dictionary> primPropertyUpdates = new Dictionary>(); + Dictionary> primPropertyUpdates = new Dictionary>(); lock (m_primPropertyUpdateLock) { - foreach (KeyValuePair> updatedPrimProperties in m_primPropertyUpdates) + foreach (KeyValuePair> updatedPrimProperties in m_primPropertyUpdates) { UUID primUUID = updatedPrimProperties.Key; SceneObjectPart prim = m_scene.GetSceneObjectPart(primUUID); @@ -3169,10 +3173,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //OSDArray primDataArray = new OSDArray(); //syncData["primData"] = (OSD)primDataArray; - foreach (KeyValuePair> updatedPrimProperties in primPropertyUpdates) + foreach (KeyValuePair> updatedPrimProperties in primPropertyUpdates) { UUID primUUID = updatedPrimProperties.Key; - HashSet updatedProperties = updatedPrimProperties.Value; + HashSet updatedProperties = updatedPrimProperties.Value; OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); if (syncData.Count > 0) @@ -3228,7 +3232,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule * */ data["GroupPosition"] = OSDMap.FromVector3(globalPos); - HashSet fullPropertyList = new HashSet() { SceneObjectPartProperties.FullUpdate }; + HashSet fullPropertyList = new HashSet() { SceneObjectPartSyncProperties.FullUpdate }; if (!m_primSyncInfoManager.IsPrimSyncInfoExist(sog.RootPart.UUID)) { m_log.WarnFormat("{0}: SceneObjectEncoder -- SOP {1},{2} not in PrimSyncInfoManager's record yet", LogHeader, sog.RootPart.Name, sog.RootPart.UUID); @@ -3557,22 +3561,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { return m_lastUpdateSource; } } - private SceneObjectPartProperties m_property; - public SceneObjectPartProperties Property + private SceneObjectPartSyncProperties m_property; + public SceneObjectPartSyncProperties Property { get { return m_property; } } private Object m_syncInfoLock = new Object(); - public PropertySyncInfo(SceneObjectPartProperties property) + public PropertySyncInfo(SceneObjectPartSyncProperties property) { m_property = property; m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } - public PropertySyncInfo(SceneObjectPartProperties property, Object initValue, long initTS, string syncID) + public PropertySyncInfo(SceneObjectPartSyncProperties property, Object initValue, long initTS, string syncID) { m_property = property; m_lastUpdateValue = initValue; @@ -3588,7 +3592,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public PropertySyncInfo(SceneObjectPartProperties property, OSDMap syncData) + public PropertySyncInfo(SceneObjectPartSyncProperties property, OSDMap syncData) { m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); m_property = property; @@ -3684,55 +3688,55 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////////////////////// //SOP properties with complex structure /////////////////////////////////////// - case SceneObjectPartProperties.Shape: - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: propertyData["Value"] = OSD.FromString((string)LastUpdateValue); break; //////////////////////////// //SOP properties, enum types //////////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: + case SceneObjectPartSyncProperties.AggregateScriptEvents: propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); break; - case SceneObjectPartProperties.Flags: + case SceneObjectPartSyncProperties.Flags: propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); break; //////////////////////////// //SOP properties, bool types //////////////////////////// - case SceneObjectPartProperties.AllowedDrop: - case SceneObjectPartProperties.IsAttachment: - case SceneObjectPartProperties.PassTouches: + case SceneObjectPartSyncProperties.AllowedDrop: + case SceneObjectPartSyncProperties.IsAttachment: + case SceneObjectPartSyncProperties.PassTouches: propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); break; //////////////////////////// //SOP properties, Vector3 types //////////////////////////// - case SceneObjectPartProperties.AngularVelocity: - case SceneObjectPartProperties.AttachedPos: - case SceneObjectPartProperties.GroupPosition: - case SceneObjectPartProperties.OffsetPosition: - case SceneObjectPartProperties.Scale: - case SceneObjectPartProperties.SitTargetPosition: - case SceneObjectPartProperties.SitTargetPositionLL: - case SceneObjectPartProperties.SOP_Acceleration: - case SceneObjectPartProperties.Velocity: + case SceneObjectPartSyncProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AttachedPos: + case SceneObjectPartSyncProperties.GroupPosition: + case SceneObjectPartSyncProperties.OffsetPosition: + case SceneObjectPartSyncProperties.Scale: + case SceneObjectPartSyncProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.Velocity: propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); break; //////////////////////////// //SOP properties, UUID types //////////////////////////// - case SceneObjectPartProperties.AttachedAvatar: - case SceneObjectPartProperties.CollisionSound: - case SceneObjectPartProperties.CreatorID: - case SceneObjectPartProperties.FolderID: - case SceneObjectPartProperties.GroupID: - case SceneObjectPartProperties.LastOwnerID: - case SceneObjectPartProperties.OwnerID: - case SceneObjectPartProperties.Sound: + case SceneObjectPartSyncProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.CollisionSound: + case SceneObjectPartSyncProperties.CreatorID: + case SceneObjectPartSyncProperties.FolderID: + case SceneObjectPartSyncProperties.GroupID: + case SceneObjectPartSyncProperties.LastOwnerID: + case SceneObjectPartSyncProperties.OwnerID: + case SceneObjectPartSyncProperties.Sound: propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); break; @@ -3740,14 +3744,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, uint types //////////////////////////// - case SceneObjectPartProperties.AttachmentPoint: - case SceneObjectPartProperties.BaseMask: - case SceneObjectPartProperties.Category: - case SceneObjectPartProperties.EveryoneMask: - case SceneObjectPartProperties.GroupMask: - case SceneObjectPartProperties.InventorySerial: - case SceneObjectPartProperties.NextOwnerMask: - case SceneObjectPartProperties.OwnerMask: + case SceneObjectPartSyncProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.BaseMask: + case SceneObjectPartSyncProperties.Category: + case SceneObjectPartSyncProperties.EveryoneMask: + case SceneObjectPartSyncProperties.GroupMask: + case SceneObjectPartSyncProperties.InventorySerial: + case SceneObjectPartSyncProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); break; @@ -3757,10 +3761,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, byte types //////////////////////////// - case SceneObjectPartProperties.ClickAction: - case SceneObjectPartProperties.Material: - case SceneObjectPartProperties.ObjectSaleType: - case SceneObjectPartProperties.UpdateFlag: + case SceneObjectPartSyncProperties.ClickAction: + case SceneObjectPartSyncProperties.Material: + case SceneObjectPartSyncProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.UpdateFlag: propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); break; //case SceneObjectPartProperties.CollisionSound: @@ -3768,98 +3772,98 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, float types //////////////////////////// - case SceneObjectPartProperties.CollisionSoundVolume: + case SceneObjectPartSyncProperties.CollisionSoundVolume: propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); break; //////////////////////////// //SOP properties, Color(struct type) //////////////////////////// - case SceneObjectPartProperties.Color: + case SceneObjectPartSyncProperties.Color: propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); break; //////////////////////////// //SOP properties, int types //////////////////////////// - case SceneObjectPartProperties.CreationDate: - case SceneObjectPartProperties.LinkNum: - case SceneObjectPartProperties.OwnershipCost: - case SceneObjectPartProperties.SalePrice: - case SceneObjectPartProperties.ScriptAccessPin: + case SceneObjectPartSyncProperties.CreationDate: + case SceneObjectPartSyncProperties.LinkNum: + case SceneObjectPartSyncProperties.OwnershipCost: + case SceneObjectPartSyncProperties.SalePrice: + case SceneObjectPartSyncProperties.ScriptAccessPin: propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); break; //////////////////////////// //SOP properties, string types //////////////////////////// - case SceneObjectPartProperties.CreatorData: - case SceneObjectPartProperties.Description: - case SceneObjectPartProperties.MediaUrl: - case SceneObjectPartProperties.Name: - case SceneObjectPartProperties.SitName: - case SceneObjectPartProperties.Text: - case SceneObjectPartProperties.TouchName: + case SceneObjectPartSyncProperties.CreatorData: + case SceneObjectPartSyncProperties.Description: + case SceneObjectPartSyncProperties.MediaUrl: + case SceneObjectPartSyncProperties.Name: + case SceneObjectPartSyncProperties.SitName: + case SceneObjectPartSyncProperties.Text: + case SceneObjectPartSyncProperties.TouchName: propertyData["Value"] = OSD.FromString((string)LastUpdateValue); break; //////////////////////////// //SOP properties, byte[] types //////////////////////////// - case SceneObjectPartProperties.ParticleSystem: - case SceneObjectPartProperties.TextureAnimation: + case SceneObjectPartSyncProperties.ParticleSystem: + case SceneObjectPartSyncProperties.TextureAnimation: propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); break; //////////////////////////// //SOP properties, Quaternion types //////////////////////////// - case SceneObjectPartProperties.RotationOffset: - case SceneObjectPartProperties.SitTargetOrientation: - case SceneObjectPartProperties.SitTargetOrientationLL: + case SceneObjectPartSyncProperties.RotationOffset: + case SceneObjectPartSyncProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); break; //////////////////////////////////// //PhysActor properties, float type //////////////////////////////////// - case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartSyncProperties.Buoyancy: propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); break; //////////////////////////////////// //PhysActor properties, bool type //////////////////////////////////// - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.IsColliding: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Kinematic: propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); break; //////////////////////////////////// //PhysActor properties, Vector3 type //////////////////////////////////// - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Torque: propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); break; //////////////////////////////////// //PhysActor properties, Quaternion type //////////////////////////////////// - case SceneObjectPartProperties.Orientation: + case SceneObjectPartSyncProperties.Orientation: propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); break; /////////////////////// //SOG properties /////////////////////// - case SceneObjectPartProperties.IsSelected: + case SceneObjectPartSyncProperties.IsSelected: propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); break; @@ -3897,20 +3901,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////////////////////// //SOP properties with complex structure /////////////////////////////////////// - case SceneObjectPartProperties.Shape: - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: m_lastUpdateValue = (Object)propertyData["Value"].AsString(); break; //////////////////////////// //SOP properties, enum types //////////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: + case SceneObjectPartSyncProperties.AggregateScriptEvents: scriptEvents sEvents = (scriptEvents)(propertyData["Value"].AsInteger()); m_lastUpdateValue = (Object)sEvents; //propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); break; - case SceneObjectPartProperties.Flags: + case SceneObjectPartSyncProperties.Flags: PrimFlags flags = (PrimFlags)(propertyData["Value"].AsInteger()); m_lastUpdateValue = (Object)flags; //propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); @@ -3918,9 +3922,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, bool types //////////////////////////// - case SceneObjectPartProperties.AllowedDrop: - case SceneObjectPartProperties.IsAttachment: - case SceneObjectPartProperties.PassTouches: + case SceneObjectPartSyncProperties.AllowedDrop: + case SceneObjectPartSyncProperties.IsAttachment: + case SceneObjectPartSyncProperties.PassTouches: m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); break; @@ -3928,15 +3932,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, Vector3 types //////////////////////////// - case SceneObjectPartProperties.AngularVelocity: - case SceneObjectPartProperties.AttachedPos: - case SceneObjectPartProperties.GroupPosition: - case SceneObjectPartProperties.OffsetPosition: - case SceneObjectPartProperties.Scale: - case SceneObjectPartProperties.SitTargetPosition: - case SceneObjectPartProperties.SitTargetPositionLL: - case SceneObjectPartProperties.SOP_Acceleration: - case SceneObjectPartProperties.Velocity: + case SceneObjectPartSyncProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AttachedPos: + case SceneObjectPartSyncProperties.GroupPosition: + case SceneObjectPartSyncProperties.OffsetPosition: + case SceneObjectPartSyncProperties.Scale: + case SceneObjectPartSyncProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.Velocity: //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); break; @@ -3944,14 +3948,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, UUID types //////////////////////////// - case SceneObjectPartProperties.AttachedAvatar: - case SceneObjectPartProperties.CollisionSound: - case SceneObjectPartProperties.CreatorID: - case SceneObjectPartProperties.FolderID: - case SceneObjectPartProperties.GroupID: - case SceneObjectPartProperties.LastOwnerID: - case SceneObjectPartProperties.OwnerID: - case SceneObjectPartProperties.Sound: + case SceneObjectPartSyncProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.CollisionSound: + case SceneObjectPartSyncProperties.CreatorID: + case SceneObjectPartSyncProperties.FolderID: + case SceneObjectPartSyncProperties.GroupID: + case SceneObjectPartSyncProperties.LastOwnerID: + case SceneObjectPartSyncProperties.OwnerID: + case SceneObjectPartSyncProperties.Sound: //propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsUUID()); break; @@ -3960,14 +3964,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, uint types //////////////////////////// - case SceneObjectPartProperties.AttachmentPoint: - case SceneObjectPartProperties.BaseMask: - case SceneObjectPartProperties.Category: - case SceneObjectPartProperties.EveryoneMask: - case SceneObjectPartProperties.GroupMask: - case SceneObjectPartProperties.InventorySerial: - case SceneObjectPartProperties.NextOwnerMask: - case SceneObjectPartProperties.OwnerMask: + case SceneObjectPartSyncProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.BaseMask: + case SceneObjectPartSyncProperties.Category: + case SceneObjectPartSyncProperties.EveryoneMask: + case SceneObjectPartSyncProperties.GroupMask: + case SceneObjectPartSyncProperties.InventorySerial: + case SceneObjectPartSyncProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: //propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsUInteger()); break; @@ -3978,10 +3982,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, byte types //////////////////////////// - case SceneObjectPartProperties.ClickAction: - case SceneObjectPartProperties.Material: - case SceneObjectPartProperties.ObjectSaleType: - case SceneObjectPartProperties.UpdateFlag: + case SceneObjectPartSyncProperties.ClickAction: + case SceneObjectPartSyncProperties.Material: + case SceneObjectPartSyncProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.UpdateFlag: //propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); byte pValue = (byte)(propertyData["Value"].AsInteger()); m_lastUpdateValue = (Object)pValue; @@ -3991,7 +3995,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, float types //////////////////////////// - case SceneObjectPartProperties.CollisionSoundVolume: + case SceneObjectPartSyncProperties.CollisionSoundVolume: //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); float csValue = (float)propertyData["Value"].AsReal(); m_lastUpdateValue = (Object)(csValue); @@ -4000,7 +4004,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, Color(struct type) //////////////////////////// - case SceneObjectPartProperties.Color: + case SceneObjectPartSyncProperties.Color: //propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); System.Drawing.Color cValue = PropertySerializer.DeSerializeColor(propertyData["Value"].AsString()); m_lastUpdateValue = (Object)cValue; @@ -4009,11 +4013,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, int types //////////////////////////// - case SceneObjectPartProperties.CreationDate: - case SceneObjectPartProperties.LinkNum: - case SceneObjectPartProperties.OwnershipCost: - case SceneObjectPartProperties.SalePrice: - case SceneObjectPartProperties.ScriptAccessPin: + case SceneObjectPartSyncProperties.CreationDate: + case SceneObjectPartSyncProperties.LinkNum: + case SceneObjectPartSyncProperties.OwnershipCost: + case SceneObjectPartSyncProperties.SalePrice: + case SceneObjectPartSyncProperties.ScriptAccessPin: //propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsInteger()); break; @@ -4021,21 +4025,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, string types //////////////////////////// - case SceneObjectPartProperties.CreatorData: - case SceneObjectPartProperties.Description: - case SceneObjectPartProperties.MediaUrl: - case SceneObjectPartProperties.Name: - case SceneObjectPartProperties.SitName: - case SceneObjectPartProperties.Text: - case SceneObjectPartProperties.TouchName: + case SceneObjectPartSyncProperties.CreatorData: + case SceneObjectPartSyncProperties.Description: + case SceneObjectPartSyncProperties.MediaUrl: + case SceneObjectPartSyncProperties.Name: + case SceneObjectPartSyncProperties.SitName: + case SceneObjectPartSyncProperties.Text: + case SceneObjectPartSyncProperties.TouchName: //propertyData["Value"] = OSD.FromString((string)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsString()); break; //////////////////////////// //SOP properties, byte[] types //////////////////////////// - case SceneObjectPartProperties.ParticleSystem: - case SceneObjectPartProperties.TextureAnimation: + case SceneObjectPartSyncProperties.ParticleSystem: + case SceneObjectPartSyncProperties.TextureAnimation: //propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsBinary()); break; @@ -4043,9 +4047,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////// //SOP properties, Quaternion types //////////////////////////// - case SceneObjectPartProperties.RotationOffset: - case SceneObjectPartProperties.SitTargetOrientation: - case SceneObjectPartProperties.SitTargetOrientationLL: + case SceneObjectPartSyncProperties.RotationOffset: + case SceneObjectPartSyncProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); break; @@ -4053,7 +4057,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////////////// //PhysActor properties, float type //////////////////////////////////// - case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartSyncProperties.Buoyancy: //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); float bValue = (float)propertyData["Value"].AsReal(); m_lastUpdateValue = (Object)(bValue); @@ -4062,11 +4066,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////////////// //PhysActor properties, bool type //////////////////////////////////// - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.IsColliding: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Kinematic: //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); break; @@ -4074,12 +4078,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////////////// //PhysActor properties, Vector3 type //////////////////////////////////// - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Torque: //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); break; @@ -4087,7 +4091,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //////////////////////////////////// //PhysActor properties, Quaternion type //////////////////////////////////// - case SceneObjectPartProperties.Orientation: + case SceneObjectPartSyncProperties.Orientation: //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); break; @@ -4095,7 +4099,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //SOG properties /////////////////////// - case SceneObjectPartProperties.IsSelected: + case SceneObjectPartSyncProperties.IsSelected: //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); break; @@ -4230,8 +4234,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #region Members public static long TimeOutThreshold; - private Dictionary m_propertiesSyncInfo = new Dictionary(); - public Dictionary PropertiesSyncInfo + private Dictionary m_propertiesSyncInfo = new Dictionary(); + public Dictionary PropertiesSyncInfo { get { return m_propertiesSyncInfo; } } @@ -4249,9 +4253,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } private ILog m_log; private Object m_primSyncInfoLock = new Object(); - private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); - private static HashSet PrimPhysActorProperties = SceneObjectPart.GetAllPhysActorProperties(); - private static HashSet GroupProperties = SceneObjectPart.GetGroupProperties(); + private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); + private static HashSet PrimPhysActorProperties = SceneObjectPart.GetAllPhysActorProperties(); + private static HashSet GroupProperties = SceneObjectPart.GetGroupProperties(); #endregion //Members @@ -4259,7 +4263,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public PrimSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { - + m_UUID = part.UUID; InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -4271,24 +4275,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } - public PrimSyncInfo(OSDMap primSyncInfoData) + public PrimSyncInfo(UUID id, OSDMap primSyncInfoData) { + m_UUID = id; InitPropertiesSyncInfoFromOSDMap(primSyncInfoData); } #endregion //Constructors - public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue, pHashedValue); } - public void UpdatePropertySyncInfoByLocal(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue) + public void UpdatePropertySyncInfoByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue); } - public void UpdatePropertySyncInfoBySync(SceneObjectPartProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) + public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) { m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); } @@ -4302,14 +4307,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// /// - public HashSet UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) + public HashSet UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) { - HashSet propertiesWithSyncInfoUpdated = new HashSet(); + HashSet propertiesWithSyncInfoUpdated = new HashSet(); if (part == null) return propertiesWithSyncInfoUpdated; - HashSet propertiesToBeSynced = new HashSet < SceneObjectPartProperties >(updatedProperties); + HashSet propertiesToBeSynced = new HashSet < SceneObjectPartSyncProperties >(updatedProperties); - foreach (SceneObjectPartProperties property in updatedProperties) + foreach (SceneObjectPartSyncProperties property in updatedProperties) { //first, see if there are physics properties updated but PhysActor //does not exist @@ -4325,12 +4330,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { switch (property) { - case SceneObjectPartProperties.FullUpdate: + case SceneObjectPartSyncProperties.FullUpdate: //Caller indicated many properties have changed. We need to //compare and update all properties propertiesToBeSynced = FullSetPrimProperties; return propertiesWithSyncInfoUpdated; - case SceneObjectPartProperties.None: + case SceneObjectPartSyncProperties.None: propertiesToBeSynced.Clear(); break; } @@ -4342,15 +4347,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //value here and set the timestamp and syncID lock (m_primSyncInfoLock) { - foreach (SceneObjectPartProperties property in propertiesToBeSynced) + foreach (SceneObjectPartSyncProperties property in propertiesToBeSynced) { bool updated = false; //Compare if the value of the property in this SyncModule is //different than the value in SOP switch (property) { - case SceneObjectPartProperties.Shape: - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: //Convert the value of complex properties to string and hash updated = CompareAndUpdateHashedValueByLocal(part, property, lastUpdateTS, syncID); break; @@ -4375,23 +4380,23 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// The list of properties to be encoded. /// If FullUpdate is included, then encode all properties. /// - public OSDMap EncodePropertiesSyncInfo(HashSet propertiesToSync) + public OSDMap EncodePropertiesSyncInfo(HashSet propertiesToSync) { OSDMap propertyData = new OSDMap(); //Lock first, so that we effectively freeze the record and take a snapshot lock (m_primSyncInfoLock) { - if (propertiesToSync.Contains(SceneObjectPartProperties.FullUpdate)) + if (propertiesToSync.Contains(SceneObjectPartSyncProperties.FullUpdate)) { - foreach (SceneObjectPartProperties property in FullSetPrimProperties) + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); } } else { - foreach (SceneObjectPartProperties property in propertiesToSync) + foreach (SceneObjectPartSyncProperties property in propertiesToSync) { propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); } @@ -4407,7 +4412,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public void DecodeAndSetProperiesSyncInfo(OSDMap primSyncInfoData) { - foreach (SceneObjectPartProperties property in FullSetPrimProperties) + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { if (primSyncInfoData.ContainsKey(property.ToString())) { @@ -4431,7 +4436,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public SceneObjectPart PrimSyncInfoToSOP() { SceneObjectPart sop = new SceneObjectPart(); - foreach (SceneObjectPartProperties property in FullSetPrimProperties) + sop.UUID = m_UUID; + + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { if (m_propertiesSyncInfo.ContainsKey(property)) SetSOPPropertyValue(sop, property); @@ -4445,7 +4452,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public void SetSOPPhyscActorProperties(SceneObjectPart sop) { - foreach (SceneObjectPartProperties property in PrimPhysActorProperties) + foreach (SceneObjectPartSyncProperties property in PrimPhysActorProperties) { SetSOPPropertyValue(sop, property); } @@ -4459,7 +4466,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo.Clear(); - foreach (SceneObjectPartProperties property in FullSetPrimProperties) + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { Object initValue = GetSOPPropertyValue(part, property); PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); @@ -4475,7 +4482,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void InitPropertiesSyncInfoFromOSDMap(OSDMap primSyncInfoData) { m_propertiesSyncInfo.Clear(); - foreach (SceneObjectPartProperties property in FullSetPrimProperties) + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { if (primSyncInfoData.ContainsKey(property.ToString())) { @@ -4490,12 +4497,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } //Assumption: the caller already locks the access lock, and no need to lock here - private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateTS, string syncID) + private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID) { bool updated = false; switch (property) { - case SceneObjectPartProperties.Shape: + case SceneObjectPartSyncProperties.Shape: string primShapeString = PropertySerializer.SerializeShape(part); string primShapeStringHash = Util.Md5Hash(primShapeString); //primShapeString.GetHashCode @@ -4514,7 +4521,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.TaskInventory: string primTaskInventoryString = PropertySerializer.SerializeTaskInventory(part); string primTaskInventoryStringHash = Util.Md5Hash(primTaskInventoryString); if (!m_propertiesSyncInfo[property].IsHashValueEqual(primTaskInventoryStringHash)) @@ -4558,7 +4565,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// Return true if the property's value maintained in this /// RegionSyncModule is replaced by SOP's data. - private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartProperties property, long lastUpdateByLocalTS, string syncID) + private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID) { bool propertyUpdatedByLocal = false; @@ -4578,7 +4585,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //SOP properties /////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: + case SceneObjectPartSyncProperties.AggregateScriptEvents: if (!part.AggregateScriptEvents.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4594,7 +4601,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartSyncProperties.AllowedDrop: if (!part.AllowedDrop.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4609,7 +4616,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AngularVelocity: if (!part.AngularVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4624,7 +4631,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.AttachedAvatar: if (!part.AttachedAvatar.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4639,7 +4646,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartSyncProperties.AttachedPos: if (!part.AttachedPos.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4654,7 +4661,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.AttachmentPoint: if (!part.AttachmentPoint.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4669,7 +4676,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.BaseMask: + case SceneObjectPartSyncProperties.BaseMask: if (!part.BaseMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4684,7 +4691,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Category: + case SceneObjectPartSyncProperties.Category: if (!part.Category.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4699,7 +4706,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.ClickAction: + case SceneObjectPartSyncProperties.ClickAction: if (!part.ClickAction.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4714,7 +4721,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartSyncProperties.CollisionSound: if (!part.CollisionSound.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4729,7 +4736,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CollisionSoundVolume: + case SceneObjectPartSyncProperties.CollisionSoundVolume: if (!part.CollisionSoundVolume.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4744,7 +4751,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Color: + case SceneObjectPartSyncProperties.Color: if (!part.Color.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4759,7 +4766,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CreationDate: + case SceneObjectPartSyncProperties.CreationDate: if (!part.CreationDate.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4774,7 +4781,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CreatorData: + case SceneObjectPartSyncProperties.CreatorData: if (!part.CreatorData.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4789,7 +4796,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CreatorID: + case SceneObjectPartSyncProperties.CreatorID: if (!part.CreatorID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4804,7 +4811,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Description: + case SceneObjectPartSyncProperties.Description: if (!part.Description.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4819,7 +4826,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartSyncProperties.EveryoneMask: if (!part.EveryoneMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4834,7 +4841,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Flags: + case SceneObjectPartSyncProperties.Flags: if (!part.Flags.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4849,7 +4856,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.FolderID: + case SceneObjectPartSyncProperties.FolderID: if (!part.FolderID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4865,7 +4872,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly - case SceneObjectPartProperties.GroupID: + case SceneObjectPartSyncProperties.GroupID: if (!part.GroupID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4880,7 +4887,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.GroupMask: + case SceneObjectPartSyncProperties.GroupMask: if (!part.GroupMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4895,7 +4902,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartSyncProperties.GroupPosition: if (!part.GroupPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4910,7 +4917,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartSyncProperties.InventorySerial: if (!part.InventorySerial.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4925,7 +4932,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartSyncProperties.IsAttachment: if (!part.IsAttachment.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4940,7 +4947,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartSyncProperties.LastOwnerID: if (!part.LastOwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4955,7 +4962,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.LinkNum: + case SceneObjectPartSyncProperties.LinkNum: if (!part.LinkNum.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4970,7 +4977,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Material: + case SceneObjectPartSyncProperties.Material: if (!part.Material.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -4985,7 +4992,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartSyncProperties.MediaUrl: if (!part.MediaUrl.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5000,7 +5007,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Name: + case SceneObjectPartSyncProperties.Name: if (!part.Name.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5015,7 +5022,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.NextOwnerMask: if (!part.NextOwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5030,7 +5037,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.ObjectSaleType: if (!part.ObjectSaleType.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5045,7 +5052,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartSyncProperties.OffsetPosition: if (!part.OffsetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5060,7 +5067,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.OwnerID: + case SceneObjectPartSyncProperties.OwnerID: if (!part.OwnerID.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5075,7 +5082,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.OwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: if (!part.OwnerMask.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5090,7 +5097,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartSyncProperties.OwnershipCost: if (!part.OwnershipCost.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5105,7 +5112,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartSyncProperties.ParticleSystem: if (!ByteArrayEquals(part.ParticleSystem, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5121,7 +5128,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.PassTouches: + case SceneObjectPartSyncProperties.PassTouches: if (!part.PassTouches.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5136,7 +5143,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartSyncProperties.RotationOffset: if (!part.RotationOffset.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5151,7 +5158,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SalePrice: + case SceneObjectPartSyncProperties.SalePrice: if (!part.SalePrice.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5166,7 +5173,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Scale: + case SceneObjectPartSyncProperties.Scale: if (!part.Scale.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5181,7 +5188,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.ScriptAccessPin: + case SceneObjectPartSyncProperties.ScriptAccessPin: if (!part.ScriptAccessPin.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5197,7 +5204,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues - case SceneObjectPartProperties.SitName: + case SceneObjectPartSyncProperties.SitName: if (!part.SitName.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5212,7 +5219,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientation: if (!part.SitTargetOrientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5227,7 +5234,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SitTargetOrientationLL: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: if (!part.SitTargetOrientationLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5242,7 +5249,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPosition: if (!part.SitTargetPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5257,7 +5264,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SitTargetPositionLL: if (!part.SitTargetPositionLL.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5272,7 +5279,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.SOP_Acceleration: if (!part.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5287,7 +5294,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Sound: + case SceneObjectPartSyncProperties.Sound: if (!part.Sound.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5303,7 +5310,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues - case SceneObjectPartProperties.Text: + case SceneObjectPartSyncProperties.Text: if (!part.Text.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5318,7 +5325,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.TextureAnimation: + case SceneObjectPartSyncProperties.TextureAnimation: if (!ByteArrayEquals(part.TextureAnimation, (Byte[])m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5334,7 +5341,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.TouchName: + case SceneObjectPartSyncProperties.TouchName: if (!part.TouchName.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5349,7 +5356,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.UpdateFlag: + case SceneObjectPartSyncProperties.UpdateFlag: if (!part.UpdateFlag.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5364,7 +5371,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Velocity: + case SceneObjectPartSyncProperties.Velocity: if (!part.Velocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5383,7 +5390,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //PhysActor properties /////////////////////// - case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartSyncProperties.Buoyancy: if (!part.PhysActor.Buoyancy.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5398,7 +5405,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Flying: + case SceneObjectPartSyncProperties.Flying: if (!part.PhysActor.Flying.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5413,7 +5420,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Force: + case SceneObjectPartSyncProperties.Force: if (!part.PhysActor.Force.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5428,7 +5435,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.IsColliding: + case SceneObjectPartSyncProperties.IsColliding: if (!part.PhysActor.IsColliding.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5443,7 +5450,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartSyncProperties.CollidingGround: if (!part.PhysActor.CollidingGround.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5458,7 +5465,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartSyncProperties.IsPhysical: if (!part.PhysActor.IsPhysical.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5473,7 +5480,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Kinematic: + case SceneObjectPartSyncProperties.Kinematic: if (!part.PhysActor.Kinematic.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5488,7 +5495,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Orientation: + case SceneObjectPartSyncProperties.Orientation: if (!part.PhysActor.Orientation.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5503,7 +5510,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.PA_Acceleration: if (!part.PhysActor.Acceleration.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5518,7 +5525,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Position: + case SceneObjectPartSyncProperties.Position: if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5533,7 +5540,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.RotationalVelocity: if (!part.PhysActor.RotationalVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5548,7 +5555,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Size: + case SceneObjectPartSyncProperties.Size: if (!part.PhysActor.Size.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5563,7 +5570,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Torque: if (!part.PhysActor.Torque.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5582,7 +5589,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //SOG properties /////////////////////// - case SceneObjectPartProperties.IsSelected: + case SceneObjectPartSyncProperties.IsSelected: if (!part.ParentGroup.IsSelected.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5614,174 +5621,174 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return true; } - private Object GetSOPPropertyValue(SceneObjectPart part, SceneObjectPartProperties property) + private Object GetSOPPropertyValue(SceneObjectPart part, SceneObjectPartSyncProperties property) { if (part == null) return null; Object pValue = null; switch (property) { - case SceneObjectPartProperties.Shape: + case SceneObjectPartSyncProperties.Shape: return (Object)PropertySerializer.SerializeShape(part); - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.TaskInventory: return (Object)PropertySerializer.SerializeTaskInventory(part); /////////////////////// //SOP properties /////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: + case SceneObjectPartSyncProperties.AggregateScriptEvents: return (Object)part.AggregateScriptEvents; - case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartSyncProperties.AllowedDrop: return (Object)part.AllowedDrop; - case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AngularVelocity: return (Object)part.AngularVelocity; - case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.AttachedAvatar: return (Object)part.AttachedAvatar; - case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartSyncProperties.AttachedPos: return (Object)part.AttachedPos; - case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.AttachmentPoint: return (Object)part.AttachmentPoint; - case SceneObjectPartProperties.BaseMask: + case SceneObjectPartSyncProperties.BaseMask: return (Object)part.BaseMask; - case SceneObjectPartProperties.Category: + case SceneObjectPartSyncProperties.Category: return (Object)part.Category; - case SceneObjectPartProperties.ClickAction: + case SceneObjectPartSyncProperties.ClickAction: return (Object)part.ClickAction; - case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartSyncProperties.CollisionSound: return (Object)part.CollisionSound; - case SceneObjectPartProperties.CollisionSoundVolume: + case SceneObjectPartSyncProperties.CollisionSoundVolume: return (Object)part.CollisionSoundVolume; - case SceneObjectPartProperties.Color: + case SceneObjectPartSyncProperties.Color: return (Object)part.Color; - case SceneObjectPartProperties.CreationDate: + case SceneObjectPartSyncProperties.CreationDate: return (Object)part.CreationDate; - case SceneObjectPartProperties.CreatorData: + case SceneObjectPartSyncProperties.CreatorData: return (Object)part.CreatorData; - case SceneObjectPartProperties.CreatorID: + case SceneObjectPartSyncProperties.CreatorID: return (Object)part.CreatorID; - case SceneObjectPartProperties.Description: + case SceneObjectPartSyncProperties.Description: return (Object)part.Description; - case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartSyncProperties.EveryoneMask: return (Object)part.EveryoneMask; - case SceneObjectPartProperties.Flags: + case SceneObjectPartSyncProperties.Flags: return (Object)part.Flags; - case SceneObjectPartProperties.FolderID: + case SceneObjectPartSyncProperties.FolderID: return (Object)part.FolderID; //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly - case SceneObjectPartProperties.GroupID: + case SceneObjectPartSyncProperties.GroupID: return (Object)part.GroupID; - case SceneObjectPartProperties.GroupMask: + case SceneObjectPartSyncProperties.GroupMask: return (Object)part.GroupMask; - case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartSyncProperties.GroupPosition: return (Object)part.GroupPosition; - case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartSyncProperties.InventorySerial: return (Object)part.InventorySerial; - case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartSyncProperties.IsAttachment: return (Object)part.IsAttachment; - case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartSyncProperties.LastOwnerID: return (Object)part.LastOwnerID; - case SceneObjectPartProperties.LinkNum: + case SceneObjectPartSyncProperties.LinkNum: return (Object)part.LinkNum; - case SceneObjectPartProperties.Material: + case SceneObjectPartSyncProperties.Material: return (Object)part.Material; - case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartSyncProperties.MediaUrl: return (Object)part.MediaUrl; - case SceneObjectPartProperties.Name: + case SceneObjectPartSyncProperties.Name: return (Object)part.Name; - case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.NextOwnerMask: return (Object)part.NextOwnerMask; - case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.ObjectSaleType: return (Object)part.ObjectSaleType; - case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartSyncProperties.OffsetPosition: return (Object)part.OffsetPosition; - case SceneObjectPartProperties.OwnerID: + case SceneObjectPartSyncProperties.OwnerID: return (Object)part.OwnerID; - case SceneObjectPartProperties.OwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: return (Object)part.OwnerMask; - case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartSyncProperties.OwnershipCost: return (Object)part.OwnershipCost; - case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartSyncProperties.ParticleSystem: //byte[], return a cloned copy return (Object)part.ParticleSystem.Clone(); - case SceneObjectPartProperties.PassTouches: + case SceneObjectPartSyncProperties.PassTouches: return (Object)part.PassTouches; - case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartSyncProperties.RotationOffset: return (Object)part.RotationOffset; - case SceneObjectPartProperties.SalePrice: + case SceneObjectPartSyncProperties.SalePrice: return (Object)part.SalePrice; - case SceneObjectPartProperties.Scale: + case SceneObjectPartSyncProperties.Scale: return (Object)part.Scale; - case SceneObjectPartProperties.ScriptAccessPin: + case SceneObjectPartSyncProperties.ScriptAccessPin: return (Object)part.ScriptAccessPin; //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues - case SceneObjectPartProperties.SitName: + case SceneObjectPartSyncProperties.SitName: return (Object)part.SitName; - case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientation: return (Object)part.SitTargetOrientation; - case SceneObjectPartProperties.SitTargetOrientationLL: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: return (Object)part.SitTargetOrientationLL; - case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPosition: return (Object)part.SitTargetPosition; - case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SitTargetPositionLL: return (Object)part.SitTargetPositionLL; - case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.SOP_Acceleration: return (Object)part.Acceleration; - case SceneObjectPartProperties.Sound: + case SceneObjectPartSyncProperties.Sound: return (Object)part.Sound; //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues - case SceneObjectPartProperties.Text: + case SceneObjectPartSyncProperties.Text: return (Object)part.Text; - case SceneObjectPartProperties.TextureAnimation: + case SceneObjectPartSyncProperties.TextureAnimation: //byte[], return a cloned copy return part.TextureAnimation.Clone(); - case SceneObjectPartProperties.TouchName: + case SceneObjectPartSyncProperties.TouchName: return (Object)part.TouchName; - case SceneObjectPartProperties.UpdateFlag: + case SceneObjectPartSyncProperties.UpdateFlag: return (Object)part.UpdateFlag; - case SceneObjectPartProperties.Velocity: + case SceneObjectPartSyncProperties.Velocity: return (Object)part.Velocity; /////////////////////// //PhysActor properties /////////////////////// - case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartSyncProperties.Buoyancy: return (Object)part.PhysActor.Buoyancy; - case SceneObjectPartProperties.Flying: + case SceneObjectPartSyncProperties.Flying: return (Object)part.PhysActor.Flying; - case SceneObjectPartProperties.Force: + case SceneObjectPartSyncProperties.Force: return (Object)part.PhysActor.Force; - case SceneObjectPartProperties.IsColliding: + case SceneObjectPartSyncProperties.IsColliding: return (Object)part.PhysActor.IsColliding; - case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartSyncProperties.CollidingGround: return (Object)part.PhysActor.CollidingGround; - case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartSyncProperties.IsPhysical: return (Object)part.PhysActor.IsPhysical; - case SceneObjectPartProperties.Kinematic: + case SceneObjectPartSyncProperties.Kinematic: return (Object)part.PhysActor.Kinematic; - case SceneObjectPartProperties.Orientation: + case SceneObjectPartSyncProperties.Orientation: return (Object)part.PhysActor.Orientation; - case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.PA_Acceleration: return (Object)part.PhysActor.Acceleration; - case SceneObjectPartProperties.Position: + case SceneObjectPartSyncProperties.Position: return (Object)part.PhysActor.Position; - case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.RotationalVelocity: return (Object)part.PhysActor.RotationalVelocity; - case SceneObjectPartProperties.Size: + case SceneObjectPartSyncProperties.Size: return (Object)part.PhysActor.Size; - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Torque: return (Object)part.PhysActor.Torque; /////////////////////// //SOG properties /////////////////////// - case SceneObjectPartProperties.IsSelected: + case SceneObjectPartSyncProperties.IsSelected: return (Object)part.ParentGroup.IsSelected; } return pValue; } - private void SetSOPPropertyValue(SceneObjectPart part, SceneObjectPartProperties property) + private void SetSOPPropertyValue(SceneObjectPart part, SceneObjectPartSyncProperties property) { if (part == null) return; if (!m_propertiesSyncInfo.ContainsKey(property)){ @@ -5792,12 +5799,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule switch (property) { - case SceneObjectPartProperties.Shape: + case SceneObjectPartSyncProperties.Shape: PrimitiveBaseShape shapeVal = PropertySerializer.DeSerializeShape((string)pSyncInfo.LastUpdateValue); if (shapeVal != null) part.Shape = shapeVal; break; - case SceneObjectPartProperties.TaskInventory: + case SceneObjectPartSyncProperties.TaskInventory: TaskInventoryDictionary taskVal = PropertySerializer.DeSerializeTaskInventory((string)pSyncInfo.LastUpdateValue); if (taskVal != null) part.TaskInventory = taskVal; @@ -5806,225 +5813,225 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //SOP properties /////////////////////// - case SceneObjectPartProperties.AggregateScriptEvents: + case SceneObjectPartSyncProperties.AggregateScriptEvents: part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.AllowedDrop: + case SceneObjectPartSyncProperties.AllowedDrop: part.AllowedDrop = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AngularVelocity: part.AngularVelocity = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.AttachedAvatar: part.AttachedAvatar = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.AttachedPos: + case SceneObjectPartSyncProperties.AttachedPos: part.AttachedPos = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.AttachmentPoint: part.AttachmentPoint = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.BaseMask: + case SceneObjectPartSyncProperties.BaseMask: part.BaseMask = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Category: + case SceneObjectPartSyncProperties.Category: part.Category = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.ClickAction: + case SceneObjectPartSyncProperties.ClickAction: part.ClickAction = (byte)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CollisionSound: + case SceneObjectPartSyncProperties.CollisionSound: part.CollisionSound = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CollisionSoundVolume: + case SceneObjectPartSyncProperties.CollisionSoundVolume: part.CollisionSoundVolume = (float)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Color: + case SceneObjectPartSyncProperties.Color: part.Color = (System.Drawing.Color)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CreationDate: + case SceneObjectPartSyncProperties.CreationDate: part.CreationDate = (int)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CreatorData: + case SceneObjectPartSyncProperties.CreatorData: part.CreatorData = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CreatorID: + case SceneObjectPartSyncProperties.CreatorID: part.CreatorID = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Description: + case SceneObjectPartSyncProperties.Description: part.Description = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.EveryoneMask: + case SceneObjectPartSyncProperties.EveryoneMask: part.EveryoneMask = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Flags: + case SceneObjectPartSyncProperties.Flags: part.Flags = (PrimFlags)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.FolderID: + case SceneObjectPartSyncProperties.FolderID: part.FolderID = (UUID)pSyncInfo.LastUpdateValue; break; //Skip SceneObjectPartProperties.FullUpdate, which should be handled seperatedly - case SceneObjectPartProperties.GroupID: + case SceneObjectPartSyncProperties.GroupID: part.GroupID = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.GroupMask: + case SceneObjectPartSyncProperties.GroupMask: part.GroupMask = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.GroupPosition: + case SceneObjectPartSyncProperties.GroupPosition: part.GroupPosition = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.InventorySerial: + case SceneObjectPartSyncProperties.InventorySerial: part.InventorySerial = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.IsAttachment: + case SceneObjectPartSyncProperties.IsAttachment: part.IsAttachment = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.LastOwnerID: + case SceneObjectPartSyncProperties.LastOwnerID: part.LastOwnerID = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.LinkNum: + case SceneObjectPartSyncProperties.LinkNum: part.LinkNum = (int)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Material: + case SceneObjectPartSyncProperties.Material: part.Material = (byte)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.MediaUrl: + case SceneObjectPartSyncProperties.MediaUrl: part.MediaUrl = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Name: + case SceneObjectPartSyncProperties.Name: part.Name = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.NextOwnerMask: part.NextOwnerMask = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.ObjectSaleType: part.ObjectSaleType = (byte)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.OffsetPosition: + case SceneObjectPartSyncProperties.OffsetPosition: part.OffsetPosition = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.OwnerID: + case SceneObjectPartSyncProperties.OwnerID: part.OwnerID = (UUID)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.OwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: part.OwnerMask = (uint)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.OwnershipCost: + case SceneObjectPartSyncProperties.OwnershipCost: part.OwnershipCost = (int)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.ParticleSystem: + case SceneObjectPartSyncProperties.ParticleSystem: //byte[], return a cloned copy byte[] pValue = (byte[])pSyncInfo.LastUpdateValue; part.ParticleSystem = (byte[])pValue.Clone(); break; - case SceneObjectPartProperties.PassTouches: + case SceneObjectPartSyncProperties.PassTouches: part.PassTouches = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.RotationOffset: + case SceneObjectPartSyncProperties.RotationOffset: part.RotationOffset = (Quaternion)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SalePrice: + case SceneObjectPartSyncProperties.SalePrice: part.SalePrice = (int)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Scale: + case SceneObjectPartSyncProperties.Scale: part.Scale = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.ScriptAccessPin: + case SceneObjectPartSyncProperties.ScriptAccessPin: part.ScriptAccessPin = (int)pSyncInfo.LastUpdateValue; break; //case SceneObjectPartProperties.Shape: -- For "Shape", we need to call CompareHashValues - case SceneObjectPartProperties.SitName: + case SceneObjectPartSyncProperties.SitName: part.SitName = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientation: part.SitTargetOrientation = (Quaternion)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SitTargetOrientationLL: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: part.SitTargetOrientationLL = (Quaternion)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPosition: part.SitTargetPosition = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SitTargetPositionLL: part.SitTargetPositionLL = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.SOP_Acceleration: part.Acceleration = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Sound: + case SceneObjectPartSyncProperties.Sound: part.Sound = (UUID)pSyncInfo.LastUpdateValue; break; //case SceneObjectPartProperties.TaskInventory:-- For "TaskInventory", we need to call CompareHashValues - case SceneObjectPartProperties.Text: + case SceneObjectPartSyncProperties.Text: part.Text = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.TextureAnimation: + case SceneObjectPartSyncProperties.TextureAnimation: //byte[], return a cloned copy byte[] tValue = (byte[])pSyncInfo.LastUpdateValue; part.TextureAnimation = (byte[])tValue.Clone(); break; - case SceneObjectPartProperties.TouchName: + case SceneObjectPartSyncProperties.TouchName: part.TouchName = (string)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.UpdateFlag: + case SceneObjectPartSyncProperties.UpdateFlag: part.UpdateFlag = (byte)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Velocity: + case SceneObjectPartSyncProperties.Velocity: part.Velocity = (Vector3)pSyncInfo.LastUpdateValue; break; /////////////////////// //PhysActor properties /////////////////////// - case SceneObjectPartProperties.Buoyancy: + case SceneObjectPartSyncProperties.Buoyancy: if (part.PhysActor != null) part.PhysActor.Buoyancy = (float)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Flying: + case SceneObjectPartSyncProperties.Flying: if (part.PhysActor != null) part.PhysActor.Flying = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Force: + case SceneObjectPartSyncProperties.Force: if (part.PhysActor != null) part.PhysActor.Force = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.IsColliding: + case SceneObjectPartSyncProperties.IsColliding: if (part.PhysActor != null) part.PhysActor.IsColliding = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.CollidingGround: + case SceneObjectPartSyncProperties.CollidingGround: if (part.PhysActor != null) part.PhysActor.CollidingGround = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.IsPhysical: + case SceneObjectPartSyncProperties.IsPhysical: if (part.PhysActor != null) part.PhysActor.IsPhysical = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Kinematic: + case SceneObjectPartSyncProperties.Kinematic: if (part.PhysActor != null) part.PhysActor.Kinematic = (bool)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Orientation: + case SceneObjectPartSyncProperties.Orientation: if (part.PhysActor != null) part.PhysActor.Orientation = (Quaternion)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.PA_Acceleration: if (part.PhysActor != null) part.PhysActor.Acceleration = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Position: + case SceneObjectPartSyncProperties.Position: if (part.PhysActor != null) part.PhysActor.Position = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.RotationalVelocity: if (part.PhysActor != null) part.PhysActor.RotationalVelocity = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Size: + case SceneObjectPartSyncProperties.Size: if (part.PhysActor != null) part.PhysActor.Size = (Vector3)pSyncInfo.LastUpdateValue; break; - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Torque: if (part.PhysActor != null) part.PhysActor.Torque = (Vector3)pSyncInfo.LastUpdateValue; break; @@ -6032,7 +6039,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// //SOG properties /////////////////////// - case SceneObjectPartProperties.IsSelected: + case SceneObjectPartSyncProperties.IsSelected: if (part.ParentGroup != null) part.ParentGroup.IsSelected = (bool)pSyncInfo.LastUpdateValue; break; @@ -6093,7 +6100,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// The list properties among updatedProperties whose value /// have been copied over to PrimSyncInfo. - public HashSet UpdatePrimSyncInfoByLocal(SceneObjectPart part, List updatedProperties) + public HashSet UpdatePrimSyncInfoByLocal(SceneObjectPart part, List updatedProperties) { long currentTime = DateTime.Now.Ticks; if (m_primsInSync.ContainsKey(part.UUID)) @@ -6109,11 +6116,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule PrimSyncInfo primSyncInfo = new PrimSyncInfo(part, currentTime, m_regionSyncModule.SyncID); InsertPrimSyncInfo(part.UUID, primSyncInfo); - return new HashSet(updatedProperties); + return new HashSet(updatedProperties); } } - public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) + public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) { OSDMap data = new OSDMap(); if (!m_primsInSync.ContainsKey(primUUID)) @@ -6129,8 +6136,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //If SceneObjectPartProperties.FullUpdate is in updatedProperties, //convert it to the full list of all properties - HashSet propertiesToEncoded = updatedProperties; - if (updatedProperties.Contains(SceneObjectPartProperties.FullUpdate)) + HashSet propertiesToEncoded = updatedProperties; + if (updatedProperties.Contains(SceneObjectPartSyncProperties.FullUpdate)) { propertiesToEncoded = SceneObjectPart.GetAllPrimProperties(); } @@ -6155,7 +6162,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UUID primUUID = primData["primUUID"]; OSDMap propertyData = (OSDMap)primData["propertyData"]; - PrimSyncInfo primSynInfo = new PrimSyncInfo(propertyData); + PrimSyncInfo primSynInfo = new PrimSyncInfo(primUUID, propertyData); return primSynInfo; //InsertPrimSyncInfo(primUUID, ); diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 5eda422b16..fe82487295 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap SetPartMediaFlags(part, face, me != null); //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.MediaUrl, SceneObjectPartProperties.Shape}); + part.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.MediaUrl, SceneObjectPartSyncProperties.Shape}); part.TriggerScriptChangedEvent(Changed.MEDIA); } @@ -459,7 +459,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap // Arguably, we could avoid sending a full update to the avatar that just changed the texture. //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Shape, SceneObjectPartProperties.MediaUrl}); + part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Shape, SceneObjectPartSyncProperties.MediaUrl}); part.TriggerScriptChangedEvent(Changed.MEDIA); @@ -538,7 +538,7 @@ namespace OpenSim.Region.CoreModules.World.Media.Moap UpdateMediaUrl(part, agentId); //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.MediaUrl}); + part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.MediaUrl}); part.TriggerScriptChangedEvent(Changed.MEDIA); diff --git a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs index 253dbd7649..d389a475ee 100644 --- a/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/BuySell/BuySellModule.cs @@ -149,7 +149,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell part.TriggerScriptChangedEvent(Changed.OWNER); group.ResumeScripts(); //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.FullUpdate }); //quite some properties changed, let's just force all to be synchronized + part.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.FullUpdate }); //quite some properties changed, let's just force all to be synchronized break; diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 59bca17bf7..8154e854fb 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -60,7 +60,7 @@ namespace OpenSim.Region.Framework.Interfaces /// /// The mapping of a property (identified by its name) to the index of a bucket. /// - Dictionary PrimPropertyBucketMap { get; } + Dictionary PrimPropertyBucketMap { get; } /// /// The text description of the properties in each bucket, e.g. "General", "Physics" /// @@ -71,7 +71,7 @@ namespace OpenSim.Region.Framework.Interfaces //void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueScenePresenceForTerseUpdate(ScenePresence presence); - void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); + void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); void SyncOutPrimUpdates(); //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 501aa42a02..ec8c49410a 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2211,7 +2211,7 @@ namespace OpenSim.Region.Framework.Scenes group.CreateScriptInstances(param, true, DefaultScriptEngine, 3); //group.ScheduleGroupForFullUpdate(); - group.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //new object, all properties have new value + group.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //new object, all properties have new value return group; } @@ -2277,7 +2277,7 @@ namespace OpenSim.Region.Framework.Scenes sog.SetOwnerId(ownerID); sog.SetGroup(groupID, remoteClient); //sog.ScheduleGroupForFullUpdate(); - sog.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.OwnerID, SceneObjectPartProperties.GroupID}); + sog.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.OwnerID, SceneObjectPartSyncProperties.GroupID}); SceneObjectPart[] partList = sog.Parts; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 22636b1b1d..60eae3306e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -213,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes isAttachment = true; else //part.ParentGroup.ScheduleGroupForFullUpdate(); - part.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.IsSelected}); + part.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.IsSelected}); // If it's not an attachment, and we are allowed to move it, // then we might have done so. If we moved across a parcel diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index df3732c198..70e60c489f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2416,7 +2416,7 @@ namespace OpenSim.Region.Framework.Scenes } //sceneObject.ScheduleGroupForFullUpdate(); - sceneObject.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //new object, all properties have new value + sceneObject.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //new object, all properties have new value return sceneObject; } @@ -4536,7 +4536,7 @@ namespace OpenSim.Region.Framework.Scenes if (ent is SceneObjectGroup) { //((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); - ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.None}); //This is not due to property being updated, hence passing "None" property. + ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //This is not due to property being updated, hence passing "None" property. } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 2ba40dc688..6d36cec97a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -437,7 +437,7 @@ namespace OpenSim.Region.Framework.Scenes if (sendClientUpdates) //sceneObject.ScheduleGroupForFullUpdate(); - sceneObject.ScheduleGroupForFullUpdate(new List() { SceneObjectPartProperties.None }); + sceneObject.ScheduleGroupForFullUpdate(new List() { SceneObjectPartSyncProperties.None }); return true; } @@ -1954,7 +1954,7 @@ namespace OpenSim.Region.Framework.Scenes copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); copy.HasGroupChanged = true; //copy.ScheduleGroupForFullUpdate(); - copy.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //new object, all property values are new + copy.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //new object, all property values are new copy.ResumeScripts(); // required for physics to update it's position diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index d94c2b9b0a..ec522182b9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1017,7 +1017,7 @@ namespace OpenSim.Region.Framework.Scenes AttachToBackup(); m_scene.EventManager.TriggerParcelPrimCountTainted(); //m_rootPart.ScheduleFullUpdate(); - m_rootPart.ScheduleFullUpdate(new List() { SceneObjectPartProperties.GroupPosition, SceneObjectPartProperties.AttachmentPoint}); //Physics properties, such as Position, OffsetPosition, etc, should be tainted in ApplyPhysics() + m_rootPart.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.GroupPosition, SceneObjectPartSyncProperties.AttachmentPoint}); //Physics properties, such as Position, OffsetPosition, etc, should be tainted in ApplyPhysics() m_rootPart.ClearUndoState(); } @@ -1291,7 +1291,7 @@ namespace OpenSim.Region.Framework.Scenes } //ScheduleGroupForFullUpdate(); - ScheduleGroupForFullUpdate(new List(){ SceneObjectPartProperties.Flags}); //do we also need to synchronize SOG properties such as m_scriptListens_atRotTarget? (does any acotr other than script engine care about it?) + ScheduleGroupForFullUpdate(new List(){ SceneObjectPartSyncProperties.Flags}); //do we also need to synchronize SOG properties such as m_scriptListens_atRotTarget? (does any acotr other than script engine care about it?) } public void SetText(string text, Vector3 color, double alpha) @@ -1304,7 +1304,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; //m_rootPart.ScheduleFullUpdate(); - m_rootPart.ScheduleFullUpdate(new List() {SceneObjectPartProperties.Text, SceneObjectPartProperties.Color}); + m_rootPart.ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.Text, SceneObjectPartSyncProperties.Color}); } /// @@ -1547,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes dupe.AttachToBackup(); //ScheduleGroupForFullUpdate(); - ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); + ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); } return dupe; @@ -1801,7 +1801,7 @@ namespace OpenSim.Region.Framework.Scenes } //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List() {SceneObjectPartProperties.OwnerID, SceneObjectPartProperties.GroupID, SceneObjectPartProperties.LastOwnerID}); + part.ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.OwnerID, SceneObjectPartSyncProperties.GroupID, SceneObjectPartSyncProperties.LastOwnerID}); } /// @@ -1927,7 +1927,7 @@ namespace OpenSim.Region.Framework.Scenes /// Schedule a full update for this scene object /// //public void ScheduleGroupForFullUpdate() - public void ScheduleGroupForFullUpdate(List updatedProperties) + public void ScheduleGroupForFullUpdate(List updatedProperties) { // if (IsAttachment) // m_log.DebugFormat("[SOG]: Scheduling full update for {0} {1}", Name, LocalId); @@ -1950,7 +1950,7 @@ namespace OpenSim.Region.Framework.Scenes /// Schedule a terse update for this scene object /// //public void ScheduleGroupForTerseUpdate() - public void ScheduleGroupForTerseUpdate(List updatedProperties) + public void ScheduleGroupForTerseUpdate(List updatedProperties) { // m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID); @@ -2716,7 +2716,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; part.TriggerScriptChangedEvent(Changed.SCALE); //ScheduleGroupForFullUpdate(); - ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.None}); //above actions only update Scale for the given part, and part.Resize() will taint Scale as updated + ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //above actions only update Scale for the given part, and part.Resize() will taint Scale as updated //if (part.UUID == m_rootPart.UUID) //{ @@ -2869,7 +2869,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; m_rootPart.TriggerScriptChangedEvent(Changed.SCALE); //ScheduleGroupForTerseUpdate(); - ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.Scale}); + ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.Scale}); } } @@ -2911,10 +2911,10 @@ namespace OpenSim.Region.Framework.Scenes //we need to do a terse update even if the move wasn't allowed // so that the position is reset in the client (the object snaps back) //ScheduleGroupForTerseUpdate(); - List updatedProperties = new List() { SceneObjectPartProperties.GroupPosition }; + List updatedProperties = new List() { SceneObjectPartSyncProperties.GroupPosition }; if (IsAttachment) { - updatedProperties.Add(SceneObjectPartProperties.AttachedPos); + updatedProperties.Add(SceneObjectPartSyncProperties.AttachedPos); } ScheduleGroupForTerseUpdate(updatedProperties); } @@ -2980,7 +2980,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; //ScheduleGroupForTerseUpdate(); - ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.Position, SceneObjectPartProperties.OffsetPosition}); + ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.Position, SceneObjectPartSyncProperties.OffsetPosition}); } public void OffsetForNewRegion(Vector3 offset) @@ -3013,7 +3013,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; //ScheduleGroupForTerseUpdate(); - ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.Orientation}); //Above actions only update m_rootPart's RotationOffset, and m_rootPart.UpdateRotation will taint RotationOffset as updated + ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.Orientation}); //Above actions only update m_rootPart's RotationOffset, and m_rootPart.UpdateRotation will taint RotationOffset as updated } /// @@ -3040,7 +3040,7 @@ namespace OpenSim.Region.Framework.Scenes HasGroupChanged = true; //ScheduleGroupForTerseUpdate(); - ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.Position, SceneObjectPartProperties.Orientation}); //RotationOffset is only updated for m_rootPart, and m_rootPart.UpdateRotation should already taint RotationOffset as updated + ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.Position, SceneObjectPartSyncProperties.Orientation}); //RotationOffset is only updated for m_rootPart, and m_rootPart.UpdateRotation should already taint RotationOffset as updated } /// @@ -3128,7 +3128,7 @@ namespace OpenSim.Region.Framework.Scenes newRot *= Quaternion.Inverse(axRot); prim.RotationOffset = newRot; //prim.ScheduleTerseUpdate(); - prim.ScheduleTerseUpdate(new List(){ SceneObjectPartProperties.RotationOffset, SceneObjectPartProperties.OffsetPosition}); + prim.ScheduleTerseUpdate(new List(){ SceneObjectPartSyncProperties.RotationOffset, SceneObjectPartSyncProperties.OffsetPosition}); } } @@ -3143,7 +3143,7 @@ namespace OpenSim.Region.Framework.Scenes } //m_rootPart.ScheduleTerseUpdate(); - m_rootPart.ScheduleTerseUpdate(new List(){SceneObjectPartProperties.RotationOffset}); + m_rootPart.ScheduleTerseUpdate(new List(){SceneObjectPartSyncProperties.RotationOffset}); } #endregion diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ac8a5ce502..5781d291c8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -2800,7 +2800,7 @@ namespace OpenSim.Region.Framework.Scenes //m_parentGroup.RootPart.m_groupPosition = newpos; } //ScheduleTerseUpdate(); - ScheduleTerseUpdate(new List(){SceneObjectPartProperties.Position}); + ScheduleTerseUpdate(new List(){SceneObjectPartSyncProperties.Position}); //SendTerseUpdateToAllClients(); } @@ -2891,7 +2891,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; //ScheduleFullUpdate(); - ScheduleFullUpdate(new List(){SceneObjectPartProperties.Scale}); + ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Scale}); } public void RotLookAt(Quaternion target, float strength, float damping) @@ -2934,7 +2934,7 @@ namespace OpenSim.Region.Framework.Scenes /// Schedules this prim for a full update /// //public void ScheduleFullUpdate() :: SYMMETRIC SYNC: changed the interface so that we can identify which property triggers calling this function - public virtual void ScheduleFullUpdate(List updatedProperties) + public virtual void ScheduleFullUpdate(List updatedProperties) { // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); @@ -2969,7 +2969,7 @@ namespace OpenSim.Region.Framework.Scenes /// rotation, velocity, rotational velocity and shape information. /// //public void ScheduleTerseUpdate() - public virtual void ScheduleTerseUpdate(List updatedProperties) + public virtual void ScheduleTerseUpdate(List updatedProperties) { if (m_updateFlag < 1) { @@ -3675,7 +3675,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; //ScheduleFullUpdate(); - ScheduleFullUpdate(new List(){SceneObjectPartProperties.Text}); + ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Text}); } public void StopLookAt() @@ -3683,7 +3683,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.stopLookAt(); //m_parentGroup.ScheduleGroupForTerseUpdate(); - m_parentGroup.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.None});//in stopLookAt(), PhysicsActor shall already take care of tainting which properties have been updated + m_parentGroup.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.None});//in stopLookAt(), PhysicsActor shall already take care of tainting which properties have been updated } /// @@ -3706,7 +3706,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.stopMoveToTarget(); //m_parentGroup.ScheduleGroupForTerseUpdate(); - m_parentGroup.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.None}); //in stopMoveToTarget(), PhysicsActor shall already take care of tainting which properties have been updated + m_parentGroup.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.None}); //in stopMoveToTarget(), PhysicsActor shall already take care of tainting which properties have been updated //m_parentGroup.ScheduleGroupForFullUpdate(); } @@ -4255,7 +4255,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; //ScheduleFullUpdate(); - ScheduleFullUpdate(new List(){SceneObjectPartProperties.Shape}); + ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Shape}); } public void UpdateGroupPosition(Vector3 pos) @@ -4267,7 +4267,7 @@ namespace OpenSim.Region.Framework.Scenes Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z); GroupPosition = newPos; //ScheduleTerseUpdate(); - ScheduleFullUpdate(new List(){SceneObjectPartProperties.GroupPosition}); + ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.GroupPosition}); } } @@ -4300,7 +4300,7 @@ namespace OpenSim.Region.Framework.Scenes OffsetPosition = newPos; //ScheduleTerseUpdate(); - ScheduleFullUpdate(new List(){SceneObjectPartProperties.OffsetPosition}); + ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.OffsetPosition}); } } @@ -4590,7 +4590,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() { SceneObjectPartProperties.Flags}); + ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Flags}); } public void UpdateRotation(Quaternion rot) @@ -4603,7 +4603,7 @@ namespace OpenSim.Region.Framework.Scenes RotationOffset = rot; ParentGroup.HasGroupChanged = true; //ScheduleTerseUpdate(); - ScheduleFullUpdate(new List() {SceneObjectPartProperties.RotationOffset}); + ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.RotationOffset}); } } @@ -4649,7 +4649,7 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; TriggerScriptChangedEvent(Changed.SHAPE); //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() {SceneObjectPartProperties.Shape}); + ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.Shape}); } /// @@ -4697,7 +4697,7 @@ namespace OpenSim.Region.Framework.Scenes //ParentGroup.ScheduleGroupForFullUpdate(); //This is sparta //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() {SceneObjectPartProperties.Shape}); + ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.Shape}); } public void aggregateScriptEvents() @@ -4766,7 +4766,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents() since m_parentGroup == null", Name, LocalId); //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() { SceneObjectPartProperties.Flags, SceneObjectPartProperties.AggregateScriptEvents}); + ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.AggregateScriptEvents}); return; } @@ -4790,7 +4790,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() { SceneObjectPartProperties.Flags, SceneObjectPartProperties.AggregateScriptEvents}); + ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.AggregateScriptEvents}); } } @@ -5155,7 +5155,7 @@ namespace OpenSim.Region.Framework.Scenes } */ - public enum SceneObjectPartProperties + public enum SceneObjectPartSyncProperties { None, //Following properties copied from SceneObjectSerializer(), @@ -5165,7 +5165,7 @@ namespace OpenSim.Region.Framework.Scenes FolderID , InventorySerial, TaskInventory, - //UUID", + //UUID", //UUID not supposed to be changed after SOP is created, not included in SyncProperties //LocalId", Name, Material, @@ -5271,7 +5271,7 @@ namespace OpenSim.Region.Framework.Scenes //TODO: serialization and deserialization processors to be added in SceneObjectSerializer //The following variables are initialized when RegionSyncModule reads the config file for mapping of properties and buckets - private static Dictionary m_primPropertyBucketMap = null; + private static Dictionary m_primPropertyBucketMap = null; private static List m_propertyBucketNames = null; private static string m_localActorID = ""; @@ -5369,15 +5369,15 @@ namespace OpenSim.Region.Framework.Scenes /// Excluding None, FullUpdate. /// /// - public static HashSet GetAllPrimProperties() + public static HashSet GetAllPrimProperties() { - HashSet allProperties = new HashSet(); - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartSyncProperties property in Enum.GetValues(typeof(SceneObjectPartSyncProperties))) { switch (property) { - case SceneObjectPartProperties.None: - case SceneObjectPartProperties.FullUpdate: + case SceneObjectPartSyncProperties.None: + case SceneObjectPartSyncProperties.FullUpdate: break; default: allProperties.Add(property); @@ -5387,30 +5387,30 @@ namespace OpenSim.Region.Framework.Scenes return allProperties; } - public static HashSet GetAllPrimNonPhysActorProperties() + public static HashSet GetAllPrimNonPhysActorProperties() { - HashSet allProperties = new HashSet(); - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartSyncProperties property in Enum.GetValues(typeof(SceneObjectPartSyncProperties))) { switch (property) { //Enum value that is not real properties - case SceneObjectPartProperties.None: - case SceneObjectPartProperties.FullUpdate: + case SceneObjectPartSyncProperties.None: + case SceneObjectPartSyncProperties.FullUpdate: //PhysActor properties - case SceneObjectPartProperties.Buoyancy: - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: - case SceneObjectPartProperties.Orientation: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Buoyancy: + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.IsColliding: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Kinematic: + case SceneObjectPartSyncProperties.Orientation: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Torque: break; default: allProperties.Add(property); @@ -5420,27 +5420,27 @@ namespace OpenSim.Region.Framework.Scenes return allProperties; } - public static HashSet GetAllPhysActorProperties() + public static HashSet GetAllPhysActorProperties() { - HashSet allProperties = new HashSet(); - foreach (SceneObjectPartProperties property in Enum.GetValues(typeof(SceneObjectPartProperties))) + HashSet allProperties = new HashSet(); + foreach (SceneObjectPartSyncProperties property in Enum.GetValues(typeof(SceneObjectPartSyncProperties))) { switch (property) { //PhysActor properties - case SceneObjectPartProperties.Buoyancy: - case SceneObjectPartProperties.Flying: - case SceneObjectPartProperties.Force: - case SceneObjectPartProperties.IsColliding: - case SceneObjectPartProperties.CollidingGround: - case SceneObjectPartProperties.IsPhysical: - case SceneObjectPartProperties.Kinematic: - case SceneObjectPartProperties.Orientation: - case SceneObjectPartProperties.PA_Acceleration: - case SceneObjectPartProperties.Position: - case SceneObjectPartProperties.RotationalVelocity: - case SceneObjectPartProperties.Size: - case SceneObjectPartProperties.Torque: + case SceneObjectPartSyncProperties.Buoyancy: + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.IsColliding: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Kinematic: + case SceneObjectPartSyncProperties.Orientation: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Torque: allProperties.Add(property); break; default: @@ -5450,13 +5450,13 @@ namespace OpenSim.Region.Framework.Scenes return allProperties; } - public static HashSet GetGroupProperties() + public static HashSet GetGroupProperties() { - HashSet allProperties = new HashSet(){SceneObjectPartProperties.IsSelected}; + HashSet allProperties = new HashSet(){SceneObjectPartSyncProperties.IsSelected}; return allProperties; } - public static void InitializePropertyBucketInfo(Dictionary propertyBucketMap, List bucketNames, string actorID) + public static void InitializePropertyBucketInfo(Dictionary propertyBucketMap, List bucketNames, string actorID) { m_primPropertyBucketMap = propertyBucketMap; m_propertyBucketNames = bucketNames; @@ -5801,14 +5801,14 @@ namespace OpenSim.Region.Framework.Scenes } //For tainitng and clearing taints, do i need to lock on m_bucketSyncTaint? - public void TaintBucketSyncInfo(SceneObjectPartProperties property) + public void TaintBucketSyncInfo(SceneObjectPartSyncProperties property) { if (m_syncEnabled) { - if (property == SceneObjectPartProperties.None) + if (property == SceneObjectPartSyncProperties.None) return; - if (property == SceneObjectPartProperties.FullUpdate) + if (property == SceneObjectPartSyncProperties.FullUpdate) { foreach (BucketSyncInfo bucketSynInfo in m_bucketSyncInfoList.Values) { @@ -5896,7 +5896,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 - public void UpdateBucketSyncInfo(SceneObjectPartProperties property) + public void UpdateBucketSyncInfo(SceneObjectPartSyncProperties property) { if (m_syncEnabled && m_bucketSyncInfoList != null && m_bucketSyncInfoList.Count > 0) { @@ -6066,7 +6066,7 @@ namespace OpenSim.Region.Framework.Scenes //Implementation of ScheduleFullUpdate and ScheduleTerseUpdate for Bucket //based synchronization - public override void ScheduleFullUpdate(List updatedProperties) + public override void ScheduleFullUpdate(List updatedProperties) { if (updatedProperties != null && updatedProperties.Count > 0) { @@ -6079,7 +6079,7 @@ namespace OpenSim.Region.Framework.Scenes base.ScheduleTerseUpdate(updatedProperties); } - public override void ScheduleTerseUpdate(List updatedProperties) + public override void ScheduleTerseUpdate(List updatedProperties) { if (updatedProperties != null && updatedProperties.Count > 0) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 9dfa7882a8..ce093d6f08 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -294,7 +294,7 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource); m_part.ParentGroup.AddActiveScriptCount(1); - m_part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Flags, SceneObjectPartProperties.TaskInventory}); + m_part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.TaskInventory}); return; } @@ -322,7 +322,7 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.Scene.EventManager.TriggerRezScript( m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); m_part.ParentGroup.AddActiveScriptCount(1); - m_part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Flags, SceneObjectPartProperties.TaskInventory}); + m_part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.TaskInventory}); } } } @@ -546,7 +546,7 @@ namespace OpenSim.Region.Framework.Scenes m_part.ParentGroup.HasGroupChanged = true; //SYMMETRIC SYNC: add ScheduleFullUpdate to enable synchronization across actors - m_part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.TaskInventory, SceneObjectPartProperties.InventorySerial}); + m_part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.TaskInventory, SceneObjectPartSyncProperties.InventorySerial}); } /// @@ -766,7 +766,7 @@ namespace OpenSim.Region.Framework.Scenes if (!ContainsScripts()) m_part.RemFlag(PrimFlags.Scripted); - m_part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.TaskInventory}); + m_part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.TaskInventory}); return type; diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index 3a55ac3285..e4fc6f08a9 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -95,12 +95,12 @@ namespace OpenSim.Region.Framework.Scenes part.Resize(Scale); //part.ParentGroup.ScheduleGroupForTerseUpdate(); //SYMMETRIC SYNC - List updatedProperties = new List(); - updatedProperties.Add(SceneObjectPartProperties.RotationOffset); + List updatedProperties = new List(); + updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Position); + updatedProperties.Add(SceneObjectPartSyncProperties.Position); if (Scale != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Scale); + updatedProperties.Add(SceneObjectPartSyncProperties.Scale); part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties); } else @@ -111,12 +111,12 @@ namespace OpenSim.Region.Framework.Scenes if (Scale != Vector3.Zero) part.Resize(Scale); //part.ScheduleTerseUpdate(); //SYMMETRIC SYNC - List updatedProperties = new List(); - updatedProperties.Add(SceneObjectPartProperties.RotationOffset); + List updatedProperties = new List(); + updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.OffsetPosition); + updatedProperties.Add(SceneObjectPartSyncProperties.OffsetPosition); if (Scale != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Scale); + updatedProperties.Add(SceneObjectPartSyncProperties.Scale); part.ScheduleTerseUpdate(updatedProperties); } part.Undoing = false; @@ -139,13 +139,13 @@ namespace OpenSim.Region.Framework.Scenes part.Resize(Scale); //part.ParentGroup.ScheduleGroupForTerseUpdate(); //SYMMETRIC SYNC - List updatedProperties = new List(); + List updatedProperties = new List(); if (Rotation != Quaternion.Identity) - updatedProperties.Add(SceneObjectPartProperties.RotationOffset); + updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Position); + updatedProperties.Add(SceneObjectPartSyncProperties.Position); if (Scale != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Scale); + updatedProperties.Add(SceneObjectPartSyncProperties.Scale); part.ParentGroup.ScheduleGroupForTerseUpdate(updatedProperties); } else @@ -158,13 +158,13 @@ namespace OpenSim.Region.Framework.Scenes part.Resize(Scale); //part.ScheduleTerseUpdate(); //SYMMETRIC SYNC - List updatedProperties = new List(); + List updatedProperties = new List(); if (Rotation != Quaternion.Identity) - updatedProperties.Add(SceneObjectPartProperties.RotationOffset); + updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Position); + updatedProperties.Add(SceneObjectPartSyncProperties.Position); if (Scale != Vector3.Zero) - updatedProperties.Add(SceneObjectPartProperties.Scale); + updatedProperties.Add(SceneObjectPartSyncProperties.Scale); part.ScheduleTerseUpdate(updatedProperties); } diff --git a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs index 462b014306..2fcacddfef 100644 --- a/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs +++ b/OpenSim/Region/OptionalModules/ContentManagementSystem/CMModel.cs @@ -291,7 +291,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement ((SceneObjectGroup)ent).AttachToBackup(); ((SceneObjectGroup)ent).HasGroupChanged = true; // If not true, then attaching to backup does nothing because no change is detected. //((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(); - ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.FullUpdate}); //don't know what properties to taint, so just taint all + ((SceneObjectGroup)ent).ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); //don't know what properties to taint, so just taint all } catch(Exception e) { diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 75538c97f2..3b13a8bb84 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -641,7 +641,7 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator s_tree.Scale += copse.m_rate; s_tree.ParentGroup.HasGroupChanged = true; //s_tree.ScheduleFullUpdate(); - s_tree.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Scale}); + s_tree.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Scale}); } } else diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2ba7d400bd..7c1e634f56 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -1390,7 +1390,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.SendFullUpdateToAllClients(); //DSG SYNC - part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.Scale }); + part.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Scale }); } public LSL_Vector llGetScale() @@ -1405,7 +1405,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.ClickAction = (byte)action; if (m_host.ParentGroup != null) m_host.ParentGroup.HasGroupChanged = true; //m_host.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.ClickAction}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.ClickAction}); return; } @@ -1658,7 +1658,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ParentGroup.HasGroupChanged = true; //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Shape}); + part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Shape}); } /// @@ -1694,7 +1694,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ParentGroup.HasGroupChanged = true; //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Shape}); + part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Shape}); } public LSL_Vector llGetColor(int face) @@ -1970,7 +1970,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api SceneObjectGroup parent = part.ParentGroup; parent.HasGroupChanged = true; //parent.ScheduleGroupForTerseUpdate(); - parent.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartProperties.OffsetPosition}); + parent.ScheduleGroupForTerseUpdate(new List(){SceneObjectPartSyncProperties.OffsetPosition}); } } @@ -2317,7 +2317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? //m_host.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); m_host.SendFullUpdateToAllClients(); } @@ -2338,7 +2338,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api prim.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? //prim.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); prim.SendFullUpdateToAllClients(); } } @@ -2351,7 +2351,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SoundRadius = 20; // Magic number, 20 seems reasonable. Make configurable? //m_host.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); m_host.SendFullUpdateToAllClients(); } @@ -2394,7 +2394,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.SoundFlags = 0; part.SoundRadius = 0; //part.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); part.SendFullUpdateToAllClients(); } m_host.ParentGroup.LoopSoundMasterPrim = null; @@ -2407,7 +2407,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SoundFlags = 0; m_host.SoundRadius = 0; //m_host.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); m_host.SendFullUpdateToAllClients(); } } @@ -2418,7 +2418,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SoundFlags = 0; m_host.SoundRadius = 0; //m_host.ScheduleFullUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Sound}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Sound}); m_host.SendFullUpdateToAllClients(); } } @@ -3329,7 +3329,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.AddScriptLPS(1); m_host.AngularVelocity = new Vector3((float)(axis.x * spinrate), (float)(axis.y * spinrate), (float)(axis.z * spinrate)); //m_host.ScheduleTerseUpdate(); - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.AngularVelocity}); + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.AngularVelocity}); m_host.SendTerseUpdateToAllClients(); m_host.ParentGroup.HasGroupChanged = true; } @@ -3624,7 +3624,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //parentGroup.SyncInfoUpdate(); World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children); } - m_host.ScheduleFullUpdate(new List(){SceneObjectPartProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here + m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here //end of SYMMETRIC SYNC if (client != null) @@ -3706,7 +3706,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { World.RegionSyncModule.SendDeLinkObject(parts, beforeDelinkGroups, afterDelinkGroups); } - parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.None}); + parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //end of SYMMETRIC SYNC parentPrim.TriggerScriptChangedEvent(Changed.LINK); @@ -3726,7 +3726,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { World.RegionSyncModule.SendLinkObject(newRoot.ParentGroup, newRoot, new List(newRoot.ParentGroup.Parts)); } - newRoot.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.None}); + newRoot.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //end of SYMMETRIC SYNC } @@ -3788,7 +3788,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api afterDelinkGroups.Add(rootPart.ParentGroup); World.RegionSyncModule.SendDeLinkObject(parts, beforeDelinkGroups, afterDelinkGroups); } - parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.None}); + parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //end of SYMMETRIC SYNC } @@ -4028,7 +4028,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api m_host.SetText(text, av3, Util.Clip((float)alpha, 0.0f, 1.0f)); m_host.ParentGroup.HasGroupChanged = true; //m_host.ParentGroup.ScheduleGroupForFullUpdate(); - m_host.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartProperties.Text}); + m_host.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.Text}); } public LSL_Float llWater(LSL_Vector offset) @@ -5682,7 +5682,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.ParentGroup.HasGroupChanged = true; //DSG SYNC - part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.TextureAnimation }); + part.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.TextureAnimation }); } public void llTriggerSoundLimited(string sound, double volume, LSL_Vector top_north_east, @@ -6197,7 +6197,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api part.SendFullUpdateToAllClients(); //DSG SYNC - part.ScheduleFullUpdate(new List() { SceneObjectPartProperties.ParticleSystem }); + part.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.ParticleSystem }); } public void llGroundRepel(double height, int water, double tau) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 4e5ed5c4d0..a9096fc855 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2346,7 +2346,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api obj.ParentGroup.HasGroupChanged = true; //obj.ScheduleFullUpdate(); - obj.ScheduleFullUpdate(new List(){SceneObjectPartProperties.Shape}); + obj.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.Shape}); } From 21c48088d8f0613dddcb239f398d721da6c22fe0 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 15 Apr 2011 12:15:28 -0700 Subject: [PATCH 14/36] Added SyncNewObject() to IRegionSyncModule, to be called when new object is added to local SceneObject (by local operation, not by receiving sync message). Code seems good for initial sync when one CM connects to PSA. --- .../SymmetricSync/RegionSyncModule.cs | 477 ++++++++++-------- .../Framework/Interfaces/IRegionSyncModule.cs | 6 + OpenSim/Region/Framework/Scenes/SceneGraph.cs | 5 +- 3 files changed, 264 insertions(+), 224 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index a4fb1e3ef2..f17d63d307 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -336,6 +336,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + //Legacy SendNewObject and SendDeleteObject for Bucket based sync protocol + /// /// Send a sync message to add the given object to other sync nodes. /// @@ -389,7 +391,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm); //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog); } - + public void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children) { @@ -541,6 +543,40 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + ///////////////////////////////////////////////////////////// + //New IRegionSyncModule functions for per property sync'ing + ///////////////////////////////////////////////////////////// + + /// + /// Called when new object is created in local SceneGraph. (Add new object + /// by receiving sync message should not trigger calling this function.) + /// + /// + public void SyncNewObject(SceneObjectGroup sog) + { + //First, add PrimSyncInfoManager's record. + foreach (SceneObjectPart part in sog.Parts) + { + m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID); + } + + if (!IsSyncingWithOtherSyncNodes()) + { + //no SyncConnector connected. No need to send out sync messages. + return; + } + + OSDMap encodedSOG = SceneObjectEncoder(sog); + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG)); + + //SendObjectUpdateToRelevantSyncConnectors(sog, rsm); + //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog); + SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg); + } + + public void SyncDeleteObject(SceneObjectGroup sog, bool softDelete) + { + } #endregion //IRegionSyncModule @@ -762,10 +798,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //if (connector.IsPositionInSyncQuarks(sog.AbsolutePosition)) //{ - SymmetricSyncMessage syncMsg = NewObjectMessageEncoder(sog); - //SendToSyncConnector(connector, sog, syncMsg); - connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes()); + //SymmetricSyncMessage syncMsg = NewObjectMessageEncoder(sog); + OSDMap encodedSOG = SceneObjectEncoder(sog); + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG)); + + //SendToSyncConnector(connector, sog, syncMsg); + connector.EnqueueOutgoingUpdate(sog.UUID, syncMsg.ToBytes()); //} } } @@ -2177,8 +2216,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID) { - //string sogxml = Encoding.ASCII.GetString(msg.Data, 0, msg.Length); - //SceneObjectGroup sog = SceneObjectSerializer.FromXml2Format(sogxml); OSDMap data = DeserializeMessage(msg); //if this is a relay node, forward the event @@ -2196,9 +2233,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } * */ - Object sog; - NewObjectMessageDecoder(data, out sog); - SceneObjectGroup group = (SceneObjectGroup)sog; + //NewObjectMessageDecoder(data, out sog); + + //SceneObjectGroup group = SceneObjectDecoder( + AddNewSceneObjectByDecoding(data); } @@ -3573,7 +3611,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_property = property; m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - + } public PropertySyncInfo(SceneObjectPartSyncProperties property, Object initValue, long initTS, string syncID) @@ -3869,7 +3907,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule default: m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); - break; + break; } return propertyData; } @@ -3879,238 +3917,241 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (!propertyData.ContainsKey("LastUpdateTimeStamp")) { m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateTimeStamp"); - }else{ + } + else + { m_lastUpdateTimeStamp = propertyData["LastUpdateTimeStamp"].AsLong(); } if (!propertyData.ContainsKey("LastUpdateSyncID")) - { - m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); - }else{ - m_lastUpdateSyncID = propertyData["LastUpdateSyncID"].AsString(); - } - - if (!propertyData.ContainsKey("Value")) { m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); } else { - switch (m_property) - { - /////////////////////////////////////// - //SOP properties with complex structure - /////////////////////////////////////// - case SceneObjectPartSyncProperties.Shape: - case SceneObjectPartSyncProperties.TaskInventory: - m_lastUpdateValue = (Object)propertyData["Value"].AsString(); - break; + m_lastUpdateSyncID = propertyData["LastUpdateSyncID"].AsString(); + } - //////////////////////////// - //SOP properties, enum types - //////////////////////////// - case SceneObjectPartSyncProperties.AggregateScriptEvents: - scriptEvents sEvents = (scriptEvents)(propertyData["Value"].AsInteger()); - m_lastUpdateValue = (Object)sEvents; - //propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); - break; - case SceneObjectPartSyncProperties.Flags: - PrimFlags flags = (PrimFlags)(propertyData["Value"].AsInteger()); - m_lastUpdateValue = (Object)flags; - //propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); - break; - //////////////////////////// - //SOP properties, bool types - //////////////////////////// - case SceneObjectPartSyncProperties.AllowedDrop: - case SceneObjectPartSyncProperties.IsAttachment: - case SceneObjectPartSyncProperties.PassTouches: - m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); - //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); - break; + //We do not test if propertyData.ContainsKey("Value"), since Jason + //serialization seems does not include a value if it's equals to + //the default value. So just let Jason decoding to set the value + //either by reading out of the OSDMap, or set to default value. - //////////////////////////// - //SOP properties, Vector3 types - //////////////////////////// - case SceneObjectPartSyncProperties.AngularVelocity: - case SceneObjectPartSyncProperties.AttachedPos: - case SceneObjectPartSyncProperties.GroupPosition: - case SceneObjectPartSyncProperties.OffsetPosition: - case SceneObjectPartSyncProperties.Scale: - case SceneObjectPartSyncProperties.SitTargetPosition: - case SceneObjectPartSyncProperties.SitTargetPositionLL: - case SceneObjectPartSyncProperties.SOP_Acceleration: - case SceneObjectPartSyncProperties.Velocity: - //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); - break; + switch (m_property) + { + /////////////////////////////////////// + //SOP properties with complex structure + /////////////////////////////////////// + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: + m_lastUpdateValue = (Object)propertyData["Value"].AsString(); + break; - //////////////////////////// - //SOP properties, UUID types - //////////////////////////// - case SceneObjectPartSyncProperties.AttachedAvatar: - case SceneObjectPartSyncProperties.CollisionSound: - case SceneObjectPartSyncProperties.CreatorID: - case SceneObjectPartSyncProperties.FolderID: - case SceneObjectPartSyncProperties.GroupID: - case SceneObjectPartSyncProperties.LastOwnerID: - case SceneObjectPartSyncProperties.OwnerID: - case SceneObjectPartSyncProperties.Sound: - //propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsUUID()); - break; + //////////////////////////// + //SOP properties, enum types + //////////////////////////// + case SceneObjectPartSyncProperties.AggregateScriptEvents: + scriptEvents sEvents = (scriptEvents)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)sEvents; + //propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); + break; + case SceneObjectPartSyncProperties.Flags: + PrimFlags flags = (PrimFlags)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)flags; + //propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); + break; + //////////////////////////// + //SOP properties, bool types + //////////////////////////// + case SceneObjectPartSyncProperties.AllowedDrop: + case SceneObjectPartSyncProperties.IsAttachment: + case SceneObjectPartSyncProperties.PassTouches: + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + break; - //case SceneObjectPartProperties.AttachedPos: - //////////////////////////// - //SOP properties, uint types - //////////////////////////// - case SceneObjectPartSyncProperties.AttachmentPoint: - case SceneObjectPartSyncProperties.BaseMask: - case SceneObjectPartSyncProperties.Category: - case SceneObjectPartSyncProperties.EveryoneMask: - case SceneObjectPartSyncProperties.GroupMask: - case SceneObjectPartSyncProperties.InventorySerial: - case SceneObjectPartSyncProperties.NextOwnerMask: - case SceneObjectPartSyncProperties.OwnerMask: - //propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsUInteger()); - break; + //////////////////////////// + //SOP properties, Vector3 types + //////////////////////////// + case SceneObjectPartSyncProperties.AngularVelocity: + case SceneObjectPartSyncProperties.AttachedPos: + case SceneObjectPartSyncProperties.GroupPosition: + case SceneObjectPartSyncProperties.OffsetPosition: + case SceneObjectPartSyncProperties.Scale: + case SceneObjectPartSyncProperties.SitTargetPosition: + case SceneObjectPartSyncProperties.SitTargetPositionLL: + case SceneObjectPartSyncProperties.SOP_Acceleration: + case SceneObjectPartSyncProperties.Velocity: + //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); + break; - //case SceneObjectPartProperties.BaseMask: - //case SceneObjectPartProperties.Category: + //////////////////////////// + //SOP properties, UUID types + //////////////////////////// + case SceneObjectPartSyncProperties.AttachedAvatar: + case SceneObjectPartSyncProperties.CollisionSound: + case SceneObjectPartSyncProperties.CreatorID: + case SceneObjectPartSyncProperties.FolderID: + case SceneObjectPartSyncProperties.GroupID: + case SceneObjectPartSyncProperties.LastOwnerID: + case SceneObjectPartSyncProperties.OwnerID: + case SceneObjectPartSyncProperties.Sound: + //propertyData["Value"] = OSD.FromUUID((UUID)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsUUID()); + break; - //////////////////////////// - //SOP properties, byte types - //////////////////////////// - case SceneObjectPartSyncProperties.ClickAction: - case SceneObjectPartSyncProperties.Material: - case SceneObjectPartSyncProperties.ObjectSaleType: - case SceneObjectPartSyncProperties.UpdateFlag: - //propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); - byte pValue = (byte)(propertyData["Value"].AsInteger()); - m_lastUpdateValue = (Object)pValue; - break; - //case SceneObjectPartProperties.CollisionSound: + //case SceneObjectPartProperties.AttachedPos: + //////////////////////////// + //SOP properties, uint types + //////////////////////////// + case SceneObjectPartSyncProperties.AttachmentPoint: + case SceneObjectPartSyncProperties.BaseMask: + case SceneObjectPartSyncProperties.Category: + case SceneObjectPartSyncProperties.EveryoneMask: + case SceneObjectPartSyncProperties.GroupMask: + case SceneObjectPartSyncProperties.InventorySerial: + case SceneObjectPartSyncProperties.NextOwnerMask: + case SceneObjectPartSyncProperties.OwnerMask: + //propertyData["Value"] = OSD.FromUInteger((uint)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsUInteger()); + break; - //////////////////////////// - //SOP properties, float types - //////////////////////////// - case SceneObjectPartSyncProperties.CollisionSoundVolume: - //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); - float csValue = (float)propertyData["Value"].AsReal(); - m_lastUpdateValue = (Object)(csValue); - break; + //case SceneObjectPartProperties.BaseMask: + //case SceneObjectPartProperties.Category: - //////////////////////////// - //SOP properties, Color(struct type) - //////////////////////////// - case SceneObjectPartSyncProperties.Color: - //propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); - System.Drawing.Color cValue = PropertySerializer.DeSerializeColor(propertyData["Value"].AsString()); - m_lastUpdateValue = (Object)cValue; - break; + //////////////////////////// + //SOP properties, byte types + //////////////////////////// + case SceneObjectPartSyncProperties.ClickAction: + case SceneObjectPartSyncProperties.Material: + case SceneObjectPartSyncProperties.ObjectSaleType: + case SceneObjectPartSyncProperties.UpdateFlag: + //propertyData["Value"] = OSD.FromInteger((byte)LastUpdateValue); + byte pValue = (byte)(propertyData["Value"].AsInteger()); + m_lastUpdateValue = (Object)pValue; + break; + //case SceneObjectPartProperties.CollisionSound: - //////////////////////////// - //SOP properties, int types - //////////////////////////// - case SceneObjectPartSyncProperties.CreationDate: - case SceneObjectPartSyncProperties.LinkNum: - case SceneObjectPartSyncProperties.OwnershipCost: - case SceneObjectPartSyncProperties.SalePrice: - case SceneObjectPartSyncProperties.ScriptAccessPin: - //propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsInteger()); - break; + //////////////////////////// + //SOP properties, float types + //////////////////////////// + case SceneObjectPartSyncProperties.CollisionSoundVolume: + //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + float csValue = (float)propertyData["Value"].AsReal(); + m_lastUpdateValue = (Object)(csValue); + break; - //////////////////////////// - //SOP properties, string types - //////////////////////////// - case SceneObjectPartSyncProperties.CreatorData: - case SceneObjectPartSyncProperties.Description: - case SceneObjectPartSyncProperties.MediaUrl: - case SceneObjectPartSyncProperties.Name: - case SceneObjectPartSyncProperties.SitName: - case SceneObjectPartSyncProperties.Text: - case SceneObjectPartSyncProperties.TouchName: - //propertyData["Value"] = OSD.FromString((string)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsString()); - break; - //////////////////////////// - //SOP properties, byte[] types - //////////////////////////// - case SceneObjectPartSyncProperties.ParticleSystem: - case SceneObjectPartSyncProperties.TextureAnimation: - //propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsBinary()); - break; + //////////////////////////// + //SOP properties, Color(struct type) + //////////////////////////// + case SceneObjectPartSyncProperties.Color: + //propertyData["Value"] = OSD.FromString(PropertySerializer.SerializeColor((System.Drawing.Color)LastUpdateValue)); + System.Drawing.Color cValue = PropertySerializer.DeSerializeColor(propertyData["Value"].AsString()); + m_lastUpdateValue = (Object)cValue; + break; - //////////////////////////// - //SOP properties, Quaternion types - //////////////////////////// - case SceneObjectPartSyncProperties.RotationOffset: - case SceneObjectPartSyncProperties.SitTargetOrientation: - case SceneObjectPartSyncProperties.SitTargetOrientationLL: - //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); - break; + //////////////////////////// + //SOP properties, int types + //////////////////////////// + case SceneObjectPartSyncProperties.CreationDate: + case SceneObjectPartSyncProperties.LinkNum: + case SceneObjectPartSyncProperties.OwnershipCost: + case SceneObjectPartSyncProperties.SalePrice: + case SceneObjectPartSyncProperties.ScriptAccessPin: + //propertyData["Value"] = OSD.FromInteger((int)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsInteger()); + break; - //////////////////////////////////// - //PhysActor properties, float type - //////////////////////////////////// - case SceneObjectPartSyncProperties.Buoyancy: - //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); - float bValue = (float)propertyData["Value"].AsReal(); - m_lastUpdateValue = (Object)(bValue); - break; + //////////////////////////// + //SOP properties, string types + //////////////////////////// + case SceneObjectPartSyncProperties.CreatorData: + case SceneObjectPartSyncProperties.Description: + case SceneObjectPartSyncProperties.MediaUrl: + case SceneObjectPartSyncProperties.Name: + case SceneObjectPartSyncProperties.SitName: + case SceneObjectPartSyncProperties.Text: + case SceneObjectPartSyncProperties.TouchName: + //propertyData["Value"] = OSD.FromString((string)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsString()); + break; + //////////////////////////// + //SOP properties, byte[] types + //////////////////////////// + case SceneObjectPartSyncProperties.ParticleSystem: + case SceneObjectPartSyncProperties.TextureAnimation: + //propertyData["Value"] = OSD.FromBinary((byte[])LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBinary()); + break; - //////////////////////////////////// - //PhysActor properties, bool type - //////////////////////////////////// - case SceneObjectPartSyncProperties.Flying: - case SceneObjectPartSyncProperties.IsColliding: - case SceneObjectPartSyncProperties.CollidingGround: - case SceneObjectPartSyncProperties.IsPhysical: - case SceneObjectPartSyncProperties.Kinematic: - //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); - break; + //////////////////////////// + //SOP properties, Quaternion types + //////////////////////////// + case SceneObjectPartSyncProperties.RotationOffset: + case SceneObjectPartSyncProperties.SitTargetOrientation: + case SceneObjectPartSyncProperties.SitTargetOrientationLL: + //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); + break; - //////////////////////////////////// - //PhysActor properties, Vector3 type - //////////////////////////////////// - case SceneObjectPartSyncProperties.Force: - case SceneObjectPartSyncProperties.PA_Acceleration: - case SceneObjectPartSyncProperties.Position: - case SceneObjectPartSyncProperties.RotationalVelocity: - case SceneObjectPartSyncProperties.Size: - case SceneObjectPartSyncProperties.Torque: - //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); - break; + //////////////////////////////////// + //PhysActor properties, float type + //////////////////////////////////// + case SceneObjectPartSyncProperties.Buoyancy: + //propertyData["Value"] = OSD.FromReal((float)LastUpdateValue); + float bValue = (float)propertyData["Value"].AsReal(); + m_lastUpdateValue = (Object)(bValue); + break; - //////////////////////////////////// - //PhysActor properties, Quaternion type - //////////////////////////////////// - case SceneObjectPartSyncProperties.Orientation: - //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); - break; + //////////////////////////////////// + //PhysActor properties, bool type + //////////////////////////////////// + case SceneObjectPartSyncProperties.Flying: + case SceneObjectPartSyncProperties.IsColliding: + case SceneObjectPartSyncProperties.CollidingGround: + case SceneObjectPartSyncProperties.IsPhysical: + case SceneObjectPartSyncProperties.Kinematic: + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + break; - /////////////////////// - //SOG properties - /////////////////////// - case SceneObjectPartSyncProperties.IsSelected: - //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); - m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); - break; + //////////////////////////////////// + //PhysActor properties, Vector3 type + //////////////////////////////////// + case SceneObjectPartSyncProperties.Force: + case SceneObjectPartSyncProperties.PA_Acceleration: + case SceneObjectPartSyncProperties.Position: + case SceneObjectPartSyncProperties.RotationalVelocity: + case SceneObjectPartSyncProperties.Size: + case SceneObjectPartSyncProperties.Torque: + //propertyData["Value"] = OSD.FromVector3((Vector3)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsVector3()); + break; - default: - m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); - break; + //////////////////////////////////// + //PhysActor properties, Quaternion type + //////////////////////////////////// + case SceneObjectPartSyncProperties.Orientation: + //propertyData["Value"] = OSD.FromQuaternion((Quaternion)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsQuaternion()); + break; + + /////////////////////// + //SOG properties + /////////////////////// + case SceneObjectPartSyncProperties.IsSelected: + //propertyData["Value"] = OSD.FromBoolean((bool)LastUpdateValue); + m_lastUpdateValue = (Object)(propertyData["Value"].AsBoolean()); + break; + + default: + m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); + break; - } } } + } public class PropertySerializer @@ -6130,22 +6171,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } data["primUUID"] = OSDMap.FromUUID(primUUID); - //OSDMap propertyData = new OSDMap(); - //data["propertyData"] = propertyData; //If SceneObjectPartProperties.FullUpdate is in updatedProperties, //convert it to the full list of all properties - HashSet propertiesToEncoded = updatedProperties; if (updatedProperties.Contains(SceneObjectPartSyncProperties.FullUpdate)) { propertiesToEncoded = SceneObjectPart.GetAllPrimProperties(); } - //foreach (SceneObjectPartProperties property in propertiesToEncoded) - //{ - //propertyData.Add(property.ToString(), m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded)); - //} OSDMap propertyData = m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded); data["propertyData"] = propertyData; @@ -6165,7 +6199,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule PrimSyncInfo primSynInfo = new PrimSyncInfo(primUUID, propertyData); return primSynInfo; - //InsertPrimSyncInfo(primUUID, ); } /// diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 8154e854fb..57f606795a 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -74,10 +74,16 @@ namespace OpenSim.Region.Framework.Interfaces void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); void SyncOutPrimUpdates(); + //Legacy calls in Bucket sync'ing //The folloiwng calls deal with object updates, and will insert each update into an outgoing queue of each SyncConnector //void SendSceneUpdates(); void SendNewObject(SceneObjectGroup sog); void SendDeleteObject(SceneObjectGroup sog, bool softDelete); + + //New functions for per property sync'ing + void SyncNewObject(SceneObjectGroup sog); + void SyncDeleteObject(SceneObjectGroup sog, bool softDelete); + void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children); void SendDeLinkObject(List prims, List beforeDelinkGroups, List afterDelinkGroups); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 6d36cec97a..e62677a48c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -429,10 +429,11 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; } - //SYMMETRIC SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate + //DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate if (m_parentScene.RegionSyncModule != null) { - m_parentScene.RegionSyncModule.SendNewObject(sceneObject); + //m_parentScene.RegionSyncModule.SendNewObject(sceneObject); + m_parentScene.RegionSyncModule.SyncNewObject(sceneObject); } if (sendClientUpdates) From e84a7157b442dc9fb8332ffe3473dd1b48bebcf7 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 15 Apr 2011 15:00:02 -0700 Subject: [PATCH 15/36] Added SyncDeleteObject to replace calling to SendDeleteObject. --- .../SymmetricSync/RegionSyncModule.cs | 56 +++++++++++++++++-- OpenSim/Region/Framework/Scenes/Scene.cs | 17 +++--- 2 files changed, 58 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index f17d63d307..6a89b8e94c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -569,13 +569,32 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap encodedSOG = SceneObjectEncoder(sog); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG)); - //SendObjectUpdateToRelevantSyncConnectors(sog, rsm); - //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, sog); SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg); } public void SyncDeleteObject(SceneObjectGroup sog, bool softDelete) { + //First, remove from PrimSyncInfoManager's record. + foreach (SceneObjectPart part in sog.Parts) + { + m_primSyncInfoManager.RemovePrimSyncInfo(part); + } + + if (!IsSyncingWithOtherSyncNodes()) + { + //no SyncConnector connected. Do nothing. + return; + } + + OSDMap data = new OSDMap(); + data["UUID"] = OSD.FromUUID(sog.UUID); + //TODO: need to put in SyncID instead of ActorID here. + //For now, keep it the same for simple debugging + data["actorID"] = OSD.FromString(m_actorID); + data["softDelete"] = OSD.FromBoolean(softDelete); + + SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.RemovedObject, OSDParser.SerializeJsonString(data)); + SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm); } #endregion //IRegionSyncModule @@ -2445,6 +2464,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (!softDelete) { //m_log.DebugFormat("{0}: hard delete object {1}", LogHeader, sog.UUID); + foreach (SceneObjectPart part in sog.Parts) + { + m_primSyncInfoManager.RemovePrimSyncInfo(part); + } m_scene.DeleteSceneObjectBySynchronization(sog); } else @@ -3123,9 +3146,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { - m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal called. Simply return for now. More testing later."); - return; - //Sync values with SOP's data and update timestamp according, to //obtain the list of properties that really have been updated //and should be propogated to other sync nodes. @@ -3386,6 +3406,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + foreach (SceneObjectPart part in sog.Parts) + { + partsPrimSyncInfo[part.UUID].SetGroupProperties(part); + } + //Convert the coordinates if necessary /* Vector3 globalPos; @@ -4501,7 +4526,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public void SetGroupProperties(SceneObjectPart sop) { - + foreach (SceneObjectPartSyncProperties property in GroupProperties) + { + SetSOPPropertyValue(sop, property); + } } private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) @@ -6280,6 +6308,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + public bool RemovePrimSyncInfo(SceneObjectPart part) + { + if (!m_primsInSync.ContainsKey(part.UUID)) + { + return false; + } + lock (m_primsInSyncLock) + { + Dictionary newPrimsInSync = new Dictionary(m_primsInSync); + newPrimsInSync.Remove(part.UUID); + + m_primsInSync = newPrimsInSync; + } + return true; + } + public PrimSyncInfo GetPrimSyncInfo(UUID primUUID) { if (m_primsInSync.ContainsKey(primUUID)) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 70e60c489f..07d9eb87d9 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -709,9 +709,6 @@ namespace OpenSim.Region.Framework.Scenes //Similar to DeleteSceneObject, except that this does not change LastUpdateActorID and LastUpdateTimeStamp public void DeleteSceneObjectBySynchronization(SceneObjectGroup group) { - // m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID); - - //SceneObjectPart rootPart = group.GetChildPart(group.UUID); // Serialise calls to RemoveScriptInstances to avoid // deadlocking on m_parts inside SceneObjectGroup @@ -2593,16 +2590,18 @@ namespace OpenSim.Region.Framework.Scenes EventManager.TriggerParcelPrimCountTainted(); } - group.DeleteGroupFromScene(silent); - -// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); - + //DSG SYNC //Propagate the RemovedObject message if (RegionSyncModule != null) { - RegionSyncModule.SendDeleteObject(group, false); + //RegionSyncModule.SendDeleteObject(group, false); + RegionSyncModule.SyncDeleteObject(group, false); } - //end of SYMMETRIC SYNC + //end of DSG SYNC + + group.DeleteGroupFromScene(silent); + +// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID); } From 8b08e4b17635b70891d3131274eee3c4717570e3 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 15 Apr 2011 17:13:56 -0700 Subject: [PATCH 16/36] Added sync message type UpdatedPrimProperties, to send prim property updates. Sender/receiver functions most in place, need more testing. --- .../SymmetricSync/RegionSyncModule.cs | 228 +++++++++++++++--- .../SymmetricSync/SymmetricSyncMessage.cs | 1 + 2 files changed, 198 insertions(+), 31 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 6a89b8e94c..85f628a3d4 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2153,6 +2153,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SymmetricSyncMessage.MsgType.NewObject: HandleAddNewObject(msg, senderActorID); break; + case SymmetricSyncMessage.MsgType.UpdatedPrimProperties: + HandleUpdatedPrimProperties(msg, senderActorID); + break; case SymmetricSyncMessage.MsgType.UpdatedObject: { //HandleUpdateObjectBySynchronization(msg, senderActorID); @@ -2232,6 +2235,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /////////////////////////////////////////////////////////////////////// + // Per property sync handlers + /////////////////////////////////////////////////////////////////////// + private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID) { @@ -2254,11 +2261,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //NewObjectMessageDecoder(data, out sog); - //SceneObjectGroup group = SceneObjectDecoder( AddNewSceneObjectByDecoding(data); } + private void HandleUpdatedPrimProperties(SymmetricSyncMessage msg, string senderActorID) + { + OSDMap data = DeserializeMessage(msg); + UUID primUUID; + List propertiesSyncInfo; + m_primSyncInfoManager.DecodePrimProperties(data, out primUUID, out propertiesSyncInfo); + + SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID); + + if (sop != null && !sop.ParentGroup.IsDeleted && propertiesSyncInfo.Count>0) + { + m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); + } + } + + /////////////////////////////////////////////////////////////////////// + // Bucket sync handlers + /////////////////////////////////////////////////////////////////////// + /// /// Handler of UpdatedObject message. Note: for a relay node in the /// sync topology, it won't forward the message right away. Instead, @@ -3168,7 +3193,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - m_primPropertyUpdates[part.UUID] = propertiesWithSyncInfoUpdated; + m_primPropertyUpdates.Add(part.UUID, propertiesWithSyncInfoUpdated); } } } @@ -3226,15 +3251,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Starting a new thread to prepare sync message and enqueue it to SyncConnectors System.Threading.ThreadPool.QueueUserWorkItem(delegate { - //OSDMap syncData = new OSDMap(); - //syncData["primCount"] = OSD.FromInteger(primPropertyUpdates.Count); - //OSDArray primDataArray = new OSDArray(); - //syncData["primData"] = (OSD)primDataArray; - foreach (KeyValuePair> updatedPrimProperties in primPropertyUpdates) { UUID primUUID = updatedPrimProperties.Key; HashSet updatedProperties = updatedPrimProperties.Value; + + SendPrimPropertyUpdates(primUUID, updatedProperties); + /* OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); if (syncData.Count > 0) @@ -3242,6 +3265,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData)); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); } + * */ } // Indicate that the current batch of updates has been completed @@ -3254,6 +3278,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + private void SendPrimPropertyUpdates(UUID primUUID, HashSet updatedProperties) + { + OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); + + if (syncData.Count > 0) + { + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); + SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); + } + } + //Object updates are sent by enqueuing into each connector's outQueue. private void SendPrimUpdateToRelevantSyncConnectors(UUID primUUID, SymmetricSyncMessage syncMsg) { @@ -3377,7 +3412,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap rootData = (OSDMap)data["RootPart"]; //Decode and copy to the list of PrimSyncInfo - PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodePrimProperties(rootData); + PrimSyncInfo primSyncInfo = m_primSyncInfoManager.DecodeFullSetPrimProperties(rootData); SceneObjectPart root = primSyncInfo.PrimSyncInfoToSOP(); if (root != null) @@ -3397,7 +3432,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDArray otherPartsArray = (OSDArray) data["OtherParts"]; for(int i=0; i /// Record the time the last sync message about this property is received. @@ -3647,6 +3682,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_lastUpdateSyncID = syncID; //m_lastSyncUpdateRecvTime == ?? + switch (property) + { + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: + m_lastUpdateValueHash = GetPropertyHashValue((string)initValue); + break; + } + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } @@ -3702,13 +3745,42 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /// + /// Compare the local timestamp with that in pSyncInfo. If the one in + /// pSyncInfo is newer, copy its members to the local record. + /// + /// + /// + public bool CompareAndUpdateSyncInfoBySync(PropertySyncInfo pSyncInfo, long recvTS) + { + if (pSyncInfo.LastUpdateTimeStamp > m_lastUpdateTimeStamp) + { + //update + UpdateSyncInfoBySync(pSyncInfo.m_lastUpdateTimeStamp, pSyncInfo.m_lastUpdateSyncID, pSyncInfo.m_lastUpdateValue, recvTS); + return true; + } + else + { + if (pSyncInfo.LastUpdateTimeStamp == m_lastUpdateTimeStamp) + { + if (!m_lastUpdateSyncID.Equals(pSyncInfo.LastUpdateSyncID)) + { + m_log.WarnFormat("CompareAndUpdateSyncInfoBySync: property {0} being updated by {1} and {2} at the same time. Do nothing as of current implementation. TO RESOLVE.", + m_property, m_lastUpdateSyncID, pSyncInfo.LastUpdateSyncID); + } + } + return false; + } + + } + /// /// Update SyncInfo when the property is updated by receiving a sync /// message. /// /// /// - public void UpdateSyncInfoBySync(long ts, string syncID, long recvTS, Object pValue) + public void UpdateSyncInfoBySync(long ts, string syncID, Object pValue, long recvTS) { lock (m_syncInfoLock) { @@ -3717,6 +3789,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_lastUpdateSyncID = syncID; m_lastSyncUpdateRecvTime = recvTS; m_lastUpdateSource = PropertyUpdateSource.BySync; + + switch (m_property) + { + case SceneObjectPartSyncProperties.Shape: + case SceneObjectPartSyncProperties.TaskInventory: + m_lastUpdateValueHash = GetPropertyHashValue((string)m_lastUpdateValue); + break; + } } } @@ -3937,6 +4017,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertyData; } + /// + /// Set member values by decoding out of propertyData. Should only + /// be called in initialization time (e.g. from constructor). + /// + /// private void FromOSDMap(OSDMap propertyData) { if (!propertyData.ContainsKey("LastUpdateTimeStamp")) @@ -3970,6 +4055,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.Shape: case SceneObjectPartSyncProperties.TaskInventory: m_lastUpdateValue = (Object)propertyData["Value"].AsString(); + m_lastUpdateValueHash = Util.Md5Hash((string)m_lastUpdateValue); break; //////////////////////////// @@ -4177,12 +4263,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + private string GetPropertyHashValue(string initValue) + { + return Util.Md5Hash(initValue); + } + } public class PropertySerializer { //TO BE TESTED + public static string SerializeShape(SceneObjectPart part) { string serializedShape; @@ -4359,10 +4451,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue); } - public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) - { - m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); - } + //public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) + //{ + // m_propertiesSyncInfo[property].UpdateSyncInfoBySync(lastUpdateTS, syncID, recvTS, pValue); + //} //Triggered when a set of local writes just happened, and ScheduleFullUpdate //or ScheduleTerseUpdate has been called. @@ -4375,10 +4467,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public HashSet UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) { - HashSet propertiesWithSyncInfoUpdated = new HashSet(); - if (part == null) return propertiesWithSyncInfoUpdated; - - HashSet propertiesToBeSynced = new HashSet < SceneObjectPartSyncProperties >(updatedProperties); + HashSet propertiesToBeSynced = new HashSet(updatedProperties); + if (part == null) + { + propertiesToBeSynced.Clear(); + return propertiesToBeSynced; + } foreach (SceneObjectPartSyncProperties property in updatedProperties) { @@ -4389,7 +4483,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (part.PhysActor == null) { m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); - return propertiesWithSyncInfoUpdated; + return propertiesToBeSynced; } } else @@ -4400,7 +4494,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Caller indicated many properties have changed. We need to //compare and update all properties propertiesToBeSynced = FullSetPrimProperties; - return propertiesWithSyncInfoUpdated; + break; + //return propertiesToBeSynced; case SceneObjectPartSyncProperties.None: propertiesToBeSynced.Clear(); break; @@ -4408,6 +4503,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + if(propertiesToBeSynced.Count==0){ + return propertiesToBeSynced; + } + //Second, for each updated property in the list, compare the value //maintained here and the value in SOP. If different, update the //value here and set the timestamp and syncID @@ -4423,20 +4522,50 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.Shape: case SceneObjectPartSyncProperties.TaskInventory: //Convert the value of complex properties to string and hash - updated = CompareAndUpdateHashedValueByLocal(part, property, lastUpdateTS, syncID); + updated = CompareHashedValue_UpdateByLocal(part, property, lastUpdateTS, syncID); break; default: - updated = CompareAndUpdateValueByLocal(part, property, lastUpdateTS, syncID); + updated = CompareValue_UpdateByLocal(part, property, lastUpdateTS, syncID); break; } if (updated) { - propertiesWithSyncInfoUpdated.Add(property); + propertiesToBeSynced.Add(property); } } } - return propertiesWithSyncInfoUpdated; + return propertiesToBeSynced; + } + + //TODO: might return status such as Updated, Unchanged, etc to caller + public void UpdatePropertiesBySync(SceneObjectPart part, List propertiesSyncInfo) + { + long recvTS = DateTime.Now.Ticks; + foreach (PropertySyncInfo pSyncInfo in propertiesSyncInfo) + { + bool updated = false; + SceneObjectPartSyncProperties property = pSyncInfo.Property; + //Compare if the value of the property in this SyncModule is + //different than the value in SOP + if (!m_propertiesSyncInfo.ContainsKey(property)) + { + //Should not happen + m_log.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID); + } + else + { + //Compare timestamp and update SyncInfo if necessary + updated = m_propertiesSyncInfo[property].CompareAndUpdateSyncInfoBySync(pSyncInfo, recvTS); + //If updated, update the property value in SOP + if (updated) + { + //UpdateSOPProperty(part, m_propertiesSyncInfo[property]); + SetSOPPropertyValue(part, property); + } + } + } + } /// @@ -4493,7 +4622,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_propertiesSyncInfo[property] = propertySyncInfo; } }else{ - m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap"); + m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property); } } } @@ -4560,13 +4689,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap"); + m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property); } } } //Assumption: the caller already locks the access lock, and no need to lock here - private bool CompareAndUpdateHashedValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID) + private bool CompareHashedValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID) { bool updated = false; switch (property) @@ -4634,7 +4763,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// /// Return true if the property's value maintained in this /// RegionSyncModule is replaced by SOP's data. - private bool CompareAndUpdateValueByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID) + private bool CompareValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID) { bool propertyUpdatedByLocal = false; @@ -5678,6 +5807,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertyUpdatedByLocal; } + private void UpdateSOPProperty(SceneObjectPart sop, PropertySyncInfo propertySyncInfo) + { + switch (propertySyncInfo.Property) + { + + } + } + private bool ByteArrayEquals(byte[] a, byte[] b) { if (a.Length != b.Length) @@ -6189,6 +6326,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + public void UpdatePrimSyncInfoBySync(SceneObjectPart part, List propertiesSyncInfo) + { + if (m_primsInSync.ContainsKey(part.UUID)) + { + PrimSyncInfo primSyncInfo = m_primsInSync[part.UUID]; + primSyncInfo.UpdatePropertiesBySync(part, propertiesSyncInfo); + } + else + { + //This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message + m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); + } + } + + public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) { OSDMap data = new OSDMap(); @@ -6214,11 +6366,25 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return data; } - public PrimSyncInfo DecodePrimProperties(OSDMap primData) + public void DecodePrimProperties(OSDMap primPropertiesData, out UUID primUUID, out List propertiesSyncInfo) + { + primUUID = UUID.Zero; + propertiesSyncInfo = new List(); + if (!primPropertiesData.ContainsKey("primUUID") || !primPropertiesData.ContainsKey("propertyData")) + { + m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing"); + } + else + { + + } + } + + public PrimSyncInfo DecodeFullSetPrimProperties(OSDMap primData) { if (!primData.ContainsKey("primUUID") || !primData.ContainsKey("propertyData")) { - m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing"); + m_log.WarnFormat("DecodeFullSetPrimProperties: either primUUID or propertyData is missing"); return null; } UUID primUUID = primData["primUUID"]; diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs index 987a563257..165f951e31 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SymmetricSyncMessage.cs @@ -47,6 +47,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // SIM <-> CM Terrain, NewObject, // objects + UpdatedPrimProperties, //per property sync UpdatedObject, // objects UpdatedBucketProperties, //object properties in one bucket RemovedObject, // objects From 28f401d95a65eee8514dd65eae0197fe706e2982 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 18 Apr 2011 15:54:24 -0700 Subject: [PATCH 17/36] Added RegionSyncModule.ProcessAndEnqueuePrimUpdatesBySync, and revised functions relavant to processing and forwarding prim updates. Code good for 2 CM and PSA to sync on NewObject and UpdatedPrimProperties. --- .../SymmetricSync/RegionSyncModule.cs | 180 +++++++++++++----- .../Framework/Interfaces/IRegionSyncModule.cs | 1 + OpenSim/Region/Framework/Scenes/SceneGraph.cs | 8 +- .../Framework/Scenes/SceneObjectPart.cs | 11 +- 4 files changed, 152 insertions(+), 48 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 85f628a3d4..1985b1a4f1 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -569,6 +569,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap encodedSOG = SceneObjectEncoder(sog); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.NewObject, OSDParser.SerializeJsonString(encodedSOG)); + m_log.DebugFormat("{0}: Send NewObject out for {1},{2}", LogHeader, sog.Name, sog.UUID); + SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, syncMsg); } @@ -2269,14 +2271,36 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { OSDMap data = DeserializeMessage(msg); UUID primUUID; - List propertiesSyncInfo; - m_primSyncInfoManager.DecodePrimProperties(data, out primUUID, out propertiesSyncInfo); + HashSet propertiesSyncInfo; + if (!data.ContainsKey("primUUID")) + { + m_log.WarnFormat("{0}: HandleUpdatedPrimProperties -- primUUID is missing in {1}", LogHeader, msg.Type.ToString()); + return; + } + primUUID = data["primUUID"].AsUUID(); SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID); - if (sop != null && !sop.ParentGroup.IsDeleted && propertiesSyncInfo.Count>0) + if (sop == null || sop.ParentGroup.IsDeleted) { - m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); + m_log.WarnFormat("{0}: HandleUpdatedPrimProperties -- prim {1} no longer in local SceneGraph", LogHeader, primUUID); + return; + } + + propertiesSyncInfo = m_primSyncInfoManager.DecodePrimProperties(data); + + if (propertiesSyncInfo.Count>0) + { + List propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); + + if (propertiesUpdated.Count > 0) + { + //Enqueue the updated SOP and its properties for sync + ProcessAndEnqueuePrimUpdatesBySync(sop, propertiesUpdated); + //Calling SOP.ScheduleFullUpdate(), so that viewers, if any, + //will receive updates as well. + sop.ScheduleFullUpdate(null); + } } } @@ -3163,7 +3187,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private PrimSyncInfoManager m_primSyncInfoManager; //private /// - /// Triggered when some properties in an SOP have been updated. + /// Triggered when some properties in an SOP have been updated locally. /// Sync the properties' values in this sync module with those in /// SOP, and update timestamp accordingly. /// @@ -3171,6 +3195,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties) { + if (part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + //Sync values with SOP's data and update timestamp according, to //obtain the list of properties that really have been updated //and should be propogated to other sync nodes. @@ -3199,6 +3226,49 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /// + /// Triggered when some properties of the given SOP have been updated by + /// receiving a sync message UpdatedPrimProperties. + /// + /// + /// + public void ProcessAndEnqueuePrimUpdatesBySync(SceneObjectPart part, List updatedProperties) + { + if (part.ParentGroup == null || part.ParentGroup.IsDeleted) + return; + + HashSet propertiesToSync = new HashSet(); + + if (m_isSyncRelay) + { + //If this is a sync relay node, it needs to forward out the updates + propertiesToSync = new HashSet(updatedProperties); + } + + //Enqueue the prim with the set of updated properties + if (propertiesToSync.Count > 0) + { + lock (m_primPropertyUpdateLock) + { + if (m_primPropertyUpdates.ContainsKey(part.UUID)) + { + foreach (SceneObjectPartSyncProperties property in propertiesToSync) + { + //Include the "property" into the list of updated properties. + //HashSet's Add function should handle it correctly whether the property + //is or is not in the set. + m_primPropertyUpdates[part.UUID].Add(property); + } + } + else + { + m_primPropertyUpdates.Add(part.UUID, propertiesToSync); + } + } + } + } + + /// /// Triggered periodically to send out sync messages that include /// prim-properties that have been updated since last SyncOut. @@ -4474,6 +4544,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesToBeSynced; } + //pre-process properties in updatedProperties, for sanity checking + //or expanding/shrinking foreach (SceneObjectPartSyncProperties property in updatedProperties) { //first, see if there are physics properties updated but PhysActor @@ -4507,9 +4579,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesToBeSynced; } - //Second, for each updated property in the list, compare the value - //maintained here and the value in SOP. If different, update the - //value here and set the timestamp and syncID + //Second, for each updated property in the list, find out the ones + //that really have recently been updated by local operations + HashSet propertiesUpdatedByLocal = new HashSet(); + lock (m_primSyncInfoLock) { foreach (SceneObjectPartSyncProperties property in propertiesToBeSynced) @@ -4531,17 +4604,19 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (updated) { - propertiesToBeSynced.Add(property); + propertiesUpdatedByLocal.Add(property); } } } - return propertiesToBeSynced; + return propertiesUpdatedByLocal; } //TODO: might return status such as Updated, Unchanged, etc to caller - public void UpdatePropertiesBySync(SceneObjectPart part, List propertiesSyncInfo) + public List UpdatePropertiesBySync(SceneObjectPart part, HashSet propertiesSyncInfo) { long recvTS = DateTime.Now.Ticks; + List propertiesUpdated = new List(); + foreach (PropertySyncInfo pSyncInfo in propertiesSyncInfo) { bool updated = false; @@ -4562,10 +4637,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { //UpdateSOPProperty(part, m_propertiesSyncInfo[property]); SetSOPPropertyValue(part, property); + propertiesUpdated.Add(property); } } } - + return propertiesUpdated; } /// @@ -4601,30 +4677,27 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } /// - /// Decode PropertySyncInfo for each property and insert into m_propertiesSyncInfo. - /// This is called to initialize this PrimSyncInfo by decoding from OSDMap. + /// Decode a set of PropertySyncInfo from OSDMap. /// /// - public void DecodeAndSetProperiesSyncInfo(OSDMap primSyncInfoData) + public static HashSet DecodeProperiesSyncInfo(OSDMap primSyncInfoData) { - foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) + HashSet propertiesSyncInfo = new HashSet(); + + foreach (string propertyString in primSyncInfoData.Keys) { - if (primSyncInfoData.ContainsKey(property.ToString())) + //convert string to enum + SceneObjectPartSyncProperties property = (SceneObjectPartSyncProperties)Enum.Parse(typeof(SceneObjectPartSyncProperties), propertyString, true); + if (FullSetPrimProperties.Contains(property)) { //PropertySyncInfo propertySyncInfo = OSDMapToPropertySyncInfo((OSDMap)primSyncInfoData[property.ToString()]); - PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); - if (!m_propertiesSyncInfo.ContainsKey(property)) - { - m_propertiesSyncInfo.Add(property, propertySyncInfo); - } - else - { - m_propertiesSyncInfo[property] = propertySyncInfo; - } + PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[propertyString]); + propertiesSyncInfo.Add(propertySyncInfo); }else{ - m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property); + //m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not a valid SceneObjectPartSyncProperties", propertyString); } } + return propertiesSyncInfo; } //TO BE FINISHED @@ -4689,7 +4762,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not included in the given OSDMap", property); + m_log.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); } } } @@ -4703,15 +4776,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.Shape: string primShapeString = PropertySerializer.SerializeShape(part); string primShapeStringHash = Util.Md5Hash(primShapeString); - //primShapeString.GetHashCode + if (!m_propertiesSyncInfo[property].IsHashValueEqual(primShapeStringHash)) { + //The SOP's property value has a newer timestamp, update the data in + //PrimSyncInfoManager to be consistent; otherwise, overwrite SOP's property + //value by copying that from PrimSyncInfoManager if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); updated = true; } - else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + else if (lastUpdateTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((string)m_propertiesSyncInfo[property].LastUpdateValue); part.Shape = shape; @@ -4729,7 +4805,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); updated = true; } - else if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + else if (lastUpdateTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { TaskInventoryDictionary taskInv = PropertySerializer.DeSerializeTaskInventory((string)m_propertiesSyncInfo[property].LastUpdateValue); part.TaskInventory = taskInv; @@ -5191,11 +5267,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; case SceneObjectPartSyncProperties.MediaUrl: - if (!part.MediaUrl.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + //Use "!=" to compare, instead of "Equals", because part.MediaUrl + //might be null. + //String assignment in C# create a new copy of the string, hence we do + //not call clone() explicitly, so that the case of "part.MediaUrl==null" + //can be handled properly as well + if (part.MediaUrl != (string) m_propertiesSyncInfo[property].LastUpdateValue) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { - m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.MediaUrl.Clone()); + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.MediaUrl); propertyUpdatedByLocal = true; } else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5994,6 +6075,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return pValue; } + /// + /// Set the property's value based on the value maintained in PrimSyncInfoManager. + /// Assumption: caller will call ScheduleFullUpdate to enqueue updates properly. + /// + /// + /// private void SetSOPPropertyValue(SceneObjectPart part, SceneObjectPartSyncProperties property) { if (part == null) return; @@ -6251,6 +6338,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule break; } + //Calling ScheduleFullUpdate to trigger enqueuing updates for sync'ing (relay sync nodes need to do so) + //part.ScheduleFullUpdate(new List() { property }); } } @@ -6326,17 +6415,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - public void UpdatePrimSyncInfoBySync(SceneObjectPart part, List propertiesSyncInfo) + public List UpdatePrimSyncInfoBySync(SceneObjectPart part, HashSet propertiesSyncInfo) { if (m_primsInSync.ContainsKey(part.UUID)) { PrimSyncInfo primSyncInfo = m_primsInSync[part.UUID]; - primSyncInfo.UpdatePropertiesBySync(part, propertiesSyncInfo); + return primSyncInfo.UpdatePropertiesBySync(part, propertiesSyncInfo); } else { //This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); + return new List(); } } @@ -6366,18 +6456,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return data; } - public void DecodePrimProperties(OSDMap primPropertiesData, out UUID primUUID, out List propertiesSyncInfo) + public HashSet DecodePrimProperties(OSDMap primPropertiesData) { - primUUID = UUID.Zero; - propertiesSyncInfo = new List(); - if (!primPropertiesData.ContainsKey("primUUID") || !primPropertiesData.ContainsKey("propertyData")) + HashSet propertiesSyncInfo = new HashSet(); + if (!primPropertiesData.ContainsKey("propertyData")) { - m_log.WarnFormat("DecodePrimProperties: either primUUID or propertyData is missing"); + m_log.WarnFormat("DecodePrimProperties: propertyData is missing"); + return propertiesSyncInfo; } - else - { + + //if(!m_primsInSync.ContainsKey(primUUID)){ + // m_log.WarnFormat("prim {0} not in PrimSyncInfoManager's record"); + // return; + //} + propertiesSyncInfo = PrimSyncInfo.DecodeProperiesSyncInfo((OSDMap)primPropertiesData["propertyData"]); - } + return propertiesSyncInfo; } public PrimSyncInfo DecodeFullSetPrimProperties(OSDMap primData) diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 57f606795a..45d69aa491 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -71,6 +71,7 @@ namespace OpenSim.Region.Framework.Interfaces //void QueueSceneObjectPartForUpdate(SceneObjectPart part); void QueueScenePresenceForTerseUpdate(ScenePresence presence); + //void ProcessAndEnqueuePrimUpdatesBySync(SceneObjectPart part, List updatedProperties); void ProcessAndEnqueuePrimUpdatesByLocal(SceneObjectPart part, List updatedProperties); void SyncOutPrimUpdates(); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e62677a48c..5753cd3a0a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2169,9 +2169,13 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.RootPart.SetParentLocalId(avatar.LocalId); } - //SYMMETRIC SYNC, + //DSG SYNC, + sceneObject.HasGroupChanged = true; + //NewObject is sent via a specific sync message, not through updates; + //hence not passing any property list here in calling + //ScheduleGroupForFullUpdate(). sceneObject.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); - //end of SYMMETRIC SYNC, + //end of DSG SYNC, Entities.Add(sceneObject); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5781d291c8..fca3f63d68 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3204,7 +3204,7 @@ namespace OpenSim.Region.Framework.Scenes //SYMMETRIC SYNC //KittyL: 04/06/2011, No longer calling QueueSceneObjectPartForUpdate - //from here. Local updates are now recorded by calling IRegionSyncModule.RecordPrimUpdatesByLocal(). + //from here. Local updates are now recorded by calling IRegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(). /* if (m_parentGroup.Scene.RegionSyncModule != null) { @@ -6070,13 +6070,13 @@ namespace OpenSim.Region.Framework.Scenes { if (updatedProperties != null && updatedProperties.Count > 0) { - if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + if (m_parentGroup != null && m_parentGroup.Scene!=null && m_parentGroup.Scene.RegionSyncModule != null) { m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); } } - base.ScheduleTerseUpdate(updatedProperties); + base.ScheduleFullUpdate(updatedProperties); } public override void ScheduleTerseUpdate(List updatedProperties) @@ -6135,6 +6135,11 @@ namespace OpenSim.Region.Framework.Scenes { base.PhysicsCollision(e); } + + /////////////////////////////////////////////////////////////////////// + //Per property sync functions + /////////////////////////////////////////////////////////////////////// + } //end of SYMMETRIC SYNC From 85085977accff41aaa631e9c96c79524fa9682ed Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 19 Apr 2011 09:52:55 -0700 Subject: [PATCH 18/36] Fixed a bug in ScheduleTerseUpdate, and added a few debug lines. --- .../SymmetricSync/RegionSyncModule.cs | 34 +++++++++++++++++++ .../Framework/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 1985b1a4f1..12bdfc9733 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2291,12 +2291,27 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (propertiesSyncInfo.Count>0) { + //SYNC DEBUG + string pString = ""; + foreach (PropertySyncInfo p in propertiesSyncInfo) + { + pString += p.Property.ToString() + " "; + } + m_log.DebugFormat("{0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); + List propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); + //SYNC DEBUG + if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) + { + m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); + } + if (propertiesUpdated.Count > 0) { //Enqueue the updated SOP and its properties for sync ProcessAndEnqueuePrimUpdatesBySync(sop, propertiesUpdated); + //Calling SOP.ScheduleFullUpdate(), so that viewers, if any, //will receive updates as well. sop.ScheduleFullUpdate(null); @@ -3350,10 +3365,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void SendPrimPropertyUpdates(UUID primUUID, HashSet updatedProperties) { + SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID); + + if (sop == null || sop.ParentGroup.IsDeleted) + return; + OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); if (syncData.Count > 0) { + //SYNC DEBUG + string pString = ""; + foreach (SceneObjectPartSyncProperties property in updatedProperties) + { + pString += property.ToString() + " "; + } + m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); + + //SYNC DEBUG + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); + } + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index fca3f63d68..145ee80f89 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -6083,7 +6083,7 @@ namespace OpenSim.Region.Framework.Scenes { if (updatedProperties != null && updatedProperties.Count > 0) { - if (m_parentGroup != null && m_parentGroup.Scene.RegionSyncModule != null) + if (m_parentGroup != null && m_parentGroup.Scene != null && m_parentGroup.Scene.RegionSyncModule != null) { m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); } From 3d7cece491f3e0878dbd5e85b60528f31e8285d2 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 19 Apr 2011 11:11:14 -0700 Subject: [PATCH 19/36] Include serialization of Scale in SOP.Shape (it's a sub property in Shape, and also a seperate SOP property, both pointing to the same copy), so that now serialization of Shape has all its sub properties. --- .../Framework/Scenes/Serialization/SceneObjectSerializer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index eec6f7b466..5a7ca5dc5a 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -578,7 +578,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader) { obj.Scale = Util.ReadVector(reader, "Scale"); - //obj.SetScale(Util.ReadVector(reader, "Scale")); } private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader) @@ -1471,6 +1470,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("ProfileBegin", shp.ProfileBegin.ToString()); writer.WriteElementString("ProfileEnd", shp.ProfileEnd.ToString()); writer.WriteElementString("ProfileHollow", shp.ProfileHollow.ToString()); + //DSG SYNC: added serialization of Shape + WriteVector(writer, "Scale", shp.Scale); + //end of DSG SYNC writer.WriteElementString("State", shp.State.ToString()); WriteFlags(writer, "ProfileShape", shp.ProfileShape.ToString(), options); From 3676b5fbefa7547f065e820a34902a2171b48ec8 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 19 Apr 2011 14:49:47 -0700 Subject: [PATCH 20/36] 1. Replaced SendLinkObject and SendDeLinkObject with SyncLinkObject and SyncDeLinkObject 2. Replaced HandleLinkObject and HandleDelinkObject with HandleSyncLinkObject and HandleSyncDelinkObject. LinkObject seems sync'ed well across actors. --- .../SymmetricSync/RegionSyncModule.cs | 283 +++++++++++++++++- .../Framework/Interfaces/IRegionSyncModule.cs | 7 +- OpenSim/Region/Framework/Scenes/Scene.cs | 10 +- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 10 +- .../Framework/Scenes/SceneObjectGroup.cs | 85 ++++++ 5 files changed, 371 insertions(+), 24 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 12bdfc9733..06cb919c92 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -599,6 +599,92 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, sog, rsm); } + public void SyncLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children) + { + if (children.Count == 0) return; + + if (!IsSyncingWithOtherSyncNodes()) + { + //no SyncConnector connected. Do nothing. + return; + } + + //First, make sure the linked group has updated timestamp info for synchronization + linkedGroup.BucketSyncInfoUpdate(); + + OSDMap data = new OSDMap(); + OSDMap encodedSOG = SceneObjectEncoder(linkedGroup); + data["linkedGroup"] = encodedSOG; + data["rootID"] = OSD.FromUUID(root.UUID); + data["partCount"] = OSD.FromInteger(children.Count); + data["actorID"] = OSD.FromString(m_actorID); + int partNum = 0; + foreach (SceneObjectPart part in children) + { + string partTempID = "part" + partNum; + data[partTempID] = OSD.FromUUID(part.UUID); + partNum++; + + //m_log.DebugFormat("{0}: SendLinkObject to link {1},{2} with {3}, {4}", part.Name, part.UUID, root.Name, root.UUID); + } + + SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.LinkObject, OSDParser.SerializeJsonString(data)); + SendSpecialObjectUpdateToRelevantSyncConnectors(m_actorID, linkedGroup, rsm); + //SendSceneEventToRelevantSyncConnectors(m_actorID, rsm, linkedGroup); + } + + public void SyncDeLinkObject(List prims, List beforeDelinkGroups, List afterDelinkGroups) + { + if (prims.Count == 0 || beforeDelinkGroups.Count == 0) return; + + if (!IsSyncingWithOtherSyncNodes()) + { + //no SyncConnector connected. Do nothing. + return; + } + + OSDMap data = new OSDMap(); + data["partCount"] = OSD.FromInteger(prims.Count); + int partNum = 0; + foreach (SceneObjectPart part in prims) + { + string partTempID = "part" + partNum; + data[partTempID] = OSD.FromUUID(part.UUID); + partNum++; + } + //We also include the IDs of beforeDelinkGroups, for now it is more for sanity checking at the receiving end, so that the receiver + //could make sure its delink starts with the same linking state of the groups/prims. + data["beforeGroupsCount"] = OSD.FromInteger(beforeDelinkGroups.Count); + int groupNum = 0; + foreach (SceneObjectGroup affectedGroup in beforeDelinkGroups) + { + string groupTempID = "beforeGroup" + groupNum; + data[groupTempID] = OSD.FromUUID(affectedGroup.UUID); + groupNum++; + } + + //include the property values of each object after delinking, for synchronizing the values + data["afterGroupsCount"] = OSD.FromInteger(afterDelinkGroups.Count); + groupNum = 0; + foreach (SceneObjectGroup afterGroup in afterDelinkGroups) + { + string groupTempID = "afterGroup" + groupNum; + string sogxml = SceneObjectSerializer.ToXml2Format(afterGroup); + data[groupTempID] = OSD.FromString(sogxml); + groupNum++; + } + + //make sure the newly delinked objects have the updated timestamp information + foreach (SceneObjectGroup sog in afterDelinkGroups) + { + sog.BucketSyncInfoUpdate(); + } + + SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.DelinkObject, OSDParser.SerializeJsonString(data)); + SendDelinkObjectToRelevantSyncConnectors(m_actorID, beforeDelinkGroups, rsm); + } + + #endregion //IRegionSyncModule #region ICommandableModule Members @@ -2153,7 +2239,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } case SymmetricSyncMessage.MsgType.NewObject: - HandleAddNewObject(msg, senderActorID); + //HandleAddNewObject(msg, senderActorID); + HandleSyncNewObject(msg, senderActorID); break; case SymmetricSyncMessage.MsgType.UpdatedPrimProperties: HandleUpdatedPrimProperties(msg, senderActorID); @@ -2176,12 +2263,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } case SymmetricSyncMessage.MsgType.LinkObject: { - HandleLinkObject(msg, senderActorID); + //HandleLinkObject(msg, senderActorID); + HandleSyncLinkObject(msg, senderActorID); return; } case SymmetricSyncMessage.MsgType.DelinkObject: { - HandleDelinkObject(msg, senderActorID); + //HandleDelinkObject(msg, senderActorID); + HandleSyncDelinkObject(msg, senderActorID); return; } //EVENTS PROCESSING @@ -2241,7 +2330,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Per property sync handlers /////////////////////////////////////////////////////////////////////// - private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID) + private void HandleSyncNewObject(SymmetricSyncMessage msg, string senderActorID) { OSDMap data = DeserializeMessage(msg); @@ -2260,8 +2349,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } * */ - - //NewObjectMessageDecoder(data, out sog); AddNewSceneObjectByDecoding(data); @@ -2302,10 +2389,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule List propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); //SYNC DEBUG - if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) - { - m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); - } + //if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) + //{ + // m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); + //} if (propertiesUpdated.Count > 0) { @@ -2319,10 +2406,162 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + private void HandleSyncLinkObject(SymmetricSyncMessage msg, string senderActorID) + { + + // Get the data from message and error check + OSDMap data = DeserializeMessage(msg); + if (data == null) + { + SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); + return; + } + + OSDMap encodedSOG = (OSDMap)data["linkedGroup"]; + SceneObjectGroup linkedGroup; + Dictionary primsSyncInfo; + + SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); + + if (linkedGroup == null) + { + m_log.WarnFormat("{0}: HandleSyncLinkObject, no valid Linked-Group has been deserialized", LogHeader); + return; + } + + UUID rootID = data["rootID"].AsUUID(); + int partCount = data["partCount"].AsInteger(); + List childrenIDs = new List(); + + + //if this is a relay node, forwards the event + if (m_isSyncRelay) + { + //SendSceneEventToRelevantSyncConnectors(senderActorID, msg, linkedGroup); + SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, linkedGroup, msg); + } + + for (int i = 0; i < partCount; i++) + { + string partTempID = "part" + i; + childrenIDs.Add(data[partTempID].AsUUID()); + } + + //TEMP SYNC DEBUG + //m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID); + + m_scene.LinkObjectBySync(linkedGroup, rootID, childrenIDs); + + //Update properties, if any has changed + foreach (KeyValuePair incomingPrimSyncInfo in primsSyncInfo) + { + UUID primUUID = incomingPrimSyncInfo.Key; + PrimSyncInfo updatedPrimSyncInfo = incomingPrimSyncInfo.Value; + + SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID); + if (part == null) + { + m_log.WarnFormat("{0}: HandleSyncLinkObject, prim {1} not in local Scene Graph after LinkObjectBySync is called", LogHeader, primUUID); + } + else + { + m_primSyncInfoManager.UpdatePrimSyncInfoBySync(part, updatedPrimSyncInfo); + } + } + } + + private void HandleSyncDelinkObject(SymmetricSyncMessage msg, string senderActorID) + { + + + OSDMap data = DeserializeMessage(msg); + if (data == null) + { + SymmetricSyncMessage.HandleError(LogHeader, msg, "Could not deserialize JSON data."); + return; + } + + //List localPrims = new List(); + List delinkPrimIDs = new List(); + List beforeDelinkGroupIDs = new List(); + List incomingAfterDelinkGroups = new List(); + + int partCount = data["partCount"].AsInteger(); + for (int i = 0; i < partCount; i++) + { + string partTempID = "part" + i; + UUID primID = data[partTempID].AsUUID(); + //SceneObjectPart localPart = m_scene.GetSceneObjectPart(primID); + //localPrims.Add(localPart); + delinkPrimIDs.Add(primID); + } + + int beforeGroupCount = data["beforeGroupsCount"].AsInteger(); + for (int i = 0; i < beforeGroupCount; i++) + { + string groupTempID = "beforeGroup" + i; + UUID beforeGroupID = data[groupTempID].AsUUID(); + beforeDelinkGroupIDs.Add(beforeGroupID); + } + + int afterGroupsCount = data["afterGroupsCount"].AsInteger(); + for (int i = 0; i < afterGroupsCount; i++) + { + string groupTempID = "afterGroup" + i; + string sogxml = data[groupTempID].AsString(); + //SceneObjectGroup afterGroup = SceneObjectSerializer.FromXml2Format(sogxml); + SceneObjectGroup afterGroup = DecodeSceneObjectGroup(sogxml); + incomingAfterDelinkGroups.Add(afterGroup); + } + + //if this is a relay node, forwards the event + if (m_isSyncRelay) + { + List beforeDelinkGroups = new List(); + foreach (UUID sogID in beforeDelinkGroupIDs) + { + SceneObjectGroup sog = m_scene.SceneGraph.GetGroupByPrim(sogID); + beforeDelinkGroups.Add(sog); + } + SendDelinkObjectToRelevantSyncConnectors(senderActorID, beforeDelinkGroups, msg); + } + + m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); + + } + + /////////////////////////////////////////////////////////////////////// // Bucket sync handlers /////////////////////////////////////////////////////////////////////// + private void HandleAddNewObject(SymmetricSyncMessage msg, string senderActorID) + { + + OSDMap data = DeserializeMessage(msg); + + //if this is a relay node, forward the event + Vector3 globalPos = data["GroupPosition"].AsVector3(); + if (m_isSyncRelay) + { + SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, globalPos, msg); + } + + /* + if (!m_syncQuarkManager.IsPosInSyncQuarks(globalPos)) + { + m_log.WarnFormat("{0}: Received an update for object at global pos {1}, not within local quarks, ignore the update", LogHeader, globalPos.ToString()); + return; + } + * */ + + SceneObjectGroup sog; + Object group; + NewObjectMessageDecoder(data, out group); + sog = (SceneObjectGroup)group; + //Might need to do something with SOG, or no more actions, just return + } + /// /// Handler of UpdatedObject message. Note: for a relay node in the /// sync topology, it won't forward the message right away. Instead, @@ -3375,6 +3614,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (syncData.Count > 0) { //SYNC DEBUG + string pString = ""; foreach (SceneObjectPartSyncProperties property in updatedProperties) { @@ -3383,10 +3623,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); //SYNC DEBUG + /* if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) { m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); } + * */ SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); @@ -4678,6 +4920,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesUpdated; } + public List UpdatePropertiesBySync(SceneObjectPart part, PrimSyncInfo updatedPrimSyncInfo) + { + HashSet propertiesSyncInfo = new HashSet(updatedPrimSyncInfo.PropertiesSyncInfo.Values); + return UpdatePropertiesBySync(part, propertiesSyncInfo); + } + + /// /// Encode the SyncInfo of each property, including its current value /// maintained in this SyncModule, its timestamp and syncID. @@ -6464,6 +6713,20 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + public List UpdatePrimSyncInfoBySync(SceneObjectPart part, PrimSyncInfo updatedPrimSyncInfo) + { + if (m_primsInSync.ContainsKey(part.UUID)) + { + PrimSyncInfo primSyncInfo = m_primsInSync[part.UUID]; + return primSyncInfo.UpdatePropertiesBySync(part, updatedPrimSyncInfo); + } + else + { + //This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message + m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); + return new List(); + } + } public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) { diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 45d69aa491..84c16c7181 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -80,13 +80,14 @@ namespace OpenSim.Region.Framework.Interfaces //void SendSceneUpdates(); void SendNewObject(SceneObjectGroup sog); void SendDeleteObject(SceneObjectGroup sog, bool softDelete); + void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children); + void SendDeLinkObject(List prims, List beforeDelinkGroups, List afterDelinkGroups); //New functions for per property sync'ing void SyncNewObject(SceneObjectGroup sog); void SyncDeleteObject(SceneObjectGroup sog, bool softDelete); - - void SendLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children); - void SendDeLinkObject(List prims, List beforeDelinkGroups, List afterDelinkGroups); + void SyncLinkObject(SceneObjectGroup linkedGroup, SceneObjectPart root, List children); + void SyncDeLinkObject(List prims, List beforeDelinkGroups, List afterDelinkGroups); //In RegionSyncModule's implementation, //The following calls send out a message immediately, w/o putting it in the SyncConnector's outgoing queue. diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 07d9eb87d9..94e4a1aebf 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -827,15 +827,13 @@ namespace OpenSim.Region.Framework.Scenes //m_log.Debug("to link " + children.Count + " parts with " + root.Name); //Leverage the LinkObject implementation to get the book keeping of Group and Parts relations right - m_sceneGraph.LinkObjectsBySync(root, children); + m_sceneGraph.LinkObjectsBySync(root, children); - //The properties of the newly linked object should be updated later with another UpdatedObject message. - + //KittyL 04/19/2011: no longer update properties here, caller will do it //Set the property values as in the incoming copy of the object group - - SceneObjectGroup localGroup = root.ParentGroup; - localGroup.UpdateObjectGroupBySync(linkedGroup); + //SceneObjectGroup localGroup = root.ParentGroup; + //localGroup.UpdateObjectGroupBySync(linkedGroup); //debug /* diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 5753cd3a0a..eba90bafa5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1631,13 +1631,13 @@ namespace OpenSim.Region.Framework.Scenes parentGroup.TriggerScriptChangedEvent(Changed.LINK); parentGroup.HasGroupChanged = true; - //SYMMETRIC SYNC - //Schedule a LinkObject message for synchronization purpose. This will lead to enqueue a LinkObject message in SyncConnector's outgoingQueue, - //so should return quickly. + //DSG SYNC + //Send out LinkObject sync messages. if (m_parentScene.RegionSyncModule != null) { //Tell other actors to link the SceneObjectParts together as a new group. - m_parentScene.RegionSyncModule.SendLinkObject(parentGroup, root, children); + //m_parentScene.RegionSyncModule.SendLinkObject(parentGroup, root, children); + m_parentScene.RegionSyncModule.SyncLinkObject(parentGroup, root, children); } //Schedule updates as in legacy OpenSim code, to send updates to viewers connected to this actor (at least needed for client managers). @@ -1645,7 +1645,7 @@ namespace OpenSim.Region.Framework.Scenes //via the LinkObject message sent above. parentGroup.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); - //end of SYMMETRIC SYNC + //end of DSG SYNC } finally diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ec522182b9..2268e61117 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -4137,6 +4137,91 @@ namespace OpenSim.Region.Framework.Scenes } + /////////////////////////////////////////////////////////////////////// + // Per SOP property based sync + /////////////////////////////////////////////////////////////////////// + + /// + /// Update the existing copy of the object with updated properties in 'updatedSog'. + /// + /// + /// + public Scene.ObjectUpdateResult UpdateSOGBySync(SceneObjectGroup updatedSog) + { + //This GroupID check should be done by the actor who initiates the object update + //if (!this.GroupID.Equals(updatedSog.GroupID)) + // return Scene.ObjectUpdateResult.Error; + + //////////////////////////////////////////////////////////////////////////////////////////////////// + //NOTE!!! + //We do not want to simply call SceneObjectGroup.Copy here to clone the object: + //the prims (SceneObjectParts) in updatedSog are different instances than those in the local copy, + //and we want to preserve the references to the prims in this local copy, especially for scripts + //of each prim, where the scripts have references to the local copy. If the local copy is replaced, + //the prims (parts) will be replaces and we need to update all the references that were pointing to + //the previous prims. + //////////////////////////////////////////////////////////////////////////////////////////////////// + + Scene.ObjectUpdateResult groupUpdateResult = Scene.ObjectUpdateResult.Unchanged; + Dictionary updatedParts = new Dictionary(); + + lock (m_parts.SyncRoot) + { + //This function is called by LinkObjectBySync and DelinkObjectBySinc(), + //which should have updated the parts in this SOG, hence should be no need to + //add or remove parts to sync + + if (this.PrimCount != updatedSog.PrimCount) + { + m_log.WarnFormat("UpdateSOGBySync: For SOP {0}, local copy has {1} parts, while incoming updated copy has {2} parts. Inconsistent.", this.UUID, + this.PrimCount, updatedSog.PrimCount); + } + + //now update properties of the parts + foreach (SceneObjectPart part in this.Parts) + { + Scene.ObjectUpdateResult partUpdateResult = Scene.ObjectUpdateResult.Unchanged; + SceneObjectPart updatedPart = updatedSog.GetChildPart(part.UUID); + + if (updatedPart == null) + { + m_log.WarnFormat("UpdateSOGBySync: part {0},{1} exists in local copy, not in incoming updated copy", part.Name, part.UUID); + } + else + { + partUpdateResult = part.UpdateAllProperties(updatedPart); + + if (partUpdateResult != Scene.ObjectUpdateResult.Unchanged) + { + groupUpdateResult = partUpdateResult; + } + } + } + + //Just to make sure the parts each has the right localID of the rootpart + UpdateParentIDs(); + } + + //Schedule updates to be sent out, if the local copy has just been updated + //(1) if we are debugging the actor with a viewer attaching to it, + //we need to schedule updates to be sent to the viewer. + //(2) or if we are a relaying node to relay updates, we need to forward the updates. + //NOTE: LastUpdateTimeStamp and LastUpdateActorID should be kept the same as in the received copy of the object. + if (groupUpdateResult == Scene.ObjectUpdateResult.Updated) + { + ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + } + + //debug the update result + if (groupUpdateResult == Scene.ObjectUpdateResult.Updated) + { + DebugObjectUpdateResult(); + } + + return groupUpdateResult; + } + + #endregion } } From a5ebd04d9dc69f997b7d20b9a00b3bd3e9dfed01 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 19 Apr 2011 15:55:04 -0700 Subject: [PATCH 21/36] Fixed code in SyncDeLinkObject and HandleSyncDelinkObject. Delinking a few linked objects seems working. --- .../SymmetricSync/RegionSyncModule.cs | 59 +++++++++++-------- OpenSim/Region/Framework/Scenes/Scene.cs | 8 +++ OpenSim/Region/Framework/Scenes/SceneGraph.cs | 31 ++++++---- 3 files changed, 62 insertions(+), 36 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 06cb919c92..c9f0a11d18 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -609,9 +609,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } - //First, make sure the linked group has updated timestamp info for synchronization - linkedGroup.BucketSyncInfoUpdate(); - OSDMap data = new OSDMap(); OSDMap encodedSOG = SceneObjectEncoder(linkedGroup); data["linkedGroup"] = encodedSOG; @@ -669,17 +666,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectGroup afterGroup in afterDelinkGroups) { string groupTempID = "afterGroup" + groupNum; - string sogxml = SceneObjectSerializer.ToXml2Format(afterGroup); - data[groupTempID] = OSD.FromString(sogxml); + //string sogxml = SceneObjectSerializer.ToXml2Format(afterGroup); + //data[groupTempID] = OSD.FromString(sogxml); + OSDMap encodedSOG = SceneObjectEncoder(afterGroup); + data[groupTempID] = encodedSOG; groupNum++; } - //make sure the newly delinked objects have the updated timestamp information - foreach (SceneObjectGroup sog in afterDelinkGroups) - { - sog.BucketSyncInfoUpdate(); - } - SymmetricSyncMessage rsm = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.DelinkObject, OSDParser.SerializeJsonString(data)); SendDelinkObjectToRelevantSyncConnectors(m_actorID, beforeDelinkGroups, rsm); } @@ -2420,7 +2413,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap encodedSOG = (OSDMap)data["linkedGroup"]; SceneObjectGroup linkedGroup; Dictionary primsSyncInfo; - SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); if (linkedGroup == null) @@ -2433,6 +2425,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule int partCount = data["partCount"].AsInteger(); List childrenIDs = new List(); + for (int i = 0; i < partCount; i++) + { + string partTempID = "part" + i; + childrenIDs.Add(data[partTempID].AsUUID()); + } //if this is a relay node, forwards the event if (m_isSyncRelay) @@ -2441,12 +2438,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendSpecialObjectUpdateToRelevantSyncConnectors(senderActorID, linkedGroup, msg); } - for (int i = 0; i < partCount; i++) - { - string partTempID = "part" + i; - childrenIDs.Add(data[partTempID].AsUUID()); - } - //TEMP SYNC DEBUG //m_log.DebugFormat("{0}: received LinkObject from {1}", LogHeader, senderActorID); @@ -2472,8 +2463,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void HandleSyncDelinkObject(SymmetricSyncMessage msg, string senderActorID) { - - OSDMap data = DeserializeMessage(msg); if (data == null) { @@ -2485,6 +2474,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule List delinkPrimIDs = new List(); List beforeDelinkGroupIDs = new List(); List incomingAfterDelinkGroups = new List(); + List> incomingPrimSyncInfo = new List>(); int partCount = data["partCount"].AsInteger(); for (int i = 0; i < partCount; i++) @@ -2508,10 +2498,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule for (int i = 0; i < afterGroupsCount; i++) { string groupTempID = "afterGroup" + i; - string sogxml = data[groupTempID].AsString(); - //SceneObjectGroup afterGroup = SceneObjectSerializer.FromXml2Format(sogxml); - SceneObjectGroup afterGroup = DecodeSceneObjectGroup(sogxml); + //string sogxml = data[groupTempID].AsString(); + SceneObjectGroup afterGroup; + OSDMap encodedSOG = (OSDMap)data[groupTempID]; + Dictionary primsSyncInfo; + SceneObjectDecoder(encodedSOG, out afterGroup, out primsSyncInfo); incomingAfterDelinkGroups.Add(afterGroup); + incomingPrimSyncInfo.Add(primsSyncInfo); } //if this is a relay node, forwards the event @@ -2528,6 +2521,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); + //Sync properties + //Update properties, for each prim in each deLinked-Object + foreach (Dictionary primsSyncInfo in incomingPrimSyncInfo) + { + foreach (KeyValuePair inPrimSyncInfo in primsSyncInfo) + { + UUID primUUID = inPrimSyncInfo.Key; + PrimSyncInfo updatedPrimSyncInfo = inPrimSyncInfo.Value; + + SceneObjectPart part = m_scene.GetSceneObjectPart(primUUID); + if (part == null) + { + m_log.WarnFormat("{0}: HandleSyncDelinkObject, prim {1} not in local Scene Graph after DelinkObjectsBySync is called", LogHeader, primUUID); + } + else + { + m_primSyncInfoManager.UpdatePrimSyncInfoBySync(part, updatedPrimSyncInfo); + } + } + } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 94e4a1aebf..4c3f0fc551 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -846,6 +846,14 @@ namespace OpenSim.Region.Framework.Scenes * */ } + /// + /// Delink objects after receiving DelinkObject sync message. + /// Assumption: the actor whichever initiates the DelinkObject + /// operation has already done premission checking. + /// + /// + /// + /// public void DelinkObjectsBySync(List delinkPrimIDs, List beforeDelinkGroupIDs, List incomingAfterDelinkGroups) { m_sceneGraph.DelinkObjectsBySync(delinkPrimIDs, beforeDelinkGroupIDs, incomingAfterDelinkGroups); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index eba90bafa5..54717fbb50 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1643,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes //Schedule updates as in legacy OpenSim code, to send updates to viewers connected to this actor (at least needed for client managers). //But timestamp won't be changed, so that when other actors get the update, they's simple ignore the updates since they already get them //via the LinkObject message sent above. - parentGroup.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + parentGroup.ScheduleGroupForFullUpdate(null); //end of DSG SYNC @@ -1782,19 +1782,19 @@ namespace OpenSim.Region.Framework.Scenes afterDelinkGroups.Add(g); } - //SYMMETRIC SYNC + //DSG SYNC //Send out DelinkObject message to other actors to sychronize their object list if (m_parentScene.RegionSyncModule != null) { - m_parentScene.RegionSyncModule.SendDeLinkObject(prims, beforeDelinkGroups, afterDelinkGroups); + m_parentScene.RegionSyncModule.SyncDeLinkObject(prims, beforeDelinkGroups, afterDelinkGroups); } - //Schedule updates as in legacy OpenSim code, to send updates to viewers connected to this actor (at least needed for client managers). - //But timestamp won't be changed, so that when other actors get the update, they's simple ignore the updates since they already get them + //Schedule updates as in legacy OpenSim code, to send updates + //to viewers connected to this actor (at least needed for client managers). foreach (SceneObjectGroup sog in afterDelinkGroups) { - sog.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + sog.ScheduleGroupForFullUpdate(null); } - //end of SYMMETRIC SYNC + //end of DSG SYNC } finally { @@ -2174,7 +2174,7 @@ namespace OpenSim.Region.Framework.Scenes //NewObject is sent via a specific sync message, not through updates; //hence not passing any property list here in calling //ScheduleGroupForFullUpdate(). - sceneObject.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + sceneObject.ScheduleGroupForFullUpdate(null); //end of DSG SYNC, Entities.Add(sceneObject); @@ -2283,7 +2283,7 @@ namespace OpenSim.Region.Framework.Scenes parentGroup.TriggerScriptChangedEvent(Changed.LINK); parentGroup.HasGroupChanged = true; //Do not change the timestamp and actorID values - parentGroup.ScheduleGroupForFullUpdate_SyncInfoUnchanged(); + parentGroup.ScheduleGroupForFullUpdate(null); } finally @@ -2302,6 +2302,7 @@ namespace OpenSim.Region.Framework.Scenes public void DelinkObjectsBySync(List delinkPrimIDs, List beforeDelinkGroupIDs, List incomingAfterDelinkGroups) { Dictionary localBeforeDelinkGroups = new Dictionary(); + List localAfterDelinkGroups = new List(); Dictionary delinkPrims = new Dictionary(); bool beforeStateConsistent = true; bool afterStateConsistent = true; @@ -2383,9 +2384,8 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("DelinkObjectsBySync: before-delink state not consistent in local copy and the incoming copy. Return without further operations."); }else{ //Next, apply the delink operation locally. - List localAfterDelinkGroups = DelinkObjectsBySync(new List(delinkPrims.Values)); + localAfterDelinkGroups = DelinkObjectsBySync(new List(delinkPrims.Values)); - //Check if local after-state agrees with that in the remote copy, and update the groups' properties if (localAfterDelinkGroups.Count != incomingAfterDelinkGroups.Count) { @@ -2407,11 +2407,16 @@ namespace OpenSim.Region.Framework.Scenes } else { - localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]); + //localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]); } } } } + + foreach (SceneObjectGroup sog in localAfterDelinkGroups) + { + sog.ScheduleGroupForFullUpdate(null); + } } finally { @@ -2423,7 +2428,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //Similar to DelinkObjects(), w/o triggering any ScheduleFullUpdate(), + //Similar to DelinkObjects(), but calling DelinkFromGroupBySync instead private List DelinkObjectsBySync(List prims) { //!!!Caller of this function should already lock on m_updateLock, so no locking here !!! From 1c1d3893fc864debc344d602c1e71381b8b03d54 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 20 Apr 2011 14:59:06 -0700 Subject: [PATCH 22/36] DelinkFromGroup now calls AddNewSceneObjectByDelink, to avoid calling SyncNewObject later. Also, replace all "SYMMETRIC SYNC" with "DSG SYNC" in comments. --- OpenSim/Framework/RegionInfo.cs | 12 ++-- OpenSim/Region/Application/OpenSimBase.cs | 4 +- .../InventoryAccess/InventoryAccessModule.cs | 2 +- .../RegionSyncModule/RegionSyncClient.cs | 12 ++-- .../RegionSyncModule/RegionSyncClientView.cs | 8 +-- .../RegionSyncServerModule.cs | 8 +-- .../SymmetricSync/RegionSyncModule.cs | 6 ++ .../Scripting/WorldComm/WorldCommModule.cs | 4 +- .../World/Terrain/TerrainModule.cs | 28 ++++---- .../Framework/Interfaces/ITerrainModule.cs | 4 +- .../Region/Framework/Scenes/EventManager.cs | 16 ++--- .../Framework/Scenes/Scene.Inventory.cs | 18 ++--- OpenSim/Region/Framework/Scenes/Scene.cs | 37 ++++++---- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 71 +++++++++++-------- .../Framework/Scenes/SceneObjectGroup.cs | 51 +++++-------- .../Framework/Scenes/SceneObjectPart.cs | 14 ++-- .../Scenes/SceneObjectPartInventory.cs | 4 +- .../Serialization/SceneObjectSerializer.cs | 24 +++---- OpenSim/Region/Framework/Scenes/UndoState.cs | 8 +-- .../Shared/Api/Implementation/LSL_Api.cs | 30 ++++---- 20 files changed, 188 insertions(+), 173 deletions(-) diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 9914a64e17..81bc451f53 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs @@ -386,7 +386,7 @@ namespace OpenSim.Framework public string RemotingAddress; public UUID ScopeID = UUID.Zero; - //SYMMETRIC SYNC + //DSG SYNC //IP:port for the symmetric sync listener this actor is configured to connect to private string m_syncServerAddr = String.Empty; private int m_syncServerPort; @@ -398,7 +398,7 @@ namespace OpenSim.Framework private int m_physicsSyncServerPort; private uint m_quarkLocX; private uint m_quarkLocY; - //end of SYMMETRIC SYNC + //end of DSG SYNC // Apparently, we're applying the same estatesettings regardless of whether it's local or remote. @@ -689,7 +689,7 @@ namespace OpenSim.Framework get { return Util.UIntsToLong((RegionLocX * (uint) Constants.RegionSize), (RegionLocY * (uint) Constants.RegionSize)); } } - //SYMMETRIC SYNC + //DSG SYNC public string SyncServerAddress { get { return m_syncServerAddr; } @@ -726,7 +726,7 @@ namespace OpenSim.Framework get { return m_quarkLocY; } set { m_quarkLocY = value; } } - //end of SYMMETRIC SYNC + //end of DSG SYNC public void SetEndPoint(string ipaddr, int port) { @@ -883,7 +883,7 @@ namespace OpenSim.Framework // ScopeID = new UUID(config.GetString("ScopeID", UUID.Zero.ToString())); - // SYMMETRIC SYNC + // DSG SYNC m_syncServerAddr = config.GetString("SyncServerAddress", String.Empty); m_syncServerPort = config.GetInt("SyncServerPort", -1); //if either IP or port is not configured, we set IP to empty to raise warning later @@ -908,7 +908,7 @@ namespace OpenSim.Framework m_quarkLocY = Convert.ToUInt32(quarkLocElements[1]); - // end of SYMMETRIC SYNC + // end of DSG SYNC } diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 950f57369d..4464efdbf3 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -411,11 +411,11 @@ namespace OpenSim scene.StartTimer(); - //SYMMETRIC SYNC + //DSG SYNC //For INonSharedRegionModule, there is no more PostInitialise(). So we trigger OnPostSceneCreation event here //to let the Sync modules to do their work once all modules are loaded and scene has interfaces to all of them. scene.EventManager.TriggerOnPostSceneCreation(scene); - //end of SYMMETRIC SYNC + //end of DSG SYNC return clientServer; } diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index bd316215d7..c2b608bfcc 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs @@ -674,7 +674,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess rootPart.TrimPermissions(); - //SYMMETRIC SYNC: move this part to the bottom of this function, + //DSG SYNC: move this part to the bottom of this function, //so that all properties of the object would have been set once //AddNewSceneObject is called. if (attachment) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs index 6d3192dbb8..4b649b3082 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs @@ -318,7 +318,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule RegionSyncMessage.HandleSuccess(LogHeader(), msg, String.Format("Syncing to region \"{0}\"", m_regionName)); return; } - //SYMMETRIC SYNC: do not handle terrian and object updates + //DSG SYNC: do not handle terrian and object updates case RegionSyncMessage.MsgType.Terrain: { if(!m_symSync) @@ -378,7 +378,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } return; } - //end of SYMMETRIC SYNC + //end of DSG SYNC case RegionSyncMessage.MsgType.NewAvatar: { // Get the data from message and error check @@ -854,13 +854,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule Send(new RegionSyncMessage(RegionSyncMessage.MsgType.RegionName, m_scene.RegionInfo.RegionName)); m_log.WarnFormat("Sending region name: \"{0}\"", m_scene.RegionInfo.RegionName); - //SYMMETRIC SYNC: commenting out terrian and object updates + //DSG SYNC: commenting out terrian and object updates if (!m_symSync) { Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetTerrain)); Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetObjects)); } - //end of SYMMETRIC SYNC + //end of DSG SYNC Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetAvatars)); // Register for events which will be forwarded to authoritative scene @@ -910,11 +910,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Register for interesting client events which will be forwarded to auth sim // These are the raw packet data blocks from the client, intercepted and sent up to the sim client.OnAgentUpdateRaw += HandleAgentUpdateRaw; - //SYMMETRIC SYNC: do not subscribe to OnChatFromClientRaw: RegionSyncModule + Scene.EventManager will handle this. + //DSG SYNC: do not subscribe to OnChatFromClientRaw: RegionSyncModule + Scene.EventManager will handle this. //client.OnChatFromClientRaw += HandleChatFromClientRaw; client.OnAgentRequestSit += HandleAgentRequestSit; client.OnAgentSit += HandleAgentSit; - //SYMMETRIC SYNC: do not subscribe to OnGrabObject, OnGrabUpdate, and OnDeGrabObject: RegionSyncModule + Scene.EventManager will handle this. + //DSG SYNC: do not subscribe to OnGrabObject, OnGrabUpdate, and OnDeGrabObject: RegionSyncModule + Scene.EventManager will handle this. //client.OnGrabObject += HandleGrabObject; //client.OnGrabUpdate += HandleGrabUpdate; //client.OnDeGrabObject += HandleDeGrabObject; diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs index 05b6848a0b..b605723144 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs @@ -202,10 +202,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // *** This is the main receive loop thread for each connected client private void ReceiveLoop() { - //SYMMETRIC SYNC: commenting out the code for handling chats + //DSG SYNC: commenting out the code for handling chats // m_scene.EventManager.OnChatFromClient += new EventManager.ChatFromClientEvent(EventManager_OnChatFromClient); // m_scene.EventManager.OnChatFromWorld += new EventManager.ChatFromWorldEvent(EventManager_OnChatFromClient); - //end of SYMMETRIC SYNC + //end of DSG SYNC // Reset stats and time @@ -327,7 +327,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Syncing to region \"{0}\"", m_regionName)); return; } - //SYMMETRIC SYNC: do not handle terrian and object updates + //DSG SYNC: do not handle terrian and object updates case RegionSyncMessage.MsgType.GetTerrain: { /* @@ -358,7 +358,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule * */ return; } - //end of SYMMETRIC SYNC + //end of DSG SYNC case RegionSyncMessage.MsgType.GetAvatars: { m_scene.ForEachScenePresence(delegate(ScenePresence presence) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs index 4e53703a21..0652dc9291 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs @@ -151,7 +151,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_scene.EventManager.OnNewPresence += new EventManager.OnNewPresenceDelegate(EventManager_OnNewPresence); m_scene.EventManager.OnRemovePresence += new EventManager.OnRemovePresenceDelegate(EventManager_OnRemovePresence); - //SYMMETRIC SYNC: do not handle object updates + //DSG SYNC: do not handle object updates /* if (!m_symsync) { @@ -162,7 +162,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_scene.EventManager.OnOarFileLoaded += new EventManager.OarFileLoaded(EventManager_OnOarFileLoaded); } * */ - //end of SYMMETRIC SYNC + //end of DSG SYNC // Start the server and listen for RegionSyncClients m_serveraddr = m_scene.RegionInfo.AvatarSyncServerAddress; m_serverport = m_scene.RegionInfo.AvatarSyncServerPort; @@ -300,7 +300,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // Sending the message when it's first queued would yield lower latency but much higher load on the simulator // as parts may be updated many many times very quickly. Need to implement a higher resolution send in heartbeat - //SYMMETRIC SYNC: do not handle object updates + //DSG SYNC: do not handle object updates /* if (!m_symsync) { @@ -317,7 +317,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } * */ - //end of SYMMETRIC SYNC + //end of DSG SYNC foreach (ScenePresence presence in presenceUpdates) { try diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index c9f0a11d18..e3ea30c4d4 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1944,6 +1944,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (SceneObjectGroup sog in sogList) { m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition); + foreach (SceneObjectPart part in sog.Parts) + { + m_log.WarnFormat(" -- part {0}, UUID {1}, LocalID {2}, offset-position {3}", part.Name, part.UUID, part.LocalId, part.OffsetPosition); + } } if (m_isSyncRelay) @@ -2541,6 +2545,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } } + + } diff --git a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs index 86aa79d7dd..c132f8dc3e 100644 --- a/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/WorldComm/WorldCommModule.cs @@ -127,11 +127,11 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm m_listenerManager = new ListenerManager(maxlisteners, maxhandles); m_scene.EventManager.OnChatFromClient += DeliverClientMessage; m_scene.EventManager.OnChatBroadcast += DeliverClientMessage; - //SYMMETRIC SYNC + //DSG SYNC //m_scene.EventManager.OnChatFromWorld += DeliverClientMessage; //Kitty: temp debug //m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - //end SYMMETRIC SYNC + //end DSG SYNC m_pendingQ = new Queue(); m_pending = Queue.Synchronized(m_pendingQ); } diff --git a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs index adc2d92950..b560aefefe 100644 --- a/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs +++ b/OpenSim/Region/CoreModules/World/Terrain/TerrainModule.cs @@ -551,14 +551,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_scene.PhysicsScene.SetTerrain(m_channel.GetFloatsSerialised()); m_scene.SaveTerrain(); - //SYMMETRIC SYNC + //DSG SYNC //Terrain has been modified, send out sync message if needed //if (m_scene.RegionSyncModule != null) //{ //m_log.DebugFormat("EventManager_OnTerrainTick: To call SendTerrainUpdates with TS {0} and actorID {1}", m_lastUpdateTimeStamp, m_lastUpdateActorID); //m_scene.RegionSyncModule.SendTerrainUpdates(m_lastUpdateTimeStamp, m_lastUpdateActorID); //} - //end of SYMMETRIC SYNC + //end of DSG SYNC // Clients who look at the map will never see changes after they looked at the map, so i've commented this out. //m_scene.CreateTerrainTexture(true); @@ -600,7 +600,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain client.OnUnackedTerrain += client_OnUnackedTerrain; } - //SYMMETRIC SYNC + //DSG SYNC private long m_lastUpdateTimeStamp = DateTime.Now.Ticks; public long LastUpdateTimeStamp { @@ -675,7 +675,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_lastUpdateActorID = lastUpdateActorID; } - //end of SYMMETRIC SYNC + //end of DSG SYNC /// /// Checks to see if the terrain has been modified since last check @@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// private void CheckForTerrainUpdates() { - //SYMMETRIC SYNC + //DSG SYNC m_log.DebugFormat("CheckForTerrainUpdates() called"); //Assumption: Thus function is only called when the terrain is updated by the local actor. // Updating terrain during receiving sync messages from another actor will call CheckForTerrainUpdates. @@ -696,7 +696,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain //Check if the terrain has been modified and send out sync message if modified. CheckForTerrainUpdates(false, currentTimeTick, localActorID); - //end of SYMMETRIC SYNC + //end of DSG SYNC //CheckForTerrainUpdates(false); } @@ -710,9 +710,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain /// should height map deltas be limited to the estate settings limits /// //private void CheckForTerrainUpdates(bool respectEstateSettings) - //SYMMETRIC SYNC: Change the interface, to input the right sync information for the most recent update + //DSG SYNC: Change the interface, to input the right sync information for the most recent update private void CheckForTerrainUpdates(bool respectEstateSettings, long lastUpdateTimeStamp, string lastUpdateActorID) - //end of SYMMETRIC SYNC + //end of DSG SYNC { bool shouldTaint = false; float[] serialised = m_channel.GetFloatsSerialised(); @@ -741,14 +741,14 @@ namespace OpenSim.Region.CoreModules.World.Terrain if (shouldTaint) { m_tainted = true; - //SYMMETRIC SYNC + //DSG SYNC //Terrain has been modified, updated the sync info if (m_scene.RegionSyncModule != null) { SyncInfoUpdate(lastUpdateTimeStamp, lastUpdateActorID); m_scene.RegionSyncModule.SendTerrainUpdates(lastUpdateTimeStamp, lastUpdateActorID); } - //end of SYMMETRIC SYNC + //end of DSG SYNC } } @@ -862,9 +862,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_channel, allowMask, west, south, height, size, seconds); //CheckForTerrainUpdates(!god); //revert changes outside estate limits - //SYMMETRIC SYNC + //DSG SYNC CheckForTerrainUpdates(!god, DateTime.Now.Ticks, m_scene.GetSyncActorID()); - //end of SYMMETRIC SYNC + //end of DSG SYNC } } else @@ -906,9 +906,9 @@ namespace OpenSim.Region.CoreModules.World.Terrain m_channel, fillArea, size); //CheckForTerrainUpdates(!god); //revert changes outside estate limits - //SYMMETRIC SYNC + //DSG SYNC CheckForTerrainUpdates(!god, DateTime.Now.Ticks, m_scene.GetSyncActorID()); - //end of SYMMETRIC SYNC + //end of DSG SYNC } } else diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs index e3d8e8c780..252d68d015 100644 --- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs +++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs @@ -65,7 +65,7 @@ namespace OpenSim.Region.Framework.Interfaces void UndoTerrain(ITerrainChannel channel); - //SYMMETRIC SYNC + //DSG SYNC /// /// Invoked by receiving a terrain sync message. First, check if the /// timestamp is more advance than the local copy. If so, update the @@ -96,6 +96,6 @@ namespace OpenSim.Region.Framework.Interfaces /// /// void SetSyncInfo(long lastUpdateTimeStamp, string lastUpdateActorID); - //end of SYMMETRIC SYNC + //end of DSG SYNC } } diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index 27c258ba6f..fb3088fc25 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -38,7 +38,7 @@ using GridRegion = OpenSim.Services.Interfaces.GridRegion; namespace OpenSim.Region.Framework.Scenes { - //SYMMETRIC SYNC: Rename the original EventManager as EventManagerBase, and implement a new EventManager that inherits from EventManagerBase + //DSG SYNC: Rename the original EventManager as EventManagerBase, and implement a new EventManager that inherits from EventManagerBase /// /// A wrapper class to implement handle event differently depending on if they are initiated locally or remotelly (i.e. by another actor) @@ -1113,7 +1113,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //SYMMETRIC SYNC: overridden at new EventManager class + //DSG SYNC: overridden at new EventManager class //public void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) public virtual void TriggerObjectGrab(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { @@ -1136,7 +1136,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //SYMMETRIC SYNC: overridden at new EventManager class + //DSG SYNC: overridden at new EventManager class //public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) public virtual void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { @@ -1159,7 +1159,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //SYMMETRIC SYNC: overridden at new EventManager class + //DSG SYNC: overridden at new EventManager class //public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) public virtual void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs) { @@ -1851,7 +1851,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //SYMMETRIC SYNC: the function is overridden in new EventManager + //DSG SYNC: the function is overridden in new EventManager //public void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) public virtual void TriggerOnChatFromWorld(Object sender, OSChatMessage chat) { @@ -1874,7 +1874,7 @@ namespace OpenSim.Region.Framework.Scenes } } - //SYMMETRIC SYNC: overiding this in the inherited class + //DSG SYNC: overiding this in the inherited class //public void TriggerOnChatFromClient(Object sender, OSChatMessage chat) public virtual void TriggerOnChatFromClient(Object sender, OSChatMessage chat) { @@ -2550,7 +2550,7 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - //SYMMETRIC SYNC + //DSG SYNC public event PostSceneCreation OnPostSceneCreation; public delegate void PostSceneCreation(Scene createdScene); public void TriggerOnPostSceneCreation(Scene createdScene) @@ -2619,6 +2619,6 @@ namespace OpenSim.Region.Framework.Scenes } } } - //end of SYMMETRIC SYNC + //end of DSG SYNC } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index ec8c49410a..82a3e1a408 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -251,7 +251,7 @@ namespace OpenSim.Region.Framework.Scenes AssetService.Store(asset); //REGION SYNC: if RegionSyncEnabled, move script related operations to be after update inventory item - //SYMMETRIC SYNC: commenting out old REGION SYNC code, the RemoveScriptInstance would be handled by ScriptEngineSyncModule + //DSG SYNC: commenting out old REGION SYNC code, the RemoveScriptInstance would be handled by ScriptEngineSyncModule /* if (!RegionSyncEnabled) { @@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes part.GetProperties(remoteClient); ////REGION SYNC - //SYMMETRIC SYNC: commenting out old REGION SYNC code, the RemoveScriptInstance would be handled by ScriptEngineSyncModule + //DSG SYNC: commenting out old REGION SYNC code, the RemoveScriptInstance would be handled by ScriptEngineSyncModule /* if (!RegionSyncEnabled) { @@ -309,7 +309,7 @@ namespace OpenSim.Region.Framework.Scenes } * */ - //SYMMETRIC SYNC: Distributed Scene Graph implementation + //DSG SYNC: Distributed Scene Graph implementation m_log.Debug("Scene.Inventory: to call EventManager.TriggerUpdateScript, agentID: " + remoteClient.AgentId); //Trigger OnUpdateScript event. EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID); @@ -370,7 +370,7 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - #region SYMMETRIC SYNC + #region DSG SYNC public void SymSync_OnNewScript(UUID avatarID, UUID itemID, SceneObjectPart part) { TaskInventoryItem item = part.Inventory.GetInventoryItem(itemID); @@ -433,7 +433,7 @@ namespace OpenSim.Region.Framework.Scenes return errors; } - #endregion //SYMMETRIC SYNC + #endregion //DSG SYNC /// @@ -1710,7 +1710,7 @@ namespace OpenSim.Region.Framework.Scenes part.ParentGroup.AddInventoryItem(remoteClient, localID, item, copyID); part.GetProperties(remoteClient); - //SYMMETRIC SYNC + //DSG SYNC /* Original OpenSim code, commented out // TODO: switch to posting on_rez here when scripts // have state in inventory @@ -1737,7 +1737,7 @@ namespace OpenSim.Region.Framework.Scenes //part.GetProperties(remoteClient); part.ParentGroup.ResumeScripts(); } - //end of SYMMETRIC SYNC + //end of DSG SYNC } else @@ -1797,7 +1797,7 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.AddInventoryItem(taskItem, false); part.GetProperties(remoteClient); - //SYMMETRIC SYNC + //DSG SYNC //part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); //part.ParentGroup.ResumeScripts(); if (RegionSyncModule != null) @@ -1815,7 +1815,7 @@ namespace OpenSim.Region.Framework.Scenes //part.GetProperties(remoteClient); part.ParentGroup.ResumeScripts(); } - //end of SYMMETRIC SYNC + //end of DSG SYNC } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4c3f0fc551..c1e8ed6b06 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -634,9 +634,9 @@ namespace OpenSim.Region.Framework.Scenes #endregion - #region SYMMETRIC SYNC + #region DSG SYNC /////////////////////////////////////////////////////////////////////////////////////////////// - //KittyL: 12/23/2010. SYMMETRIC SYNC: Implementation for the symmetric synchronization model. + //KittyL: 12/23/2010. DSG SYNC: Implementation for the symmetric synchronization model. /////////////////////////////////////////////////////////////////////////////////////////////// private IRegionSyncModule m_regionSyncModule = null; @@ -866,7 +866,18 @@ namespace OpenSim.Region.Framework.Scenes return m_sceneGraph.UpdateObjectPartBucketProperties(bucketName, partUUID, updatePart, bucketSyncInfo); } - #endregion //SYMMETRIC SYNC + public bool AddNewSceneObjectByDelink(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) + { + if (m_sceneGraph.AddNewSceneObjectByDelink(sceneObject, attachToBackup, sendClientUpdates)) + { + EventManager.TriggerObjectAddedToScene(sceneObject); + return true; + } + + return false; + } + + #endregion //DSG SYNC public ICapabilitiesModule CapsModule { @@ -1010,10 +1021,10 @@ namespace OpenSim.Region.Framework.Scenes m_physicalPrim = physicalPrim; m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; - //SYMMETRIC SYNC: pass Scene reference to EventManager + //DSG SYNC: pass Scene reference to EventManager //m_eventManager = new EventManager(); m_eventManager = new EventManager(this); - //end of SYMMETRIC SYNC + //end of DSG SYNC m_permissions = new ScenePermissions(this); m_asyncSceneObjectDeleter = new AsyncSceneObjectGroupDeleter(this); @@ -1219,10 +1230,10 @@ namespace OpenSim.Region.Framework.Scenes m_regInfo = regInfo; - //SYMMETRIC SYNC: pass Scene reference to EventManager + //DSG SYNC: pass Scene reference to EventManager //m_eventManager = new EventManager(); m_eventManager = new EventManager(this); - //end of SYMMETRIC SYNC + //end of DSG SYNC m_lastUpdate = Util.EnvironmentTickCount(); } @@ -1557,13 +1568,13 @@ namespace OpenSim.Region.Framework.Scenes PhysEngineToSceneConnectorModule = RequestModuleInterface(); SceneToPhysEngineSyncServer = RequestModuleInterface(); ////////////////////////////////////////////////////////////////////// - //SYMMETRIC SYNC (KittyL: started 12/23/2010) + //DSG SYNC (KittyL: started 12/23/2010) ////////////////////////////////////////////////////////////////////// m_regionSyncModule = RequestModuleInterface(); m_DSGActorSyncModule = RequestModuleInterface(); ////////////////////////////////////////////////////////////////////// - //end of SYMMETRIC SYNC + //end of DSG SYNC ////////////////////////////////////////////////////////////////////// // Shoving this in here for now, because we have the needed @@ -1743,7 +1754,7 @@ namespace OpenSim.Region.Framework.Scenes m_regionSyncServerModule.SendUpdates(); } - //SYMMETRIC SYNC + //DSG SYNC //NOTE: If it is configured as symmetric sync in opensim.ini, the above IsSyncedServer() or IsSyncedClient() should all return false if (RegionSyncModule != null) @@ -1751,7 +1762,7 @@ namespace OpenSim.Region.Framework.Scenes //RegionSyncModule.SendSceneUpdates(); RegionSyncModule.SyncOutPrimUpdates(); } - //end of SYMMETRIC SYNC + //end of DSG SYNC int tmpPhysicsMS2 = Util.EnvironmentTickCount(); if ((Frame % m_update_physics == 0) && m_physics_enabled && (IsSyncedServer() || IsPhysEngineActor())) @@ -3228,7 +3239,7 @@ namespace OpenSim.Region.Framework.Scenes client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily; client.OnObjectPermissions += HandleObjectPermissionsUpdate; - //SYMMETRIC SYNC: return the code back to its original OpenSim version + //DSG SYNC: return the code back to its original OpenSim version //if (IsSyncedServer()) //{ client.OnGrabObject += ProcessObjectGrab; @@ -3728,7 +3739,7 @@ namespace OpenSim.Region.Framework.Scenes ForEachClient(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); - //SYMMETRIC SYNC: object remove should be handled through RegionSyncModule + //DSG SYNC: object remove should be handled through RegionSyncModule // REGION SYNC /* if( IsSyncedServer() ) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 54717fbb50..b19374cbb3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -47,9 +47,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void ObjectDeleteDelegate(EntityBase obj); - //SYMMETRIC SYNC + //DSG SYNC public delegate void ObjectCreateBySyncDelegate(EntityBase obj); - //end of SYMMETRIC SYNC + //end of DSG SYNC /// @@ -69,9 +69,9 @@ namespace OpenSim.Region.Framework.Scenes public event ObjectCreateDelegate OnObjectCreate; public event ObjectDeleteDelegate OnObjectRemove; - //SYMMETRIC SYNC + //DSG SYNC public event ObjectCreateBySyncDelegate OnObjectCreateBySync; - //end of SYMMETRIC SYNC + //end of DSG SYNC #endregion @@ -288,7 +288,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.HasGroupChanged = true; } - return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); + return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, false); } /// @@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes if (attachToBackup) sceneObject.HasGroupChanged = true; - return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates); + return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, false); } /// @@ -344,7 +344,7 @@ namespace OpenSim.Region.Framework.Scenes sceneObject.Velocity = vel; } - //SYMMETRIC SYNC + //DSG SYNC //Moving AddNewSceneObject to the end of this function, so that //all object properties are set when AddNewSceneObject is called. AddNewSceneObject(sceneObject, true, false); @@ -368,17 +368,17 @@ namespace OpenSim.Region.Framework.Scenes /// /// true if the object was added, false if an object with the same uuid was already in the scene /// - protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) + protected bool AddSceneObject(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates, bool addedByDelink) { if (sceneObject == null || sceneObject.RootPart == null || sceneObject.RootPart.UUID == UUID.Zero) return false; if (Entities.ContainsKey(sceneObject.UUID)) return false; - -// m_log.DebugFormat( -// "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", -// sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); + + // m_log.DebugFormat( + // "[SCENEGRAPH]: Adding scene object {0} {1}, with {2} parts on {3}", + // sceneObject.Name, sceneObject.UUID, sceneObject.Parts.Length, m_parentScene.RegionInfo.RegionName); SceneObjectPart[] children = sceneObject.Parts; @@ -403,18 +403,18 @@ namespace OpenSim.Region.Framework.Scenes m_numPrim += children.Length; sceneObject.AttachToScene(m_parentScene); - + Entities.Add(sceneObject); if (attachToBackup) sceneObject.AttachToBackup(); - + if (OnObjectCreate != null) OnObjectCreate(sceneObject); lock (SceneObjectGroupsByFullID) SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; - + lock (SceneObjectGroupsByFullPartID) { SceneObjectGroupsByFullPartID[sceneObject.UUID] = sceneObject; @@ -429,16 +429,15 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroupsByLocalPartID[part.LocalId] = sceneObject; } - //DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate - if (m_parentScene.RegionSyncModule != null) - { - //m_parentScene.RegionSyncModule.SendNewObject(sceneObject); - m_parentScene.RegionSyncModule.SyncNewObject(sceneObject); - } - if (sendClientUpdates) //sceneObject.ScheduleGroupForFullUpdate(); - sceneObject.ScheduleGroupForFullUpdate(new List() { SceneObjectPartSyncProperties.None }); + sceneObject.ScheduleGroupForFullUpdate(null); + + //DSG SYNC: sending NewObject event, and sending it before calling ScheduleGroupForFullUpdate + if (m_parentScene.RegionSyncModule != null && !addedByDelink) + { + m_parentScene.RegionSyncModule.SyncNewObject(sceneObject); + } return true; } @@ -1667,7 +1666,7 @@ namespace OpenSim.Region.Framework.Scenes List rootParts = new List(); List affectedGroups = new List(); - //SYMMETRIC SYNC, record the new object groups after the delink operation + //DSG SYNC, record the new object groups after the delink operation List beforeDelinkGroups = new List(); List afterDelinkGroups = new List(); @@ -1688,7 +1687,7 @@ namespace OpenSim.Region.Framework.Scenes if (!affectedGroups.Contains(group)) { affectedGroups.Add(group); - //SYMMETRIC SYNC + //DSG SYNC beforeDelinkGroups.Add(group); } } @@ -1705,7 +1704,7 @@ namespace OpenSim.Region.Framework.Scenes // handled further. Do the honors here. child.ParentGroup.HasGroupChanged = true; - //SYMMETRIC SYNC, delay ScheduleGroupForFullUpdate till the end of the delink operations. + //DSG SYNC, delay ScheduleGroupForFullUpdate till the end of the delink operations. //child.ParentGroup.ScheduleGroupForFullUpdate(); afterDelinkGroups.Add(child.ParentGroup); } @@ -1777,7 +1776,7 @@ namespace OpenSim.Region.Framework.Scenes g.TriggerScriptChangedEvent(Changed.LINK); g.HasGroupChanged = true; // Persist - //SYMMETRIC SYNC, delay ScheduleGroupForFullUpdate till the end of the delink operations. + //DSG SYNC, delay ScheduleGroupForFullUpdate till the end of the delink operations. //g.ScheduleGroupForFullUpdate(); afterDelinkGroups.Add(g); } @@ -2053,7 +2052,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion // REGION SYNC - #region SYMMETRIC SYNC + #region DSG SYNC public Scene.ObjectUpdateResult UpdateObjectBySynchronization(SceneObjectGroup updatedSog) { @@ -2246,7 +2245,7 @@ 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 - //SYMMETRIC SYNC: need to copy value w/o trigger UpdateBucketSyncInfo + //DSG SYNC: need to copy value w/o trigger UpdateBucketSyncInfo //child.RootPart.ObjectSaleType = 0; //child.RootPart.SalePrice = 10; //child.RootPart.SetObjectSaleType(0); @@ -2407,6 +2406,7 @@ namespace OpenSim.Region.Framework.Scenes } else { + //No longer calling update prim's properties here, caller will do that //localAfterGroup.UpdateObjectGroupBySync(incomingAfterDelinkGroupsDictionary[localAfterGroup.UUID]); } } @@ -2556,6 +2556,17 @@ namespace OpenSim.Region.Framework.Scenes return localPart.UpdateBucketProperties(bucketName, updatedPart, bucketSyncInfo); } - #endregion //SYMMETRIC SYNC + protected internal bool AddNewSceneObjectByDelink(SceneObjectGroup sceneObject, bool attachToBackup, bool sendClientUpdates) + { + // Ensure that we persist this new scene object if it's not an + // attachment + if (attachToBackup) + sceneObject.HasGroupChanged = true; + + bool addedByDelink = true; + return AddSceneObject(sceneObject, attachToBackup, sendClientUpdates, addedByDelink); + } + + #endregion //DSG SYNC } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 2268e61117..7d1983d90d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -498,7 +498,7 @@ namespace OpenSim.Region.Framework.Scenes #region Constructors - //SYMMETRIC SYNC + //DSG SYNC public SceneObjectGroup(SceneObjectPart part, bool newGroupBySync) { if (!newGroupBySync) @@ -627,7 +627,7 @@ namespace OpenSim.Region.Framework.Scenes // for the same object with very different properties. The caller must schedule the update. //ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC if (m_scene.RegionSyncModule != null) { foreach (SceneObjectPart part in Parts) @@ -1212,7 +1212,7 @@ namespace OpenSim.Region.Framework.Scenes { SceneObjectPart part = parts[i]; - //SYMMETRIC SYNC: object remove should be handled through RegionSyncModule + //DSG SYNC: object remove should be handled through RegionSyncModule /* // REGION SYNC if (Scene.IsSyncedServer()) @@ -1221,7 +1221,7 @@ namespace OpenSim.Region.Framework.Scenes //return; } * */ - //end of SYMMETRIC SYNC + //end of DSG SYNC Scene.ForEachScenePresence(delegate(ScenePresence avatar) { @@ -1366,13 +1366,13 @@ namespace OpenSim.Region.Framework.Scenes return; } - //SYMMETRIC SYNC + //DSG SYNC //if we are doing sync across different sync nodes, and are not told to persist the state, don't do anything (only persistence actor will do it) if (m_scene.RegionSyncModule != null && !ToPersistObjectState) { return; } - //end of SYMMETRIC SYNC + //end of DSG SYNC // Since this is the top of the section of call stack for backing up a particular scene object, don't let // any exception propogate upwards. @@ -2200,11 +2200,11 @@ namespace OpenSim.Region.Framework.Scenes //HasGroupChanged = true; //ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC //The DeleteObject message will be enqueued to be sent out by another thread, and the call will return quickly. //if (m_scene.RegionSyncModule != null) // m_scene.RegionSyncModule.SendDeleteObject(objectGroup, true); - //end of SYMMETRIC SYNC + //end of DSG SYNC } @@ -2307,7 +2307,11 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); - m_scene.AddNewSceneObject(objectGroup, true); + //m_scene.AddNewSceneObject(objectGroup, true); + //DSG SYNC: calling AddNewSceneObjectByDelink, so that later on we know + //the "new" object is added by delink operation, no need to send sync + //message of NewObject + m_scene.AddNewSceneObjectByDelink(objectGroup, true, true); if (sendEvents) linkPart.TriggerScriptChangedEvent(Changed.LINK); @@ -3556,7 +3560,7 @@ namespace OpenSim.Region.Framework.Scenes } #endregion - #region SYMMETRIC SYNC + #region DSG SYNC private bool m_toPersistObjectState = false; public bool ToPersistObjectState @@ -3779,14 +3783,11 @@ 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 delinkPart, bool sendEvents) { - // m_log.DebugFormat( - // "[SCENE OBJECT GROUP]: Delinking part {0}, {1} from group with root part {2}, {3}", - // linkPart.Name, linkPart.UUID, RootPart.Name, RootPart.UUID); + m_log.DebugFormat( + "[SCENE OBJECT GROUP]: Delinking part {0}, {1}, {4} from group with root part {2}, {3}", + delinkPart.Name, delinkPart.UUID, RootPart.Name, RootPart.UUID, delinkPart.LocalId); SceneObjectPartBase linkPart = (SceneObjectPartBase)delinkPart; linkPart.ClearUndoState(); @@ -3803,9 +3804,7 @@ namespace OpenSim.Region.Framework.Scenes if (parts.Length == 1 && RootPart != null) { // Single prim left - //RootPart.LinkNum = 0; - //RootPart.SetProperty("LinkNum", 0); - ((SceneObjectPartBase)RootPart).LinkNum = 0; + RootPart.LinkNum = 0; } else { @@ -3815,16 +3814,13 @@ namespace OpenSim.Region.Framework.Scenes if (part.LinkNum > linkPart.LinkNum) { part.LinkNum--; - //int linkNum = part.LinkNum - 1; - //part.SetProperty("LinkNum", linkNum); } } } } - linkPart.ParentID = 0; //ParentID is a value set only locally and ignored in synchronization, so no need to call SetProperty to set its value + linkPart.ParentID = 0; //ParentID is a value set only locally and ignored in synchronization, so no need to set its value linkPart.LinkNum = 0; - //linkPart.SetParentID(0); if (linkPart.PhysActor != null) { @@ -3843,15 +3839,6 @@ namespace OpenSim.Region.Framework.Scenes linkPart.OffsetPosition = new Vector3(0, 0, 0); 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); - //linkPart.SetProperty("OffsetPosition", new Vector3(axPos.X, axPos.Y, axPos.Z)); - //linkPart.SetProperty("GroupPosition", AbsolutePosition + linkPart.OffsetPosition); - //linkPart.SetProperty("OffsetPosition", new Vector3(0, 0, 0)); - //linkPart.SetProperty("RotationOffset", worldRot); - //SceneObjectGroup objectGroup = new SceneObjectGroup(linkPart); bool newGroupBySync = true; SceneObjectGroup objectGroup = new SceneObjectGroup(delinkPart, newGroupBySync); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 145ee80f89..6a2a00e0f9 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -129,7 +129,7 @@ namespace OpenSim.Region.Framework.Scenes #region Fields - //SYMMETRIC SYNC + //DSG SYNC //public bool AllowedDrop; private bool m_allowedDrop; public bool AllowedDrop @@ -2933,7 +2933,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Schedules this prim for a full update /// - //public void ScheduleFullUpdate() :: SYMMETRIC SYNC: changed the interface so that we can identify which property triggers calling this function + //public void ScheduleFullUpdate() :: DSG SYNC: changed the interface so that we can identify which property triggers calling this function public virtual void ScheduleFullUpdate(List updatedProperties) { // m_log.DebugFormat("[SCENE OBJECT PART]: Scheduling full update for {0} {1}", Name, LocalId); @@ -3202,7 +3202,7 @@ namespace OpenSim.Region.Framework.Scenes } ClearUpdateSchedule(); - //SYMMETRIC SYNC + //DSG SYNC //KittyL: 04/06/2011, No longer calling QueueSceneObjectPartForUpdate //from here. Local updates are now recorded by calling IRegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(). /* @@ -3211,7 +3211,7 @@ namespace OpenSim.Region.Framework.Scenes m_parentGroup.Scene.RegionSyncModule.QueueSceneObjectPartForUpdate((SceneObjectPart)this); } * */ - //end of SYMMETRIC SYNC + //end of DSG SYNC } /// @@ -4983,7 +4983,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion - #region SYMMETRIC SYNC + #region DSG SYNC //Time stamp for the most recent update on this prim. We only have one time-stamp per prim for now. //The goal is to evetually have time-stamp per property bucket for each prim. @@ -4998,7 +4998,7 @@ namespace OpenSim.Region.Framework.Scenes } - //SYMMETRIC SYNC + //DSG SYNC //Information for concurrency control of one bucket of prim proproperties. public class BucketSyncInfo @@ -6142,5 +6142,5 @@ namespace OpenSim.Region.Framework.Scenes } - //end of SYMMETRIC SYNC + //end of DSG SYNC } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index ce093d6f08..244af48b84 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs @@ -545,7 +545,7 @@ namespace OpenSim.Region.Framework.Scenes HasInventoryChanged = true; m_part.ParentGroup.HasGroupChanged = true; - //SYMMETRIC SYNC: add ScheduleFullUpdate to enable synchronization across actors + //DSG SYNC: add ScheduleFullUpdate to enable synchronization across actors m_part.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.TaskInventory, SceneObjectPartSyncProperties.InventorySerial}); } @@ -1180,7 +1180,7 @@ namespace OpenSim.Region.Framework.Scenes #endregion REGION SYNC } - #region SYMMETRIC SYNC + #region DSG SYNC public class SceneObjectPartInventory : SceneObjectPartInventoryBase { private SceneObjectPart m_part; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 5a7ca5dc5a..c148bb9de0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -215,7 +215,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization sceneObject.AddPart(part); - //SYMMETRIC SYNC + //DSG SYNC //KittyL: 12/27/2010, added ActorID for symmetric synch model //part.SetLastUpdateActorID(); @@ -329,7 +329,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); - //SYMMETRIC SYNC + //DSG SYNC m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags); //m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp); //m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID); @@ -340,7 +340,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("AggregateScriptEvents", ProcessAggregateScriptEvents); m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo); - //end of SYMMETRIC SYNC + //end of DSG SYNC #endregion @@ -425,7 +425,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } #region SOPXmlProcessors - //SYMMETRIC SYNC NOTE: -- assignments in de-serialization should directly set the values w/o triggering SceneObjectPart.UpdateBucketSyncInfo; + //DSG SYNC NOTE: -- assignments in de-serialization should directly set the values w/o triggering SceneObjectPart.UpdateBucketSyncInfo; private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader) { obj.AllowedDrop = Util.ReadBoolean(reader); @@ -706,7 +706,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization obj.ParticleSystem = Convert.FromBase64String(reader.ReadElementContentAsString("ParticleSystem", String.Empty)); } - //SYMMETRIC SYNC + //DSG SYNC /* private static void ProcessUpdateTimeStamp(SceneObjectPart obj, XmlTextReader reader) { @@ -799,7 +799,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization reader.ReadEndElement(); // BucketSyncInfoList } - //end of SYMMETRIC SYNC + //end of DSG SYNC #endregion @@ -1271,10 +1271,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization writer.WriteElementString("GroupMask", sop.GroupMask.ToString()); writer.WriteElementString("EveryoneMask", sop.EveryoneMask.ToString()); writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString()); - //SYMMETRIC SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors + //DSG SYNC: also serialize SceneObjectPart:LocalFlags, so that it can be propogated across actors WriteFlags(writer, "Flags", sop.Flags.ToString(), options); WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options); - //end SYMMETRIC SYNC + //end DSG SYNC WriteUUID(writer, "CollisionSound", sop.CollisionSound, options); writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString()); if (sop.MediaUrl != null) @@ -1282,7 +1282,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization WriteBytes(writer, "TextureAnimation", sop.TextureAnimation); WriteBytes(writer, "ParticleSystem", sop.ParticleSystem); - //SYMMETRIC SYNC + //DSG SYNC //These properties are only meaningful for synchronization purpose. For saving oar files, they are not necessary. //We may remove these if later we use a different method to encode object properties for synchronization. WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options); @@ -1291,12 +1291,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization //writer.WriteElementString("IsAttachment", sop.IsAttachment.ToString().ToLower()); //IsAttachment is written last, so that on deserialization, it will be deserialized later than other Attachment properties WriteFlags(writer, "AggregateScriptEvents", sop.AggregateScriptEvents.ToString(), options); WriteBucketSyncInfo(writer, sop.BucketSyncInfoList); - //end of SYMMETRIC SYNC + //end of DSG SYNC writer.WriteEndElement(); } - //SYMMETRIC SYNC + //DSG SYNC public static void WriteBucketSyncInfo(XmlTextWriter writer, Dictionary bucketSyncInfoList) { if (bucketSyncInfoList!=null || bucketSyncInfoList.Count > 0) // otherwise skip this @@ -1318,7 +1318,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } - //end of SYMMETRIC SYNC + //end of DSG SYNC static void WriteUUID(XmlTextWriter writer, string name, UUID id, Dictionary options) { diff --git a/OpenSim/Region/Framework/Scenes/UndoState.cs b/OpenSim/Region/Framework/Scenes/UndoState.cs index e4fc6f08a9..4ec6e155c7 100644 --- a/OpenSim/Region/Framework/Scenes/UndoState.cs +++ b/OpenSim/Region/Framework/Scenes/UndoState.cs @@ -94,7 +94,7 @@ namespace OpenSim.Region.Framework.Scenes if (Scale != Vector3.Zero) part.Resize(Scale); //part.ParentGroup.ScheduleGroupForTerseUpdate(); - //SYMMETRIC SYNC + //DSG SYNC List updatedProperties = new List(); updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) @@ -110,7 +110,7 @@ namespace OpenSim.Region.Framework.Scenes part.UpdateRotation(Rotation); if (Scale != Vector3.Zero) part.Resize(Scale); //part.ScheduleTerseUpdate(); - //SYMMETRIC SYNC + //DSG SYNC List updatedProperties = new List(); updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); if (Position != Vector3.Zero) @@ -138,7 +138,7 @@ namespace OpenSim.Region.Framework.Scenes if (Scale != Vector3.Zero) part.Resize(Scale); //part.ParentGroup.ScheduleGroupForTerseUpdate(); - //SYMMETRIC SYNC + //DSG SYNC List updatedProperties = new List(); if (Rotation != Quaternion.Identity) updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); @@ -157,7 +157,7 @@ namespace OpenSim.Region.Framework.Scenes if (Scale != Vector3.Zero) part.Resize(Scale); //part.ScheduleTerseUpdate(); - //SYMMETRIC SYNC + //DSG SYNC List updatedProperties = new List(); if (Rotation != Quaternion.Identity) updatedProperties.Add(SceneObjectPartSyncProperties.RotationOffset); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 7c1e634f56..a0d4c048cc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3615,7 +3615,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parentPrim.RootPart.CreateSelected = true; parentPrim.HasGroupChanged = true; //parentPrim.ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC //Schedule a LinkObject message for synchronization purpose. This will lead to enqueue a LinkObject message in SyncConnector's outgoingQueue, //so should return quickly. if (World.RegionSyncModule != null) @@ -3625,7 +3625,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children); } m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here - //end of SYMMETRIC SYNC + //end of DSG SYNC if (client != null) parentPrim.GetProperties(client); @@ -3683,11 +3683,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (linknum == ScriptBaseClass.LINK_ROOT) { - //SYMMETRIC SYNC + //DSG SYNC List beforeDelinkGroups = new List(); beforeDelinkGroups.Add(parentPrim); List afterDelinkGroups = new List(); - //end of SYMMETRIC SYNC + //end of DSG SYNC // Restructuring Multiple Prims. List parts = new List(parentPrim.Parts); @@ -3695,19 +3695,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api foreach (SceneObjectPart part in parts) { parentPrim.DelinkFromGroup(part.LocalId, true); - //SYMMETRIC SYNC + //DSG SYNC afterDelinkGroups.Add(part.ParentGroup); } parentPrim.HasGroupChanged = true; //parentPrim.ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC //Send out DelinkObject message to other actors to sychronize their object list if (World.RegionSyncModule != null) { World.RegionSyncModule.SendDeLinkObject(parts, beforeDelinkGroups, afterDelinkGroups); } parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); - //end of SYMMETRIC SYNC + //end of DSG SYNC parentPrim.TriggerScriptChangedEvent(Changed.LINK); if (parts.Count > 0) @@ -3721,13 +3721,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } newRoot.ParentGroup.HasGroupChanged = true; //newRoot.ParentGroup.ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC if (World.RegionSyncModule != null) { World.RegionSyncModule.SendLinkObject(newRoot.ParentGroup, newRoot, new List(newRoot.ParentGroup.Parts)); } newRoot.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); - //end of SYMMETRIC SYNC + //end of DSG SYNC } } @@ -3739,7 +3739,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api parentPrim.DelinkFromGroup(childPrim.LocalId, true); parentPrim.HasGroupChanged = true; //parentPrim.ScheduleGroupForFullUpdate(); - //SYMMETRIC SYNC + //DSG SYNC //Send out DelinkObject message to other actors to sychronize their object list if (World.RegionSyncModule != null) { @@ -3749,7 +3749,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api afterDelinkGroups.Add(childPrim.ParentGroup); World.RegionSyncModule.SendDeLinkObject(new List(parentPrim.Parts), beforeDelinkGroups, afterDelinkGroups); } - //end of SYMMETRIC SYNC + //end of DSG SYNC parentPrim.TriggerScriptChangedEvent(Changed.LINK); } @@ -3762,12 +3762,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (parentPrim.RootPart.AttachmentPoint != 0) return; // Fail silently if attached - //SYMMETRIC SYNC + //DSG SYNC List beforeDelinkGroups = new List(); beforeDelinkGroups.Add(parentPrim); List afterDelinkGroups = new List(); SceneObjectPart rootPart = parentPrim.RootPart; - //end of SYMMETRIC SYNC + //end of DSG SYNC List parts = new List(parentPrim.Parts); parts.Remove(parentPrim.RootPart); @@ -3776,7 +3776,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { parentPrim.DelinkFromGroup(part.LocalId, true); parentPrim.TriggerScriptChangedEvent(Changed.LINK); - //SYMMETRIC SYNC + //DSG SYNC afterDelinkGroups.Add(part.ParentGroup); } parentPrim.HasGroupChanged = true; @@ -3789,7 +3789,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api World.RegionSyncModule.SendDeLinkObject(parts, beforeDelinkGroups, afterDelinkGroups); } parentPrim.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); - //end of SYMMETRIC SYNC + //end of DSG SYNC } public LSL_String llGetLinkKey(int linknum) From b182e3bf30771e294e6f66ecacee9315dd389181 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Wed, 20 Apr 2011 17:34:55 -0700 Subject: [PATCH 23/36] In SyncLinkObject and SyncDelinkObject, copy property values from linked/delinked SOP values to those in PrimSyncInfo, before sending out sync messages. --- .../SymmetricSync/RegionSyncModule.cs | 46 +++++++++++++++---- OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++-- .../Framework/Scenes/SceneObjectPart.cs | 11 +++-- 3 files changed, 51 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index e3ea30c4d4..5148f3a283 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -603,12 +603,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (children.Count == 0) return; + //the group is just linked, each part has quite some properties changed + //(OffsetPosition, etc). Need to sync the property values in PrimSyncInfoManager + //first + foreach (SceneObjectPart part in linkedGroup.Parts) + { + m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, new List { SceneObjectPartSyncProperties.FullUpdate }); + } + + if (!IsSyncingWithOtherSyncNodes()) { //no SyncConnector connected. Do nothing. return; } + //Now encode the linkedGroup for sync OSDMap data = new OSDMap(); OSDMap encodedSOG = SceneObjectEncoder(linkedGroup); data["linkedGroup"] = encodedSOG; @@ -634,6 +644,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (prims.Count == 0 || beforeDelinkGroups.Count == 0) return; + //the prims are just delinked, each part has quite some properties changed + //(OffsetPosition, etc). Need to sync the property values in PrimSyncInfoManager + //first + foreach (SceneObjectPart part in prims) + { + m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, new List { SceneObjectPartSyncProperties.FullUpdate }); + } + + if (!IsSyncingWithOtherSyncNodes()) { //no SyncConnector connected. Do nothing. @@ -2386,10 +2405,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule List propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); //SYNC DEBUG - //if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) - //{ - // m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); - //} + if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents)) + { + m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); + } if (propertiesUpdated.Count > 0) { @@ -2419,6 +2438,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule Dictionary primsSyncInfo; SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); + //TEMP DEBUG + m_log.DebugFormat("{0}: received linkedGroup: {1}", LogHeader, linkedGroup.DebugObjectUpdateResult()); + //m_log.DebugFormat(linkedGroup.DebugObjectUpdateResult()); + if (linkedGroup == null) { m_log.WarnFormat("{0}: HandleSyncLinkObject, no valid Linked-Group has been deserialized", LogHeader); @@ -3642,12 +3665,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); //SYNC DEBUG - /* - if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + + if (updatedProperties.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents)) { - m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); + m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); } - * */ + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); @@ -4802,6 +4825,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_UUID = id; InitPropertiesSyncInfoFromOSDMap(primSyncInfoData); + m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } #endregion //Constructors @@ -5169,6 +5193,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //copy from SOP's data m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AggregateScriptEvents); propertyUpdatedByLocal = true; + + //TEMP DEBUG + m_log.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents); } else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { @@ -6410,6 +6437,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /////////////////////// case SceneObjectPartSyncProperties.AggregateScriptEvents: part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; + + m_log.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents); + break; case SceneObjectPartSyncProperties.AllowedDrop: part.AllowedDrop = (bool)pSyncInfo.LastUpdateValue; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c1e8ed6b06..6bfd07ac73 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -791,8 +791,8 @@ namespace OpenSim.Region.Framework.Scenes /// public void LinkObjectBySync(SceneObjectGroup linkedGroup, UUID rootID, List childrenIDs) { - //m_log.Debug("Start to LinkObjectBySync"); - //DebugSceneObjectGroups(); + m_log.Debug("Start to LinkObjectBySync"); + DebugSceneObjectGroups(); List children = new List(); SceneObjectPart root = GetSceneObjectPart(rootID); @@ -813,7 +813,9 @@ namespace OpenSim.Region.Framework.Scenes continue; } - //m_log.Debug("to link part " + part.DebugObjectPartProperties()); + //TEMP DEBUG + m_log.Debug("to link part " + part.DebugObjectPartProperties()); + string partNames = ""; foreach (SceneObjectPart child in part.ParentGroup.Parts) { @@ -836,14 +838,14 @@ namespace OpenSim.Region.Framework.Scenes //localGroup.UpdateObjectGroupBySync(linkedGroup); //debug - /* + m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult()); m_log.Debug("parts before linking now have properties: "); foreach (SceneObjectPart part in children) { m_log.Debug(part.DebugObjectPartProperties()); } - * */ + } /// diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6a2a00e0f9..a2f8b20465 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5469,11 +5469,12 @@ namespace OpenSim.Region.Framework.Scenes public string DebugObjectPartProperties() { string debugMsg = "UUID " + UUID + ", Name " + Name + ", localID " + LocalId; - debugMsg += ", parentID " + ParentID + ", parentUUID " + ParentUUID; - foreach (KeyValuePair pair in m_bucketSyncInfoList) - { - debugMsg += ", Bucket " + pair.Key + ": TimeStamp - " + pair.Value.LastUpdateTimeStamp + ", ActorID - " + pair.Value.LastUpdateActorID; - } + //debugMsg += ", parentID " + ParentID + ", parentUUID " + ParentUUID; + //foreach (KeyValuePair pair in m_bucketSyncInfoList) + //{ + // debugMsg += ", Bucket " + pair.Key + ": TimeStamp - " + pair.Value.LastUpdateTimeStamp + ", ActorID - " + pair.Value.LastUpdateActorID; + //} + debugMsg += ", AggregateScriptEvents = " + AggregateScriptEvents.ToString()+", OffsetPosition: "+OffsetPosition; return debugMsg; } From 68375822cd4ad00e2170bc2a920852b0105dcede Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Thu, 21 Apr 2011 17:44:07 -0700 Subject: [PATCH 24/36] Fixed code so that when GroupPosition or Position is synced between PrimSyncInfoManager and SOP, the other will be udpated properly as well. Also, in SOP.aggregateScriptEvents, add AggregateScriptEvents as one property that has changed. --- .../SymmetricSync/RegionSyncModule.cs | 115 +++++++++++++++++- .../Framework/Scenes/Scene.Inventory.cs | 6 + .../Framework/Scenes/SceneObjectGroup.cs | 2 +- .../Framework/Scenes/SceneObjectPart.cs | 2 +- 4 files changed, 120 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 5148f3a283..17e2bd9c7f 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1965,7 +1965,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.WarnFormat("SyncStateReport -- SOG: name {0}, UUID {1}, position {2}", sog.Name, sog.UUID, sog.AbsolutePosition); foreach (SceneObjectPart part in sog.Parts) { - m_log.WarnFormat(" -- part {0}, UUID {1}, LocalID {2}, offset-position {3}", part.Name, part.UUID, part.LocalId, part.OffsetPosition); + Vector3 pos = Vector3.Zero; + if (part.PhysActor != null) + { + pos = part.PhysActor.Position; + } + m_log.WarnFormat(" -- part {0}, UUID {1}, LocalID {2}, GroupPos {3}, offset-position {4}, Position {5}, AggregateScriptEvents ={6}, Flags = {7}, LocalFlags {8}", + part.Name, part.UUID, part.LocalId, part.GroupPosition, part.OffsetPosition, + pos, part.AggregateScriptEvents, part.Flags, part.LocalFlags); } } @@ -5320,7 +5327,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { //overwrite SOP's data - part.ClickAction = (byte)m_propertiesSyncInfo[property].LastUpdateValue; + SetSOPCollisionSound(part, (UUID)m_propertiesSyncInfo[property].LastUpdateValue); } } break; @@ -5506,6 +5513,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; case SceneObjectPartSyncProperties.GroupPosition: + /* if (!part.GroupPosition.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -5519,6 +5527,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule part.GroupPosition = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; } } + * */ + propertyUpdatedByLocal = CompareAndUpdateSOPGroupPosition(part, lastUpdateByLocalTS, syncID); break; case SceneObjectPartSyncProperties.InventorySerial: if (!part.InventorySerial.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) @@ -6134,6 +6144,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } break; case SceneObjectPartSyncProperties.Position: + /* if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -6147,6 +6158,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule part.PhysActor.Position = (Vector3)m_propertiesSyncInfo[property].LastUpdateValue; } } + * */ + propertyUpdatedByLocal = CompareAndUpdateSOPPosition(part, lastUpdateByLocalTS, syncID); break; case SceneObjectPartSyncProperties.RotationalVelocity: if (!part.PhysActor.RotationalVelocity.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) @@ -6466,7 +6479,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule part.ClickAction = (byte)pSyncInfo.LastUpdateValue; break; case SceneObjectPartSyncProperties.CollisionSound: - part.CollisionSound = (UUID)pSyncInfo.LastUpdateValue; + //part.CollisionSound = (UUID)pSyncInfo.LastUpdateValue; + SetSOPCollisionSound(part, (UUID)pSyncInfo.LastUpdateValue); break; case SceneObjectPartSyncProperties.CollisionSoundVolume: part.CollisionSoundVolume = (float)pSyncInfo.LastUpdateValue; @@ -6674,6 +6688,101 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //part.ScheduleFullUpdate(new List() { property }); } + //Do not call "part.CollisionSound =" to go through its set function. + //We don't want the side effect of calling aggregateScriptEvents. + private void SetSOPCollisionSound(SceneObjectPart part, UUID cSound) + { + if (part.UpdateCollisionSound(cSound)) + { + part.ParentGroup.Scene.EventManager.TriggerAggregateScriptEvents(part); + } + } + + //In SOP's implementation, GroupPosition and SOP.PhysActor.Position are + //correlated. We need to make sure that they are both properly synced. + private bool CompareAndUpdateSOPGroupPosition(SceneObjectPart part, long lastUpdateByLocalTS, string syncID) + { + if (!part.GroupPosition.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateTimeStamp) + { + //Update cached value with SOP.GroupPosition + m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.GroupPosition); + + //Also may need to cached PhysActor.Position + if (part.PhysActor != null) + { + if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateValue)) + { + m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Position); + } + + } + return true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateTimeStamp) + { + //overwrite SOP's data, set function of GroupPosition updates PhysActor.Position as well + part.GroupPosition = (Vector3)m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateValue; + + //PhysActor.Position is just updated by setting GroupPosition + //above, so need to update the cached value of Position here. + if (part.PhysActor != null) + { + if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateValue)) + { + //Set the timestamp and syncID to be the same with GroupPosition + long lastUpdateTimestamp = m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateTimeStamp; + string lastUpdateSyncID = m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateSyncID; + m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].UpdateSyncInfoByLocal(lastUpdateTimestamp, + lastUpdateSyncID, (Object)part.PhysActor.Position); + } + } + } + } + return false; + } + + private bool CompareAndUpdateSOPPosition(SceneObjectPart part, long lastUpdateByLocalTS, string syncID) + { + if (part.PhysActor == null) + return false; + + if (!part.PhysActor.Position.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateTimeStamp) + { + //Update SOP.PhysActor.Position + m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.PhysActor.Position); + + //Also may need to update SOP.GroupPosition (especially for root parts) + if (!part.GroupPosition.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateValue)) + { + //Update SOP.GroupPosition + m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.GroupPosition); + } + return true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateTimeStamp) + { + //overwrite PhysActor's data with the cached value + part.PhysActor.Position = (Vector3)m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateValue; + + //GroupPosition may change due to PhysActor.Position changes, + //especially for root parts. Sync the value of GroupPosition. + if (!part.GroupPosition.Equals(m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].LastUpdateValue)) + { + //Need to reset SOP.GroupPosition to the cached value here + //Set the timestamp and syncID to be the same with Position + long lastUpdateTimestamp = m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateTimeStamp; + string lastUpdateSyncID = m_propertiesSyncInfo[SceneObjectPartSyncProperties.Position].LastUpdateSyncID; + m_propertiesSyncInfo[SceneObjectPartSyncProperties.GroupPosition].UpdateSyncInfoByLocal(lastUpdateTimestamp, + lastUpdateSyncID, (Object)part.GroupPosition); + } + } + } + return false; + } } public class PrimSyncInfoManager diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 82a3e1a408..d8812da145 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -2337,6 +2337,9 @@ namespace OpenSim.Region.Framework.Scenes List children = new List(); SceneObjectPart root = GetSceneObjectPart(parentPrimId); + //DSG DEBUG + m_log.Debug("Scene.LinkObjects -- ROOT: " + root.DebugObjectPartProperties()); + if (root == null) { m_log.DebugFormat("[LINK]: Can't find linkset root prim {0}", parentPrimId); @@ -2356,6 +2359,9 @@ namespace OpenSim.Region.Framework.Scenes if (part == null) continue; + //DSG DEBUG + m_log.Debug("Scene.LinkObjects -- child to link: " + part.DebugObjectPartProperties()); + if (!owners.Contains(part.OwnerID)) owners.Add(part.OwnerID); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 7d1983d90d..0abed55c0e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1291,7 +1291,7 @@ namespace OpenSim.Region.Framework.Scenes } //ScheduleGroupForFullUpdate(); - ScheduleGroupForFullUpdate(new List(){ SceneObjectPartSyncProperties.Flags}); //do we also need to synchronize SOG properties such as m_scriptListens_atRotTarget? (does any acotr other than script engine care about it?) + ScheduleGroupForFullUpdate(new List(){ SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.AggregateScriptEvents}); //do we also need to synchronize SOG properties such as m_scriptListens_atRotTarget? (does any acotr other than script engine care about it?) } public void SetText(string text, Vector3 color, double alpha) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index a2f8b20465..233e43568d 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -6103,7 +6103,7 @@ namespace OpenSim.Region.Framework.Scenes base.ScheduleFullUpdate(null); } - private bool UpdateCollisionSound(UUID updatedCollisionSound) + public bool UpdateCollisionSound(UUID updatedCollisionSound) { if (this.CollisionSound != updatedCollisionSound) { From 3076761d774479b428b5439f402490532d8193d6 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 22 Apr 2011 10:39:36 -0700 Subject: [PATCH 25/36] For group properties, only trigger SendPrimPropertyUpdates for the rootpart, to avoid multiple updates (each through a different part in the SOG) to update the same property. Also, change m_log in PrimSyncInfo and PropertySyncInfo to a class static variable, to reduce initiation cost. --- .../SymmetricSync/RegionSyncModule.cs | 95 +++++++++++-------- .../Framework/Scenes/SceneObjectGroup.cs | 18 +++- .../Framework/Scenes/SceneObjectPart.cs | 6 +- 3 files changed, 74 insertions(+), 45 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 17e2bd9c7f..9331dc1fa6 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -102,6 +102,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SyncStatisticCollector.LogFileHeader = m_sysConfig.GetString("SyncLogFileHeader", "sync-"); //initialize PrimSyncInfoManager + PrimSyncInfoManager.DebugLog = m_log; + PrimSyncInfo.DebugLog = m_log; + PropertySyncInfo.DebugLog = m_log; int syncInfoAgeOutSeconds = m_sysConfig.GetInt("PrimSyncInfoAgeOutSeconds", 300); //unit of seconds TimeSpan tSpan = new TimeSpan(0, 0, syncInfoAgeOutSeconds); m_primSyncInfoManager = new PrimSyncInfoManager(this, tSpan.Ticks); @@ -3506,7 +3509,28 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //and should be propogated to other sync nodes. HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); - //Enqueue the prim with the set of updated properties + /* + //For group properties, we only need to send it once per SOG, + //hence only enqueue it with root part + foreach (SceneObjectPartSyncProperties groupProperty in SceneObjectPart.GetGroupProperties()) + { + if (propertiesWithSyncInfoUpdated.Contains(groupProperty)) + { + SceneObjectPart rootpart = part.ParentGroup.RootPart; + if (m_primPropertyUpdates.ContainsKey(rootpart.UUID)) + { + m_primPropertyUpdates[rootpart.UUID].Add(groupProperty); + } + else + { + m_primPropertyUpdates.Add(rootpart.UUID, new HashSet() { groupProperty }); + } + } + propertiesWithSyncInfoUpdated.Remove(groupProperty); + } + * */ + + //Enqueue the prim with the set of updated properties, excluding the group properties if (propertiesWithSyncInfoUpdated.Count > 0) { lock (m_primPropertyUpdateLock) @@ -4008,7 +4032,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public class PropertySyncInfo { - private ILog m_log = null; + //private ILog m_log; + public static ILog DebugLog; private long m_lastUpdateTimeStamp; public long LastUpdateTimeStamp @@ -4065,8 +4090,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public PropertySyncInfo(SceneObjectPartSyncProperties property) { m_property = property; - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - } public PropertySyncInfo(SceneObjectPartSyncProperties property, Object initValue, long initTS, string syncID) @@ -4084,8 +4107,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_lastUpdateValueHash = GetPropertyHashValue((string)initValue); break; } - - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } /// @@ -4095,7 +4116,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public PropertySyncInfo(SceneObjectPartSyncProperties property, OSDMap syncData) { - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); m_property = property; FromOSDMap(syncData); } @@ -4160,7 +4180,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (!m_lastUpdateSyncID.Equals(pSyncInfo.LastUpdateSyncID)) { - m_log.WarnFormat("CompareAndUpdateSyncInfoBySync: property {0} being updated by {1} and {2} at the same time. Do nothing as of current implementation. TO RESOLVE.", + DebugLog.WarnFormat("CompareAndUpdateSyncInfoBySync: property {0} being updated by {1} and {2} at the same time. Do nothing as of current implementation. TO RESOLVE.", m_property, m_lastUpdateSyncID, pSyncInfo.LastUpdateSyncID); } } @@ -4205,11 +4225,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return m_lastUpdateValue.Equals(pValue); } - public void SetLog(ILog log) - { - m_log = log; - } - /// /// Convert the value of the given property to OSD type. /// @@ -4406,7 +4421,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule break; default: - m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); + DebugLog.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); break; } return propertyData; @@ -4421,7 +4436,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (!propertyData.ContainsKey("LastUpdateTimeStamp")) { - m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateTimeStamp"); + DebugLog.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateTimeStamp"); } else { @@ -4430,7 +4445,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (!propertyData.ContainsKey("LastUpdateSyncID")) { - m_log.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); + DebugLog.WarnFormat("PrimSynInfo.FromOSDMap -- OSDMap missing LastUpdateSyncID"); } else { @@ -4652,7 +4667,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule break; default: - m_log.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); + DebugLog.WarnFormat("PrimSynInfo.PropertyToOSD -- no handler for property {0} ", m_property); break; } @@ -4786,7 +4801,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { #region Members public static long TimeOutThreshold; - + public static ILog DebugLog; + private Dictionary m_propertiesSyncInfo = new Dictionary(); public Dictionary PropertiesSyncInfo { @@ -4804,7 +4820,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { get { return m_UUID; } } - private ILog m_log; + private Object m_primSyncInfoLock = new Object(); private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); private static HashSet PrimPhysActorProperties = SceneObjectPart.GetAllPhysActorProperties(); @@ -4818,21 +4834,16 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { m_UUID = part.UUID; InitPropertiesSyncInfo(part, initUpdateTimestamp, syncID); - - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - //m_fullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); } public PrimSyncInfo() { - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } public PrimSyncInfo(UUID id, OSDMap primSyncInfoData) { m_UUID = id; InitPropertiesSyncInfoFromOSDMap(primSyncInfoData); - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } #endregion //Constructors @@ -4880,7 +4891,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (part.PhysActor == null) { - m_log.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); + DebugLog.WarnFormat("PrimSyncInfo: Informed some physics property in SOP updated, yet SOP's PhysActor no longer exsits."); return propertiesToBeSynced; } } @@ -4952,7 +4963,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (!m_propertiesSyncInfo.ContainsKey(property)) { //Should not happen - m_log.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID); + DebugLog.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID); } else { @@ -5027,7 +5038,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[propertyString]); propertiesSyncInfo.Add(propertySyncInfo); }else{ - //m_log.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not a valid SceneObjectPartSyncProperties", propertyString); + //DebugLog.WarnFormat("DecodeAndSetProperiesSyncInfo: Property {0} not a valid SceneObjectPartSyncProperties", propertyString); } } return propertiesSyncInfo; @@ -5045,7 +5056,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SetSOPPropertyValue(sop, property); else { - m_log.WarnFormat("PrimSyncInfoToSOP -- property {0} not in record.", property); + DebugLog.WarnFormat("PrimSyncInfoToSOP -- property {0} not in record.", property); } } return sop; @@ -5095,7 +5106,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - m_log.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); } } } @@ -5202,7 +5213,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule propertyUpdatedByLocal = true; //TEMP DEBUG - m_log.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents); + DebugLog.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents); } else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { @@ -6427,7 +6438,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (part == null) return; if (!m_propertiesSyncInfo.ContainsKey(property)){ - m_log.WarnFormat("SetSOPPropertyValue: property {0} not in record.", property.ToString()); + DebugLog.WarnFormat("SetSOPPropertyValue: property {0} not in record.", property.ToString()); return; } PropertySyncInfo pSyncInfo = m_propertiesSyncInfo[property]; @@ -6451,7 +6462,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.AggregateScriptEvents: part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; - m_log.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents); + DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents); break; case SceneObjectPartSyncProperties.AllowedDrop: @@ -6787,6 +6798,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule public class PrimSyncInfoManager { + //private ILog DebugLog; + public static ILog DebugLog; + /// /// Lock for write-accessing m_primsInSync. We assume accesses to m_primsInSync /// are in the "many reads, a few writes" pattern. Writers needs to lock on it. @@ -6798,8 +6812,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private Object m_primsInSyncLock = new Object(); private Dictionary m_primsInSync; private RegionSyncModule m_regionSyncModule; - private ILog m_log; - + /// /// The max time for a SOP's SyncInfo to sit in record @@ -6817,8 +6830,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_primsInSync = new Dictionary(); m_regionSyncModule = syncModule; m_ageOutThreshold = ageOutTh; - - m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); } public bool IsPrimSyncInfoExist(UUID primUUID) @@ -6866,7 +6877,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule else { //This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message - m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); + DebugLog.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); return new List(); } } @@ -6881,7 +6892,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule else { //This should not happen, as we should only receive UpdatedPrimProperties after receiving a NewObject message - m_log.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); + DebugLog.WarnFormat("PrimSyncInfoManager.UpdatePrimSyncInfoBySync: SOP {0},{1} not in local record of PrimSyncInfo.", part.Name, part.UUID); return new List(); } } @@ -6891,7 +6902,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule OSDMap data = new OSDMap(); if (!m_primsInSync.ContainsKey(primUUID)) { - m_log.WarnFormat("EncodePrimProperties: {0} not in RegionSyncModule's PrimSyncInfo list yet", primUUID); + DebugLog.WarnFormat("EncodePrimProperties: {0} not in RegionSyncModule's PrimSyncInfo list yet", primUUID); return data; } @@ -6916,12 +6927,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet propertiesSyncInfo = new HashSet(); if (!primPropertiesData.ContainsKey("propertyData")) { - m_log.WarnFormat("DecodePrimProperties: propertyData is missing"); + DebugLog.WarnFormat("DecodePrimProperties: propertyData is missing"); return propertiesSyncInfo; } //if(!m_primsInSync.ContainsKey(primUUID)){ - // m_log.WarnFormat("prim {0} not in PrimSyncInfoManager's record"); + // DebugLog.WarnFormat("prim {0} not in PrimSyncInfoManager's record"); // return; //} propertiesSyncInfo = PrimSyncInfo.DecodeProperiesSyncInfo((OSDMap)primPropertiesData["propertyData"]); @@ -6933,7 +6944,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (!primData.ContainsKey("primUUID") || !primData.ContainsKey("propertyData")) { - m_log.WarnFormat("DecodeFullSetPrimProperties: either primUUID or propertyData is missing"); + DebugLog.WarnFormat("DecodeFullSetPrimProperties: either primUUID or propertyData is missing"); return null; } UUID primUUID = primData["primUUID"]; diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 0abed55c0e..b9d8e5e2d3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -1936,13 +1936,29 @@ namespace OpenSim.Region.Framework.Scenes //RootPart.ScheduleFullUpdate(); RootPart.ScheduleFullUpdate(updatedProperties); + //For group properties, we only need to send it once per SOG, + //hence remove them from the updatedProperties for other parts + List otherPartsUpdatedProperties = updatedProperties; + if (updatedProperties!=null) + { + HashSet hashedList = new HashSet(updatedProperties); + foreach (SceneObjectPartSyncProperties groupProperty in SceneObjectPart.GetGroupProperties()) + { + if (updatedProperties.Contains(groupProperty)) + { + hashedList.Remove(groupProperty); + } + } + otherPartsUpdatedProperties = new List(hashedList); + } + SceneObjectPart[] parts = m_parts.GetArray(); for (int i = 0; i < parts.Length; i++) { SceneObjectPart part = parts[i]; if (part != RootPart) //part.ScheduleFullUpdate(); - part.ScheduleFullUpdate(updatedProperties); + part.ScheduleFullUpdate(otherPartsUpdatedProperties); } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 233e43568d..4eed75ea6f 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5228,17 +5228,19 @@ namespace OpenSim.Region.Framework.Scenes Kinematic, CollidingGround, IsColliding, - //TODO!!!! To be handled in serialization/deserizaltion for synchronization + + //Properties need to be synced, but not in xml serializations AggregateScriptEvents, IsAttachment, AttachedAvatar, AttachedPos, AttachmentPoint, //TODO!!!! To be handled in serialization/deserizaltion for synchronization - IsSelected, Sound, //This indicates any Sound related property has changed: Sound, SoundGain, SoundFlags,SoundRadius, //Addition properties to be added here + //Group properties + IsSelected, //Client Manager may want to add some property here that viewers care about and should be synchronized across actors FullUpdate, From cb6630aa354ae9e9c47496077967d99b8ec9a632 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 22 Apr 2011 16:57:22 -0700 Subject: [PATCH 26/36] For functions in PrimSyncInfo that access per property sync info, adding checking of if m_propertiesSyncInfo[property] exists before accessing it. --- .../SymmetricSync/RegionSyncModule.cs | 115 ++++++++++++++---- .../Framework/Scenes/SceneObjectPart.cs | 12 ++ 2 files changed, 104 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 9331dc1fa6..1271c8de08 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -3654,15 +3654,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet updatedProperties = updatedPrimProperties.Value; SendPrimPropertyUpdates(primUUID, updatedProperties); - /* - OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); - - if (syncData.Count > 0) - { - SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedObject, OSDParser.SerializeJsonString(syncData)); - SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); - } - * */ } // Indicate that the current batch of updates has been completed @@ -3682,7 +3673,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (sop == null || sop.ParentGroup.IsDeleted) return; - OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(primUUID, updatedProperties); + OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(sop, updatedProperties); if (syncData.Count > 0) { @@ -3751,7 +3742,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //This should not happen, but we deal with it by inserting a newly created PrimSynInfo m_primSyncInfoManager.InsertPrimSyncInfo(sog.RootPart, DateTime.Now.Ticks, m_syncID); } - data["RootPart"] = m_primSyncInfoManager.EncodePrimProperties(sog.RootPart.UUID, fullPropertyList); + data["RootPart"] = m_primSyncInfoManager.EncodePrimProperties(sog.RootPart, fullPropertyList); //int otherPartsCount = sog.Parts.Length - 1; @@ -3767,7 +3758,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //This should not happen, but we deal with it by inserting a newly created PrimSynInfo m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID); } - OSDMap partData = m_primSyncInfoManager.EncodePrimProperties(part.UUID, fullPropertyList); + OSDMap partData = m_primSyncInfoManager.EncodePrimProperties(part, fullPropertyList); otherPartsArray.Add(partData); } } @@ -4824,6 +4815,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private Object m_primSyncInfoLock = new Object(); private static HashSet FullSetPrimProperties = SceneObjectPart.GetAllPrimProperties(); private static HashSet PrimPhysActorProperties = SceneObjectPart.GetAllPhysActorProperties(); + private static HashSet PrimNonPhysActorProperties = SceneObjectPart.GetAllPrimNonPhysActorProperties(); private static HashSet GroupProperties = SceneObjectPart.GetGroupProperties(); #endregion //Members @@ -4902,7 +4894,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.FullUpdate: //Caller indicated many properties have changed. We need to //compare and update all properties - propertiesToBeSynced = FullSetPrimProperties; + if (part.PhysActor == null) + propertiesToBeSynced = PrimNonPhysActorProperties; + else + propertiesToBeSynced = FullSetPrimProperties; break; //return propertiesToBeSynced; case SceneObjectPartSyncProperties.None: @@ -5006,14 +5001,24 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { - propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + if (m_propertiesSyncInfo.ContainsKey(property)) + propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + else + { + DebugLog.WarnFormat("PrimSyncInfo: property {0} not in sync cache", property); + } } } else { foreach (SceneObjectPartSyncProperties property in propertiesToSync) { - propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + if (m_propertiesSyncInfo.ContainsKey(property)) + propertyData.Add(property.ToString(), m_propertiesSyncInfo[property].ToOSDMap()); + else + { + DebugLog.WarnFormat("PrimSyncInfo: property {0} not in sync cache", property); + } } } } @@ -5056,7 +5061,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SetSOPPropertyValue(sop, property); else { - DebugLog.WarnFormat("PrimSyncInfoToSOP -- property {0} not in record.", property); + //This might just be fine. For phantom objects, they don't have + //PhysActor properties, and those properties would end up here. + + //DebugLog.WarnFormat("PrimSyncInfoToSOP -- property {0} not in record.", property); } } return sop; @@ -5081,7 +5089,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo.Clear(); - foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) + HashSet initPrimProperties; + + if (part.PhysActor == null) + initPrimProperties = PrimNonPhysActorProperties; + else + initPrimProperties = FullSetPrimProperties; + + foreach (SceneObjectPartSyncProperties property in initPrimProperties) { Object initValue = GetSOPPropertyValue(part, property); PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); @@ -5106,7 +5121,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } else { - DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + //For Phantom prims, they don't have PhysActor properties. So this branch could happen. + //DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); } } } @@ -5115,6 +5131,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private bool CompareHashedValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID) { bool updated = false; + if (!m_propertiesSyncInfo.ContainsKey(property)) + { + Object initValue = GetSOPPropertyValue(part, property); + PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, lastUpdateTS, syncID); + m_propertiesSyncInfo.Add(property, syncInfo); + return true; + } switch (property) { case SceneObjectPartSyncProperties.Shape: @@ -5186,7 +5209,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private bool CompareValue_UpdateByLocal(SceneObjectPart part, SceneObjectPartSyncProperties property, long lastUpdateByLocalTS, string syncID) { bool propertyUpdatedByLocal = false; - + + if (!m_propertiesSyncInfo.ContainsKey(property)) + { + Object initValue = GetSOPPropertyValue(part, property); + PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, lastUpdateByLocalTS, syncID); + m_propertiesSyncInfo.Add(property, syncInfo); + return true; + } + //First, check if the value maintained here is different from that //in SOP's. If different, next check if the timestamp in SyncInfo is //bigger (newer) than lastUpdateByLocalTS; if so (although ideally @@ -6260,7 +6291,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } return true; } - + private Object GetSOPPropertyValue(SceneObjectPart part, SceneObjectPartSyncProperties property) { if (part == null) return null; @@ -6392,30 +6423,56 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //PhysActor properties /////////////////////// case SceneObjectPartSyncProperties.Buoyancy: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Buoyancy; case SceneObjectPartSyncProperties.Flying: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Flying; case SceneObjectPartSyncProperties.Force: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Force; case SceneObjectPartSyncProperties.IsColliding: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.IsColliding; case SceneObjectPartSyncProperties.CollidingGround: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.CollidingGround; case SceneObjectPartSyncProperties.IsPhysical: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.IsPhysical; case SceneObjectPartSyncProperties.Kinematic: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Kinematic; case SceneObjectPartSyncProperties.Orientation: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Orientation; case SceneObjectPartSyncProperties.PA_Acceleration: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Acceleration; case SceneObjectPartSyncProperties.Position: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Position; case SceneObjectPartSyncProperties.RotationalVelocity: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.RotationalVelocity; case SceneObjectPartSyncProperties.Size: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Size; case SceneObjectPartSyncProperties.Torque: + if (part.PhysActor == null) + return null; return (Object)part.PhysActor.Torque; /////////////////////// @@ -6438,7 +6495,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (part == null) return; if (!m_propertiesSyncInfo.ContainsKey(property)){ - DebugLog.WarnFormat("SetSOPPropertyValue: property {0} not in record.", property.ToString()); + //DebugLog.WarnFormat("SetSOPPropertyValue: property {0} not in record.", property.ToString()); + //For phantom prims, they don't have physActor properties, + //so for those properties, simply return + return; + } + + if (!m_propertiesSyncInfo.ContainsKey(property)) + { + DebugLog.WarnFormat("PrimSyncInfo: property {0} not in sync cache", property); return; } PropertySyncInfo pSyncInfo = m_propertiesSyncInfo[property]; @@ -6897,9 +6962,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - public OSDMap EncodePrimProperties(UUID primUUID, HashSet updatedProperties) + public OSDMap EncodePrimProperties(SceneObjectPart sop, HashSet updatedProperties) { OSDMap data = new OSDMap(); + UUID primUUID = sop.UUID; if (!m_primsInSync.ContainsKey(primUUID)) { DebugLog.WarnFormat("EncodePrimProperties: {0} not in RegionSyncModule's PrimSyncInfo list yet", primUUID); @@ -6913,7 +6979,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet propertiesToEncoded = updatedProperties; if (updatedProperties.Contains(SceneObjectPartSyncProperties.FullUpdate)) { - propertiesToEncoded = SceneObjectPart.GetAllPrimProperties(); + if (sop.PhysActor != null) + propertiesToEncoded = SceneObjectPart.GetAllPrimProperties(); + else + propertiesToEncoded = SceneObjectPart.GetAllPrimNonPhysActorProperties(); } OSDMap propertyData = m_primsInSync[primUUID].EncodePropertiesSyncInfo(propertiesToEncoded); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4eed75ea6f..5573df2301 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5452,6 +5452,18 @@ namespace OpenSim.Region.Framework.Scenes return allProperties; } + public static HashSet GetAllNonPhysActorProperties() + { + HashSet allProperties = GetAllPrimProperties(); + HashSet physActorProperties = GetAllPhysActorProperties(); + + foreach (SceneObjectPartSyncProperties pProperty in physActorProperties) + { + allProperties.Remove(pProperty); + } + return allProperties; + } + public static HashSet GetGroupProperties() { HashSet allProperties = new HashSet(){SceneObjectPartSyncProperties.IsSelected}; From 49139f53bbaee4798fb8b592319f778be149f3e8 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Fri, 29 Apr 2011 16:49:53 -0700 Subject: [PATCH 27/36] Replaced all calling to SendLinkObject to SyncLinkObject. Added a bunch of debugging message to keep track of Shape updates synchronization. --- .../SymmetricSync/RegionSyncModule.cs | 68 ++++++++++++++++--- .../Framework/Interfaces/IRegionSyncModule.cs | 2 + OpenSim/Region/Framework/Scenes/Scene.cs | 4 +- .../Framework/Scenes/SceneObjectPart.cs | 20 +++++- .../Shared/Api/Implementation/LSL_Api.cs | 11 ++- 5 files changed, 91 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 1271c8de08..a0ec2b30c0 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -699,6 +699,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SendDelinkObjectToRelevantSyncConnectors(m_actorID, beforeDelinkGroups, rsm); } + public void Debug(String debugMsg) + { + m_log.DebugFormat("{0}", debugMsg); + } #endregion //IRegionSyncModule @@ -2409,15 +2413,29 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (PropertySyncInfo p in propertiesSyncInfo) { pString += p.Property.ToString() + " "; + if (p.Property == SceneObjectPartSyncProperties.Shape) + { + PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((String)p.LastUpdateValue); + m_log.DebugFormat("Shaped changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); + //m_log.DebugFormat("SOP {0}, {1} Shape value in incoming message: {1 + } } - m_log.DebugFormat("{0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); + //m_log.DebugFormat("ms {0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", DateTime.Now.Millisecond, sop.Name, sop.UUID, pString); + List propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); //SYNC DEBUG if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents)) { - m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); + //m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); + } + + if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) + { + String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); + m_log.DebugFormat("HandleUpdatedPrimProperties -- SOP {0},{1}, Shape, ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", + sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } if (propertiesUpdated.Count > 0) @@ -2449,7 +2467,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); //TEMP DEBUG - m_log.DebugFormat("{0}: received linkedGroup: {1}", LogHeader, linkedGroup.DebugObjectUpdateResult()); + m_log.DebugFormat(" received linkedGroup: {1}", linkedGroup.DebugObjectUpdateResult()); //m_log.DebugFormat(linkedGroup.DebugObjectUpdateResult()); if (linkedGroup == null) @@ -3530,6 +3548,13 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } * */ + if(updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + string hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); + m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal: Shape of SOP {0}, {1} updated, ProfileShape {2}, hashed value in SOP: {3}, in PrimSyncInfoManager: {4}", + part.Name, part.UUID, part.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(part.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); + } + //Enqueue the prim with the set of updated properties, excluding the group properties if (propertiesWithSyncInfoUpdated.Count > 0) { @@ -3653,6 +3678,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UUID primUUID = updatedPrimProperties.Key; HashSet updatedProperties = updatedPrimProperties.Value; + //Sync the SOP data and cached property values in PrimSyncInfoManager again + //HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); + SendPrimPropertyUpdates(primUUID, updatedProperties); } @@ -3677,7 +3705,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (syncData.Count > 0) { - //SYNC DEBUG + //DSG DEBUG string pString = ""; foreach (SceneObjectPartSyncProperties property in updatedProperties) @@ -3686,13 +3714,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); - //SYNC DEBUG + //DSG DEBUG if (updatedProperties.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents)) { - m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); + // m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); } - + + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); + m_log.DebugFormat("SendPrimPropertyUpdates -- SOP {0},{1}, Shape updated: ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", + sop.Name, sop.UUID, sop.Shape.ProfileShape, + hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); + } + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); @@ -3783,6 +3819,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } + //DSG DEBUG + m_log.DebugFormat("calling AddNewSceneObjectByDecoding for SOG {1}, {2}", group.Name, group.UUID); + //Add the list of PrimSyncInfo to PrimSyncInfoManager's record. m_primSyncInfoManager.InsertMultiPrimSyncInfo(primsSyncInfo); @@ -4052,6 +4091,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } private string m_lastUpdateValueHash = String.Empty; + public String LastUpdateValueHash + { + get {return m_lastUpdateValueHash;} + } /// /// Record the time the last sync message about this property is received. @@ -5152,6 +5195,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); + + //DSG DEBUG + DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1}, updated: hashed value {2}", part.Name, part.UUID, m_propertiesSyncInfo[property].LastUpdateValueHash); + updated = true; } else if (lastUpdateTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -6513,7 +6560,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.Shape: PrimitiveBaseShape shapeVal = PropertySerializer.DeSerializeShape((string)pSyncInfo.LastUpdateValue); if (shapeVal != null) + { part.Shape = shapeVal; + String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); + DebugLog.DebugFormat("prim type of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", + part.Name, part.UUID, hashedShape, pSyncInfo.LastUpdateValueHash); + } break; case SceneObjectPartSyncProperties.TaskInventory: TaskInventoryDictionary taskVal = PropertySerializer.DeSerializeTaskInventory((string)pSyncInfo.LastUpdateValue); @@ -6527,7 +6579,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.AggregateScriptEvents: part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; - DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents); + //DebugLog.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents); break; case SceneObjectPartSyncProperties.AllowedDrop: diff --git a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs index 84c16c7181..e07b498500 100755 --- a/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionSyncModule.cs @@ -101,6 +101,8 @@ namespace OpenSim.Region.Framework.Interfaces //void QueuePresenceForTerseUpdate(ScenePresence presence) //void SendAvatarUpdates(); + //Debug purpose, mainly for LSL scripts + void Debug(String debugMsg); } /// diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6bfd07ac73..b4a35afa0d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -792,7 +792,7 @@ namespace OpenSim.Region.Framework.Scenes public void LinkObjectBySync(SceneObjectGroup linkedGroup, UUID rootID, List childrenIDs) { m_log.Debug("Start to LinkObjectBySync"); - DebugSceneObjectGroups(); + //DebugSceneObjectGroups(); List children = new List(); SceneObjectPart root = GetSceneObjectPart(rootID); @@ -837,7 +837,7 @@ namespace OpenSim.Region.Framework.Scenes //SceneObjectGroup localGroup = root.ParentGroup; //localGroup.UpdateObjectGroupBySync(linkedGroup); - //debug + //DSG DEBUG m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult()); m_log.Debug("parts before linking now have properties: "); diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 5573df2301..3a7453f93b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -42,6 +42,7 @@ using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.Framework.Scenes.Scripting; using OpenSim.Region.Framework.Scenes.Serialization; using OpenSim.Region.Physics.Manager; +using System.IO; namespace OpenSim.Region.Framework.Scenes { @@ -5488,7 +5489,9 @@ namespace OpenSim.Region.Framework.Scenes //{ // debugMsg += ", Bucket " + pair.Key + ": TimeStamp - " + pair.Value.LastUpdateTimeStamp + ", ActorID - " + pair.Value.LastUpdateActorID; //} - debugMsg += ", AggregateScriptEvents = " + AggregateScriptEvents.ToString()+", OffsetPosition: "+OffsetPosition; + debugMsg += ", AggregateScriptEvents = " + AggregateScriptEvents.ToString()+", OffsetPosition: "+OffsetPosition; + String hashedShape = Util.Md5Hash(SerializeShape()); + debugMsg += ", hashed Shape = " + hashedShape; return debugMsg; } @@ -6155,6 +6158,21 @@ namespace OpenSim.Region.Framework.Scenes //Per property sync functions /////////////////////////////////////////////////////////////////////// + + //For debugging, same implemenation with PropertySerializer.SerializeShape + private string SerializeShape() + { + string serializedShape; + using (StringWriter sw = new StringWriter()) + { + using (XmlTextWriter writer = new XmlTextWriter(sw)) + { + SceneObjectSerializer.WriteShape(writer, Shape, new Dictionary()); + } + serializedShape = sw.ToString(); + } + return serializedShape; + } } //end of DSG SYNC diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index a0d4c048cc..b0c296041d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3622,9 +3622,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { //Tell other actors to link the SceneObjectParts together as a new group. //parentGroup.SyncInfoUpdate(); - World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children); + //World.RegionSyncModule.SendLinkObject(parentPrim, parentPrim.RootPart, children); + World.RegionSyncModule.SyncLinkObject(parentPrim, parentPrim.RootPart, children); } - m_host.ScheduleFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //SendLinkObject above will synchronize the link operation, no need to taint updates here + m_host.ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.None }); //SyncLinkObject above will synchronize the link operation, no need to taint updates here //end of DSG SYNC if (client != null) @@ -3724,7 +3725,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api //DSG SYNC if (World.RegionSyncModule != null) { - World.RegionSyncModule.SendLinkObject(newRoot.ParentGroup, newRoot, new List(newRoot.ParentGroup.Parts)); + //World.RegionSyncModule.SendLinkObject(newRoot.ParentGroup, newRoot, new List(newRoot.ParentGroup.Parts)); + World.RegionSyncModule.SyncLinkObject(newRoot.ParentGroup, newRoot, new List(newRoot.ParentGroup.Parts)); } newRoot.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.None}); //end of DSG SYNC @@ -7090,6 +7092,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api code = (int)rules.GetLSLIntegerItem(idx++); + //debug + part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); + remain = rules.Length - idx; float hollow; LSL_Vector twist; From bceafb429186d9b855a2434b69e59670ccbe8f08 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 2 May 2011 15:17:17 -0700 Subject: [PATCH 28/36] removed a bunch of debug messages, which were added to debug why shape was not synchronizing properly. --- .../SymmetricSync/RegionSyncModule.cs | 27 ++++++++++++++----- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 3 files changed, 25 insertions(+), 9 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index a0ec2b30c0..1c0da4dd44 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2409,6 +2409,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (propertiesSyncInfo.Count>0) { //SYNC DEBUG + /* string pString = ""; foreach (PropertySyncInfo p in propertiesSyncInfo) { @@ -2417,9 +2418,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((String)p.LastUpdateValue); m_log.DebugFormat("Shaped changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); - //m_log.DebugFormat("SOP {0}, {1} Shape value in incoming message: {1 } } + * */ //m_log.DebugFormat("ms {0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", DateTime.Now.Millisecond, sop.Name, sop.UUID, pString); @@ -2431,12 +2432,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); } + /* if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); m_log.DebugFormat("HandleUpdatedPrimProperties -- SOP {0},{1}, Shape, ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } + * */ if (propertiesUpdated.Count > 0) { @@ -2467,7 +2470,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SceneObjectDecoder(encodedSOG, out linkedGroup, out primsSyncInfo); //TEMP DEBUG - m_log.DebugFormat(" received linkedGroup: {1}", linkedGroup.DebugObjectUpdateResult()); + // m_log.DebugFormat(" received linkedGroup: {0}", linkedGroup.DebugObjectUpdateResult()); //m_log.DebugFormat(linkedGroup.DebugObjectUpdateResult()); if (linkedGroup == null) @@ -3527,7 +3530,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //and should be propogated to other sync nodes. HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); - /* + /* //Below is done at SOG level, not here (TO DOUBLE CHECK) //For group properties, we only need to send it once per SOG, //hence only enqueue it with root part foreach (SceneObjectPartSyncProperties groupProperty in SceneObjectPart.GetGroupProperties()) @@ -3548,12 +3551,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } * */ + /* if(updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) { string hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); m_log.DebugFormat("ProcessAndEnqueuePrimUpdatesByLocal: Shape of SOP {0}, {1} updated, ProfileShape {2}, hashed value in SOP: {3}, in PrimSyncInfoManager: {4}", part.Name, part.UUID, part.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(part.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } + * */ //Enqueue the prim with the set of updated properties, excluding the group properties if (propertiesWithSyncInfoUpdated.Count > 0) @@ -3712,7 +3717,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { pString += property.ToString() + " "; } - m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); + //m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString); //DSG DEBUG @@ -3721,6 +3726,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); } + /* if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); @@ -3728,6 +3734,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } + * */ SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); @@ -3820,7 +3827,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } //DSG DEBUG - m_log.DebugFormat("calling AddNewSceneObjectByDecoding for SOG {1}, {2}", group.Name, group.UUID); + m_log.DebugFormat("calling AddNewSceneObjectByDecoding for SOG {0}, {1}", group.Name, group.UUID); //Add the list of PrimSyncInfo to PrimSyncInfoManager's record. m_primSyncInfoManager.InsertMultiPrimSyncInfo(primsSyncInfo); @@ -5197,7 +5204,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); //DSG DEBUG - DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1}, updated: hashed value {2}", part.Name, part.UUID, m_propertiesSyncInfo[property].LastUpdateValueHash); + //DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1}, updated: hashed value {2}", part.Name, part.UUID, m_propertiesSyncInfo[property].LastUpdateValueHash); updated = true; } @@ -6562,9 +6569,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (shapeVal != null) { part.Shape = shapeVal; + /* String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); - DebugLog.DebugFormat("prim type of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", + DebugLog.DebugFormat("prim type of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", part.Name, part.UUID, hashedShape, pSyncInfo.LastUpdateValueHash); + * */ + } + else + { + } break; case SceneObjectPartSyncProperties.TaskInventory: diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index b4a35afa0d..17750b3171 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -814,6 +814,7 @@ namespace OpenSim.Region.Framework.Scenes } //TEMP DEBUG + /* m_log.Debug("to link part " + part.DebugObjectPartProperties()); string partNames = ""; @@ -822,6 +823,7 @@ namespace OpenSim.Region.Framework.Scenes partNames += "(" + child.Name + "," + child.UUID + ")"; } //m_log.Debug("LinkObjectBySync: " + part.Name + "," + part.UUID + " with root "+root.Name+","+root.UUID+"; its SOG has " + part.ParentGroup.Parts.Length + " parts : "+partNames); + * */ children.Add(part); } @@ -838,13 +840,14 @@ namespace OpenSim.Region.Framework.Scenes //localGroup.UpdateObjectGroupBySync(linkedGroup); //DSG DEBUG - + /* m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult()); m_log.Debug("parts before linking now have properties: "); foreach (SceneObjectPart part in children) { m_log.Debug(part.DebugObjectPartProperties()); } + * */ } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b0c296041d..1931c3e7f3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7093,7 +7093,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api code = (int)rules.GetLSLIntegerItem(idx++); //debug - part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); + //part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); remain = rules.Length - idx; float hollow; From 7157398d77dbf626e0f4390a557eb03ad63d96ab Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 2 May 2011 16:39:03 -0700 Subject: [PATCH 29/36] For debugging shape not sync'ed properly problem: adding back debug messages in CompareHashedValue_UpdateByLocal SetSOPPropertyValue --- .../RegionSyncModule/SymmetricSync/RegionSyncModule.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 1c0da4dd44..aa0b3f07c4 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -5204,7 +5204,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); //DSG DEBUG - //DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1}, updated: hashed value {2}", part.Name, part.UUID, m_propertiesSyncInfo[property].LastUpdateValueHash); + DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1} updated: SOP hashed shape: {2}, cached hash {3}", + part.Name, part.UUID, primShapeStringHash, m_propertiesSyncInfo[property].LastUpdateValueHash); updated = true; } @@ -6569,11 +6570,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (shapeVal != null) { part.Shape = shapeVal; - /* + String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); DebugLog.DebugFormat("prim type of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", part.Name, part.UUID, hashedShape, pSyncInfo.LastUpdateValueHash); - * */ + } else { From c07c46c14713aa5110f739768c30df29e37afd5f Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Mon, 2 May 2011 16:48:25 -0700 Subject: [PATCH 30/36] For debugging shape not sync'ed properly problem: adding back debug messages in CompareHashedValue_UpdateByLocal HandleUpdatedPrimProperties --- .../SymmetricSync/RegionSyncModule.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index aa0b3f07c4..4ad2d6d500 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2409,7 +2409,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (propertiesSyncInfo.Count>0) { //SYNC DEBUG - /* + string pString = ""; foreach (PropertySyncInfo p in propertiesSyncInfo) { @@ -2417,10 +2417,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (p.Property == SceneObjectPartSyncProperties.Shape) { PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((String)p.LastUpdateValue); - m_log.DebugFormat("Shaped changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); + m_log.DebugFormat("Shape changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); } } - * */ + //m_log.DebugFormat("ms {0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", DateTime.Now.Millisecond, sop.Name, sop.UUID, pString); @@ -6570,10 +6570,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (shapeVal != null) { part.Shape = shapeVal; - + /* String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(part))); - DebugLog.DebugFormat("prim type of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", + DebugLog.DebugFormat("Shape of SOP {0}, {1}, changed, hashed shape = {2} in SOP, = {3} in PrimSyncInfoManager", part.Name, part.UUID, hashedShape, pSyncInfo.LastUpdateValueHash); + * */ } else From 54ba7a61f89b2ff110051cb81108cef9cc0a3f90 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 13:16:39 -0700 Subject: [PATCH 31/36] Added back some debug messages, seems now shapes are sync'ed properly again. --- .../SymmetricSync/RegionSyncModule.cs | 120 ++++++++++++------ .../Framework/Scenes/SceneObjectPart.cs | 19 ++- .../Shared/Api/Implementation/LSL_Api.cs | 2 +- 3 files changed, 100 insertions(+), 41 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 4ad2d6d500..a4fcdf77c5 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2417,10 +2417,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (p.Property == SceneObjectPartSyncProperties.Shape) { PrimitiveBaseShape shape = PropertySerializer.DeSerializeShape((String)p.LastUpdateValue); - m_log.DebugFormat("Shape changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); + m_log.DebugFormat("Shape to be changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); } } + //m_log.DebugFormat("ms {0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", DateTime.Now.Millisecond, sop.Name, sop.UUID, pString); @@ -2432,14 +2433,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); } - /* + if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); - m_log.DebugFormat("HandleUpdatedPrimProperties -- SOP {0},{1}, Shape, ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", + m_log.DebugFormat("HandleUpdatedPrimProperties -- SOP {0},{1}, Shape updated, ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } - * */ + if (propertiesUpdated.Count > 0) { @@ -3559,6 +3560,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule part.Name, part.UUID, part.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(part.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } * */ + //Enqueue the prim with the set of updated properties, excluding the group properties if (propertiesWithSyncInfoUpdated.Count > 0) @@ -3726,7 +3728,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); } - /* + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); @@ -3734,7 +3736,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } - * */ + SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); @@ -3839,7 +3841,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //set the PhysActor's properties foreach (SceneObjectPart part in group.Parts) { - primsSyncInfo[part.UUID].SetSOPPhyscActorProperties(part); + //primsSyncInfo[part.UUID].SetSOPPhyscActorProperties(part); + m_primSyncInfoManager.SetSOPPhyscActorProperties(part); } } @@ -4890,15 +4893,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule #endregion //Constructors - public void UpdatePropertySyncInfoByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) + public void UpdatePropertyWithHashByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, string pHashedValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue, pHashedValue); } - public void UpdatePropertySyncInfoByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue) + /* + public void UpdatePropertyByLocal(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue) { m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateTS, syncID, pValue); } + * */ //public void UpdatePropertySyncInfoBySync(SceneObjectPartSyncProperties property, long lastUpdateTS, string syncID, Object pValue, Object pHashedValue, long recvTS) //{ @@ -4916,6 +4921,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// public HashSet UpdatePropertiesByLocal(SceneObjectPart part, List updatedProperties, long lastUpdateTS, string syncID) { + //DSG DEBUG + /* + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + DebugLog.DebugFormat("UpdatePropertiesByLocal: To update SOP {0},{1} Shape to be {2}", part.Name, part.UUID, part.Shape.ProfileShape); + }*/ + + HashSet propertiesToBeSynced = new HashSet(updatedProperties); if (part == null) { @@ -4965,6 +4978,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //that really have recently been updated by local operations HashSet propertiesUpdatedByLocal = new HashSet(); + //DSG DEBUG + if (propertiesToBeSynced.Contains(SceneObjectPartSyncProperties.Shape)) + { + DebugLog.DebugFormat("UpdatePropertiesByLocal: to update cache of SOP {0}, {1} Shape to {2}", part.Name, part.UUID, part.Shape.ProfileShape); + } + lock (m_primSyncInfoLock) { foreach (SceneObjectPartSyncProperties property in propertiesToBeSynced) @@ -4999,27 +5018,36 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule long recvTS = DateTime.Now.Ticks; List propertiesUpdated = new List(); - foreach (PropertySyncInfo pSyncInfo in propertiesSyncInfo) + lock (m_primSyncInfoLock) { - bool updated = false; - SceneObjectPartSyncProperties property = pSyncInfo.Property; - //Compare if the value of the property in this SyncModule is - //different than the value in SOP - if (!m_propertiesSyncInfo.ContainsKey(property)) + foreach (PropertySyncInfo pSyncInfo in propertiesSyncInfo) { - //Should not happen - DebugLog.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID); - } - else - { - //Compare timestamp and update SyncInfo if necessary - updated = m_propertiesSyncInfo[property].CompareAndUpdateSyncInfoBySync(pSyncInfo, recvTS); - //If updated, update the property value in SOP - if (updated) + bool updated = false; + SceneObjectPartSyncProperties property = pSyncInfo.Property; + //Compare if the value of the property in this SyncModule is + //different than the value in SOP + if (!m_propertiesSyncInfo.ContainsKey(property)) { - //UpdateSOPProperty(part, m_propertiesSyncInfo[property]); - SetSOPPropertyValue(part, property); - propertiesUpdated.Add(property); + //Should not happen + DebugLog.WarnFormat("PrimSyncInfo.UpdatePropertiesBySync -- no record of property {0} for SOP {1},{2}", property, part.Name, part.UUID); + } + else + { + //Compare timestamp and update SyncInfo if necessary + updated = m_propertiesSyncInfo[property].CompareAndUpdateSyncInfoBySync(pSyncInfo, recvTS); + //If updated, update the property value in SOP + if (updated) + { + //DSG DEBUG + if (property == SceneObjectPartSyncProperties.Shape) + { + DebugLog.DebugFormat("UpdatePropertiesBySync: updating Shape of {0}, {1}", part.Name, part.UUID); + } + + //UpdateSOPProperty(part, m_propertiesSyncInfo[property]); + SetSOPPropertyValue(part, property); + propertiesUpdated.Add(property); + } } } } @@ -5099,7 +5127,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertiesSyncInfo; } - //TO BE FINISHED + //Should only be called after receiving a message with encoded prim properties, + // + /// + /// Create a SOP instance based on the properties in PrimSyncInfo. Should + /// only be called after receiving a message with encoded prim properties, + /// and the SOP with the given UUID does not exsit locally yet. + /// + /// public SceneObjectPart PrimSyncInfoToSOP() { SceneObjectPart sop = new SceneObjectPart(); @@ -5136,6 +5171,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } + /// + /// Initialize the properties with the values in the given SOP. + /// + /// + /// + /// private void InitPropertiesSyncInfo(SceneObjectPart part, long initUpdateTimestamp, string syncID) { m_propertiesSyncInfo.Clear(); @@ -5201,11 +5242,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //value by copying that from PrimSyncInfoManager if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { - UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); + UpdatePropertyWithHashByLocal(property, lastUpdateTS, syncID, (Object)primShapeString, primShapeStringHash); //DSG DEBUG - DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1} updated: SOP hashed shape: {2}, cached hash {3}", - part.Name, part.UUID, primShapeStringHash, m_propertiesSyncInfo[property].LastUpdateValueHash); + //DebugLog.DebugFormat("CompareHashedValue_UpdateByLocal - Shape of {0}, {1} updated to ProfileShape {2}: SOP hashed shape: {3}, cached hash {4}", + // part.Name, part.UUID, part.Shape.ProfileShape, primShapeStringHash, m_propertiesSyncInfo[property].LastUpdateValueHash); updated = true; } @@ -5224,7 +5265,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (lastUpdateTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) { - UpdatePropertySyncInfoByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); + UpdatePropertyWithHashByLocal(property, lastUpdateTS, syncID, (Object)primTaskInventoryString, primTaskInventoryStringHash); updated = true; } else if (lastUpdateTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) @@ -6327,13 +6368,6 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return propertyUpdatedByLocal; } - private void UpdateSOPProperty(SceneObjectPart sop, PropertySyncInfo propertySyncInfo) - { - switch (propertySyncInfo.Property) - { - - } - } private bool ByteArrayEquals(byte[] a, byte[] b) { @@ -7196,6 +7230,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return null; } + public bool SetSOPPhyscActorProperties(SceneObjectPart part) + { + if(m_primsInSync.ContainsKey(part.UUID)){ + m_primsInSync[part.UUID].SetSOPPhyscActorProperties(part); + return true; + } + return false; + } } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 3a7453f93b..04129a5fd0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4650,6 +4650,10 @@ namespace OpenSim.Region.Framework.Scenes ParentGroup.HasGroupChanged = true; TriggerScriptChangedEvent(Changed.SHAPE); //ScheduleFullUpdate(); + + //DSG DEBUG + m_log.DebugFormat("{0}, {1}: shaped updated to {2}, calling ScheduleFullUpdate.", Name, UUID, Shape.ProfileShape); + ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.Shape}); } @@ -6088,10 +6092,23 @@ namespace OpenSim.Region.Framework.Scenes { if (updatedProperties != null && updatedProperties.Count > 0) { - if (m_parentGroup != null && m_parentGroup.Scene!=null && m_parentGroup.Scene.RegionSyncModule != null) + if (m_parentGroup != null && m_parentGroup.Scene != null && m_parentGroup.Scene.RegionSyncModule != null) { + /* + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + m_log.DebugFormat("{0}, {1} -- calling ProcessAndEnqueuePrimUpdatesByLocal to update to Shape {2}", Name, UUID, Shape.ProfileShape); + } + * */ m_parentGroup.Scene.RegionSyncModule.ProcessAndEnqueuePrimUpdatesByLocal(this, updatedProperties); } + else + { + if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) + { + m_log.DebugFormat("{0}, {1} Shape changed to {2}, but this SOP not attached to Scene yet", Name, UUID, Shape.ProfileShape); + } + } } base.ScheduleFullUpdate(updatedProperties); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1931c3e7f3..b0c296041d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7093,7 +7093,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api code = (int)rules.GetLSLIntegerItem(idx++); //debug - //part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); + part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); remain = rules.Length - idx; float hollow; From f8bf6c2cc462014af7ae2f3ae91e9b7b0ef1d180 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 13:37:55 -0700 Subject: [PATCH 32/36] Removed a few debug messages from previous commit, then the problem shows up again. It seems due to the script engine, after rezzing the pebbles and changing their shapes, the cached values in RegionSyncModule not properly sync'ed with SOP's data. --- .../RegionSyncModule/SymmetricSync/RegionSyncModule.cs | 5 ++++- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index a4fcdf77c5..5972caa186 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2409,7 +2409,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (propertiesSyncInfo.Count>0) { //SYNC DEBUG - + /* string pString = ""; foreach (PropertySyncInfo p in propertiesSyncInfo) { @@ -2420,6 +2420,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.DebugFormat("Shape to be changed on SOP {0}, {1} to ProfileShape {2}", sop.Name, sop.UUID, shape.ProfileShape); } } + * */ //m_log.DebugFormat("ms {0}: HandleUpdatedPrimProperties, for prim {1},{2} with updated properties -- {3}", DateTime.Now.Millisecond, sop.Name, sop.UUID, pString); @@ -4979,10 +4980,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule HashSet propertiesUpdatedByLocal = new HashSet(); //DSG DEBUG + /* if (propertiesToBeSynced.Contains(SceneObjectPartSyncProperties.Shape)) { DebugLog.DebugFormat("UpdatePropertiesByLocal: to update cache of SOP {0}, {1} Shape to {2}", part.Name, part.UUID, part.Shape.ProfileShape); } + * */ lock (m_primSyncInfoLock) { diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 04129a5fd0..1270533138 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4652,7 +4652,7 @@ namespace OpenSim.Region.Framework.Scenes //ScheduleFullUpdate(); //DSG DEBUG - m_log.DebugFormat("{0}, {1}: shaped updated to {2}, calling ScheduleFullUpdate.", Name, UUID, Shape.ProfileShape); + //m_log.DebugFormat("{0}, {1}: shaped updated to {2}, calling ScheduleFullUpdate.", Name, UUID, Shape.ProfileShape); ScheduleFullUpdate(new List() {SceneObjectPartSyncProperties.Shape}); } From eeb09f33e3230001b23da4f97a23e45b3f2c333e Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 13:54:59 -0700 Subject: [PATCH 33/36] Add locking on m_primSyncInfoLock in InitPropertiesBySync and InitPropertiesSyncInfoFromOSDMap. --- .../SymmetricSync/RegionSyncModule.cs | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 5972caa186..e0b23184aa 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -5190,11 +5190,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule else initPrimProperties = FullSetPrimProperties; - foreach (SceneObjectPartSyncProperties property in initPrimProperties) + lock (m_primSyncInfoLock) { - Object initValue = GetSOPPropertyValue(part, property); - PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); - m_propertiesSyncInfo.Add(property, syncInfo); + foreach (SceneObjectPartSyncProperties property in initPrimProperties) + { + Object initValue = GetSOPPropertyValue(part, property); + PropertySyncInfo syncInfo = new PropertySyncInfo(property, initValue, initUpdateTimestamp, syncID); + m_propertiesSyncInfo.Add(property, syncInfo); + } } } @@ -5205,18 +5208,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule /// private void InitPropertiesSyncInfoFromOSDMap(OSDMap primSyncInfoData) { - m_propertiesSyncInfo.Clear(); - foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) + lock (m_primSyncInfoLock) { - if (primSyncInfoData.ContainsKey(property.ToString())) + m_propertiesSyncInfo.Clear(); + foreach (SceneObjectPartSyncProperties property in FullSetPrimProperties) { - PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); - m_propertiesSyncInfo.Add(property, propertySyncInfo); - } - else - { - //For Phantom prims, they don't have PhysActor properties. So this branch could happen. - //DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + if (primSyncInfoData.ContainsKey(property.ToString())) + { + PropertySyncInfo propertySyncInfo = new PropertySyncInfo(property, (OSDMap)primSyncInfoData[property.ToString()]); + m_propertiesSyncInfo.Add(property, propertySyncInfo); + } + else + { + //For Phantom prims, they don't have PhysActor properties. So this branch could happen. + //DebugLog.WarnFormat("InitPropertiesSyncInfoFromOSDMap: Property {0} not included in the given OSDMap", property); + } } } } From 4acd23f0f90e56eecd4af3acd6b77e9d0951ac52 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 14:25:05 -0700 Subject: [PATCH 34/36] In SyncOutPrimUpdates(), calling UpdatePrimSyncInfoByLocal again before calling SendPrimPropertyUpdates, to make sure local updates are sync'ed into RegionSyncModule's cache. --- .../SymmetricSync/RegionSyncModule.cs | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index e0b23184aa..8385e09641 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -3684,12 +3684,18 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule foreach (KeyValuePair> updatedPrimProperties in primPropertyUpdates) { UUID primUUID = updatedPrimProperties.Key; - HashSet updatedProperties = updatedPrimProperties.Value; + SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID); - //Sync the SOP data and cached property values in PrimSyncInfoManager again - //HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(part, updatedProperties); + if (sop == null || sop.ParentGroup.IsDeleted) + continue; + else + { + HashSet updatedProperties = updatedPrimProperties.Value; - SendPrimPropertyUpdates(primUUID, updatedProperties); + //Sync the SOP data and cached property values in PrimSyncInfoManager again + HashSet propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(sop, new List(updatedProperties)); + SendPrimPropertyUpdates(sop, updatedProperties); + } } // Indicate that the current batch of updates has been completed @@ -3702,13 +3708,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - private void SendPrimPropertyUpdates(UUID primUUID, HashSet updatedProperties) + private void SendPrimPropertyUpdates(SceneObjectPart sop, HashSet updatedProperties) { - SceneObjectPart sop = m_scene.GetSceneObjectPart(primUUID); - - if (sop == null || sop.ParentGroup.IsDeleted) - return; - OSDMap syncData = m_primSyncInfoManager.EncodePrimProperties(sop, updatedProperties); if (syncData.Count > 0) @@ -3741,7 +3742,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); - SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); + SendPrimUpdateToRelevantSyncConnectors(sop.UUID, syncMsg); } } From 4afd3f66022c35c364c527be74523237abe1cda1 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 14:38:21 -0700 Subject: [PATCH 35/36] Commented out some debug messages. --- .../SymmetricSync/RegionSyncModule.cs | 12 +++++++----- .../Shared/Api/Implementation/LSL_Api.cs | 3 --- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 8385e09641..597a0db26e 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -2434,14 +2434,14 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents); } - + /* if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); m_log.DebugFormat("HandleUpdatedPrimProperties -- SOP {0},{1}, Shape updated, ProfileShape {2}, hashed value in SOP:{3}, in PrinSyncInfoManager: {4}", sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } - + * */ if (propertiesUpdated.Count > 0) { @@ -3730,7 +3730,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule // m_log.DebugFormat("SendPrimPropertyUpdates -- AggregateScriptEvents: " + sop.AggregateScriptEvents); } - + /* if (updatedProperties.Contains(SceneObjectPartSyncProperties.Shape)) { String hashedShape = Util.Md5Hash((PropertySerializer.SerializeShape(sop))); @@ -3738,7 +3738,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule sop.Name, sop.UUID, sop.Shape.ProfileShape, hashedShape, m_primSyncInfoManager.GetPrimSyncInfo(sop.UUID).PropertiesSyncInfo[SceneObjectPartSyncProperties.Shape].LastUpdateValueHash); } - + */ SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData)); @@ -5043,10 +5043,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule if (updated) { //DSG DEBUG + /* if (property == SceneObjectPartSyncProperties.Shape) { DebugLog.DebugFormat("UpdatePropertiesBySync: updating Shape of {0}, {1}", part.Name, part.UUID); } + * */ //UpdateSOPProperty(part, m_propertiesSyncInfo[property]); SetSOPPropertyValue(part, property); @@ -5350,7 +5352,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule propertyUpdatedByLocal = true; //TEMP DEBUG - DebugLog.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents); + //DebugLog.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents); } else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) { diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index b0c296041d..18916ca7fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -7092,9 +7092,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api code = (int)rules.GetLSLIntegerItem(idx++); - //debug - part.ParentGroup.Scene.RegionSyncModule.Debug("LSL_Api: Prim " + part.Name + "," + part.UUID + ", changing shape to " + code); - remain = rules.Length - idx; float hollow; LSL_Vector twist; From 04d406a7c8f2fce7365bc215410e63608d2affc3 Mon Sep 17 00:00:00 2001 From: "Huaiyu (Kitty) Liu" Date: Tue, 3 May 2011 14:48:14 -0700 Subject: [PATCH 36/36] Added code to sync each SOP's LocalFlags property. Also, in DeselectPrim, feed the list of updated properties as FullUpdate, instead of only the IsSelected property, since SOP's Name, Description and some other properties might just have been edited by a user. --- .../SymmetricSync/RegionSyncModule.cs | 22 +++++++++++++++++++ .../Framework/Scenes/Scene.PacketHandlers.cs | 2 +- .../Framework/Scenes/SceneObjectPart.cs | 9 +++++--- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index 597a0db26e..a504bc6e91 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -4299,6 +4299,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); break; case SceneObjectPartSyncProperties.Flags: + case SceneObjectPartSyncProperties.LocalFlags: propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); break; //////////////////////////// @@ -4523,6 +4524,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //propertyData["Value"] = OSD.FromInteger((int)((scriptEvents)LastUpdateValue)); break; case SceneObjectPartSyncProperties.Flags: + case SceneObjectPartSyncProperties.LocalFlags: PrimFlags flags = (PrimFlags)(propertyData["Value"].AsInteger()); m_lastUpdateValue = (Object)flags; //propertyData["Value"] = OSD.FromInteger((int)((PrimFlags)LastUpdateValue)); @@ -5740,6 +5742,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } break; + case SceneObjectPartSyncProperties.LocalFlags: + if (!part.LocalFlags.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) + { + if (lastUpdateByLocalTS > m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.LocalFlags); + propertyUpdatedByLocal = true; + } + else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) + { + //overwrite SOP's data + part.LocalFlags = (PrimFlags)m_propertiesSyncInfo[property].LastUpdateValue; + } + } + break; case SceneObjectPartSyncProperties.Material: if (!part.Material.Equals(m_propertiesSyncInfo[property].LastUpdateValue)) { @@ -6461,6 +6478,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return (Object)part.LastOwnerID; case SceneObjectPartSyncProperties.LinkNum: return (Object)part.LinkNum; + case SceneObjectPartSyncProperties.LocalFlags: + return (Object)part.LocalFlags; case SceneObjectPartSyncProperties.Material: return (Object)part.Material; case SceneObjectPartSyncProperties.MediaUrl: @@ -6720,6 +6739,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case SceneObjectPartSyncProperties.LinkNum: part.LinkNum = (int)pSyncInfo.LastUpdateValue; break; + case SceneObjectPartSyncProperties.LocalFlags: + part.LocalFlags = (PrimFlags)pSyncInfo.LastUpdateValue; + break; case SceneObjectPartSyncProperties.Material: part.Material = (byte)pSyncInfo.LastUpdateValue; break; diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index 60eae3306e..f1de066c90 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs @@ -213,7 +213,7 @@ namespace OpenSim.Region.Framework.Scenes isAttachment = true; else //part.ParentGroup.ScheduleGroupForFullUpdate(); - part.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.IsSelected}); + part.ParentGroup.ScheduleGroupForFullUpdate(new List(){SceneObjectPartSyncProperties.FullUpdate}); // If it's not an attachment, and we are allowed to move it, // then we might have done so. If we moved across a parcel diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 1270533138..753712013c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4795,7 +4795,8 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat( // "[SCENE OBJECT PART]: Scheduling part {0} {1} for full update in aggregateScriptEvents()", Name, LocalId); //ScheduleFullUpdate(); - ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.AggregateScriptEvents}); + ScheduleFullUpdate(new List() { SceneObjectPartSyncProperties.Flags, SceneObjectPartSyncProperties.LocalFlags, + SceneObjectPartSyncProperties.AggregateScriptEvents}); } } @@ -5218,7 +5219,8 @@ namespace OpenSim.Region.Framework.Scenes MediaUrl, TextureAnimation, ParticleSystem, - //Property names below copied from PhysicsActor, they are necessary in synchronization, but not covered the above properties + //Property names below copied from PhysicsActor, they are necessary in + //synchronization, but not covered by xml serialization //Physics properties "Velocity" is covered above Position, Size, @@ -5236,10 +5238,11 @@ namespace OpenSim.Region.Framework.Scenes //Properties need to be synced, but not in xml serializations AggregateScriptEvents, - IsAttachment, AttachedAvatar, AttachedPos, AttachmentPoint, + IsAttachment, + LocalFlags, //TODO!!!! To be handled in serialization/deserizaltion for synchronization Sound, //This indicates any Sound related property has changed: Sound, SoundGain, SoundFlags,SoundRadius, //Addition properties to be added here