Fix some issues with unlinking

avinationmerge
Melanie Thielker 2010-09-07 17:12:28 +02:00
parent 2684ca0838
commit 8ab4b277c1
1 changed files with 53 additions and 56 deletions

View File

@ -1678,16 +1678,16 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = part.ParentGroup;
if (!affectedGroups.Contains(group))
{
group.areUpdatesSuspended = true;
affectedGroups.Add(group);
}
}
}
}
if (childParts.Count > 0)
{
try
{
childParts[0].ParentGroup.areUpdatesSuspended = true;
foreach (SceneObjectPart child in childParts)
{
// Unlink all child parts from their groups
@ -1697,11 +1697,6 @@ namespace OpenSim.Region.Framework.Scenes
child.ParentGroup.ScheduleGroupForFullUpdate();
}
}
finally
{
childParts[0].ParentGroup.areUpdatesSuspended = false;
}
}
foreach (SceneObjectPart root in rootParts)
{
@ -1710,9 +1705,10 @@ namespace OpenSim.Region.Framework.Scenes
// However, editing linked parts and unlinking may be different
//
SceneObjectGroup group = root.ParentGroup;
group.areUpdatesSuspended = true;
List<SceneObjectPart> newSet = null;
int numChildren = -1;
int numChildren;
lock (group.Children)
{
@ -1720,31 +1716,31 @@ namespace OpenSim.Region.Framework.Scenes
numChildren = group.PrimCount;
}
if (numChildren == 1)
break;
// If there are prims left in a link set, but the root is
// slated for unlink, we need to do this
//
if (numChildren != 1)
{
// Unlink the remaining set
//
bool sendEventsToRemainder = true;
if (numChildren > 1)
sendEventsToRemainder = false;
if (newSet.Count > 0)
{
try
{
newSet[0].ParentGroup.areUpdatesSuspended = true;
foreach (SceneObjectPart p in newSet)
{
if (p != group.RootPart)
group.DelinkFromGroup(p, sendEventsToRemainder);
}
}
finally
{
newSet[0].ParentGroup.areUpdatesSuspended = false;
group.DelinkFromGroup(p, sendEventsToRemainder);
if (numChildren > 2)
{
p.ParentGroup.areUpdatesSuspended = true;
}
else
{
p.ParentGroup.HasGroupChanged = true;
p.ParentGroup.ScheduleGroupForFullUpdate();
}
}
}
@ -1773,12 +1769,12 @@ namespace OpenSim.Region.Framework.Scenes
foreach (SceneObjectPart newChild in newSet)
newChild.UpdateFlag = 0;
newRoot.ParentGroup.areUpdatesSuspended = true;
LinkObjects(newRoot, newSet);
if (!affectedGroups.Contains(newRoot.ParentGroup))
affectedGroups.Add(newRoot.ParentGroup);
}
}
}
// Finally, trigger events in the roots
//
@ -1786,6 +1782,7 @@ namespace OpenSim.Region.Framework.Scenes
{
g.TriggerScriptChangedEvent(Changed.LINK);
g.HasGroupChanged = true; // Persist
g.areUpdatesSuspended = false;
g.ScheduleGroupForFullUpdate();
}
}