diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 78 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | 38 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 90 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 111 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | 69 |
6 files changed, 253 insertions, 167 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 012732b..48508f8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -2022,60 +2022,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
2022 | if (null == item) | 2022 | if (null == item) |
2023 | return null; | 2023 | return null; |
2024 | 2024 | ||
2025 | UUID ownerID = item.OwnerID; | 2025 | SceneObjectGroup group = sourcePart.Inventory.GetRezReadySceneObject(item); |
2026 | AssetBase rezAsset = AssetService.Get(item.AssetID.ToString()); | 2026 | |
2027 | 2027 | if (null == group) | |
2028 | if (null == rezAsset) | ||
2029 | return null; | ||
2030 | |||
2031 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
2032 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
2033 | |||
2034 | if (!Permissions.CanRezObject(group.Children.Count, ownerID, pos)) | ||
2035 | return null; | 2028 | return null; |
2036 | |||
2037 | group.ResetIDs(); | ||
2038 | |||
2039 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
2040 | |||
2041 | // Since renaming the item in the inventory does not affect the name stored | ||
2042 | // in the serialization, transfer the correct name from the inventory to the | ||
2043 | // object itself before we rez. | ||
2044 | rootPart.Name = item.Name; | ||
2045 | rootPart.Description = item.Description; | ||
2046 | |||
2047 | List<SceneObjectPart> partList = new List<SceneObjectPart>(group.Children.Values); | ||
2048 | |||
2049 | group.SetGroup(sourcePart.GroupID, null); | ||
2050 | |||
2051 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
2052 | { | ||
2053 | if (Permissions.PropagatePermissions()) | ||
2054 | { | ||
2055 | foreach (SceneObjectPart part in partList) | ||
2056 | { | ||
2057 | part.EveryoneMask = item.EveryonePermissions; | ||
2058 | part.NextOwnerMask = item.NextPermissions; | ||
2059 | } | ||
2060 | |||
2061 | group.ApplyNextOwnerPermissions(); | ||
2062 | } | ||
2063 | } | ||
2064 | |||
2065 | foreach (SceneObjectPart part in partList) | ||
2066 | { | ||
2067 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
2068 | { | ||
2069 | part.LastOwnerID = part.OwnerID; | ||
2070 | part.OwnerID = item.OwnerID; | ||
2071 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
2072 | } | ||
2073 | |||
2074 | part.EveryoneMask = item.EveryonePermissions; | ||
2075 | part.NextOwnerMask = item.NextPermissions; | ||
2076 | } | ||
2077 | 2029 | ||
2078 | rootPart.TrimPermissions(); | 2030 | if (!Permissions.CanRezObject(group.PrimCount, item.OwnerID, pos)) |
2031 | return null; | ||
2079 | 2032 | ||
2080 | if (!Permissions.BypassPermissions()) | 2033 | if (!Permissions.BypassPermissions()) |
2081 | { | 2034 | { |
@@ -2091,7 +2044,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2091 | 2044 | ||
2092 | group.ScheduleGroupForFullUpdate(); | 2045 | group.ScheduleGroupForFullUpdate(); |
2093 | 2046 | ||
2094 | return rootPart.ParentGroup; | 2047 | return group; |
2095 | } | 2048 | } |
2096 | 2049 | ||
2097 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) | 2050 | public virtual bool returnObjects(SceneObjectGroup[] returnobjects, UUID AgentId) |
@@ -2151,8 +2104,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2151 | sog.SetGroup(groupID, remoteClient); | 2104 | sog.SetGroup(groupID, remoteClient); |
2152 | sog.ScheduleGroupForFullUpdate(); | 2105 | sog.ScheduleGroupForFullUpdate(); |
2153 | 2106 | ||
2154 | foreach (SceneObjectPart child in sog.Children.Values) | 2107 | lock (sog.Children) |
2155 | child.Inventory.ChangeInventoryOwner(ownerID); | 2108 | { |
2109 | foreach (SceneObjectPart child in sog.Children.Values) | ||
2110 | child.Inventory.ChangeInventoryOwner(ownerID); | ||
2111 | } | ||
2156 | } | 2112 | } |
2157 | else | 2113 | else |
2158 | { | 2114 | { |
@@ -2162,16 +2118,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
2162 | if (sog.GroupID != groupID) | 2118 | if (sog.GroupID != groupID) |
2163 | continue; | 2119 | continue; |
2164 | 2120 | ||
2165 | foreach (SceneObjectPart child in sog.Children.Values) | 2121 | lock (sog.Children) |
2166 | { | 2122 | { |
2167 | child.LastOwnerID = child.OwnerID; | 2123 | foreach (SceneObjectPart child in sog.Children.Values) |
2168 | child.Inventory.ChangeInventoryOwner(groupID); | 2124 | { |
2125 | child.LastOwnerID = child.OwnerID; | ||
2126 | child.Inventory.ChangeInventoryOwner(groupID); | ||
2127 | } | ||
2169 | } | 2128 | } |
2170 | 2129 | ||
2171 | sog.SetOwnerId(groupID); | 2130 | sog.SetOwnerId(groupID); |
2172 | sog.ApplyNextOwnerPermissions(); | 2131 | sog.ApplyNextOwnerPermissions(); |
2173 | } | 2132 | } |
2174 | |||
2175 | } | 2133 | } |
2176 | 2134 | ||
2177 | foreach (uint localID in localIDs) | 2135 | foreach (uint localID in localIDs) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs index e25b1f1..9f1575d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs | |||
@@ -156,21 +156,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
156 | } | 156 | } |
157 | break; | 157 | break; |
158 | } | 158 | } |
159 | else | 159 | else |
160 | { | 160 | { |
161 | // We also need to check the children of this prim as they | 161 | // We also need to check the children of this prim as they |
162 | // can be selected as well and send property information | 162 | // can be selected as well and send property information |
163 | bool foundPrim = false; | 163 | bool foundPrim = false; |
164 | foreach (KeyValuePair<UUID, SceneObjectPart> child in ((SceneObjectGroup) ent).Children) | 164 | |
165 | { | 165 | SceneObjectGroup sog = ent as SceneObjectGroup; |
166 | if (child.Value.LocalId == primLocalID) | 166 | |
167 | { | 167 | lock (sog.Children) |
168 | child.Value.GetProperties(remoteClient); | 168 | { |
169 | foundPrim = true; | 169 | foreach (KeyValuePair<UUID, SceneObjectPart> child in (sog.Children)) |
170 | break; | 170 | { |
171 | } | 171 | if (child.Value.LocalId == primLocalID) |
172 | } | 172 | { |
173 | if (foundPrim) break; | 173 | child.Value.GetProperties(remoteClient); |
174 | foundPrim = true; | ||
175 | break; | ||
176 | } | ||
177 | } | ||
178 | } | ||
179 | |||
180 | if (foundPrim) | ||
181 | break; | ||
174 | } | 182 | } |
175 | } | 183 | } |
176 | } | 184 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 520f1a1..ec97d25 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1790,8 +1790,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1790 | 1790 | ||
1791 | if (group.RootPart == null) | 1791 | if (group.RootPart == null) |
1792 | { | 1792 | { |
1793 | m_log.ErrorFormat("[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", | 1793 | m_log.ErrorFormat( |
1794 | group.Children == null ? 0 : group.Children.Count); | 1794 | "[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children", |
1795 | group.Children == null ? 0 : group.PrimCount); | ||
1795 | } | 1796 | } |
1796 | 1797 | ||
1797 | AddRestoredSceneObject(group, true, true); | 1798 | AddRestoredSceneObject(group, true, true); |
@@ -2130,18 +2131,22 @@ namespace OpenSim.Region.Framework.Scenes | |||
2130 | group.RemoveScriptInstances(true); | 2131 | group.RemoveScriptInstances(true); |
2131 | } | 2132 | } |
2132 | 2133 | ||
2133 | foreach (SceneObjectPart part in group.Children.Values) | 2134 | lock (group.Children) |
2134 | { | 2135 | { |
2135 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) | 2136 | foreach (SceneObjectPart part in group.Children.Values) |
2136 | { | 2137 | { |
2137 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? | 2138 | if (part.IsJoint() && ((part.Flags & PrimFlags.Physics) != 0)) |
2138 | } | 2139 | { |
2139 | else if (part.PhysActor != null) | 2140 | PhysicsScene.RequestJointDeletion(part.Name); // FIXME: what if the name changed? |
2140 | { | 2141 | } |
2141 | PhysicsScene.RemovePrim(part.PhysActor); | 2142 | else if (part.PhysActor != null) |
2142 | part.PhysActor = null; | 2143 | { |
2144 | PhysicsScene.RemovePrim(part.PhysActor); | ||
2145 | part.PhysActor = null; | ||
2146 | } | ||
2143 | } | 2147 | } |
2144 | } | 2148 | } |
2149 | |||
2145 | // if (rootPart.PhysActor != null) | 2150 | // if (rootPart.PhysActor != null) |
2146 | // { | 2151 | // { |
2147 | // PhysicsScene.RemovePrim(rootPart.PhysActor); | 2152 | // PhysicsScene.RemovePrim(rootPart.PhysActor); |
@@ -2498,14 +2503,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2498 | 2503 | ||
2499 | // Force allocation of new LocalId | 2504 | // Force allocation of new LocalId |
2500 | // | 2505 | // |
2501 | foreach (SceneObjectPart p in sceneObject.Children.Values) | 2506 | lock (sceneObject.Children) |
2502 | p.LocalId = 0; | 2507 | { |
2508 | foreach (SceneObjectPart p in sceneObject.Children.Values) | ||
2509 | p.LocalId = 0; | ||
2510 | } | ||
2503 | 2511 | ||
2504 | if (sceneObject.IsAttachmentCheckFull()) // Attachment | 2512 | if (sceneObject.IsAttachmentCheckFull()) // Attachment |
2505 | { | 2513 | { |
2506 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); | 2514 | sceneObject.RootPart.AddFlag(PrimFlags.TemporaryOnRez); |
2507 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); | 2515 | sceneObject.RootPart.AddFlag(PrimFlags.Phantom); |
2508 | |||
2509 | 2516 | ||
2510 | // Don't sent a full update here because this will cause full updates to be sent twice for | 2517 | // Don't sent a full update here because this will cause full updates to be sent twice for |
2511 | // attachments on region crossings, resulting in viewer glitches. | 2518 | // attachments on region crossings, resulting in viewer glitches. |
@@ -2519,7 +2526,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2519 | 2526 | ||
2520 | if (sp != null) | 2527 | if (sp != null) |
2521 | { | 2528 | { |
2522 | |||
2523 | SceneObjectGroup grp = sceneObject; | 2529 | SceneObjectGroup grp = sceneObject; |
2524 | 2530 | ||
2525 | m_log.DebugFormat( | 2531 | m_log.DebugFormat( |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 3a0532a..9c5ee60 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -384,34 +384,35 @@ namespace OpenSim.Region.Framework.Scenes | |||
384 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", | 384 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", |
385 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | 385 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); |
386 | 386 | ||
387 | if (m_parentScene.m_clampPrimSize) | 387 | lock (sceneObject.Children) |
388 | { | 388 | { |
389 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 389 | if (m_parentScene.m_clampPrimSize) |
390 | { | 390 | { |
391 | Vector3 scale = part.Shape.Scale; | 391 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
392 | 392 | { | |
393 | if (scale.X > m_parentScene.m_maxNonphys) | 393 | Vector3 scale = part.Shape.Scale; |
394 | scale.X = m_parentScene.m_maxNonphys; | 394 | |
395 | if (scale.Y > m_parentScene.m_maxNonphys) | 395 | if (scale.X > m_parentScene.m_maxNonphys) |
396 | scale.Y = m_parentScene.m_maxNonphys; | 396 | scale.X = m_parentScene.m_maxNonphys; |
397 | if (scale.Z > m_parentScene.m_maxNonphys) | 397 | if (scale.Y > m_parentScene.m_maxNonphys) |
398 | scale.Z = m_parentScene.m_maxNonphys; | 398 | scale.Y = m_parentScene.m_maxNonphys; |
399 | 399 | if (scale.Z > m_parentScene.m_maxNonphys) | |
400 | part.Shape.Scale = scale; | 400 | scale.Z = m_parentScene.m_maxNonphys; |
401 | |||
402 | part.Shape.Scale = scale; | ||
403 | } | ||
401 | } | 404 | } |
402 | } | 405 | |
403 | 406 | sceneObject.AttachToScene(m_parentScene); | |
404 | sceneObject.AttachToScene(m_parentScene); | ||
405 | |||
406 | if (sendClientUpdates) | ||
407 | sceneObject.ScheduleGroupForFullUpdate(); | ||
408 | |||
409 | Entities.Add(sceneObject); | ||
410 | m_numPrim += sceneObject.Children.Count; | ||
411 | 407 | ||
412 | if (attachToBackup) | 408 | if (sendClientUpdates) |
413 | { | 409 | sceneObject.ScheduleGroupForFullUpdate(); |
414 | sceneObject.AttachToBackup(); | 410 | |
411 | Entities.Add(sceneObject); | ||
412 | m_numPrim += sceneObject.Children.Count; | ||
413 | |||
414 | if (attachToBackup) | ||
415 | sceneObject.AttachToBackup(); | ||
415 | } | 416 | } |
416 | 417 | ||
417 | if (OnObjectCreate != null) | 418 | if (OnObjectCreate != null) |
@@ -448,10 +449,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
448 | 449 | ||
449 | if (!resultOfObjectLinked) | 450 | if (!resultOfObjectLinked) |
450 | { | 451 | { |
451 | m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; | 452 | m_numPrim -= grp.PrimCount; |
452 | 453 | ||
453 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 454 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
454 | RemovePhysicalPrim(grp.Children.Count); | 455 | RemovePhysicalPrim(grp.PrimCount); |
455 | } | 456 | } |
456 | 457 | ||
457 | if (OnObjectRemove != null) | 458 | if (OnObjectRemove != null) |
@@ -966,8 +967,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
966 | { | 967 | { |
967 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) | 968 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) |
968 | { | 969 | { |
969 | if (sog.Children.ContainsKey(fullID)) | 970 | lock (sog.Children) |
970 | return sog; | 971 | { |
972 | if (sog.Children.ContainsKey(fullID)) | ||
973 | return sog; | ||
974 | } | ||
975 | |||
971 | SceneObjectGroupsByFullID.Remove(fullID); | 976 | SceneObjectGroupsByFullID.Remove(fullID); |
972 | } | 977 | } |
973 | } | 978 | } |
@@ -1678,7 +1683,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1678 | { | 1683 | { |
1679 | if (part != null) | 1684 | if (part != null) |
1680 | { | 1685 | { |
1681 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1686 | if (part.ParentGroup.PrimCount != 1) // Skip single |
1682 | { | 1687 | { |
1683 | if (part.LinkNum < 2) // Root | 1688 | if (part.LinkNum < 2) // Root |
1684 | rootParts.Add(part); | 1689 | rootParts.Add(part); |
@@ -1717,8 +1722,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1717 | // However, editing linked parts and unlinking may be different | 1722 | // However, editing linked parts and unlinking may be different |
1718 | // | 1723 | // |
1719 | SceneObjectGroup group = root.ParentGroup; | 1724 | SceneObjectGroup group = root.ParentGroup; |
1720 | List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Children.Values); | 1725 | |
1721 | int numChildren = group.Children.Count; | 1726 | List<SceneObjectPart> newSet = null; |
1727 | int numChildren = -1; | ||
1728 | |||
1729 | lock (group.Children) | ||
1730 | { | ||
1731 | newSet = new List<SceneObjectPart>(group.Children.Values); | ||
1732 | numChildren = group.PrimCount; | ||
1733 | } | ||
1722 | 1734 | ||
1723 | // If there are prims left in a link set, but the root is | 1735 | // If there are prims left in a link set, but the root is |
1724 | // slated for unlink, we need to do this | 1736 | // slated for unlink, we need to do this |
@@ -1808,12 +1820,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1808 | { | 1820 | { |
1809 | if (ent is SceneObjectGroup) | 1821 | if (ent is SceneObjectGroup) |
1810 | { | 1822 | { |
1811 | foreach (KeyValuePair<UUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children) | 1823 | SceneObjectGroup sog = ent as SceneObjectGroup; |
1824 | |||
1825 | lock (sog.Children) | ||
1812 | { | 1826 | { |
1813 | if (subent.Value.LocalId == localID) | 1827 | foreach (KeyValuePair<UUID, SceneObjectPart> subent in sog.Children) |
1814 | { | 1828 | { |
1815 | objid = subent.Key; | 1829 | if (subent.Value.LocalId == localID) |
1816 | obj = subent.Value; | 1830 | { |
1831 | objid = subent.Key; | ||
1832 | obj = subent.Value; | ||
1833 | } | ||
1817 | } | 1834 | } |
1818 | } | 1835 | } |
1819 | } | 1836 | } |
@@ -1878,7 +1895,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1878 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 1895 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
1879 | if (original != null) | 1896 | if (original != null) |
1880 | { | 1897 | { |
1881 | if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) | 1898 | if (m_parentScene.Permissions.CanDuplicateObject( |
1899 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | ||
1882 | { | 1900 | { |
1883 | SceneObjectGroup copy = original.Copy(true); | 1901 | SceneObjectGroup copy = original.Copy(true); |
1884 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1902 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 9b66fad..e003cf8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -360,7 +360,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
360 | /// </summary> | 360 | /// </summary> |
361 | public int PrimCount | 361 | public int PrimCount |
362 | { | 362 | { |
363 | get { return m_parts.Count; } | 363 | get { lock (m_parts) { return m_parts.Count; } } |
364 | } | 364 | } |
365 | 365 | ||
366 | protected Quaternion m_rotation = Quaternion.Identity; | 366 | protected Quaternion m_rotation = Quaternion.Identity; |
@@ -398,6 +398,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
398 | 398 | ||
399 | /// <value> | 399 | /// <value> |
400 | /// The parts of this scene object group. You must lock this property before using it. | 400 | /// The parts of this scene object group. You must lock this property before using it. |
401 | /// If you want to know the number of children, consider using the PrimCount property instead | ||
401 | /// </value> | 402 | /// </value> |
402 | public Dictionary<UUID, SceneObjectPart> Children | 403 | public Dictionary<UUID, SceneObjectPart> Children |
403 | { | 404 | { |
@@ -521,7 +522,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
521 | public override UUID UUID | 522 | public override UUID UUID |
522 | { | 523 | { |
523 | get { return m_rootPart.UUID; } | 524 | get { return m_rootPart.UUID; } |
524 | set { m_rootPart.UUID = value; } | 525 | set |
526 | { | ||
527 | m_rootPart.UUID = value; | ||
528 | |||
529 | lock (m_parts) | ||
530 | { | ||
531 | m_parts.Remove(m_rootPart.UUID); | ||
532 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
533 | } | ||
534 | } | ||
525 | } | 535 | } |
526 | 536 | ||
527 | public UUID OwnerID | 537 | public UUID OwnerID |
@@ -742,21 +752,23 @@ namespace OpenSim.Region.Framework.Scenes | |||
742 | if (m_rootPart.LocalId == 0) | 752 | if (m_rootPart.LocalId == 0) |
743 | m_rootPart.LocalId = m_scene.AllocateLocalId(); | 753 | m_rootPart.LocalId = m_scene.AllocateLocalId(); |
744 | 754 | ||
745 | // No need to lock here since the object isn't yet in a scene | 755 | lock (m_parts) |
746 | foreach (SceneObjectPart part in m_parts.Values) | ||
747 | { | 756 | { |
748 | if (Object.ReferenceEquals(part, m_rootPart)) | 757 | foreach (SceneObjectPart part in m_parts.Values) |
749 | { | ||
750 | continue; | ||
751 | } | ||
752 | |||
753 | if (part.LocalId == 0) | ||
754 | { | 758 | { |
755 | part.LocalId = m_scene.AllocateLocalId(); | 759 | if (Object.ReferenceEquals(part, m_rootPart)) |
760 | { | ||
761 | continue; | ||
762 | } | ||
763 | |||
764 | if (part.LocalId == 0) | ||
765 | { | ||
766 | part.LocalId = m_scene.AllocateLocalId(); | ||
767 | } | ||
768 | |||
769 | part.ParentID = m_rootPart.LocalId; | ||
770 | //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); | ||
756 | } | 771 | } |
757 | |||
758 | part.ParentID = m_rootPart.LocalId; | ||
759 | //m_log.DebugFormat("[SCENE]: Given local id {0} to part {1}, linknum {2}, parent {3} {4}", part.LocalId, part.UUID, part.LinkNum, part.ParentID, part.ParentUUID); | ||
760 | } | 772 | } |
761 | 773 | ||
762 | ApplyPhysics(m_scene.m_physicalPrim); | 774 | ApplyPhysics(m_scene.m_physicalPrim); |
@@ -1238,9 +1250,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
1238 | m_rootPart.AttachedAvatar = agentID; | 1250 | m_rootPart.AttachedAvatar = agentID; |
1239 | 1251 | ||
1240 | //Anakin Lohner bug #3839 | 1252 | //Anakin Lohner bug #3839 |
1241 | foreach (SceneObjectPart p in m_parts.Values) | 1253 | lock (m_parts) |
1242 | { | 1254 | { |
1243 | p.AttachedAvatar = agentID; | 1255 | foreach (SceneObjectPart p in m_parts.Values) |
1256 | { | ||
1257 | p.AttachedAvatar = agentID; | ||
1258 | } | ||
1244 | } | 1259 | } |
1245 | 1260 | ||
1246 | if (m_rootPart.PhysActor != null) | 1261 | if (m_rootPart.PhysActor != null) |
@@ -1308,10 +1323,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1308 | 1323 | ||
1309 | AbsolutePosition = detachedpos; | 1324 | AbsolutePosition = detachedpos; |
1310 | m_rootPart.AttachedAvatar = UUID.Zero; | 1325 | m_rootPart.AttachedAvatar = UUID.Zero; |
1311 | //Anakin Lohner bug #3839 | 1326 | |
1312 | foreach (SceneObjectPart p in m_parts.Values) | 1327 | //Anakin Lohner bug #3839 |
1328 | lock (m_parts) | ||
1313 | { | 1329 | { |
1314 | p.AttachedAvatar = UUID.Zero; | 1330 | foreach (SceneObjectPart p in m_parts.Values) |
1331 | { | ||
1332 | p.AttachedAvatar = UUID.Zero; | ||
1333 | } | ||
1315 | } | 1334 | } |
1316 | 1335 | ||
1317 | m_rootPart.SetParentLocalId(0); | 1336 | m_rootPart.SetParentLocalId(0); |
@@ -1337,10 +1356,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1337 | } | 1356 | } |
1338 | 1357 | ||
1339 | m_rootPart.AttachedAvatar = UUID.Zero; | 1358 | m_rootPart.AttachedAvatar = UUID.Zero; |
1359 | |||
1340 | //Anakin Lohner bug #3839 | 1360 | //Anakin Lohner bug #3839 |
1341 | foreach (SceneObjectPart p in m_parts.Values) | 1361 | lock (m_parts) |
1342 | { | 1362 | { |
1343 | p.AttachedAvatar = UUID.Zero; | 1363 | foreach (SceneObjectPart p in m_parts.Values) |
1364 | { | ||
1365 | p.AttachedAvatar = UUID.Zero; | ||
1366 | } | ||
1344 | } | 1367 | } |
1345 | 1368 | ||
1346 | m_rootPart.SetParentLocalId(0); | 1369 | m_rootPart.SetParentLocalId(0); |
@@ -1406,9 +1429,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1406 | part.ParentID = 0; | 1429 | part.ParentID = 0; |
1407 | part.LinkNum = 0; | 1430 | part.LinkNum = 0; |
1408 | 1431 | ||
1409 | // No locking required since the SOG should not be in the scene yet - one can't change root parts after | 1432 | lock (m_parts) |
1410 | // the scene object has been attached to the scene | 1433 | m_parts.Add(m_rootPart.UUID, m_rootPart); |
1411 | m_parts.Add(m_rootPart.UUID, m_rootPart); | ||
1412 | } | 1434 | } |
1413 | 1435 | ||
1414 | /// <summary> | 1436 | /// <summary> |
@@ -1928,14 +1950,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1928 | } | 1950 | } |
1929 | 1951 | ||
1930 | /// <summary> | 1952 | /// <summary> |
1931 | /// | 1953 | /// Copy the given part as the root part of this scene object. |
1932 | /// </summary> | 1954 | /// </summary> |
1933 | /// <param name="part"></param> | 1955 | /// <param name="part"></param> |
1934 | /// <param name="cAgentID"></param> | 1956 | /// <param name="cAgentID"></param> |
1935 | /// <param name="cGroupID"></param> | 1957 | /// <param name="cGroupID"></param> |
1936 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) | 1958 | public void CopyRootPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed) |
1937 | { | 1959 | { |
1938 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed)); | 1960 | SetRootPart(part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, 0, userExposed)); |
1939 | } | 1961 | } |
1940 | 1962 | ||
1941 | public void ScriptSetPhysicsStatus(bool UsePhysics) | 1963 | public void ScriptSetPhysicsStatus(bool UsePhysics) |
@@ -2234,14 +2256,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2234 | /// </summary> | 2256 | /// </summary> |
2235 | public void ResetIDs() | 2257 | public void ResetIDs() |
2236 | { | 2258 | { |
2237 | // As this is only ever called for prims which are not currently part of the scene (and hence | 2259 | lock (m_parts) |
2238 | // not accessible by clients), there should be no need to lock | ||
2239 | List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values); | ||
2240 | m_parts.Clear(); | ||
2241 | foreach (SceneObjectPart part in partsList) | ||
2242 | { | 2260 | { |
2243 | part.ResetIDs(part.LinkNum); // Don't change link nums | 2261 | List<SceneObjectPart> partsList = new List<SceneObjectPart>(m_parts.Values); |
2244 | m_parts.Add(part.UUID, part); | 2262 | m_parts.Clear(); |
2263 | foreach (SceneObjectPart part in partsList) | ||
2264 | { | ||
2265 | part.ResetIDs(part.LinkNum); // Don't change link nums | ||
2266 | m_parts.Add(part.UUID, part); | ||
2267 | } | ||
2245 | } | 2268 | } |
2246 | } | 2269 | } |
2247 | 2270 | ||
@@ -2479,10 +2502,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
2479 | public SceneObjectPart GetChildPart(UUID primID) | 2502 | public SceneObjectPart GetChildPart(UUID primID) |
2480 | { | 2503 | { |
2481 | SceneObjectPart childPart = null; | 2504 | SceneObjectPart childPart = null; |
2482 | if (m_parts.ContainsKey(primID)) | 2505 | |
2506 | lock (m_parts) | ||
2483 | { | 2507 | { |
2484 | childPart = m_parts[primID]; | 2508 | if (m_parts.ContainsKey(primID)) |
2509 | { | ||
2510 | childPart = m_parts[primID]; | ||
2511 | } | ||
2485 | } | 2512 | } |
2513 | |||
2486 | return childPart; | 2514 | return childPart; |
2487 | } | 2515 | } |
2488 | 2516 | ||
@@ -2519,9 +2547,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
2519 | /// <returns></returns> | 2547 | /// <returns></returns> |
2520 | public bool HasChildPrim(UUID primID) | 2548 | public bool HasChildPrim(UUID primID) |
2521 | { | 2549 | { |
2522 | if (m_parts.ContainsKey(primID)) | 2550 | lock (m_parts) |
2523 | { | 2551 | { |
2524 | return true; | 2552 | if (m_parts.ContainsKey(primID)) |
2553 | return true; | ||
2525 | } | 2554 | } |
2526 | 2555 | ||
2527 | return false; | 2556 | return false; |
@@ -3132,9 +3161,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
3132 | public void UpdatePermissions(UUID AgentID, byte field, uint localID, | 3161 | public void UpdatePermissions(UUID AgentID, byte field, uint localID, |
3133 | uint mask, byte addRemTF) | 3162 | uint mask, byte addRemTF) |
3134 | { | 3163 | { |
3135 | foreach (SceneObjectPart part in m_parts.Values) | 3164 | lock (m_parts) |
3136 | part.UpdatePermissions(AgentID, field, localID, mask, | 3165 | { |
3137 | addRemTF); | 3166 | foreach (SceneObjectPart part in m_parts.Values) |
3167 | part.UpdatePermissions(AgentID, field, localID, mask, addRemTF); | ||
3168 | } | ||
3138 | 3169 | ||
3139 | HasGroupChanged = true; | 3170 | HasGroupChanged = true; |
3140 | } | 3171 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 8b4f0ed..10931b7 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -37,6 +37,7 @@ using log4net; | |||
37 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
38 | using OpenSim.Region.Framework.Interfaces; | 38 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes.Scripting; | 39 | using OpenSim.Region.Framework.Scenes.Scripting; |
40 | using OpenSim.Region.Framework.Scenes.Serialization; | ||
40 | 41 | ||
41 | namespace OpenSim.Region.Framework.Scenes | 42 | namespace OpenSim.Region.Framework.Scenes |
42 | { | 43 | { |
@@ -722,6 +723,71 @@ namespace OpenSim.Region.Framework.Scenes | |||
722 | return items; | 723 | return items; |
723 | } | 724 | } |
724 | 725 | ||
726 | public SceneObjectGroup GetRezReadySceneObject(TaskInventoryItem item) | ||
727 | { | ||
728 | UUID ownerID = item.OwnerID; | ||
729 | AssetBase rezAsset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); | ||
730 | |||
731 | if (null == rezAsset) | ||
732 | { | ||
733 | m_log.WarnFormat( | ||
734 | "[PRIM INVENTORY]: Could not find asset {0} for inventory item {1} in {2}", | ||
735 | item.AssetID, item.Name, m_part.Name); | ||
736 | return null; | ||
737 | } | ||
738 | |||
739 | string xmlData = Utils.BytesToString(rezAsset.Data); | ||
740 | SceneObjectGroup group = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
741 | |||
742 | group.ResetIDs(); | ||
743 | |||
744 | SceneObjectPart rootPart = group.GetChildPart(group.UUID); | ||
745 | |||
746 | // Since renaming the item in the inventory does not affect the name stored | ||
747 | // in the serialization, transfer the correct name from the inventory to the | ||
748 | // object itself before we rez. | ||
749 | rootPart.Name = item.Name; | ||
750 | rootPart.Description = item.Description; | ||
751 | |||
752 | List<SceneObjectPart> partList = null; | ||
753 | |||
754 | lock (group.Children) | ||
755 | partList = new List<SceneObjectPart>(group.Children.Values); | ||
756 | |||
757 | group.SetGroup(m_part.GroupID, null); | ||
758 | |||
759 | if ((rootPart.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
760 | { | ||
761 | if (m_part.ParentGroup.Scene.Permissions.PropagatePermissions()) | ||
762 | { | ||
763 | foreach (SceneObjectPart part in partList) | ||
764 | { | ||
765 | part.EveryoneMask = item.EveryonePermissions; | ||
766 | part.NextOwnerMask = item.NextPermissions; | ||
767 | } | ||
768 | |||
769 | group.ApplyNextOwnerPermissions(); | ||
770 | } | ||
771 | } | ||
772 | |||
773 | foreach (SceneObjectPart part in partList) | ||
774 | { | ||
775 | if ((part.OwnerID != item.OwnerID) || (item.CurrentPermissions & 16) != 0) | ||
776 | { | ||
777 | part.LastOwnerID = part.OwnerID; | ||
778 | part.OwnerID = item.OwnerID; | ||
779 | part.Inventory.ChangeInventoryOwner(item.OwnerID); | ||
780 | } | ||
781 | |||
782 | part.EveryoneMask = item.EveryonePermissions; | ||
783 | part.NextOwnerMask = item.NextPermissions; | ||
784 | } | ||
785 | |||
786 | rootPart.TrimPermissions(); | ||
787 | |||
788 | return group; | ||
789 | } | ||
790 | |||
725 | /// <summary> | 791 | /// <summary> |
726 | /// Update an existing inventory item. | 792 | /// Update an existing inventory item. |
727 | /// </summary> | 793 | /// </summary> |
@@ -1197,6 +1263,5 @@ namespace OpenSim.Region.Framework.Scenes | |||
1197 | 1263 | ||
1198 | Items.LockItemsForRead(false); | 1264 | Items.LockItemsForRead(false); |
1199 | } | 1265 | } |
1200 | |||
1201 | } | 1266 | } |
1202 | } | 1267 | } \ No newline at end of file |