Made sure IsAttachment is set only after AttachedAvatar is set. Also, in GroupPosition get, added checking of "if m_parentGroup==null".

dsg
Huaiyu (Kitty) Liu 2011-02-16 15:42:10 -08:00
parent f99b516eec
commit 7b9bd89a5c
2 changed files with 13 additions and 9 deletions

View File

@ -771,9 +771,12 @@ namespace OpenSim.Region.Framework.Scenes
if (IsAttachment)
{
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
if (sp != null)
return sp.AbsolutePosition;
if (m_parentGroup != null) //need to check this, it would be null while deserialization -- IsAttachment is now serialized
{
ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
if (sp != null)
return sp.AbsolutePosition;
}
}
return m_groupPosition;
@ -5445,12 +5448,13 @@ namespace OpenSim.Region.Framework.Scenes
localPart.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
}
localPart.AttachedPos = updatedPart.AttachedPos;
localPart.AttachmentPoint = updatedPart.AttachmentPoint;
localPart.SetAttachmentPoint(updatedPart.AttachmentPoint);
//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;
}
//if (!localPart.AttachedAvatar.Equals(UUID.Zero) && updatedPart.IsAttachment)
//{
// localPart.IsAttachment = updatedPart.IsAttachment;
//}
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;

View File

@ -1285,10 +1285,10 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
//SYMMETRIC 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.
writer.WriteElementString("IsAttachment", sop.IsAttachment.ToString().ToLower());
WriteUUID(writer, "AttachedAvatar", sop.AttachedAvatar, options);
WriteVector(writer, "AttachedPos", sop.AttachedPos);
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
WriteFlags(writer, "AggregateScriptEvents", sop.AggregateScriptEvents.ToString(), options);
WriteBucketSyncInfo(writer, sop.BucketSyncInfoList);
//end of SYMMETRIC SYNC