Revised SetSOPPropertyValue in RegionSyncModule.cs:

added calling aggregateScriptEventSubscriptions() after SOP.AggregateScriptEvents is set.
        for properties AttachedAvatar and AttachmentPoint, do extra work besides copying the property values.
Propogation of colission event and attachment (attached after avatar login) both working now.
dsg
Huaiyu (Kitty) Liu 2011-05-04 14:36:18 -07:00
parent cd70c3ff56
commit 854cb58d6d
4 changed files with 74 additions and 33 deletions

View File

@ -1977,9 +1977,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
pos = part.PhysActor.Position; 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}", m_log.WarnFormat("-- part {0}, UUID {1}, LocalID {2}, GroupPos {3}, offset-position {4}, Position {5}, AggregateScriptEvents ={6}, Flags = {7}, LocalFlags {8}, Scale {9}",
part.Name, part.UUID, part.LocalId, part.GroupPosition, part.OffsetPosition, part.Name, part.UUID, part.LocalId, part.GroupPosition, part.OffsetPosition,
pos, part.AggregateScriptEvents, part.Flags, part.LocalFlags); pos, part.AggregateScriptEvents, part.Flags, part.LocalFlags, part.Scale);
} }
} }
@ -2003,26 +2003,51 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
if (entity is SceneObjectGroup) if (entity is SceneObjectGroup)
{ {
//Legacy serialization/deserialization for bucket based sync
/*
//first test serialization
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
Dictionary<string, BucketSyncInfo> bucketSyncInfoList = new Dictionary<string,BucketSyncInfo>();
BucketSyncInfo generalBucket = new BucketSyncInfo(DateTime.Now.Ticks, m_actorID, "General");
bucketSyncInfoList.Add("General", generalBucket);
BucketSyncInfo physicsBucket = new BucketSyncInfo(DateTime.Now.Ticks, m_actorID, "Physics");
bucketSyncInfoList.Add("Physics", physicsBucket);
SceneObjectSerializer.WriteBucketSyncInfo(writer, bucketSyncInfoList);
string xmlString = sw.ToString(); SceneObjectGroup sog = (SceneObjectGroup)entity;
m_log.DebugFormat("Serialized xml string: {0}", xmlString);
//second, test de-serialization string sogXml = sog.ToXml2();
XmlTextReader reader = new XmlTextReader(new StringReader(xmlString));
SceneObjectPart part = new SceneObjectPart(); SceneObjectGroup sogCopy = SceneXmlLoader.DeserializeGroupFromXml2(sogXml);
SceneObjectSerializer.ProcessBucketSyncInfo(part, reader); }
* */ }
}
}
//debug functions
private void BucketSyncDebug()
{
//Legacy serialization/deserialization for bucket based sync
/*
//first test serialization
StringWriter sw = new StringWriter();
XmlTextWriter writer = new XmlTextWriter(sw);
Dictionary<string, BucketSyncInfo> bucketSyncInfoList = new Dictionary<string,BucketSyncInfo>();
BucketSyncInfo generalBucket = new BucketSyncInfo(DateTime.Now.Ticks, m_actorID, "General");
bucketSyncInfoList.Add("General", generalBucket);
BucketSyncInfo physicsBucket = new BucketSyncInfo(DateTime.Now.Ticks, m_actorID, "Physics");
bucketSyncInfoList.Add("Physics", physicsBucket);
SceneObjectSerializer.WriteBucketSyncInfo(writer, bucketSyncInfoList);
string xmlString = sw.ToString();
m_log.DebugFormat("Serialized xml string: {0}", xmlString);
//second, test de-serialization
XmlTextReader reader = new XmlTextReader(new StringReader(xmlString));
SceneObjectPart part = new SceneObjectPart();
SceneObjectSerializer.ProcessBucketSyncInfo(part, reader);
* */
}
private void PrimSyncSerializationDebug()
{
if (m_scene != null)
{
EntityBase[] entities = m_scene.GetEntities();
foreach (EntityBase entity in entities)
{
if (entity is SceneObjectGroup)
{
SceneObjectGroup sog = (SceneObjectGroup)entity; SceneObjectGroup sog = (SceneObjectGroup)entity;
@ -2032,7 +2057,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
{ {
m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID); m_primSyncInfoManager.InsertPrimSyncInfo(part, DateTime.Now.Ticks, m_syncID);
} }
//Next test serialization //Next test serialization
OSDMap sogData = SceneObjectEncoder(sog); OSDMap sogData = SceneObjectEncoder(sog);
@ -2050,7 +2075,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
UUID oldUUID = part.UUID; UUID oldUUID = part.UUID;
part.UUID = UUID.Random(); part.UUID = UUID.Random();
PrimSyncInfo syncInfo = primsSyncInfo[oldUUID]; PrimSyncInfo syncInfo = primsSyncInfo[oldUUID];
primsSyncInfo.Add(part.UUID, syncInfo); primsSyncInfo.Add(part.UUID, syncInfo);
} }
@ -2068,8 +2093,12 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
} }
} }
} }
} }
//end of debug functions
//Start connections to each remote listener. //Start connections to each remote listener.
//For now, there is only one remote listener. //For now, there is only one remote listener.
private bool StartSyncConnections() private bool StartSyncConnections()
@ -3664,7 +3693,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Skip if the prim is on longer in the local Scene Graph //Skip if the prim is on longer in the local Scene Graph
if (prim == null) if (prim == null)
{ {
m_log.WarnFormat("{0}: in SyncOutPrimUpdates, prim {1} no longer in local SceneGraph", LogHeader, primUUID); //m_log.WarnFormat("{0}: in SyncOutPrimUpdates, prim {1} no longer in local SceneGraph", LogHeader, primUUID);
continue; continue;
} }
//Skip if the object group is being deleted //Skip if the object group is being deleted
@ -3694,6 +3723,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Sync the SOP data and cached property values in PrimSyncInfoManager again //Sync the SOP data and cached property values in PrimSyncInfoManager again
HashSet<SceneObjectPartSyncProperties> propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(sop, new List<SceneObjectPartSyncProperties>(updatedProperties)); HashSet<SceneObjectPartSyncProperties> propertiesWithSyncInfoUpdated = m_primSyncInfoManager.UpdatePrimSyncInfoByLocal(sop, new List<SceneObjectPartSyncProperties>(updatedProperties));
updatedProperties.UnionWith(propertiesWithSyncInfoUpdated);
SendPrimPropertyUpdates(sop, updatedProperties); SendPrimPropertyUpdates(sop, updatedProperties);
} }
} }
@ -6658,7 +6688,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
/////////////////////// ///////////////////////
case SceneObjectPartSyncProperties.AggregateScriptEvents: case SceneObjectPartSyncProperties.AggregateScriptEvents:
part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue; part.AggregateScriptEvents = (scriptEvents)pSyncInfo.LastUpdateValue;
part.aggregateScriptEventSubscriptions();
//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; break;
@ -6669,13 +6699,21 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
part.AngularVelocity = (Vector3)pSyncInfo.LastUpdateValue; part.AngularVelocity = (Vector3)pSyncInfo.LastUpdateValue;
break; break;
case SceneObjectPartSyncProperties.AttachedAvatar: case SceneObjectPartSyncProperties.AttachedAvatar:
part.AttachedAvatar = (UUID)pSyncInfo.LastUpdateValue; //part.AttachedAvatar = (UUID)pSyncInfo.LastUpdateValue;
UUID attachedAvatar = (UUID)pSyncInfo.LastUpdateValue;
if (!part.AttachedAvatar.Equals(attachedAvatar))
{
part.AttachedAvatar = attachedAvatar;
ScenePresence avatar = part.ParentGroup.Scene.GetScenePresence(attachedAvatar);
part.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
}
break; break;
case SceneObjectPartSyncProperties.AttachedPos: case SceneObjectPartSyncProperties.AttachedPos:
part.AttachedPos = (Vector3)pSyncInfo.LastUpdateValue; part.AttachedPos = (Vector3)pSyncInfo.LastUpdateValue;
break; break;
case SceneObjectPartSyncProperties.AttachmentPoint: case SceneObjectPartSyncProperties.AttachmentPoint:
part.AttachmentPoint = (uint)pSyncInfo.LastUpdateValue; //part.AttachmentPoint = (uint)pSyncInfo.LastUpdateValue;
part.SetAttachmentPoint((uint)pSyncInfo.LastUpdateValue);
break; break;
case SceneObjectPartSyncProperties.BaseMask: case SceneObjectPartSyncProperties.BaseMask:
part.BaseMask = (uint)pSyncInfo.LastUpdateValue; part.BaseMask = (uint)pSyncInfo.LastUpdateValue;

