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

@ -770,11 +770,14 @@ namespace OpenSim.Region.Framework.Scenes
} }
if (IsAttachment) if (IsAttachment)
{
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); ScenePresence sp = m_parentGroup.Scene.GetScenePresence(AttachedAvatar);
if (sp != null) if (sp != null)
return sp.AbsolutePosition; return sp.AbsolutePosition;
} }
}
return m_groupPosition; return m_groupPosition;
} }
@ -5445,12 +5448,13 @@ namespace OpenSim.Region.Framework.Scenes
localPart.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId); localPart.ParentGroup.RootPart.SetParentLocalId(avatar.LocalId);
} }
localPart.AttachedPos = updatedPart.AttachedPos; 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. //NOTE!!!! IsAttachment can only be set after AttachedAvatar is set, see GroupPosition get function.
if (!localPart.AttachedAvatar.Equals(UUID.Zero) && updatedPart.IsAttachment) //if (!localPart.AttachedAvatar.Equals(UUID.Zero) && updatedPart.IsAttachment)
{ //{
localPart.IsAttachment = updatedPart.IsAttachment; // localPart.IsAttachment = updatedPart.IsAttachment;
} //}
localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents; localPart.AggregateScriptEvents = updatedPart.AggregateScriptEvents;

View File

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