diff options
author | Melanie Thielker | 2010-09-07 17:12:28 +0200 |
---|---|---|
committer | Melanie Thielker | 2010-09-07 17:12:28 +0200 |
commit | 8ab4b277c1e1d5470a0322ec49dde665f3cceadc (patch) | |
tree | 8c20e2bc5f5f89496522421c408de84877b08b5b /OpenSim/Region | |
parent | Merge branch 'master' into careminster-presence-refactor (diff) | |
download | opensim-SC_OLD-8ab4b277c1e1d5470a0322ec49dde665f3cceadc.zip opensim-SC_OLD-8ab4b277c1e1d5470a0322ec49dde665f3cceadc.tar.gz opensim-SC_OLD-8ab4b277c1e1d5470a0322ec49dde665f3cceadc.tar.bz2 opensim-SC_OLD-8ab4b277c1e1d5470a0322ec49dde665f3cceadc.tar.xz |
Fix some issues with unlinking
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 109 |
1 files changed, 53 insertions, 56 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 905c683..a39f27a 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1678,28 +1678,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | 1678 | ||
1679 | SceneObjectGroup group = part.ParentGroup; | 1679 | SceneObjectGroup group = part.ParentGroup; |
1680 | if (!affectedGroups.Contains(group)) | 1680 | if (!affectedGroups.Contains(group)) |
1681 | { | ||
1682 | group.areUpdatesSuspended = true; | ||
1681 | affectedGroups.Add(group); | 1683 | affectedGroups.Add(group); |
1684 | } | ||
1682 | } | 1685 | } |
1683 | } | 1686 | } |
1684 | } | 1687 | } |
1685 | 1688 | ||
1686 | if (childParts.Count > 0) | 1689 | if (childParts.Count > 0) |
1687 | { | 1690 | { |
1688 | try | 1691 | foreach (SceneObjectPart child in childParts) |
1689 | { | 1692 | { |
1690 | childParts[0].ParentGroup.areUpdatesSuspended = true; | 1693 | // Unlink all child parts from their groups |
1691 | foreach (SceneObjectPart child in childParts) | 1694 | // |
1692 | { | 1695 | child.ParentGroup.DelinkFromGroup(child, true); |
1693 | // Unlink all child parts from their groups | 1696 | child.ParentGroup.HasGroupChanged = true; |
1694 | // | 1697 | child.ParentGroup.ScheduleGroupForFullUpdate(); |
1695 | child.ParentGroup.DelinkFromGroup(child, true); | ||
1696 | child.ParentGroup.HasGroupChanged = true; | ||
1697 | child.ParentGroup.ScheduleGroupForFullUpdate(); | ||
1698 | } | ||
1699 | } | ||
1700 | finally | ||
1701 | { | ||
1702 | childParts[0].ParentGroup.areUpdatesSuspended = false; | ||
1703 | } | 1698 | } |
1704 | } | 1699 | } |
1705 | 1700 | ||
@@ -1710,9 +1705,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1710 | // However, editing linked parts and unlinking may be different | 1705 | // However, editing linked parts and unlinking may be different |
1711 | // | 1706 | // |
1712 | SceneObjectGroup group = root.ParentGroup; | 1707 | SceneObjectGroup group = root.ParentGroup; |
1708 | group.areUpdatesSuspended = true; | ||
1713 | 1709 | ||
1714 | List<SceneObjectPart> newSet = null; | 1710 | List<SceneObjectPart> newSet = null; |
1715 | int numChildren = -1; | 1711 | int numChildren; |
1716 | 1712 | ||
1717 | lock (group.Children) | 1713 | lock (group.Children) |
1718 | { | 1714 | { |
@@ -1720,63 +1716,63 @@ namespace OpenSim.Region.Framework.Scenes | |||
1720 | numChildren = group.PrimCount; | 1716 | numChildren = group.PrimCount; |
1721 | } | 1717 | } |
1722 | 1718 | ||
1719 | if (numChildren == 1) | ||
1720 | break; | ||
1721 | |||
1723 | // If there are prims left in a link set, but the root is | 1722 | // If there are prims left in a link set, but the root is |
1724 | // slated for unlink, we need to do this | 1723 | // slated for unlink, we need to do this |
1724 | // Unlink the remaining set | ||
1725 | // | 1725 | // |
1726 | if (numChildren != 1) | 1726 | bool sendEventsToRemainder = true; |
1727 | { | 1727 | if (numChildren > 1) |
1728 | // Unlink the remaining set | 1728 | sendEventsToRemainder = false; |
1729 | // | ||
1730 | bool sendEventsToRemainder = true; | ||
1731 | if (numChildren > 1) | ||
1732 | sendEventsToRemainder = false; | ||
1733 | 1729 | ||
1734 | if (newSet.Count > 0) | 1730 | foreach (SceneObjectPart p in newSet) |
1731 | { | ||
1732 | if (p != group.RootPart) | ||
1735 | { | 1733 | { |
1736 | try | 1734 | group.DelinkFromGroup(p, sendEventsToRemainder); |
1735 | if (numChildren > 2) | ||
1737 | { | 1736 | { |
1738 | newSet[0].ParentGroup.areUpdatesSuspended = true; | 1737 | p.ParentGroup.areUpdatesSuspended = true; |
1739 | foreach (SceneObjectPart p in newSet) | ||
1740 | { | ||
1741 | if (p != group.RootPart) | ||
1742 | group.DelinkFromGroup(p, sendEventsToRemainder); | ||
1743 | } | ||
1744 | } | 1738 | } |
1745 | finally | 1739 | else |
1746 | { | 1740 | { |
1747 | newSet[0].ParentGroup.areUpdatesSuspended = false; | 1741 | p.ParentGroup.HasGroupChanged = true; |
1742 | p.ParentGroup.ScheduleGroupForFullUpdate(); | ||
1748 | } | 1743 | } |
1749 | } | 1744 | } |
1745 | } | ||
1746 | |||
1747 | // If there is more than one prim remaining, we | ||
1748 | // need to re-link | ||
1749 | // | ||
1750 | if (numChildren > 2) | ||
1751 | { | ||
1752 | // Remove old root | ||
1753 | // | ||
1754 | if (newSet.Contains(root)) | ||
1755 | newSet.Remove(root); | ||
1750 | 1756 | ||
1751 | // If there is more than one prim remaining, we | 1757 | // Preserve link ordering |
1752 | // need to re-link | ||
1753 | // | 1758 | // |
1754 | if (numChildren > 2) | 1759 | newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b) |
1755 | { | 1760 | { |
1756 | // Remove old root | 1761 | return a.LinkNum.CompareTo(b.LinkNum); |
1757 | // | 1762 | }); |
1758 | if (newSet.Contains(root)) | ||
1759 | newSet.Remove(root); | ||
1760 | |||
1761 | // Preserve link ordering | ||
1762 | // | ||
1763 | newSet.Sort(delegate (SceneObjectPart a, SceneObjectPart b) | ||
1764 | { | ||
1765 | return a.LinkNum.CompareTo(b.LinkNum); | ||
1766 | }); | ||
1767 | 1763 | ||
1768 | // Determine new root | 1764 | // Determine new root |
1769 | // | 1765 | // |
1770 | SceneObjectPart newRoot = newSet[0]; | 1766 | SceneObjectPart newRoot = newSet[0]; |
1771 | newSet.RemoveAt(0); | 1767 | newSet.RemoveAt(0); |
1772 | 1768 | ||
1773 | foreach (SceneObjectPart newChild in newSet) | 1769 | foreach (SceneObjectPart newChild in newSet) |
1774 | newChild.UpdateFlag = 0; | 1770 | newChild.UpdateFlag = 0; |
1775 | 1771 | ||
1776 | LinkObjects(newRoot, newSet); | 1772 | newRoot.ParentGroup.areUpdatesSuspended = true; |
1777 | if (!affectedGroups.Contains(newRoot.ParentGroup)) | 1773 | LinkObjects(newRoot, newSet); |
1778 | affectedGroups.Add(newRoot.ParentGroup); | 1774 | if (!affectedGroups.Contains(newRoot.ParentGroup)) |
1779 | } | 1775 | affectedGroups.Add(newRoot.ParentGroup); |
1780 | } | 1776 | } |
1781 | } | 1777 | } |
1782 | 1778 | ||
@@ -1786,6 +1782,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1786 | { | 1782 | { |
1787 | g.TriggerScriptChangedEvent(Changed.LINK); | 1783 | g.TriggerScriptChangedEvent(Changed.LINK); |
1788 | g.HasGroupChanged = true; // Persist | 1784 | g.HasGroupChanged = true; // Persist |
1785 | g.areUpdatesSuspended = false; | ||
1789 | g.ScheduleGroupForFullUpdate(); | 1786 | g.ScheduleGroupForFullUpdate(); |
1790 | } | 1787 | } |
1791 | } | 1788 | } |