In SyncLinkObject and SyncDelinkObject, copy property values from linked/delinked SOP

values to those in PrimSyncInfo, before sending out sync messages.
dsg
Huaiyu (Kitty) Liu 2011-04-20 17:34:55 -07:00
parent 1c1d3893fc
commit b182e3bf30
3 changed files with 51 additions and 18 deletions

View File

@ -603,12 +603,22 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (children.Count == 0) return; 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> { SceneObjectPartSyncProperties.FullUpdate });
}
if (!IsSyncingWithOtherSyncNodes()) if (!IsSyncingWithOtherSyncNodes())
{ {
//no SyncConnector connected. Do nothing. //no SyncConnector connected. Do nothing.
return; return;
} }
//Now encode the linkedGroup for sync
OSDMap data = new OSDMap(); OSDMap data = new OSDMap();
OSDMap encodedSOG = SceneObjectEncoder(linkedGroup); OSDMap encodedSOG = SceneObjectEncoder(linkedGroup);
data["linkedGroup"] = encodedSOG; data["linkedGroup"] = encodedSOG;
@ -634,6 +644,15 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (prims.Count == 0 || beforeDelinkGroups.Count == 0) return; 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> { SceneObjectPartSyncProperties.FullUpdate });
}
if (!IsSyncingWithOtherSyncNodes()) if (!IsSyncingWithOtherSyncNodes())
{ {
//no SyncConnector connected. Do nothing. //no SyncConnector connected. Do nothing.
@ -2386,10 +2405,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
List<SceneObjectPartSyncProperties> propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo); List<SceneObjectPartSyncProperties> propertiesUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoBySync(sop, propertiesSyncInfo);
//SYNC DEBUG //SYNC DEBUG
//if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.Shape)) if (propertiesUpdated.Contains(SceneObjectPartSyncProperties.AggregateScriptEvents))
//{ {
// m_log.DebugFormat("Shape updated: " + PropertySerializer.SerializeShape(sop)); m_log.DebugFormat("AggregateScriptEvents updated: " + sop.AggregateScriptEvents);
//} }
if (propertiesUpdated.Count > 0) if (propertiesUpdated.Count > 0)
{ {
@ -2419,6 +2438,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
Dictionary<UUID, PrimSyncInfo> primsSyncInfo; Dictionary<UUID, PrimSyncInfo> primsSyncInfo;
SceneObjectDecoder(encodedSOG, out linkedGroup, out 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) if (linkedGroup == null)
{ {
m_log.WarnFormat("{0}: HandleSyncLinkObject, no valid Linked-Group has been deserialized", LogHeader); 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); m_log.DebugFormat("{0}: SendPrimPropertyUpdates for {1}, {2}, with updated properties -- {3}", LogHeader, sop.Name, sop.UUID, pString);
//SYNC DEBUG //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)); SymmetricSyncMessage syncMsg = new SymmetricSyncMessage(SymmetricSyncMessage.MsgType.UpdatedPrimProperties, OSDParser.SerializeJsonString(syncData));
SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg); SendPrimUpdateToRelevantSyncConnectors(primUUID, syncMsg);
@ -4802,6 +4825,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_UUID = id; m_UUID = id;
InitPropertiesSyncInfoFromOSDMap(primSyncInfoData); InitPropertiesSyncInfoFromOSDMap(primSyncInfoData);
m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
} }
#endregion //Constructors #endregion //Constructors
@ -5169,6 +5193,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//copy from SOP's data //copy from SOP's data
m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AggregateScriptEvents); m_propertiesSyncInfo[property].UpdateSyncInfoByLocal(lastUpdateByLocalTS, syncID, (Object)part.AggregateScriptEvents);
propertyUpdatedByLocal = true; propertyUpdatedByLocal = true;
//TEMP DEBUG
m_log.DebugFormat("CompareValue_UpdateByLocal -- copy SOP's AggregateScriptEvents {0}", part.AggregateScriptEvents);
} }
else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp) else if (lastUpdateByLocalTS < m_propertiesSyncInfo[property].LastUpdateTimeStamp)
{ {
@ -6410,6 +6437,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/////////////////////// ///////////////////////
case SceneObjectPartSyncProperties.AggregateScriptEvents: case SceneObjectPartSyncProperties.AggregateScriptEvents:
part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue;
m_log.DebugFormat("set {0} value to be {1}", property.ToString(), part.AggregateScriptEvents);
break; break;
case SceneObjectPartSyncProperties.AllowedDrop: case SceneObjectPartSyncProperties.AllowedDrop:
part.AllowedDrop = (bool)pSyncInfo.LastUpdateValue; part.AllowedDrop = (bool)pSyncInfo.LastUpdateValue;

View File

@ -791,8 +791,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="childrenIDs"></param> /// <param name="childrenIDs"></param>
public void LinkObjectBySync(SceneObjectGroup linkedGroup, UUID rootID, List<UUID> childrenIDs) public void LinkObjectBySync(SceneObjectGroup linkedGroup, UUID rootID, List<UUID> childrenIDs)
{ {
//m_log.Debug("Start to LinkObjectBySync"); m_log.Debug("Start to LinkObjectBySync");
//DebugSceneObjectGroups(); DebugSceneObjectGroups();
List<SceneObjectPart> children = new List<SceneObjectPart>(); List<SceneObjectPart> children = new List<SceneObjectPart>();
SceneObjectPart root = GetSceneObjectPart(rootID); SceneObjectPart root = GetSceneObjectPart(rootID);
@ -813,7 +813,9 @@ namespace OpenSim.Region.Framework.Scenes
continue; continue;
} }
//m_log.Debug("to link part " + part.DebugObjectPartProperties()); //TEMP DEBUG
m_log.Debug("to link part " + part.DebugObjectPartProperties());
string partNames = ""; string partNames = "";
foreach (SceneObjectPart child in part.ParentGroup.Parts) foreach (SceneObjectPart child in part.ParentGroup.Parts)
{ {
@ -836,14 +838,14 @@ namespace OpenSim.Region.Framework.Scenes
//localGroup.UpdateObjectGroupBySync(linkedGroup); //localGroup.UpdateObjectGroupBySync(linkedGroup);
//debug //debug
/*
m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult()); m_log.Debug("after SceneGraph.LinkObjectsBySync, the newly linked group is \n" + root.ParentGroup.DebugObjectUpdateResult());
m_log.Debug("parts before linking now have properties: "); m_log.Debug("parts before linking now have properties: ");
foreach (SceneObjectPart part in children) foreach (SceneObjectPart part in children)
{ {
m_log.Debug(part.DebugObjectPartProperties()); m_log.Debug(part.DebugObjectPartProperties());
} }
* */
} }
/// <summary> /// <summary>

View File

@ -5469,11 +5469,12 @@ namespace OpenSim.Region.Framework.Scenes
public string DebugObjectPartProperties() public string DebugObjectPartProperties()
{ {
string debugMsg = "UUID " + UUID + ", Name " + Name + ", localID " + LocalId; string debugMsg = "UUID " + UUID + ", Name " + Name + ", localID " + LocalId;
debugMsg += ", parentID " + ParentID + ", parentUUID " + ParentUUID; //debugMsg += ", parentID " + ParentID + ", parentUUID " + ParentUUID;
foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList) //foreach (KeyValuePair<string, BucketSyncInfo> pair in m_bucketSyncInfoList)
{ //{
debugMsg += ", Bucket " + pair.Key + ": TimeStamp - " + pair.Value.LastUpdateTimeStamp + ", ActorID - " + pair.Value.LastUpdateActorID; // debugMsg += ", Bucket " + pair.Key + ": TimeStamp - " + pair.Value.LastUpdateTimeStamp + ", ActorID - " + pair.Value.LastUpdateActorID;
} //}
debugMsg += ", AggregateScriptEvents = " + AggregateScriptEvents.ToString()+", OffsetPosition: "+OffsetPosition;
return debugMsg; return debugMsg;
} }