Added AddNewPart for synchronization of linked objects.

dsg
Huaiyu (Kitty) Liu 2011-01-19 17:34:28 -08:00
parent d874e4338f
commit a0eddfcf61
3 changed files with 39 additions and 1 deletions

View File

@ -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 #endregion //SYMMETRIC SYNC
public ICapabilitiesModule CapsModule public ICapabilitiesModule CapsModule

View File

@ -2027,6 +2027,26 @@ namespace OpenSim.Region.Framework.Scenes
return true; 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 #endregion //SYMMETRIC SYNC
} }
} }

View File

@ -3546,7 +3546,8 @@ namespace OpenSim.Region.Framework.Scenes
//Add in new parts //Add in new parts
foreach (SceneObjectPart newPart in newParts.Values) 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 !!!!!!!! //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; return groupUpdateResult;
} }
private void AddNewPart(SceneObjectPart newPart)
{
//set the parent relationship
AddPart(newPart);
m_scene.AddNewSceneObjectPart(newPart, this);
}
public void ScheduleGroupForFullUpdate_SyncInfoUnchanged() public void ScheduleGroupForFullUpdate_SyncInfoUnchanged()
{ {
if (IsAttachment) if (IsAttachment)