Fix some issues with unlinking
parent
2684ca0838
commit
8ab4b277c1
|
@ -1678,28 +1678,23 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
SceneObjectGroup group = part.ParentGroup;
|
SceneObjectGroup group = part.ParentGroup;
|
||||||
if (!affectedGroups.Contains(group))
|
if (!affectedGroups.Contains(group))
|
||||||
|
{
|
||||||
|
group.areUpdatesSuspended = true;
|
||||||
affectedGroups.Add(group);
|
affectedGroups.Add(group);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (childParts.Count > 0)
|
if (childParts.Count > 0)
|
||||||
{
|
{
|
||||||
try
|
foreach (SceneObjectPart child in childParts)
|
||||||
{
|
{
|
||||||
childParts[0].ParentGroup.areUpdatesSuspended = true;
|
// Unlink all child parts from their groups
|
||||||
foreach (SceneObjectPart child in childParts)
|
//
|
||||||
{
|
child.ParentGroup.DelinkFromGroup(child, true);
|
||||||
// Unlink all child parts from their groups
|
child.ParentGroup.HasGroupChanged = true;
|
||||||
//
|
child.ParentGroup.ScheduleGroupForFullUpdate();
|
||||||
child.ParentGroup.DelinkFromGroup(child, true);
|
|
||||||
child.ParentGroup.HasGroupChanged = true;
|
|
||||||
child.ParentGroup.ScheduleGroupForFullUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
childParts[0].ParentGroup.areUpdatesSuspended = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1710,9 +1705,10 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// However, editing linked parts and unlinking may be different
|
// However, editing linked parts and unlinking may be different
|
||||||
//
|
//
|
||||||
SceneObjectGroup group = root.ParentGroup;
|
SceneObjectGroup group = root.ParentGroup;
|
||||||
|
group.areUpdatesSuspended = true;
|
||||||
|
|
||||||
List<SceneObjectPart> newSet = null;
|
List<SceneObjectPart> newSet = null;
|
||||||
int numChildren = -1;
|
int numChildren;
|
||||||
|
|
||||||
lock (group.Children)
|
lock (group.Children)
|
||||||
{
|
{
|
||||||
|
@ -1720,63 +1716,63 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
numChildren = group.PrimCount;
|
numChildren = group.PrimCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (numChildren == 1)
|
||||||
|
break;
|
||||||
|
|
||||||
// If there are prims left in a link set, but the root is
|
// If there are prims left in a link set, but the root is
|
||||||
// slated for unlink, we need to do this
|
// slated for unlink, we need to do this
|
||||||
|
// Unlink the remaining set
|
||||||
//
|
//
|
||||||
if (numChildren != 1)
|
bool sendEventsToRemainder = true;
|
||||||
|
if (numChildren > 1)
|
||||||
|
sendEventsToRemainder = false;
|
||||||
|
|
||||||
|
foreach (SceneObjectPart p in newSet)
|
||||||
{
|
{
|
||||||
// Unlink the remaining set
|
if (p != group.RootPart)
|
||||||
//
|
|
||||||
bool sendEventsToRemainder = true;
|
|
||||||
if (numChildren > 1)
|
|
||||||
sendEventsToRemainder = false;
|
|
||||||
|
|
||||||
if (newSet.Count > 0)
|
|
||||||
{
|
{
|
||||||
try
|
group.DelinkFromGroup(p, sendEventsToRemainder);
|
||||||
|
if (numChildren > 2)
|
||||||
{
|
{
|
||||||
newSet[0].ParentGroup.areUpdatesSuspended = true;
|
p.ParentGroup.areUpdatesSuspended = true;
|
||||||
foreach (SceneObjectPart p in newSet)
|
|
||||||
{
|
|
||||||
if (p != group.RootPart)
|
|
||||||
group.DelinkFromGroup(p, sendEventsToRemainder);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
else
|
||||||
{
|
{
|
||||||
newSet[0].ParentGroup.areUpdatesSuspended = false;
|
p.ParentGroup.HasGroupChanged = true;
|
||||||
|
p.ParentGroup.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If there is more than one prim remaining, we
|
// If there is more than one prim remaining, we
|
||||||
// need to re-link
|
// need to re-link
|
||||||
|
//
|
||||||
|
if (numChildren > 2)
|
||||||
|
{
|
||||||
|
// Remove old root
|
||||||
//
|
//
|
||||||
if (numChildren > 2)
|
if (newSet.Contains(root))
|
||||||
|
newSet.Remove(root);
|
||||||
|
|
||||||
|
// Preserve link ordering
|
||||||
|
//
|
||||||
|
newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b)
|
||||||
{
|
{
|
||||||
// Remove old root
|
return a.LinkNum.CompareTo(b.LinkNum);
|
||||||
//
|
});
|
||||||
if (newSet.Contains(root))
|
|
||||||
newSet.Remove(root);
|
|
||||||
|
|
||||||
// Preserve link ordering
|
// Determine new root
|
||||||
//
|
//
|
||||||
newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b)
|
SceneObjectPart newRoot = newSet[0];
|
||||||
{
|
newSet.RemoveAt(0);
|
||||||
return a.LinkNum.CompareTo(b.LinkNum);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Determine new root
|
foreach (SceneObjectPart newChild in newSet)
|
||||||
//
|
newChild.UpdateFlag = 0;
|
||||||
SceneObjectPart newRoot = newSet[0];
|
|
||||||
newSet.RemoveAt(0);
|
|
||||||
|
|
||||||
foreach (SceneObjectPart newChild in newSet)
|
newRoot.ParentGroup.areUpdatesSuspended = true;
|
||||||
newChild.UpdateFlag = 0;
|
LinkObjects(newRoot, newSet);
|
||||||
|
if (!affectedGroups.Contains(newRoot.ParentGroup))
|
||||||
LinkObjects(newRoot, newSet);
|
affectedGroups.Add(newRoot.ParentGroup);
|
||||||
if (!affectedGroups.Contains(newRoot.ParentGroup))
|
|
||||||
affectedGroups.Add(newRoot.ParentGroup);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1786,6 +1782,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
g.TriggerScriptChangedEvent(Changed.LINK);
|
g.TriggerScriptChangedEvent(Changed.LINK);
|
||||||
g.HasGroupChanged = true; // Persist
|
g.HasGroupChanged = true; // Persist
|
||||||
|
g.areUpdatesSuspended = false;
|
||||||
g.ScheduleGroupForFullUpdate();
|
g.ScheduleGroupForFullUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue