update scenegraph group find by part information in sog link, so script link functions do update that also.

avinationmerge
UbitUmarov 2014-09-22 13:59:23 +01:00
parent e25849e1c4
commit bcaf202e34
3 changed files with 28 additions and 6 deletions

View File

@ -2548,6 +2548,11 @@ namespace OpenSim.Region.Framework.Scenes
return false; return false;
} }
public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
{
m_sceneGraph.updateScenePartGroup(part, grp);
}
/// <summary> /// <summary>
/// Move the given scene object into a new region depending on which region its absolute position has moved /// Move the given scene object into a new region depending on which region its absolute position has moved
/// into. /// into.

View File

@ -462,6 +462,20 @@ namespace OpenSim.Region.Framework.Scenes
return true; return true;
} }
public void updateScenePartGroup(SceneObjectPart part, SceneObjectGroup grp)
{
// no tests, caller has responsability...
lock (SceneObjectGroupsByFullPartID)
{
SceneObjectGroupsByFullPartID[part.UUID] = grp;
}
lock (SceneObjectGroupsByLocalPartID)
{
SceneObjectGroupsByLocalPartID[part.LocalId] = grp;
}
}
/// <summary> /// <summary>
/// Delete an object from the scene /// Delete an object from the scene
/// </summary> /// </summary>
@ -1804,7 +1818,7 @@ namespace OpenSim.Region.Framework.Scenes
List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
// We do this in reverse to get the link order of the prims correct // We do this in reverse to get the link order of the prims correct
for (int i = 0 ; i < children.Count ; i++) for (int i = 0; i < children.Count; i++)
{ {
SceneObjectGroup child = children[i].ParentGroup; SceneObjectGroup child = children[i].ParentGroup;
@ -1850,12 +1864,13 @@ namespace OpenSim.Region.Framework.Scenes
} }
finally finally
{ {
/*
lock (SceneObjectGroupsByLocalPartID) lock (SceneObjectGroupsByLocalPartID)
{ {
foreach (SceneObjectPart part in parentGroup.Parts) foreach (SceneObjectPart part in parentGroup.Parts)
SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup; SceneObjectGroupsByLocalPartID[part.LocalId] = parentGroup;
} }
*/
parentGroup.AdjustChildPrimPermissions(); parentGroup.AdjustChildPrimPermissions();
parentGroup.HasGroupChanged = true; parentGroup.HasGroupChanged = true;
parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true); parentGroup.ProcessBackup(m_parentScene.SimulationDataService, true);

View File

@ -2560,11 +2560,8 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="cGroupID"></param> /// <param name="cGroupID"></param>
public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
{ {
// give new ID to the new part, letting old keep original
// SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed); SceneObjectPart newPart = part.Copy(part.LocalId, OwnerID, GroupID, m_parts.Count, userExposed);
newPart.LocalId = m_scene.AllocateLocalId(); newPart.LocalId = m_scene.AllocateLocalId();
newPart.SetParent(this);
AddPart(newPart); AddPart(newPart);
@ -2977,6 +2974,8 @@ namespace OpenSim.Region.Framework.Scenes
m_parts.Add(linkPart.UUID, linkPart); m_parts.Add(linkPart.UUID, linkPart);
linkPart.SetParent(this); linkPart.SetParent(this);
m_scene.updateScenePartGroup(linkPart, this);
linkPart.CreateSelected = true; linkPart.CreateSelected = true;
// let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now // let physics know preserve part volume dtc messy since UpdatePrimFlags doesn't look to parent changes for now
@ -3239,8 +3238,11 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentID = m_rootPart.LocalId; part.ParentID = m_rootPart.LocalId;
m_parts.Add(part.UUID, part); m_parts.Add(part.UUID, part);
part.LinkNum = linkNum; part.LinkNum = linkNum;
m_scene.updateScenePartGroup(part, this);
// Compute the new position of this SOP relative to the group position // Compute the new position of this SOP relative to the group position
part.OffsetPosition = newPos - AbsolutePosition; part.OffsetPosition = newPos - AbsolutePosition;