View File

@ -2167,7 +2167,9 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.AttachToScene(m_parentScene); sceneObject.AttachToScene(m_parentScene);
//Take some special care of the case of this object being an attachment //Take some special care of the case of this object being an attachment,
//since localID of attachedAvatar is different in different sync node's
//Scene copies.
sceneObject.RootPart.SetAttachmentPoint(sceneObject.RootPart.AttachmentPoint); sceneObject.RootPart.SetAttachmentPoint(sceneObject.RootPart.AttachmentPoint);
if (sceneObject.IsAttachment) if (sceneObject.IsAttachment)
{ {
@ -2175,13 +2177,10 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.RootPart.SetParentLocalId(avatar.LocalId); sceneObject.RootPart.SetParentLocalId(avatar.LocalId);
} }
//DSG SYNC,
sceneObject.HasGroupChanged = true; sceneObject.HasGroupChanged = true;
//NewObject is sent via a specific sync message, not through updates; //NewObject is sent via a specific sync message, not through updates;
//hence not passing any property list here in calling //hence not passing any property list here
//ScheduleGroupForFullUpdate(). sceneObject.ScheduleGroupForFullUpdate(null);
sceneObject.ScheduleGroupForFullUpdate(null);
//end of DSG SYNC,
Entities.Add(sceneObject); Entities.Add(sceneObject);

