diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneGraph.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 119 |
1 files changed, 70 insertions, 49 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 58a7661..1da4287 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -362,48 +362,52 @@ namespace OpenSim.Region.Framework.Scenes | |||
362 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", | 362 | // "[SCENE GRAPH]: Adding object {0} {1} to region {2}", |
363 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); | 363 | // sceneObject.Name, sceneObject.UUID, m_parentScene.RegionInfo.RegionName); |
364 | 364 | ||
365 | if (m_parentScene.m_clampPrimSize) | 365 | lock (sceneObject.Children) |
366 | { | 366 | { |
367 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 367 | if (m_parentScene.m_clampPrimSize) |
368 | { | 368 | { |
369 | Vector3 scale = part.Shape.Scale; | 369 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
370 | 370 | { | |
371 | if (scale.X > m_parentScene.m_maxNonphys) | 371 | Vector3 scale = part.Shape.Scale; |
372 | scale.X = m_parentScene.m_maxNonphys; | 372 | |
373 | if (scale.Y > m_parentScene.m_maxNonphys) | 373 | if (scale.X > m_parentScene.m_maxNonphys) |
374 | scale.Y = m_parentScene.m_maxNonphys; | 374 | scale.X = m_parentScene.m_maxNonphys; |
375 | if (scale.Z > m_parentScene.m_maxNonphys) | 375 | if (scale.Y > m_parentScene.m_maxNonphys) |
376 | scale.Z = m_parentScene.m_maxNonphys; | 376 | scale.Y = m_parentScene.m_maxNonphys; |
377 | 377 | if (scale.Z > m_parentScene.m_maxNonphys) | |
378 | part.Shape.Scale = scale; | 378 | scale.Z = m_parentScene.m_maxNonphys; |
379 | |||
380 | part.Shape.Scale = scale; | ||
381 | } | ||
379 | } | 382 | } |
380 | } | 383 | |
384 | sceneObject.AttachToScene(m_parentScene); | ||
385 | |||
386 | if (sendClientUpdates) | ||
387 | sceneObject.ScheduleGroupForFullUpdate(); | ||
388 | |||
389 | Entities.Add(sceneObject); | ||
390 | m_numPrim += sceneObject.Children.Count; | ||
381 | 391 | ||
382 | sceneObject.AttachToScene(m_parentScene); | 392 | if (attachToBackup) |
393 | sceneObject.AttachToBackup(); | ||
383 | 394 | ||
384 | if (sendClientUpdates) | 395 | if (OnObjectCreate != null) |
385 | sceneObject.ScheduleGroupForFullUpdate(); | 396 | OnObjectCreate(sceneObject); |
386 | 397 | ||
387 | Entities.Add(sceneObject); | 398 | lock (SceneObjectGroupsByFullID) |
388 | m_numPrim += sceneObject.Children.Count; | 399 | { |
389 | 400 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | |
390 | if (attachToBackup) | 401 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
391 | sceneObject.AttachToBackup(); | 402 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; |
392 | 403 | } | |
393 | if (OnObjectCreate != null) | 404 | |
394 | OnObjectCreate(sceneObject); | 405 | lock (SceneObjectGroupsByLocalID) |
395 | 406 | { | |
396 | lock (SceneObjectGroupsByFullID) | 407 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; |
397 | { | 408 | foreach (SceneObjectPart part in sceneObject.Children.Values) |
398 | SceneObjectGroupsByFullID[sceneObject.UUID] = sceneObject; | 409 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; |
399 | foreach (SceneObjectPart part in sceneObject.Children.Values) | 410 | } |
400 | SceneObjectGroupsByFullID[part.UUID] = sceneObject; | ||
401 | } | ||
402 | lock (SceneObjectGroupsByLocalID) | ||
403 | { | ||
404 | SceneObjectGroupsByLocalID[sceneObject.LocalId] = sceneObject; | ||
405 | foreach (SceneObjectPart part in sceneObject.Children.Values) | ||
406 | SceneObjectGroupsByLocalID[part.LocalId] = sceneObject; | ||
407 | } | 411 | } |
408 | } | 412 | } |
409 | 413 | ||
@@ -422,10 +426,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
422 | 426 | ||
423 | if (!resultOfObjectLinked) | 427 | if (!resultOfObjectLinked) |
424 | { | 428 | { |
425 | m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; | 429 | m_numPrim -= grp.PrimCount; |
426 | 430 | ||
427 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) | 431 | if ((grp.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics) |
428 | RemovePhysicalPrim(grp.Children.Count); | 432 | RemovePhysicalPrim(grp.PrimCount); |
429 | } | 433 | } |
430 | 434 | ||
431 | if (OnObjectRemove != null) | 435 | if (OnObjectRemove != null) |
@@ -906,8 +910,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
906 | { | 910 | { |
907 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) | 911 | if (SceneObjectGroupsByFullID.TryGetValue(fullID, out sog)) |
908 | { | 912 | { |
909 | if (sog.Children.ContainsKey(fullID)) | 913 | lock (sog.Children) |
910 | return sog; | 914 | { |
915 | if (sog.Children.ContainsKey(fullID)) | ||
916 | return sog; | ||
917 | } | ||
918 | |||
911 | SceneObjectGroupsByFullID.Remove(fullID); | 919 | SceneObjectGroupsByFullID.Remove(fullID); |
912 | } | 920 | } |
913 | } | 921 | } |
@@ -1615,7 +1623,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1615 | { | 1623 | { |
1616 | if (part != null) | 1624 | if (part != null) |
1617 | { | 1625 | { |
1618 | if (part.ParentGroup.Children.Count != 1) // Skip single | 1626 | if (part.ParentGroup.PrimCount != 1) // Skip single |
1619 | { | 1627 | { |
1620 | if (part.LinkNum < 2) // Root | 1628 | if (part.LinkNum < 2) // Root |
1621 | rootParts.Add(part); | 1629 | rootParts.Add(part); |
@@ -1643,8 +1651,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1643 | // However, editing linked parts and unlinking may be different | 1651 | // However, editing linked parts and unlinking may be different |
1644 | // | 1652 | // |
1645 | SceneObjectGroup group = root.ParentGroup; | 1653 | SceneObjectGroup group = root.ParentGroup; |
1646 | List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Children.Values); | 1654 | |
1647 | int numChildren = group.Children.Count; | 1655 | List<SceneObjectPart> newSet = null; |
1656 | int numChildren = -1; | ||
1657 | |||
1658 | lock (group.Children) | ||
1659 | { | ||
1660 | newSet = new List<SceneObjectPart>(group.Children.Values); | ||
1661 | numChildren = group.PrimCount; | ||
1662 | } | ||
1648 | 1663 | ||
1649 | // If there are prims left in a link set, but the root is | 1664 | // If there are prims left in a link set, but the root is |
1650 | // slated for unlink, we need to do this | 1665 | // slated for unlink, we need to do this |
@@ -1723,12 +1738,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
1723 | { | 1738 | { |
1724 | if (ent is SceneObjectGroup) | 1739 | if (ent is SceneObjectGroup) |
1725 | { | 1740 | { |
1726 | foreach (KeyValuePair<UUID, SceneObjectPart> subent in ((SceneObjectGroup)ent).Children) | 1741 | SceneObjectGroup sog = ent as SceneObjectGroup; |
1742 | |||
1743 | lock (sog.Children) | ||
1727 | { | 1744 | { |
1728 | if (subent.Value.LocalId == localID) | 1745 | foreach (KeyValuePair<UUID, SceneObjectPart> subent in sog.Children) |
1729 | { | 1746 | { |
1730 | objid = subent.Key; | 1747 | if (subent.Value.LocalId == localID) |
1731 | obj = subent.Value; | 1748 | { |
1749 | objid = subent.Key; | ||
1750 | obj = subent.Value; | ||
1751 | } | ||
1732 | } | 1752 | } |
1733 | } | 1753 | } |
1734 | } | 1754 | } |
@@ -1793,7 +1813,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1793 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); | 1813 | SceneObjectGroup original = GetGroupByPrim(originalPrimID); |
1794 | if (original != null) | 1814 | if (original != null) |
1795 | { | 1815 | { |
1796 | if (m_parentScene.Permissions.CanDuplicateObject(original.Children.Count, original.UUID, AgentID, original.AbsolutePosition)) | 1816 | if (m_parentScene.Permissions.CanDuplicateObject( |
1817 | original.PrimCount, original.UUID, AgentID, original.AbsolutePosition)) | ||
1797 | { | 1818 | { |
1798 | SceneObjectGroup copy = original.Copy(true); | 1819 | SceneObjectGroup copy = original.Copy(true); |
1799 | copy.AbsolutePosition = copy.AbsolutePosition + offset; | 1820 | copy.AbsolutePosition = copy.AbsolutePosition + offset; |