aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SceneGraph.cs127
1 files changed, 43 insertions, 84 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 2f65ce2..49e98e7 100755
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -343,7 +343,7 @@ namespace OpenSim.Region.Framework.Scenes
343 sceneObject.ForceInventoryPersistence(); 343 sceneObject.ForceInventoryPersistence();
344 sceneObject.HasGroupChanged = true; 344 sceneObject.HasGroupChanged = true;
345 } 345 }
346 346 sceneObject.AggregateDeepPerms();
347 return ret; 347 return ret;
348 } 348 }
349 349
@@ -1358,7 +1358,7 @@ namespace OpenSim.Region.Framework.Scenes
1358 SceneObjectGroup grp = part.ParentGroup; 1358 SceneObjectGroup grp = part.ParentGroup;
1359 if (grp != null) 1359 if (grp != null)
1360 { 1360 {
1361 if (m_parentScene.Permissions.CanEditObject(grp.UUID, remoteClient.AgentId)) 1361 if (m_parentScene.Permissions.CanEditObject(grp, remoteClient))
1362 { 1362 {
1363 // These two are exceptions SL makes in the interpretation 1363 // These two are exceptions SL makes in the interpretation
1364 // of the change flags. Must check them here because otherwise 1364 // of the change flags. Must check them here because otherwise
@@ -1379,7 +1379,7 @@ namespace OpenSim.Region.Framework.Scenes
1379 if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0) 1379 if ((data.change & (ObjectChangeType.Position | ObjectChangeType.Rotation)) != 0)
1380 { 1380 {
1381 // Are we allowed to move it? 1381 // Are we allowed to move it?
1382 if (m_parentScene.Permissions.CanMoveObject(grp.UUID, remoteClient.AgentId)) 1382 if (m_parentScene.Permissions.CanMoveObject(grp, remoteClient))
1383 { 1383 {
1384 // Strip all but move and rotation from request 1384 // Strip all but move and rotation from request
1385 data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation); 1385 data.change &= (ObjectChangeType.Group | ObjectChangeType.Position | ObjectChangeType.Rotation);
@@ -1406,7 +1406,7 @@ namespace OpenSim.Region.Framework.Scenes
1406 1406
1407 if (part != null) 1407 if (part != null)
1408 { 1408 {
1409 if (m_parentScene.Permissions.CanEditObject(part.ParentGroup.UUID, remoteClient.AgentId)) 1409 if (m_parentScene.Permissions.CanEditObject(part.ParentGroup, remoteClient))
1410 { 1410 {
1411 bool physbuild = false; 1411 bool physbuild = false;
1412 if (part.ParentGroup.RootPart.PhysActor != null) 1412 if (part.ParentGroup.RootPart.PhysActor != null)
@@ -1428,7 +1428,7 @@ namespace OpenSim.Region.Framework.Scenes
1428 SceneObjectGroup group = GetGroupByPrim(localID); 1428 SceneObjectGroup group = GetGroupByPrim(localID);
1429 if (group != null) 1429 if (group != null)
1430 { 1430 {
1431 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1431 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1432 { 1432 {
1433 bool physbuild = false; 1433 bool physbuild = false;
1434 if (group.RootPart.PhysActor != null) 1434 if (group.RootPart.PhysActor != null)
@@ -1474,7 +1474,7 @@ namespace OpenSim.Region.Framework.Scenes
1474 SceneObjectGroup group = GetGroupByPrim(localID); 1474 SceneObjectGroup group = GetGroupByPrim(localID);
1475 if (group != null) 1475 if (group != null)
1476 { 1476 {
1477 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1477 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1478 { 1478 {
1479 group.UpdateSingleRotation(rot, localID); 1479 group.UpdateSingleRotation(rot, localID);
1480 } 1480 }
@@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes
1492 SceneObjectGroup group = GetGroupByPrim(localID); 1492 SceneObjectGroup group = GetGroupByPrim(localID);
1493 if (group != null) 1493 if (group != null)
1494 { 1494 {
1495 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1495 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1496 { 1496 {
1497 group.UpdateSingleRotation(rot, pos, localID); 1497 group.UpdateSingleRotation(rot, pos, localID);
1498 } 1498 }
@@ -1510,7 +1510,7 @@ namespace OpenSim.Region.Framework.Scenes
1510 SceneObjectGroup group = GetGroupByPrim(localID); 1510 SceneObjectGroup group = GetGroupByPrim(localID);
1511 if (group != null) 1511 if (group != null)
1512 { 1512 {
1513 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1513 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1514 { 1514 {
1515 group.UpdateGroupRotationR(rot); 1515 group.UpdateGroupRotationR(rot);
1516 } 1516 }
@@ -1529,7 +1529,7 @@ namespace OpenSim.Region.Framework.Scenes
1529 SceneObjectGroup group = GetGroupByPrim(localID); 1529 SceneObjectGroup group = GetGroupByPrim(localID);
1530 if (group != null) 1530 if (group != null)
1531 { 1531 {
1532 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId)) 1532 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient))
1533 { 1533 {
1534 group.UpdateGroupRotationPR(pos, rot); 1534 group.UpdateGroupRotationPR(pos, rot);
1535 } 1535 }
@@ -1547,7 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
1547 SceneObjectGroup group = GetGroupByPrim(localID); 1547 SceneObjectGroup group = GetGroupByPrim(localID);
1548 if (group != null) 1548 if (group != null)
1549 { 1549 {
1550 if (m_parentScene.Permissions.CanMoveObject(group.UUID, remoteClient.AgentId) || group.IsAttachment) 1550 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient) || group.IsAttachment)
1551 { 1551 {
1552 group.UpdateSinglePosition(pos, localID); 1552 group.UpdateSinglePosition(pos, localID);
1553 } 1553 }
@@ -1562,17 +1562,6 @@ namespace OpenSim.Region.Framework.Scenes
1562 /// <param name="remoteClient"></param> 1562 /// <param name="remoteClient"></param>
1563 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient) 1563 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, IClientAPI remoteClient)
1564 { 1564 {
1565 UpdatePrimGroupPosition(localId, pos, remoteClient.AgentId);
1566 }
1567
1568 /// <summary>
1569 /// Update the position of the given group.
1570 /// </summary>
1571 /// <param name="localId"></param>
1572 /// <param name="pos"></param>
1573 /// <param name="updatingAgentId"></param>
1574 public void UpdatePrimGroupPosition(uint localId, Vector3 pos, UUID updatingAgentId)
1575 {
1576 SceneObjectGroup group = GetGroupByPrim(localId); 1565 SceneObjectGroup group = GetGroupByPrim(localId);
1577 1566
1578 if (group != null) 1567 if (group != null)
@@ -1580,7 +1569,7 @@ namespace OpenSim.Region.Framework.Scenes
1580 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0)) 1569 if (group.IsAttachment || (group.RootPart.Shape.PCode == 9 && group.RootPart.Shape.State != 0))
1581 { 1570 {
1582 // Set the new attachment point data in the object 1571 // Set the new attachment point data in the object
1583 byte attachmentPoint = group.GetAttachmentPoint(); 1572 byte attachmentPoint = (byte)group.AttachmentPoint;
1584 group.UpdateGroupPosition(pos); 1573 group.UpdateGroupPosition(pos);
1585 group.IsAttachment = false; 1574 group.IsAttachment = false;
1586 group.AbsolutePosition = group.RootPart.AttachedPos; 1575 group.AbsolutePosition = group.RootPart.AttachedPos;
@@ -1589,8 +1578,8 @@ namespace OpenSim.Region.Framework.Scenes
1589 } 1578 }
1590 else 1579 else
1591 { 1580 {
1592 if (m_parentScene.Permissions.CanMoveObject(group.UUID, updatingAgentId) 1581 if (m_parentScene.Permissions.CanMoveObject(group, remoteClient)
1593 && m_parentScene.Permissions.CanObjectEntry(group.UUID, false, pos)) 1582 && m_parentScene.Permissions.CanObjectEntry(group, false, pos))
1594 { 1583 {
1595 group.UpdateGroupPosition(pos); 1584 group.UpdateGroupPosition(pos);
1596 } 1585 }
@@ -1614,7 +1603,7 @@ namespace OpenSim.Region.Framework.Scenes
1614 1603
1615 if (group != null) 1604 if (group != null)
1616 { 1605 {
1617 if (m_parentScene.Permissions.CanEditObject(group.UUID,remoteClient.AgentId)) 1606 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1618 { 1607 {
1619 group.UpdateTextureEntry(localID, texture); 1608 group.UpdateTextureEntry(localID, texture);
1620 } 1609 }
@@ -1638,7 +1627,7 @@ namespace OpenSim.Region.Framework.Scenes
1638 SceneObjectGroup group = GetGroupByPrim(localID); 1627 SceneObjectGroup group = GetGroupByPrim(localID);
1639 if (group != null) 1628 if (group != null)
1640 { 1629 {
1641 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1630 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1642 { 1631 {
1643 // VolumeDetect can't be set via UI and will always be off when a change is made there 1632 // VolumeDetect can't be set via UI and will always be off when a change is made there
1644 // now only change volume dtc if phantom off 1633 // now only change volume dtc if phantom off
@@ -1685,7 +1674,7 @@ namespace OpenSim.Region.Framework.Scenes
1685 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1674 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1686 if (group != null) 1675 if (group != null)
1687 { 1676 {
1688 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1677 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1689 { 1678 {
1690 group.SetPartName(Util.CleanString(name), primLocalID); 1679 group.SetPartName(Util.CleanString(name), primLocalID);
1691 group.HasGroupChanged = true; 1680 group.HasGroupChanged = true;
@@ -1703,7 +1692,7 @@ namespace OpenSim.Region.Framework.Scenes
1703 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1692 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1704 if (group != null) 1693 if (group != null)
1705 { 1694 {
1706 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1695 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1707 { 1696 {
1708 group.SetPartDescription(Util.CleanString(description), primLocalID); 1697 group.SetPartDescription(Util.CleanString(description), primLocalID);
1709 group.HasGroupChanged = true; 1698 group.HasGroupChanged = true;
@@ -1725,7 +1714,7 @@ namespace OpenSim.Region.Framework.Scenes
1725 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1714 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1726 if (group != null) 1715 if (group != null)
1727 { 1716 {
1728 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1717 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1729 { 1718 {
1730 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1719 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1731 if (part != null) 1720 if (part != null)
@@ -1742,7 +1731,7 @@ namespace OpenSim.Region.Framework.Scenes
1742 SceneObjectGroup group = GetGroupByPrim(primLocalID); 1731 SceneObjectGroup group = GetGroupByPrim(primLocalID);
1743 if (group != null) 1732 if (group != null)
1744 { 1733 {
1745 if (m_parentScene.Permissions.CanEditObject(group.UUID, remoteClient.AgentId)) 1734 if (m_parentScene.Permissions.CanEditObject(group, remoteClient))
1746 { 1735 {
1747 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID); 1736 SceneObjectPart part = m_parentScene.GetSceneObjectPart(primLocalID);
1748 if (part != null) 1737 if (part != null)
@@ -2025,27 +2014,9 @@ namespace OpenSim.Region.Framework.Scenes
2025 2014
2026 protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID) 2015 protected internal void MakeObjectSearchable(IClientAPI remoteClient, bool IncludeInSearch, uint localID)
2027 { 2016 {
2028 UUID user = remoteClient.AgentId; 2017 SceneObjectGroup sog = GetGroupByPrim(localID);
2029 UUID objid = UUID.Zero; 2018 if(sog == null)
2030 SceneObjectPart obj = null; 2019 return;
2031
2032 EntityBase[] entityList = GetEntities();
2033 foreach (EntityBase ent in entityList)
2034 {
2035 if (ent is SceneObjectGroup)
2036 {
2037 SceneObjectGroup sog = ent as SceneObjectGroup;
2038
2039 foreach (SceneObjectPart part in sog.Parts)
2040 {
2041 if (part.LocalId == localID)
2042 {
2043 objid = part.UUID;
2044 obj = part;
2045 }
2046 }
2047 }
2048 }
2049 2020
2050 //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints 2021 //Protip: In my day, we didn't call them searchable objects, we called them limited point-to-point joints
2051 //aka ObjectFlags.JointWheel = IncludeInSearch 2022 //aka ObjectFlags.JointWheel = IncludeInSearch
@@ -2062,15 +2033,15 @@ namespace OpenSim.Region.Framework.Scenes
2062 // libomv will complain about PrimFlags.JointWheel being 2033 // libomv will complain about PrimFlags.JointWheel being
2063 // deprecated, so we 2034 // deprecated, so we
2064 #pragma warning disable 0612 2035 #pragma warning disable 0612
2065 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(objid, user)) 2036 if (IncludeInSearch && m_parentScene.Permissions.CanEditObject(sog, remoteClient))
2066 { 2037 {
2067 obj.ParentGroup.RootPart.AddFlag(PrimFlags.JointWheel); 2038 sog.RootPart.AddFlag(PrimFlags.JointWheel);
2068 obj.ParentGroup.HasGroupChanged = true; 2039 sog.HasGroupChanged = true;
2069 } 2040 }
2070 else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(objid,user)) 2041 else if (!IncludeInSearch && m_parentScene.Permissions.CanMoveObject(sog, remoteClient))
2071 { 2042 {
2072 obj.ParentGroup.RootPart.RemFlag(PrimFlags.JointWheel); 2043 sog.RootPart.RemFlag(PrimFlags.JointWheel);
2073 obj.ParentGroup.HasGroupChanged = true; 2044 sog.HasGroupChanged = true;
2074 } 2045 }
2075 #pragma warning restore 0612 2046 #pragma warning restore 0612
2076 } 2047 }
@@ -2086,7 +2057,7 @@ namespace OpenSim.Region.Framework.Scenes
2086 /// <param name="rot"></param> 2057 /// <param name="rot"></param>
2087 /// <returns>null if duplication fails, otherwise the duplicated object</returns> 2058 /// <returns>null if duplication fails, otherwise the duplicated object</returns>
2088 /// <summary> 2059 /// <summary>
2089 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, uint flags, UUID AgentID, UUID GroupID, Quaternion rot) 2060 public SceneObjectGroup DuplicateObject(uint originalPrimID, Vector3 offset, UUID AgentID, UUID GroupID, Quaternion rot, bool createSelected)
2090 { 2061 {
2091// m_log.DebugFormat( 2062// m_log.DebugFormat(
2092// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}", 2063// "[SCENE]: Duplication of object {0} at offset {1} requested by agent {2}",
@@ -2095,27 +2066,28 @@ namespace OpenSim.Region.Framework.Scenes
2095 SceneObjectGroup original = GetGroupByPrim(originalPrimID); 2066 SceneObjectGroup original = GetGroupByPrim(originalPrimID);
2096 if (original != null) 2067 if (original != null)
2097 { 2068 {
2098 if (m_parentScene.Permissions.CanDuplicateObject( 2069 if (m_parentScene.Permissions.CanDuplicateObject(original, AgentID))
2099 original.PrimCount, original.UUID, AgentID, original.AbsolutePosition))
2100 { 2070 {
2101 SceneObjectGroup copy = original.Copy(true); 2071 SceneObjectGroup copy = original.Copy(true);
2102 copy.AbsolutePosition = copy.AbsolutePosition + offset; 2072 copy.AbsolutePosition = copy.AbsolutePosition + offset;
2103 2073
2074 SceneObjectPart[] parts = copy.Parts;
2075
2076 m_numTotalPrim += parts.Length;
2077
2104 if (original.OwnerID != AgentID) 2078 if (original.OwnerID != AgentID)
2105 { 2079 {
2106 copy.SetOwnerId(AgentID); 2080 copy.SetOwner(AgentID, GroupID);
2107 copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
2108
2109 SceneObjectPart[] partList = copy.Parts;
2110 2081
2111 if (m_parentScene.Permissions.PropagatePermissions()) 2082 if (m_parentScene.Permissions.PropagatePermissions())
2112 { 2083 {
2113 foreach (SceneObjectPart child in partList) 2084 foreach (SceneObjectPart child in parts)
2114 { 2085 {
2115 child.Inventory.ChangeInventoryOwner(AgentID); 2086 child.Inventory.ChangeInventoryOwner(AgentID);
2116 child.TriggerScriptChangedEvent(Changed.OWNER); 2087 child.TriggerScriptChangedEvent(Changed.OWNER);
2117 child.ApplyNextOwnerPermissions(); 2088 child.ApplyNextOwnerPermissions();
2118 } 2089 }
2090 copy.AggregatePerms();
2119 } 2091 }
2120 } 2092 }
2121 2093
@@ -2125,10 +2097,6 @@ namespace OpenSim.Region.Framework.Scenes
2125 lock (SceneObjectGroupsByFullID) 2097 lock (SceneObjectGroupsByFullID)
2126 SceneObjectGroupsByFullID[copy.UUID] = copy; 2098 SceneObjectGroupsByFullID[copy.UUID] = copy;
2127 2099
2128 SceneObjectPart[] parts = copy.Parts;
2129
2130 m_numTotalPrim += parts.Length;
2131
2132 foreach (SceneObjectPart part in parts) 2100 foreach (SceneObjectPart part in parts)
2133 { 2101 {
2134 if (part.GetPrimType() == PrimType.SCULPT) 2102 if (part.GetPrimType() == PrimType.SCULPT)
@@ -2144,28 +2112,19 @@ namespace OpenSim.Region.Framework.Scenes
2144 2112
2145 // PROBABLE END OF FIXME 2113 // PROBABLE END OF FIXME
2146 2114
2147 // Since we copy from a source group that is in selected 2115 copy.IsSelected = createSelected;
2148 // state, but the copy is shown deselected in the viewer,
2149 // We need to clear the selection flag here, else that
2150 // prim never gets persisted at all. The client doesn't
2151 // think it's selected, so it will never send a deselect...
2152 copy.IsSelected = false;
2153
2154 m_numPrim += copy.Parts.Length;
2155 2116
2156 if (rot != Quaternion.Identity) 2117 if (rot != Quaternion.Identity)
2157 {
2158 copy.UpdateGroupRotationR(rot); 2118 copy.UpdateGroupRotationR(rot);
2159 } 2119
2120 // required for physics to update it's position
2121 copy.ResetChildPrimPhysicsPositions();
2160 2122
2161 copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1); 2123 copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 1);
2162 copy.HasGroupChanged = true;
2163 copy.ScheduleGroupForFullUpdate();
2164 copy.ResumeScripts(); 2124 copy.ResumeScripts();
2165 2125
2166 // required for physics to update it's position 2126 copy.HasGroupChanged = true;
2167 copy.AbsolutePosition = copy.AbsolutePosition; 2127 copy.ScheduleGroupForFullUpdate();
2168
2169 return copy; 2128 return copy;
2170 } 2129 }
2171 } 2130 }