aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-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 5b21332..8716e0a 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2568,5 +2568,55 @@ namespace OpenSim.Region.Framework.Scenes
2568 part.GetProperties(remoteClient); 2568 part.GetProperties(remoteClient);
2569 } 2569 }
2570 } 2570 }
2571
2572 public void DelinkObjects(List<uint> primIds, IClientAPI client)
2573 {
2574 List<SceneObjectPart> parts = new List<SceneObjectPart>();
2575
2576 foreach (uint localID in primIds)
2577 {
2578 SceneObjectPart part = GetSceneObjectPart(localID);
2579
2580 if (part == null)
2581 continue;
2582
2583 if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
2584 parts.Add(part);
2585 }
2586
2587 m_sceneGraph.DelinkObjects(parts);
2588 }
2589
2590 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
2591 {
2592 List<UUID> owners = new List<UUID>();
2593
2594 List<SceneObjectPart> children = new List<SceneObjectPart>();
2595 SceneObjectPart root = GetSceneObjectPart(parentPrimId);
2596
2597 if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
2598 return;
2599
2600 foreach (uint localID in childPrimIds)
2601 {
2602 SceneObjectPart part = GetSceneObjectPart(localID);
2603
2604 if (part == null)
2605 continue;
2606
2607 if (!owners.Contains(part.OwnerID))
2608 owners.Add(part.OwnerID);
2609
2610 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
2611 children.Add(part);
2612 }
2613
2614 // Must be all one owner
2615 //
2616 if (owners.Count > 1)
2617 return;
2618
2619 m_sceneGraph.LinkObjects(root, children);
2620 }
2571 } 2621 }
2572} 2622}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 7796b8d..637ebff 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2721,8 +2721,8 @@ namespace OpenSim.Region.Framework.Scenes
2721 client.OnObjectName += m_sceneGraph.PrimName; 2721 client.OnObjectName += m_sceneGraph.PrimName;
2722 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 2722 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
2723 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 2723 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
2724 client.OnLinkObjects += m_sceneGraph.LinkObjects; 2724 client.OnLinkObjects += LinkObjects;
2725 client.OnDelinkObjects += m_sceneGraph.DelinkObjects; 2725 client.OnDelinkObjects += DelinkObjects;
2726 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; 2726 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
2727 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; 2727 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
2728 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2728 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
@@ -2877,8 +2877,8 @@ namespace OpenSim.Region.Framework.Scenes
2877 client.OnObjectName -= m_sceneGraph.PrimName; 2877 client.OnObjectName -= m_sceneGraph.PrimName;
2878 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; 2878 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
2879 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; 2879 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
2880 client.OnLinkObjects -= m_sceneGraph.LinkObjects; 2880 client.OnLinkObjects -= LinkObjects;
2881 client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; 2881 client.OnDelinkObjects -= DelinkObjects;
2882 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; 2882 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
2883 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; 2883 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
2884 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; 2884 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index d31b45e..ad24160 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1619,20 +1619,21 @@ namespace OpenSim.Region.Framework.Scenes
1619 /// <param name="client"></param> 1619 /// <param name="client"></param>
1620 /// <param name="parentPrim"></param> 1620 /// <param name="parentPrim"></param>
1621 /// <param name="childPrims"></param> 1621 /// <param name="childPrims"></param>
1622 protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 1622 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1623 { 1623 {
1624 Monitor.Enter(m_updateLock); 1624 Monitor.Enter(m_updateLock);
1625 try 1625 try
1626 { 1626 {
1627 SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); 1627 SceneObjectGroup parentGroup = root.ParentGroup;
1628 1628
1629 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1629 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1630 if (parentGroup != null) 1630 if (parentGroup != null)
1631 { 1631 {
1632 // We do this in reverse to get the link order of the prims correct 1632 // We do this in reverse to get the link order of the prims correct
1633 for (int i = childPrimIds.Count - 1; i >= 0; i--) 1633 for (int i = children.Count - 1; i >= 0; i--)
1634 { 1634 {
1635 SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); 1635 SceneObjectGroup child = children[i].ParentGroup;
1636
1636 if (child != null) 1637 if (child != null)
1637 { 1638 {
1638 // Make sure no child prim is set for sale 1639 // Make sure no child prim is set for sale
@@ -1665,17 +1666,6 @@ namespace OpenSim.Region.Framework.Scenes
1665 parentGroup.HasGroupChanged = true; 1666 parentGroup.HasGroupChanged = true;
1666 parentGroup.ScheduleGroupForFullUpdate(); 1667 parentGroup.ScheduleGroupForFullUpdate();
1667 1668
1668// if (client != null)
1669// {
1670// parentGroup.GetProperties(client);
1671// }
1672// else
1673// {
1674// foreach (ScenePresence p in GetScenePresences())
1675// {
1676// parentGroup.GetProperties(p.ControllingClient);
1677// }
1678// }
1679 } 1669 }
1680 finally 1670 finally
1681 { 1671 {
@@ -1687,12 +1677,7 @@ namespace OpenSim.Region.Framework.Scenes
1687 /// Delink a linkset 1677 /// Delink a linkset
1688 /// </summary> 1678 /// </summary>
1689 /// <param name="prims"></param> 1679 /// <param name="prims"></param>
1690 protected internal void DelinkObjects(List<uint> primIds) 1680 protected internal void DelinkObjects(List<SceneObjectPart> prims)
1691 {
1692 DelinkObjects(primIds, true);
1693 }
1694
1695 protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
1696 { 1681 {
1697 Monitor.Enter(m_updateLock); 1682 Monitor.Enter(m_updateLock);
1698 try 1683 try
@@ -1702,9 +1687,8 @@ namespace OpenSim.Region.Framework.Scenes
1702 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); 1687 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>();
1703 // Look them all up in one go, since that is comparatively expensive 1688 // Look them all up in one go, since that is comparatively expensive
1704 // 1689 //
1705 foreach (uint primID in primIds) 1690 foreach (SceneObjectPart part in prims)
1706 { 1691 {
1707 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID);
1708 if (part != null) 1692 if (part != null)
1709 { 1693 {
1710 if (part.ParentGroup.Children.Count != 1) // Skip single 1694 if (part.ParentGroup.Children.Count != 1) // Skip single
@@ -1719,17 +1703,13 @@ namespace OpenSim.Region.Framework.Scenes
1719 affectedGroups.Add(group); 1703 affectedGroups.Add(group);
1720 } 1704 }
1721 } 1705 }
1722 else
1723 {
1724 m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID);
1725 }
1726 } 1706 }
1727 1707
1728 foreach (SceneObjectPart child in childParts) 1708 foreach (SceneObjectPart child in childParts)
1729 { 1709 {
1730 // Unlink all child parts from their groups 1710 // Unlink all child parts from their groups
1731 // 1711 //
1732 child.ParentGroup.DelinkFromGroup(child, sendEvents); 1712 child.ParentGroup.DelinkFromGroup(child, true);
1733 } 1713 }
1734 1714
1735 foreach (SceneObjectPart root in rootParts) 1715 foreach (SceneObjectPart root in rootParts)
@@ -1784,12 +1764,9 @@ namespace OpenSim.Region.Framework.Scenes
1784 List<uint> linkIDs = new List<uint>(); 1764 List<uint> linkIDs = new List<uint>();
1785 1765
1786 foreach (SceneObjectPart newChild in newSet) 1766 foreach (SceneObjectPart newChild in newSet)
1787 {
1788 newChild.UpdateFlag = 0; 1767 newChild.UpdateFlag = 0;
1789 linkIDs.Add(newChild.LocalId);
1790 }
1791 1768
1792 LinkObjects(null, newRoot.LocalId, linkIDs); 1769 LinkObjects(newRoot, newSet);
1793 if (!affectedGroups.Contains(newRoot.ParentGroup)) 1770 if (!affectedGroups.Contains(newRoot.ParentGroup))
1794 affectedGroups.Add(newRoot.ParentGroup); 1771 affectedGroups.Add(newRoot.ParentGroup);
1795 } 1772 }