diff options
Diffstat (limited to 'OpenSim/Region/Framework')
6 files changed, 102 insertions, 67 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index 2b90960..fd43923 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -161,6 +161,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
161 | /// in this prim's inventory.</param> | 161 | /// in this prim's inventory.</param> |
162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 162 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
163 | bool UpdateInventoryItem(TaskInventoryItem item); | 163 | bool UpdateInventoryItem(TaskInventoryItem item); |
164 | bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents); | ||
164 | 165 | ||
165 | /// <summary> | 166 | /// <summary> |
166 | /// Remove an item from this entity's inventory | 167 | /// Remove an item from this entity's inventory |
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs index 8365fe3..e25a6e8 100644 --- a/OpenSim/Region/Framework/Interfaces/IRegionModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRegionModule.cs | |||
@@ -30,8 +30,8 @@ using OpenSim.Region.Framework.Scenes; | |||
30 | 30 | ||
31 | namespace OpenSim.Region.Framework.Interfaces | 31 | namespace OpenSim.Region.Framework.Interfaces |
32 | { | 32 | { |
33 | /// <summary> | 33 | /// <summary> |
34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead | 34 | /// DEPRECATED! Use INonSharedRegionModule or ISharedRegionModule instead |
35 | /// </summary> | 35 | /// </summary> |
36 | public interface IRegionModule | 36 | public interface IRegionModule |
37 | { | 37 | { |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 15b5230..6ebfd31 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -1941,5 +1941,55 @@ namespace OpenSim.Region.Framework.Scenes | |||
1941 | part.GetProperties(remoteClient); | 1941 | part.GetProperties(remoteClient); |
1942 | } | 1942 | } |
1943 | } | 1943 | } |
1944 | |||
1945 | public void DelinkObjects(List<uint> primIds, IClientAPI client) | ||
1946 | { | ||
1947 | List<SceneObjectPart> parts = new List<SceneObjectPart>(); | ||
1948 | |||
1949 | foreach (uint localID in primIds) | ||
1950 | { | ||
1951 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1952 | |||
1953 | if (part == null) | ||
1954 | continue; | ||
1955 | |||
1956 | if (Permissions.CanDelinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1957 | parts.Add(part); | ||
1958 | } | ||
1959 | |||
1960 | m_sceneGraph.DelinkObjects(parts); | ||
1961 | } | ||
1962 | |||
1963 | public void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | ||
1964 | { | ||
1965 | List<UUID> owners = new List<UUID>(); | ||
1966 | |||
1967 | List<SceneObjectPart> children = new List<SceneObjectPart>(); | ||
1968 | SceneObjectPart root = GetSceneObjectPart(parentPrimId); | ||
1969 | |||
1970 | if (Permissions.CanLinkObject(client.AgentId, root.ParentGroup.RootPart.UUID)) | ||
1971 | return; | ||
1972 | |||
1973 | foreach (uint localID in childPrimIds) | ||
1974 | { | ||
1975 | SceneObjectPart part = GetSceneObjectPart(localID); | ||
1976 | |||
1977 | if (part == null) | ||
1978 | continue; | ||
1979 | |||
1980 | if (!owners.Contains(part.OwnerID)) | ||
1981 | owners.Add(part.OwnerID); | ||
1982 | |||
1983 | if (Permissions.CanLinkObject(client.AgentId, part.ParentGroup.RootPart.UUID)) | ||
1984 | children.Add(part); | ||
1985 | } | ||
1986 | |||
1987 | // Must be all one owner | ||
1988 | // | ||
1989 | if (owners.Count > 1) | ||
1990 | return; | ||
1991 | |||
1992 | m_sceneGraph.LinkObjects(root, children); | ||
1993 | } | ||
1944 | } | 1994 | } |
1945 | } | 1995 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 57587be..61a2956 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; |
@@ -2878,8 +2878,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2878 | client.OnObjectName -= m_sceneGraph.PrimName; | 2878 | client.OnObjectName -= m_sceneGraph.PrimName; |
2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; | 2879 | client.OnObjectClickAction -= m_sceneGraph.PrimClickAction; |
2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; | 2880 | client.OnObjectMaterial -= m_sceneGraph.PrimMaterial; |
2881 | client.OnLinkObjects -= m_sceneGraph.LinkObjects; | 2881 | client.OnLinkObjects -= LinkObjects; |
2882 | client.OnDelinkObjects -= m_sceneGraph.DelinkObjects; | 2882 | client.OnDelinkObjects -= DelinkObjects; |
2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; | 2883 | client.OnObjectDuplicate -= m_sceneGraph.DuplicateObject; |
2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; | 2884 | client.OnObjectDuplicateOnRay -= doObjectDuplicateOnRay; |
2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; | 2885 | client.OnUpdatePrimFlags -= m_sceneGraph.UpdatePrimFlags; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 1421d0e..ce11267 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1463,20 +1463,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1463 | /// <param name="client"></param> | 1463 | /// <param name="client"></param> |
1464 | /// <param name="parentPrim"></param> | 1464 | /// <param name="parentPrim"></param> |
1465 | /// <param name="childPrims"></param> | 1465 | /// <param name="childPrims"></param> |
1466 | protected internal void LinkObjects(IClientAPI client, uint parentPrimId, List<uint> childPrimIds) | 1466 | protected internal void LinkObjects(SceneObjectPart root, List<SceneObjectPart> children) |
1467 | { | 1467 | { |
1468 | Monitor.Enter(m_updateLock); | 1468 | Monitor.Enter(m_updateLock); |
1469 | try | 1469 | try |
1470 | { | 1470 | { |
1471 | SceneObjectGroup parentGroup = GetGroupByPrim(parentPrimId); | 1471 | SceneObjectGroup parentGroup = root.ParentGroup; |
1472 | 1472 | ||
1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); | 1473 | List<SceneObjectGroup> childGroups = new List<SceneObjectGroup>(); |
1474 | if (parentGroup != null) | 1474 | if (parentGroup != null) |
1475 | { | 1475 | { |
1476 | // We do this in reverse to get the link order of the prims correct | 1476 | // We do this in reverse to get the link order of the prims correct |
1477 | for (int i = childPrimIds.Count - 1; i >= 0; i--) | 1477 | for (int i = children.Count - 1; i >= 0; i--) |
1478 | { | 1478 | { |
1479 | SceneObjectGroup child = GetGroupByPrim(childPrimIds[i]); | 1479 | SceneObjectGroup child = children[i].ParentGroup; |
1480 | |||
1480 | if (child != null) | 1481 | if (child != null) |
1481 | { | 1482 | { |
1482 | // Make sure no child prim is set for sale | 1483 | // Make sure no child prim is set for sale |
@@ -1509,17 +1510,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1509 | parentGroup.HasGroupChanged = true; | 1510 | parentGroup.HasGroupChanged = true; |
1510 | parentGroup.ScheduleGroupForFullUpdate(); | 1511 | parentGroup.ScheduleGroupForFullUpdate(); |
1511 | 1512 | ||
1512 | // if (client != null) | ||
1513 | // { | ||
1514 | // parentGroup.GetProperties(client); | ||
1515 | // } | ||
1516 | // else | ||
1517 | // { | ||
1518 | // foreach (ScenePresence p in GetScenePresences()) | ||
1519 | // { | ||
1520 | // parentGroup.GetProperties(p.ControllingClient); | ||
1521 | // } | ||
1522 | // } | ||
1523 | } | 1513 | } |
1524 | finally | 1514 | finally |
1525 | { | 1515 | { |
@@ -1531,12 +1521,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1531 | /// Delink a linkset | 1521 | /// Delink a linkset |
1532 | /// </summary> | 1522 | /// </summary> |
1533 | /// <param name="prims"></param> | 1523 | /// <param name="prims"></param> |
1534 | protected internal void DelinkObjects(List<uint> primIds) | 1524 | protected internal void DelinkObjects(List<SceneObjectPart> prims) |
1535 | { | ||
1536 | DelinkObjects(primIds, true); | ||
1537 | } | ||
1538 | |||
1539 | protected internal void DelinkObjects(List<uint> primIds, bool sendEvents) | ||
1540 | { | 1525 | { |
1541 | Monitor.Enter(m_updateLock); | 1526 | Monitor.Enter(m_updateLock); |
1542 | try | 1527 | try |
@@ -1546,9 +1531,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1546 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); | 1531 | List<SceneObjectGroup> affectedGroups = new List<SceneObjectGroup>(); |
1547 | // Look them all up in one go, since that is comparatively expensive | 1532 | // Look them all up in one go, since that is comparatively expensive |
1548 | // | 1533 | // |
1549 | foreach (uint primID in primIds) | 1534 | foreach (SceneObjectPart part in prims) |
1550 | { | 1535 | { |
1551 | SceneObjectPart part = m_parentScene.GetSceneObjectPart(primID); | ||
1552 | if (part != null) | 1536 | if (part != null) |
1553 | { | 1537 | { |
1554 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1538 | if (part.ParentGroup.Children.Count != 1) // Skip single |
@@ -1563,17 +1547,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1563 | affectedGroups.Add(group); | 1547 | affectedGroups.Add(group); |
1564 | } | 1548 | } |
1565 | } | 1549 | } |
1566 | else | ||
1567 | { | ||
1568 | m_log.ErrorFormat("Viewer requested unlink of nonexistent part {0}", primID); | ||
1569 | } | ||
1570 | } | 1550 | } |
1571 | 1551 | ||
1572 | foreach (SceneObjectPart child in childParts) | 1552 | foreach (SceneObjectPart child in childParts) |
1573 | { | 1553 | { |
1574 | // Unlink all child parts from their groups | 1554 | // Unlink all child parts from their groups |
1575 | // | 1555 | // |
1576 | child.ParentGroup.DelinkFromGroup(child, sendEvents); | 1556 | child.ParentGroup.DelinkFromGroup(child, true); |
1577 | } | 1557 | } |
1578 | 1558 | ||
1579 | foreach (SceneObjectPart root in rootParts) | 1559 | foreach (SceneObjectPart root in rootParts) |
@@ -1628,12 +1608,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1628 | List<uint> linkIDs = new List<uint>(); | 1608 | List<uint> linkIDs = new List<uint>(); |
1629 | 1609 | ||
1630 | foreach (SceneObjectPart newChild in newSet) | 1610 | foreach (SceneObjectPart newChild in newSet) |
1631 | { | ||
1632 | newChild.UpdateFlag = 0; | 1611 | newChild.UpdateFlag = 0; |
1633 | linkIDs.Add(newChild.LocalId); | ||
1634 | } | ||
1635 | 1612 | ||
1636 | LinkObjects(null, newRoot.LocalId, linkIDs); | 1613 | LinkObjects(newRoot, newSet); |
1637 | if (!affectedGroups.Contains(newRoot.ParentGroup)) | 1614 | if (!affectedGroups.Contains(newRoot.ParentGroup)) |
1638 | affectedGroups.Add(newRoot.ParentGroup); | 1615 | affectedGroups.Add(newRoot.ParentGroup); |
1639 | } | 1616 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 3b1b567..4da63c0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -609,43 +609,50 @@ namespace OpenSim.Region.Framework.Scenes | |||
609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> | 609 | /// <returns>false if the item did not exist, true if the update occurred successfully</returns> |
610 | public bool UpdateInventoryItem(TaskInventoryItem item) | 610 | public bool UpdateInventoryItem(TaskInventoryItem item) |
611 | { | 611 | { |
612 | lock (m_items) | 612 | return UpdateInventoryItem(item, true); |
613 | } | ||
614 | |||
615 | public bool UpdateInventoryItem(TaskInventoryItem item, bool fireScriptEvents) | ||
616 | { | ||
617 | lock(m_items) | ||
613 | { | 618 | { |
614 | if (m_items.ContainsKey(item.ItemID)) | 619 | if (m_items.ContainsKey(item.ItemID)) |
615 | { | 620 | { |
616 | item.ParentID = m_part.UUID; | 621 | if (m_items.ContainsKey(item.ItemID)) |
617 | item.ParentPartID = m_part.UUID; | ||
618 | item.Flags = m_items[item.ItemID].Flags; | ||
619 | |||
620 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
621 | // changed since permissions were last set. | ||
622 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
623 | item.GroupID = m_part.GroupID; | ||
624 | |||
625 | if (item.AssetID == UUID.Zero) | ||
626 | { | 622 | { |
627 | item.AssetID = m_items[item.ItemID].AssetID; | 623 | item.ParentID = m_part.UUID; |
624 | item.ParentPartID = m_part.UUID; | ||
625 | item.Flags = m_items[item.ItemID].Flags; | ||
626 | |||
627 | // If group permissions have been set on, check that the groupID is up to date in case it has | ||
628 | // changed since permissions were last set. | ||
629 | if (item.GroupPermissions != (uint)PermissionMask.None) | ||
630 | item.GroupID = m_part.GroupID; | ||
631 | |||
632 | if (item.AssetID == UUID.Zero) | ||
633 | { | ||
634 | item.AssetID = m_items[item.ItemID].AssetID; | ||
635 | } | ||
636 | m_items[item.ItemID] = item; | ||
637 | m_inventorySerial++; | ||
638 | if (fireScriptEvents) | ||
639 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
640 | HasInventoryChanged = true; | ||
641 | m_part.ParentGroup.HasGroupChanged = true; | ||
642 | return true; | ||
643 | } | ||
644 | else | ||
645 | { | ||
646 | m_log.ErrorFormat( | ||
647 | "[PRIM INVENTORY]: " + | ||
648 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
649 | item.ItemID, m_part.Name, m_part.UUID, | ||
650 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
628 | } | 651 | } |
629 | 652 | ||
630 | m_items[item.ItemID] = item; | ||
631 | m_inventorySerial++; | ||
632 | m_part.TriggerScriptChangedEvent(Changed.INVENTORY); | ||
633 | HasInventoryChanged = true; | ||
634 | m_part.ParentGroup.HasGroupChanged = true; | ||
635 | |||
636 | return true; | ||
637 | } | ||
638 | else | ||
639 | { | ||
640 | m_log.ErrorFormat( | ||
641 | "[PRIM INVENTORY]: " + | ||
642 | "Tried to retrieve item ID {0} from prim {1}, {2} at {3} in {4} but the item does not exist in this inventory", | ||
643 | item.ItemID, m_part.Name, m_part.UUID, | ||
644 | m_part.AbsolutePosition, m_part.ParentGroup.Scene.RegionInfo.RegionName); | ||
645 | } | 653 | } |
654 | return false; | ||
646 | } | 655 | } |
647 | |||
648 | return false; | ||
649 | } | 656 | } |
650 | 657 | ||
651 | /// <summary> | 658 | /// <summary> |