View File

@ -5641,7 +5641,7 @@ namespace OpenSim.Region.Framework.Scenes
} }
// Do any subscriptions based on the AggregateScriptEvents // Do any subscriptions based on the AggregateScriptEvents
protected void aggregateScriptEventSubscriptions() public void aggregateScriptEventSubscriptions()
{ {
if ( if (
((AggregateScriptEvents & scriptEvents.collision) != 0) || ((AggregateScriptEvents & scriptEvents.collision) != 0) ||

View File

@ -346,6 +346,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation); m_SOPXmlProcessors.Add("TextureAnimation", ProcessTextureAnimation);
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem); m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
/*
//DSG SYNC //DSG SYNC
m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags); m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp); //m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp);
@ -358,6 +359,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo); m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo);
//end of DSG SYNC //end of DSG SYNC
* */
#endregion #endregion
@ -1302,12 +1304,14 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
//DSG SYNC //DSG SYNC
//These properties are only meaningful for synchronization purpose. For saving oar files, they are not necessary. //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. //We may remove these if later we use a different method to encode object properties for synchronization.
/*
WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options); WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options);
WriteVector(writer, "AttachedPos", sop.AttachedPos); WriteVector(writer, "AttachedPos", sop.AttachedPos);
writer.WriteElementString("AttachmentPoint", sop.AttachmentPoint.ToString()); writer.WriteElementString("AttachmentPoint", sop.AttachmentPoint.ToString());
//writer.WriteElementString("IsAttachment", sop.IsAttachment.ToString().ToLower()); //IsAttachment is written last, so that on deserialization, it will be deserialized later than other Attachment properties //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); WriteFlags(writer, "AggregateScriptEvents", sop.AggregateScriptEvents.ToString(), options);
WriteBucketSyncInfo(writer, sop.BucketSyncInfoList); WriteBucketSyncInfo(writer, sop.BucketSyncInfoList);
* */
//end of DSG SYNC //end of DSG SYNC
writer.WriteEndElement(); writer.WriteEndElement();