diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index f2fe7f7364..6c7aade51f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -709,6 +709,15 @@ namespace OpenSim.Region.Framework.Scenes } + public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup) + { + //assign a local ID. + newPart.LocalId = AllocateLocalId(); + //add it to SceneGraph's record. + m_sceneGraph.AddNewSceneObjectPart(newPart, parentGroup); + } + + #endregion //SYMMETRIC SYNC public ICapabilitiesModule CapsModule diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index f81fc17cf3..af789e78f1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -2027,6 +2027,26 @@ namespace OpenSim.Region.Framework.Scenes return true; } + public void AddNewSceneObjectPart(SceneObjectPart newPart, SceneObjectGroup parentGroup) + { + SceneObjectPart[] children = parentGroup.Parts; + + lock (SceneObjectGroupsByFullID) + { + SceneObjectGroupsByFullID[parentGroup.UUID] = parentGroup; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByFullID[newPart.UUID] = parentGroup; + } + + lock (SceneObjectGroupsByLocalID) + { + SceneObjectGroupsByLocalID[parentGroup.LocalId] = parentGroup; + foreach (SceneObjectPart part in children) + SceneObjectGroupsByLocalID[newPart.LocalId] = parentGroup; + } + } + + #endregion //SYMMETRIC SYNC } } diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index ce518f6442..175b37567b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -3546,7 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes //Add in new parts foreach (SceneObjectPart newPart in newParts.Values) { - AddPart(newPart); + //AddPart(newPart); + AddNewPart(newPart); } //remove parts that are no longer in the group -- !!!!! need to further test how to do correct book-keeping and synchornized with other actors !!!!!!!! @@ -3637,6 +3638,14 @@ namespace OpenSim.Region.Framework.Scenes return groupUpdateResult; } + private void AddNewPart(SceneObjectPart newPart) + { + //set the parent relationship + AddPart(newPart); + + m_scene.AddNewSceneObjectPart(newPart, this); + } + public void ScheduleGroupForFullUpdate_SyncInfoUnchanged() { if (IsAttachment)