Added serialization/deserilaization of Attachment related SOP properties to sync AttachObject.

dsg
Huaiyu (Kitty) Liu 2011-02-16 14:29:08 -08:00
parent 21a1000da6
commit f99b516eec
4 changed files with 104 additions and 23 deletions

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration, if the local actor is configured to be a client manager, load this module.
if (!actorType.Equals("client_manager"))
{
m_log.Warn(LogHeader + ": not configured as Scene Persistence Actor. Shut down.");
m_log.Warn(LogHeader + ": not configured as Client Manager Actor. Shut down.");
return;
}

View File

@ -48,7 +48,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule
//Read in configuration, if the local actor is configured to be a client manager, load this module.
if (!actorType.Equals("physics_engine"))
{
m_log.Warn(LogHeader + ": not configured as Scene Persistence Actor. Shut down.");
m_log.Warn(LogHeader + ": not configured as Physics Engine Actor. Shut down.");
return;
}

View File

@ -226,19 +226,49 @@ namespace OpenSim.Region.Framework.Scenes
}
public bool IsAttachment;
//public bool IsAttachment;
private bool m_isAttachment;
public bool IsAttachment
{
get { return m_isAttachment; }
set { m_isAttachment = value; }
}
public scriptEvents AggregateScriptEvents;
//public scriptEvents AggregateScriptEvents;
private scriptEvents m_aggregateScriptEvents;
public scriptEvents AggregateScriptEvents
{
get { return m_aggregateScriptEvents; }
set { m_aggregateScriptEvents = value; }
}
//public UUID AttachedAvatar;
private UUID m_attachedAvatar;
public UUID AttachedAvatar
{
get { return m_attachedAvatar; }
set { m_attachedAvatar = value; }
}
public UUID AttachedAvatar;
//public Vector3 AttachedPos;
private Vector3 m_attachedPos;
public Vector3 AttachedPos
{
get { return m_attachedPos; }
set { m_attachedPos = value; }
}
public Vector3 AttachedPos;
public uint AttachmentPoint;
//public uint AttachmentPoint;
private uint m_attachmentPoint;
public uint AttachmentPoint
{
get { return m_attachmentPoint; }
set { m_attachmentPoint = value; }
}
public Vector3 RotationAxis = Vector3.One;
@ -5158,11 +5188,13 @@ namespace OpenSim.Region.Framework.Scenes
IsPhysical,
Flying,
Buoyancy,
//TODO!!!! To be handled in serialization/deserizaltion for synchronization
AggregateScriptEvents,
IsSelected,
AttachmentPoint,
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
@ -5406,6 +5438,22 @@ namespace OpenSim.Region.Framework.Scenes
localPart.TextureAnimation = updatedPart.TextureAnimation;
localPart.ParticleSystem = updatedPart.ParticleSystem;
if (!localPart.AttachedAvatar.Equals(updatedPart.AttachedAvatar))
{
localPart.AttachedAvatar = updatedPart.AttachedAvatar;
ScenePresence avatar = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
localPart.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
}
localPart.AttachedPos = updatedPart.AttachedPos;
localPart.AttachmentPoint = updatedPart.AttachmentPoint;
//NOTE!!!! IsAttachment can only be set after AttachedAvatar is set, see GroupPosition get function.
if (!localPart.AttachedAvatar.Equals(UUID.Zero) && updatedPart.IsAttachment)
{
localPart.IsAttachment = updatedPart.IsAttachment;
}
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;
m_bucketSyncInfoList[bucketName].LastUpdateTimeStamp = updatedPart.BucketSyncInfoList[bucketName].LastUpdateTimeStamp;
m_bucketSyncInfoList[bucketName].LastUpdateActorID = updatedPart.BucketSyncInfoList[bucketName].LastUpdateActorID;
@ -5486,7 +5534,7 @@ namespace OpenSim.Region.Framework.Scenes
}
long timeStamp = DateTime.Now.Ticks;
m_log.Debug("InitializeBucketSyncInfo called at " + timeStamp);
//m_log.Debug("InitializeBucketSyncInfo called at " + timeStamp);
for (int i = 0; i < m_propertyBucketNames.Count; i++)
{

View File

@ -330,9 +330,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
m_SOPXmlProcessors.Add("ParticleSystem", ProcessParticleSystem);
//SYMMETRIC SYNC
m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LocalFlags", ProcessLocalFlags);
//m_SOPXmlProcessors.Add("LastUpdateTimeStamp", ProcessUpdateTimeStamp);
//m_SOPXmlProcessors.Add("LastUpdateActorID", ProcessLastUpdateActorID);
m_SOPXmlProcessors.Add("IsAttachment", ProcessIsAttachment);
m_SOPXmlProcessors.Add("AttachedAvatar", ProcessAttachedAvatar);
m_SOPXmlProcessors.Add("AttachedPos", ProcessAttachedPos);
m_SOPXmlProcessors.Add("AttachmentPoint", ProcessAttachmentPoint);
m_SOPXmlProcessors.Add("AggregateScriptEvents", ProcessAggregateScriptEvents);
m_SOPXmlProcessors.Add("BucketSyncInfoList", ProcessBucketSyncInfo);
//end of SYMMETRIC SYNC
@ -420,11 +426,9 @@ 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;
//That is, calling SetXXX(value) instead of using "XXX = value".
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
{
obj.AllowedDrop = Util.ReadBoolean(reader);
//obj.SetAllowedDrop(Util.ReadBoolean(reader));
obj.AllowedDrop = Util.ReadBoolean(reader);
}
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
@ -714,12 +718,38 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
{
obj.LastUpdateActorID = reader.ReadElementContentAsString("LastUpdateActorID", string.Empty);
}
* */
private static void ProcessLocalFlags(SceneObjectPart obj, XmlTextReader reader)
{
obj.LocalFlags = Util.ReadEnum<PrimFlags>(reader, "LocalFlags");
}
* */
private static void ProcessIsAttachment(SceneObjectPart obj, XmlTextReader reader)
{
obj.IsAttachment = Util.ReadBoolean(reader);
}
private static void ProcessAttachedAvatar(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachedAvatar = Util.ReadUUID(reader, "AttachedAvatar");
}
private static void ProcessAttachedPos(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachedPos = Util.ReadVector(reader, "AttachedPos");
}
private static void ProcessAttachmentPoint(SceneObjectPart obj, XmlTextReader reader)
{
obj.AttachmentPoint = (uint)reader.ReadElementContentAsInt("AttachmentPoint", string.Empty);
}
private static void ProcessAggregateScriptEvents(SceneObjectPart obj, XmlTextReader reader)
{
obj.AggregateScriptEvents = Util.ReadEnum<scriptEvents>(reader, "AggregateScriptEvents");
}
public static void ProcessBucketSyncInfo(SceneObjectPart obj, XmlTextReader reader)
{
@ -1243,9 +1273,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteElementString("NextOwnerMask", sop.NextOwnerMask.ToString());
//SYMMETRIC 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);
//writer.WriteElementString("Flags", sop.Flags.ToString());
//writer.WriteElementString("LocalFlags", sop.Flags.ToString());
//WriteFlags(writer, "LocalFlags", sop.LocalFlags.ToString(), options);
//end SYMMETRIC SYNC
WriteUUID(writer, "CollisionSound", sop.CollisionSound, options);
writer.WriteElementString("CollisionSoundVolume", sop.CollisionSoundVolume.ToString());
@ -1255,8 +1283,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
WriteBytes(writer, "ParticleSystem", sop.ParticleSystem);
//SYMMETRIC SYNC
//writer.WriteElementString("LastUpdateTimeStamp", sop.LastUpdateTimeStamp.ToString());
//writer.WriteElementString("LastUpdateActorID", sop.LastUpdateActorID);
//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.
writer.WriteElementString("IsAttachment", sop.IsAttachment.ToString().ToLower());
WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options);
WriteVector(writer, "AttachedPos", sop.AttachedPos);
writer.WriteElementString("AttachmentPoint", sop.AttachmentPoint.ToString());
WriteFlags(writer, "AggregateScriptEvents", sop.AggregateScriptEvents.ToString(), options);
WriteBucketSyncInfo(writer, sop.BucketSyncInfoList);
//end of SYMMETRIC SYNC