diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 733d898678..ace1df11e3 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -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; diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 250e6c9bc8..9e8276e322 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -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