aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneGraph.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs90
1 files changed, 54 insertions, 36 deletions
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;