diff options
author | John Hurliman | 2010-09-16 17:30:46 -0700 |
---|---|---|
committer | John Hurliman | 2010-09-16 17:30:46 -0700 |
commit | 860b2a502f797e5822c6705d4639f370f3ac5861 (patch) | |
tree | 5a74ddbd626142e27f6c3439ea267b8ea348ce9c /OpenSim/Region/Framework/Scenes/SceneGraph.cs | |
parent | Add the modules include line back that i dropped by mistake (diff) | |
download | opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.zip opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.gz opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.bz2 opensim-SC_OLD-860b2a502f797e5822c6705d4639f370f3ac5861.tar.xz |
Changed SceneObjectGroup to store parts with the fast and thread-safe MapAndArray collection
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 53 |
1 files changed, 20 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 85ff32e..28b80bb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -348,9 +348,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
348 | if (Entities.ContainsKey(sceneObject.UUID)) | 348 | if (Entities.ContainsKey(sceneObject.UUID)) |
349 | return false; | 349 | return false; |
350 | 350 | ||
351 | List<SceneObjectPart> children; | 351 | SceneObjectPart[] children = sceneObject.Parts; |
352 | lock (sceneObject.Children) | ||
353 | children = new List<SceneObjectPart>(sceneObject.Children.Values); | ||
354 | 352 | ||
355 | // Clamp child prim sizes and add child prims to the m_numPrim count | 353 | // Clamp child prim sizes and add child prims to the m_numPrim count |
356 | if (m_parentScene.m_clampPrimSize) | 354 | if (m_parentScene.m_clampPrimSize) |
@@ -369,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
369 | part.Shape.Scale = scale; | 367 | part.Shape.Scale = scale; |
370 | } | 368 | } |
371 | } | 369 | } |
372 | m_numPrim += children.Count; | 370 | m_numPrim += children.Length; |
373 | 371 | ||
374 | sceneObject.AttachToScene(m_parentScene); | 372 | sceneObject.AttachToScene(m_parentScene); |
375 | 373 | ||
@@ -426,15 +424,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | 424 | ||
427 | lock (SceneObjectGroupsByFullID) | 425 | lock (SceneObjectGroupsByFullID) |
428 | { | 426 | { |
429 | foreach (SceneObjectPart part in grp.Children.Values) | 427 | SceneObjectPart[] parts = grp.Parts; |
430 | SceneObjectGroupsByFullID.Remove(part.UUID); | 428 | for (int i = 0; i < parts.Length; i++) |
429 | SceneObjectGroupsByFullID.Remove(parts[i].UUID); | ||
431 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); | 430 | SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID); |
432 | } | 431 | } |
433 | 432 | ||
434 | lock (SceneObjectGroupsByLocalID) | 433 | lock (SceneObjectGroupsByLocalID) |
435 | { | 434 | { |
436 | foreach (SceneObjectPart part in grp.Children.Values) | 435 | SceneObjectPart[] parts = grp.Parts; |
437 | SceneObjectGroupsByLocalID.Remove(part.LocalId); | 436 | for (int i = 0; i < parts.Length; i++) |
437 | SceneObjectGroupsByLocalID.Remove(parts[i].LocalId); | ||
438 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); | 438 | SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId); |
439 | } | 439 | } |
440 | 440 | ||
@@ -887,11 +887,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
887 | 887 | ||
888 | if (sog != null) | 888 | if (sog != null) |
889 | { | 889 | { |
890 | lock (sog.Children) | 890 | if (sog.ContainsPart(fullID)) |
891 | { | 891 | return sog; |
892 | if (sog.Children.ContainsKey(fullID)) | ||
893 | return sog; | ||
894 | } | ||
895 | 892 | ||
896 | lock (SceneObjectGroupsByFullID) | 893 | lock (SceneObjectGroupsByFullID) |
897 | SceneObjectGroupsByFullID.Remove(fullID); | 894 | SceneObjectGroupsByFullID.Remove(fullID); |
@@ -965,7 +962,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
965 | { | 962 | { |
966 | if (entity is SceneObjectGroup) | 963 | if (entity is SceneObjectGroup) |
967 | { | 964 | { |
968 | foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts()) | 965 | foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts) |
969 | { | 966 | { |
970 | if (p.Name == name) | 967 | if (p.Name == name) |
971 | { | 968 | { |
@@ -1626,14 +1623,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1626 | // | 1623 | // |
1627 | SceneObjectGroup group = root.ParentGroup; | 1624 | SceneObjectGroup group = root.ParentGroup; |
1628 | 1625 | ||
1629 | List<SceneObjectPart> newSet = null; | 1626 | List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Parts); |
1630 | int numChildren = -1; | 1627 | int numChildren = newSet.Count; |
1631 | |||
1632 | lock (group.Children) | ||
1633 | { | ||
1634 | newSet = new List<SceneObjectPart>(group.Children.Values); | ||
1635 | numChildren = group.PrimCount; | ||
1636 | } | ||
1637 | 1628 | ||
1638 | // If there are prims left in a link set, but the root is | 1629 | // If there are prims left in a link set, but the root is |
1639 | // slated for unlink, we need to do this | 1630 | // slated for unlink, we need to do this |
@@ -1711,16 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1711 | if (ent is SceneObjectGroup) | 1702 | if (ent is SceneObjectGroup) |
1712 | { | 1703 | { |
1713 | SceneObjectGroup sog = ent as SceneObjectGroup; | 1704 | SceneObjectGroup sog = ent as SceneObjectGroup; |
1714 | 1705 | ||
1715 | lock (sog.Children) | 1706 | foreach (SceneObjectPart part in sog.Parts) |
1716 | { | 1707 | { |
1717 | foreach (KeyValuePair<UUID, SceneObjectPart> subent in sog.Children) | 1708 | if (part.LocalId == localID) |
1718 | { | 1709 | { |
1719 | if (subent.Value.LocalId == localID) | 1710 | objid = part.UUID; |
1720 | { | 1711 | obj = part; |
1721 | objid = subent.Key; | ||
1722 | obj = subent.Value; | ||
1723 | } | ||
1724 | } | 1712 | } |
1725 | } | 1713 | } |
1726 | } | 1714 | } |
@@ -1796,8 +1784,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1796 | copy.SetOwnerId(AgentID); | 1784 | copy.SetOwnerId(AgentID); |
1797 | copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID); | 1785 | copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID); |
1798 | 1786 | ||
1799 | List<SceneObjectPart> partList = | 1787 | SceneObjectPart[] partList = copy.Parts; |
1800 | new List<SceneObjectPart>(copy.Children.Values); | ||
1801 | 1788 | ||
1802 | if (m_parentScene.Permissions.PropagatePermissions()) | 1789 | if (m_parentScene.Permissions.PropagatePermissions()) |
1803 | { | 1790 | { |
@@ -1822,7 +1809,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1822 | // think it's selected, so it will never send a deselect... | 1809 | // think it's selected, so it will never send a deselect... |
1823 | copy.IsSelected = false; | 1810 | copy.IsSelected = false; |
1824 | 1811 | ||
1825 | m_numPrim += copy.Children.Count; | 1812 | m_numPrim += copy.Parts.Length; |
1826 | 1813 | ||
1827 | if (rot != Quaternion.Identity) | 1814 | if (rot != Quaternion.Identity) |
1828 | { | 1815 | { |