aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs50
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs8
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs41
3 files changed, 63 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 6c57d18..a430bc4 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2577,5 +2577,55 @@ namespace OpenSim.Region.Framework.Scenes
2577 part.GetProperties(remoteClient); 2577 part.GetProperties(remoteClient);
2578 } 2578 }
2579 } 2579 }
2580
2581 public void DelinkObjects(List<uint> primIds, IClientAPI client)
2582 {
2583 List<SceneObjectPart> parts = new List<SceneObjectPart>();
2584
2585 foreach (uint localID in primIds)
2586 {
2587 SceneObjectPart part = GetSceneObjectPart(localID);
2588
2589 if (part == null)
2590 continue;
2591
2592 if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
2593 parts.Add(part);
2594 }
2595
2596 m_sceneGraph.DelinkObjects(parts);
2597 }
2598
2599 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2600 {
2601 List<UUID> owners = new List<UUID>();
2602
2603 List<SceneObjectPart> children = new List<SceneObjectPart>();
2604 SceneObjectPart root = GetSceneObjectPart(parentPrimId);
2605
2606 if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
2607 return;
2608
2609 foreach (uint localID in childPrimIds)
2610 {
2611 SceneObjectPart part = GetSceneObjectPart(localID);
2612
2613 if (part == null)
2614 continue;
2615
2616 if (!owners.Contains(part.OwnerID))
2617 owners.Add(part.OwnerID);
2618
2619 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
2620 children.Add(part);
2621 }
2622
2623 // Must be all one owner
2624 //
2625 if (owners.Count > 1)
2626 return;
2627
2628 m_sceneGraph.LinkObjects(root, children);
2629 }
2580 } 2630 }
2581} 2631}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index db073e8..0556166 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2762,8 +2762,8 @@ namespace OpenSim.Region.Framework.Scenes
2762 client.OnObjectName += m_sceneGraph.PrimName; 2762 client.OnObjectName += m_sceneGraph.PrimName;
2763 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 2763 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
2764 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 2764 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
2765 client.OnLinkObjects += m_sceneGraph.LinkObjects; 2765 client.OnLinkObjects += LinkObjects;
2766 client.OnDelinkObjects += m_sceneGraph.DelinkObjects; 2766 client.OnDelinkObjects += DelinkObjects;
2767 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; 2767 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
2768 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; 2768 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
2769 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2769 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
@@ -2918,8 +2918,8 @@ namespace OpenSim.Region.Framework.Scenes
2918 client.OnObjectName -= m_sceneGraph.PrimName; 2918 client.OnObjectName -= m_sceneGraph.PrimName;
2919 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; 2919 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
2920 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; 2920 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
2921 client.OnLinkObjects -= m_sceneGraph.LinkObjects; 2921 client.OnLinkObjects -= LinkObjects;
2922 client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; 2922 client.OnDelinkObjects -= DelinkObjects;
2923 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; 2923 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
2924 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; 2924 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
2925 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; 2925 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index bbcb85e..090f379 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1655,20 +1655,21 @@ namespace OpenSim.Region.Framework.Scenes
1655 /// <param name="client"></param> 1655 /// <param name="client"></param>
1656 /// <param name="parentPrim"></param> 1656 /// <param name="parentPrim"></param>
1657 /// <param name="childPrims"></param> 1657 /// <param name="childPrims"></param>
1658 protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 1658 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1659 { 1659 {
1660 Monitor.Enter(m_updateLock); 1660 Monitor.Enter(m_updateLock);
1661 try 1661 try
1662 { 1662 {
1663 SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); 1663 SceneObjectGroup parentGroup = root.ParentGroup;
1664 1664
1665 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1665 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1666 if (parentGroup != null) 1666 if (parentGroup != null)
1667 { 1667 {
1668 // We do this in reverse to get the link order of the prims correct 1668 // We do this in reverse to get the link order of the prims correct
1669 for (int i = childPrimIds.Count - 1; i >= 0; i--) 1669 for (int i = children.Count - 1; i >= 0; i--)
1670 { 1670 {
1671 SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); 1671 SceneObjectGroup child = children[i].ParentGroup;
1672
1672 if (child != null) 1673 if (child != null)
1673 { 1674 {
1674 // Make sure no child prim is set for sale 1675 // Make sure no child prim is set for sale
@@ -1701,17 +1702,6 @@ namespace OpenSim.Region.Framework.Scenes
1701 parentGroup.HasGroupChanged = true; 1702 parentGroup.HasGroupChanged = true;
1702 parentGroup.ScheduleGroupForFullUpdate(); 1703 parentGroup.ScheduleGroupForFullUpdate();
1703 1704
1704// if (client != null)
1705// {
1706// parentGroup.GetProperties(client);
1707// }
1708// else
1709// {
1710// foreach (ScenePresence p in GetScenePresences())
1711// {
1712// parentGroup.GetProperties(p.ControllingClient);
1713// }
1714// }
1715 } 1705 }
1716 finally 1706 finally
1717 { 1707 {
@@ -1723,12 +1713,7 @@ namespace OpenSim.Region.Framework.Scenes
1723 /// Delink a linkset 1713 /// Delink a linkset
1724 /// </summary> 1714 /// </summary>
1725 /// <param name="prims"></param> 1715 /// <param name="prims"></param>
1726 protected internal void DelinkObjects(List<uint> primIds) 1716 protected internal void DelinkObjects(List<SceneObjectPart> prims)
1727 {
1728 DelinkObjects(primIds, true);
1729 }
1730
1731 protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
1732 { 1717 {
1733 Monitor.Enter(m_updateLock); 1718 Monitor.Enter(m_updateLock);
1734 try 1719 try
@@ -1738,9 +1723,8 @@ namespace OpenSim.Region.Framework.Scenes
1738 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); 1723 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>();
1739 // Look them all up in one go, since that is comparatively expensive 1724 // Look them all up in one go, since that is comparatively expensive
1740 // 1725 //
1741 foreach (uint primID in primIds) 1726 foreach (SceneObjectPart part in prims)
1742 { 1727 {
1743 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID);
1744 if (part != null) 1728 if (part != null)
1745 { 1729 {
1746 if (part.ParentGroup.Children.Count != 1) // Skip single 1730 if (part.ParentGroup.Children.Count != 1) // Skip single
@@ -1755,17 +1739,13 @@ namespace OpenSim.Region.Framework.Scenes
1755 affectedGroups.Add(group); 1739 affectedGroups.Add(group);
1756 } 1740 }
1757 } 1741 }
1758 else
1759 {
1760 m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID);
1761 }
1762 } 1742 }
1763 1743
1764 foreach (SceneObjectPart child in childParts) 1744 foreach (SceneObjectPart child in childParts)
1765 { 1745 {
1766 // Unlink all child parts from their groups 1746 // Unlink all child parts from their groups
1767 // 1747 //
1768 child.ParentGroup.DelinkFromGroup(child, sendEvents); 1748 child.ParentGroup.DelinkFromGroup(child, true);
1769 } 1749 }
1770 1750
1771 foreach (SceneObjectPart root in rootParts) 1751 foreach (SceneObjectPart root in rootParts)
@@ -1820,12 +1800,9 @@ namespace OpenSim.Region.Framework.Scenes
1820 List<uint> linkIDs = new List<uint>(); 1800 List<uint> linkIDs = new List<uint>();
1821 1801
1822 foreach (SceneObjectPart newChild in newSet) 1802 foreach (SceneObjectPart newChild in newSet)
1823 {
1824 newChild.UpdateFlag = 0; 1803 newChild.UpdateFlag = 0;
1825 linkIDs.Add(newChild.LocalId);
1826 }
1827 1804
1828 LinkObjects(null, newRoot.LocalId, linkIDs); 1805 LinkObjects(newRoot, newSet);
1829 if (!affectedGroups.Contains(newRoot.ParentGroup)) 1806 if (!affectedGroups.Contains(newRoot.ParentGroup))
1830 affectedGroups.Add(newRoot.ParentGroup); 1807 affectedGroups.Add(newRoot.ParentGroup);
1831 } 1808 }