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 e6e414f..90bce39 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -1944,5 +1944,55 @@ namespace OpenSim.Region.Framework.Scenes
1944 part.GetProperties(remoteClient); 1944 part.GetProperties(remoteClient);
1945 } 1945 }
1946 } 1946 }
1947
1948 public void DelinkObjects(List<uint> primIds, IClientAPI client)
1949 {
1950 List<SceneObjectPart> parts = new List<SceneObjectPart>();
1951
1952 foreach (uint localID in primIds)
1953 {
1954 SceneObjectPart part = GetSceneObjectPart(localID);
1955
1956 if (part == null)
1957 continue;
1958
1959 if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
1960 parts.Add(part);
1961 }
1962
1963 m_sceneGraph.DelinkObjects(parts);
1964 }
1965
1966 public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds)
1967 {
1968 List<UUID> owners = new List<UUID>();
1969
1970 List<SceneObjectPart> children = new List<SceneObjectPart>();
1971 SceneObjectPart root = GetSceneObjectPart(parentPrimId);
1972
1973 if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID))
1974 return;
1975
1976 foreach (uint localID in childPrimIds)
1977 {
1978 SceneObjectPart part = GetSceneObjectPart(localID);
1979
1980 if (part == null)
1981 continue;
1982
1983 if (!owners.Contains(part.OwnerID))
1984 owners.Add(part.OwnerID);
1985
1986 if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID))
1987 children.Add(part);
1988 }
1989
1990 // Must be all one owner
1991 //
1992 if (owners.Count > 1)
1993 return;
1994
1995 m_sceneGraph.LinkObjects(root, children);
1996 }
1947 } 1997 }
1948} 1998}
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 58f890f..8ceb109 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2749,8 +2749,8 @@ namespace OpenSim.Region.Framework.Scenes
2749 client.OnObjectName += m_sceneGraph.PrimName; 2749 client.OnObjectName += m_sceneGraph.PrimName;
2750 client.OnObjectClickAction += m_sceneGraph.PrimClickAction; 2750 client.OnObjectClickAction += m_sceneGraph.PrimClickAction;
2751 client.OnObjectMaterial += m_sceneGraph.PrimMaterial; 2751 client.OnObjectMaterial += m_sceneGraph.PrimMaterial;
2752 client.OnLinkObjects += m_sceneGraph.LinkObjects; 2752 client.OnLinkObjects += LinkObjects;
2753 client.OnDelinkObjects += m_sceneGraph.DelinkObjects; 2753 client.OnDelinkObjects += DelinkObjects;
2754 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject; 2754 client.OnObjectDuplicate += m_sceneGraph.DuplicateObject;
2755 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay; 2755 client.OnObjectDuplicateOnRay += doObjectDuplicateOnRay;
2756 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags; 2756 client.OnUpdatePrimFlags += m_sceneGraph.UpdatePrimFlags;
@@ -2906,8 +2906,8 @@ namespace OpenSim.Region.Framework.Scenes
2906 client.OnObjectName -= m_sceneGraph.PrimName; 2906 client.OnObjectName -= m_sceneGraph.PrimName;
2907 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; 2907 client.OnObjectClickAction -= m_sceneGraph.PrimClickAction;
2908 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; 2908 client.OnObjectMaterial -= m_sceneGraph.PrimMaterial;
2909 client.OnLinkObjects -= m_sceneGraph.LinkObjects; 2909 client.OnLinkObjects -= LinkObjects;
2910 client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; 2910 client.OnDelinkObjects -= DelinkObjects;
2911 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; 2911 client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject;
2912 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; 2912 client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay;
2913 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; 2913 client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 3ac34d3..f43de20 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1487,20 +1487,21 @@ namespace OpenSim.Region.Framework.Scenes
1487 /// <param name="client"></param> 1487 /// <param name="client"></param>
1488 /// <param name="parentPrim"></param> 1488 /// <param name="parentPrim"></param>
1489 /// <param name="childPrims"></param> 1489 /// <param name="childPrims"></param>
1490 protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) 1490 protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children)
1491 { 1491 {
1492 Monitor.Enter(m_updateLock); 1492 Monitor.Enter(m_updateLock);
1493 try 1493 try
1494 { 1494 {
1495 SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); 1495 SceneObjectGroup parentGroup = root.ParentGroup;
1496 1496
1497 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); 1497 List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>();
1498 if (parentGroup != null) 1498 if (parentGroup != null)
1499 { 1499 {
1500 // We do this in reverse to get the link order of the prims correct 1500 // We do this in reverse to get the link order of the prims correct
1501 for (int i = childPrimIds.Count - 1; i >= 0; i--) 1501 for (int i = children.Count - 1; i >= 0; i--)
1502 { 1502 {
1503 SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); 1503 SceneObjectGroup child = children[i].ParentGroup;
1504
1504 if (child != null) 1505 if (child != null)
1505 { 1506 {
1506 // Make sure no child prim is set for sale 1507 // Make sure no child prim is set for sale
@@ -1533,17 +1534,6 @@ namespace OpenSim.Region.Framework.Scenes
1533 parentGroup.HasGroupChanged = true; 1534 parentGroup.HasGroupChanged = true;
1534 parentGroup.ScheduleGroupForFullUpdate(); 1535 parentGroup.ScheduleGroupForFullUpdate();
1535 1536
1536// if (client != null)
1537// {
1538// parentGroup.GetProperties(client);
1539// }
1540// else
1541// {
1542// foreach (ScenePresence p in GetScenePresences())
1543// {
1544// parentGroup.GetProperties(p.ControllingClient);
1545// }
1546// }
1547 } 1537 }
1548 finally 1538 finally
1549 { 1539 {
@@ -1555,12 +1545,7 @@ namespace OpenSim.Region.Framework.Scenes
1555 /// Delink a linkset 1545 /// Delink a linkset
1556 /// </summary> 1546 /// </summary>
1557 /// <param name="prims"></param> 1547 /// <param name="prims"></param>
1558 protected internal void DelinkObjects(List<uint> primIds) 1548 protected internal void DelinkObjects(List<SceneObjectPart> prims)
1559 {
1560 DelinkObjects(primIds, true);
1561 }
1562
1563 protected internal void DelinkObjects(List<uint> primIds, bool sendEvents)
1564 { 1549 {
1565 Monitor.Enter(m_updateLock); 1550 Monitor.Enter(m_updateLock);
1566 try 1551 try
@@ -1570,9 +1555,8 @@ namespace OpenSim.Region.Framework.Scenes
1570 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); 1555 List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>();
1571 // Look them all up in one go, since that is comparatively expensive 1556 // Look them all up in one go, since that is comparatively expensive
1572 // 1557 //
1573 foreach (uint primID in primIds) 1558 foreach (SceneObjectPart part in prims)
1574 { 1559 {
1575 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID);
1576 if (part != null) 1560 if (part != null)
1577 { 1561 {
1578 if (part.ParentGroup.Children.Count != 1) // Skip single 1562 if (part.ParentGroup.Children.Count != 1) // Skip single
@@ -1587,17 +1571,13 @@ namespace OpenSim.Region.Framework.Scenes
1587 affectedGroups.Add(group); 1571 affectedGroups.Add(group);
1588 } 1572 }
1589 } 1573 }
1590 else
1591 {
1592 m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID);
1593 }
1594 } 1574 }
1595 1575
1596 foreach (SceneObjectPart child in childParts) 1576 foreach (SceneObjectPart child in childParts)
1597 { 1577 {
1598 // Unlink all child parts from their groups 1578 // Unlink all child parts from their groups
1599 // 1579 //
1600 child.ParentGroup.DelinkFromGroup(child, sendEvents); 1580 child.ParentGroup.DelinkFromGroup(child, true);
1601 } 1581 }
1602 1582
1603 foreach (SceneObjectPart root in rootParts) 1583 foreach (SceneObjectPart root in rootParts)
@@ -1652,12 +1632,9 @@ namespace OpenSim.Region.Framework.Scenes
1652 List<uint> linkIDs = new List<uint>(); 1632 List<uint> linkIDs = new List<uint>();
1653 1633
1654 foreach (SceneObjectPart newChild in newSet) 1634 foreach (SceneObjectPart newChild in newSet)
1655 {
1656 newChild.UpdateFlag = 0; 1635 newChild.UpdateFlag = 0;
1657 linkIDs.Add(newChild.LocalId);
1658 }
1659 1636
1660 LinkObjects(null, newRoot.LocalId, linkIDs); 1637 LinkObjects(newRoot, newSet);
1661 if (!affectedGroups.Contains(newRoot.ParentGroup)) 1638 if (!affectedGroups.Contains(newRoot.ParentGroup))
1662 affectedGroups.Add(newRoot.ParentGroup); 1639 affectedGroups.Add(newRoot.ParentGroup);
1663 } 1640 }