From 1b2edfe75f4fe8b320f65ad54f6f2b0972fda154 Mon Sep 17 00:00:00 2001
From: root
Date: Thu, 16 Sep 2010 23:12:32 +0200
Subject: JustinCC is evil. f7b28dd3 broke script persistence. This fixes it.
---
.../Framework/Interfaces/IEntityInventory.cs | 9 +++++++
.../Region/Framework/Scenes/SceneObjectGroup.cs | 1 +
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 3 ++-
.../Framework/Scenes/SceneObjectPartInventory.cs | 28 ++++++++++++++++++++++
4 files changed, 40 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
index 7edb43e..2e6faa0 100644
--- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
+++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs
@@ -58,6 +58,15 @@ namespace OpenSim.Region.Framework.Interfaces
void ResetInventoryIDs();
///
+ /// Reset parent object UUID for all the items in the prim's inventory.
+ ///
+ ///
+ /// If this method is called and there are inventory items, then we regard the inventory as having changed.
+ ///
+ /// Link number for the part
+ void ResetObjectID();
+
+ ///
/// Change every item in this inventory to a new owner.
///
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f9a8d41..833c9d3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -511,6 +511,7 @@ namespace OpenSim.Region.Framework.Scenes
if (node.Attributes["UUID"] != null)
{
UUID itemid = new UUID(node.Attributes["UUID"].Value);
+ m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid);
m_savedScriptState.Add(itemid, node.InnerXml);
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 024bdc9..95cd26f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -500,7 +500,7 @@ namespace OpenSim.Region.Framework.Scenes
// This is necessary so that TaskInventoryItem parent ids correctly reference the new uuid of this part
if (Inventory != null)
- Inventory.ResetInventoryIDs();
+ Inventory.ResetObjectID();
}
}
@@ -2763,6 +2763,7 @@ namespace OpenSim.Region.Framework.Scenes
UUID = UUID.Random();
LinkNum = linkNum;
LocalId = 0;
+ Inventory.ResetInventoryIDs();
}
///
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 53ddb5d..fbaa7d4 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -140,6 +140,34 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void ResetObjectID()
+ {
+ m_items.LockItemsForWrite(true);
+
+ if (Items.Count == 0)
+ {
+ m_items.LockItemsForWrite(false);
+ return;
+ }
+
+ HasInventoryChanged = true;
+ if (m_part.ParentGroup != null)
+ {
+ m_part.ParentGroup.HasGroupChanged = true;
+ }
+
+ IList items = new List(Items.Values);
+ Items.Clear();
+
+ foreach (TaskInventoryItem item in items)
+ {
+ item.ParentPartID = m_part.UUID;
+ item.ParentID = m_part.UUID;
+ Items.Add(item.ItemID, item);
+ }
+ m_items.LockItemsForWrite(false);
+ }
+
///
/// Change every item in this inventory to a new owner.
///
--
cgit v1.1
From 670357367e825f194b7993871f1e42af41172a09 Mon Sep 17 00:00:00 2001
From: root
Date: Thu, 16 Sep 2010 23:26:53 +0200
Subject: Removing debug
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 1 -
1 file changed, 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 833c9d3..f9a8d41 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -511,7 +511,6 @@ namespace OpenSim.Region.Framework.Scenes
if (node.Attributes["UUID"] != null)
{
UUID itemid = new UUID(node.Attributes["UUID"].Value);
- m_log.DebugFormat("[SCRIPT STATE]: Adding state for oldID {0}", itemid);
m_savedScriptState.Add(itemid, node.InnerXml);
}
}
--
cgit v1.1
From e3f153370566e0fd4b6f63a066e016cb52dcdf62 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 17 Sep 2010 01:21:28 +0100
Subject: Fix build break by replacing Items.LockItemsForWrite() with lock
(Items) {}
---
.../Framework/Scenes/SceneObjectPartInventory.cs | 43 +++++++++++-----------
1 file changed, 21 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index fbaa7d4..7ba30fc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -142,30 +142,29 @@ namespace OpenSim.Region.Framework.Scenes
public void ResetObjectID()
{
- m_items.LockItemsForWrite(true);
-
- if (Items.Count == 0)
- {
- m_items.LockItemsForWrite(false);
- return;
- }
-
- HasInventoryChanged = true;
- if (m_part.ParentGroup != null)
- {
- m_part.ParentGroup.HasGroupChanged = true;
- }
-
- IList items = new List(Items.Values);
- Items.Clear();
-
- foreach (TaskInventoryItem item in items)
+ lock (Items)
{
- item.ParentPartID = m_part.UUID;
- item.ParentID = m_part.UUID;
- Items.Add(item.ItemID, item);
+ if (Items.Count == 0)
+ {
+ return;
+ }
+
+ HasInventoryChanged = true;
+ if (m_part.ParentGroup != null)
+ {
+ m_part.ParentGroup.HasGroupChanged = true;
+ }
+
+ IList items = new List(Items.Values);
+ Items.Clear();
+
+ foreach (TaskInventoryItem item in items)
+ {
+ item.ParentPartID = m_part.UUID;
+ item.ParentID = m_part.UUID;
+ Items.Add(item.ItemID, item);
+ }
}
- m_items.LockItemsForWrite(false);
}
///
--
cgit v1.1
From 860b2a502f797e5822c6705d4639f370f3ac5861 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 16 Sep 2010 17:30:46 -0700
Subject: Changed SceneObjectGroup to store parts with the fast and thread-safe
MapAndArray collection
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 8 +-
.../Framework/Scenes/Scene.PacketHandlers.cs | 5 +-
OpenSim/Region/Framework/Scenes/Scene.cs | 14 +-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 53 +-
.../Framework/Scenes/SceneObjectGroup.Inventory.cs | 58 +-
.../Region/Framework/Scenes/SceneObjectGroup.cs | 1409 ++++++++------------
.../Framework/Scenes/SceneObjectPartInventory.cs | 5 +-
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
.../Scenes/Serialization/SceneObjectSerializer.cs | 28 +-
.../Framework/Scenes/Tests/SceneGraphTests.cs | 2 +-
.../Scenes/Tests/SceneObjectLinkingTests.cs | 36 +-
OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 5 +-
12 files changed, 682 insertions(+), 943 deletions(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 838c648..8011154 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2051,9 +2051,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetGroup(groupID, remoteClient);
sog.ScheduleGroupForFullUpdate();
- List partList = null;
- lock (sog.Children)
- partList = new List(sog.Children.Values);
+ SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID);
@@ -2066,9 +2064,7 @@ namespace OpenSim.Region.Framework.Scenes
if (sog.GroupID != groupID)
continue;
- List partList = null;
- lock (sog.Children)
- partList = new List(sog.Children.Values);
+ SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart child in partList)
{
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 7788e43..4d97db7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -161,11 +161,8 @@ namespace OpenSim.Region.Framework.Scenes
bool foundPrim = false;
SceneObjectGroup sog = ent as SceneObjectGroup;
-
- List partList = null;
- lock (sog.Children)
- partList = new List(sog.Children.Values);
+ SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart part in partList)
{
if (part.LocalId == primLocalID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 8a90bc8..fe0ab5b 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1785,7 +1785,7 @@ namespace OpenSim.Region.Framework.Scenes
{
m_log.ErrorFormat(
"[SCENE]: Found a SceneObjectGroup with m_rootPart == null and {0} children",
- group.Children == null ? 0 : group.PrimCount);
+ group.Parts == null ? 0 : group.PrimCount);
}
AddRestoredSceneObject(group, true, true);
@@ -2091,9 +2091,7 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveScriptInstances(true);
}
- List partList = null;
- lock (group.Children)
- partList = new List(group.Children.Values);
+ SceneObjectPart[] partList = group.Parts;
foreach (SceneObjectPart part in partList)
{
@@ -2465,11 +2463,9 @@ namespace OpenSim.Region.Framework.Scenes
// Force allocation of new LocalId
//
- lock (sceneObject.Children)
- {
- foreach (SceneObjectPart p in sceneObject.Children.Values)
- p.LocalId = 0;
- }
+ SceneObjectPart[] parts = sceneObject.Parts;
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].LocalId = 0;
if (sceneObject.IsAttachmentCheckFull()) // Attachment
{
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
if (Entities.ContainsKey(sceneObject.UUID))
return false;
- List children;
- lock (sceneObject.Children)
- children = new List(sceneObject.Children.Values);
+ SceneObjectPart[] children = sceneObject.Parts;
// Clamp child prim sizes and add child prims to the m_numPrim count
if (m_parentScene.m_clampPrimSize)
@@ -369,7 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
part.Shape.Scale = scale;
}
}
- m_numPrim += children.Count;
+ m_numPrim += children.Length;
sceneObject.AttachToScene(m_parentScene);
@@ -426,15 +424,17 @@ namespace OpenSim.Region.Framework.Scenes
lock (SceneObjectGroupsByFullID)
{
- foreach (SceneObjectPart part in grp.Children.Values)
- SceneObjectGroupsByFullID.Remove(part.UUID);
+ SceneObjectPart[] parts = grp.Parts;
+ for (int i = 0; i < parts.Length; i++)
+ SceneObjectGroupsByFullID.Remove(parts[i].UUID);
SceneObjectGroupsByFullID.Remove(grp.RootPart.UUID);
}
lock (SceneObjectGroupsByLocalID)
{
- foreach (SceneObjectPart part in grp.Children.Values)
- SceneObjectGroupsByLocalID.Remove(part.LocalId);
+ SceneObjectPart[] parts = grp.Parts;
+ for (int i = 0; i < parts.Length; i++)
+ SceneObjectGroupsByLocalID.Remove(parts[i].LocalId);
SceneObjectGroupsByLocalID.Remove(grp.RootPart.LocalId);
}
@@ -887,11 +887,8 @@ namespace OpenSim.Region.Framework.Scenes
if (sog != null)
{
- lock (sog.Children)
- {
- if (sog.Children.ContainsKey(fullID))
- return sog;
- }
+ if (sog.ContainsPart(fullID))
+ return sog;
lock (SceneObjectGroupsByFullID)
SceneObjectGroupsByFullID.Remove(fullID);
@@ -965,7 +962,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (entity is SceneObjectGroup)
{
- foreach (SceneObjectPart p in ((SceneObjectGroup)entity).GetParts())
+ foreach (SceneObjectPart p in ((SceneObjectGroup)entity).Parts)
{
if (p.Name == name)
{
@@ -1626,14 +1623,8 @@ namespace OpenSim.Region.Framework.Scenes
//
SceneObjectGroup group = root.ParentGroup;
- List newSet = null;
- int numChildren = -1;
-
- lock (group.Children)
- {
- newSet = new List(group.Children.Values);
- numChildren = group.PrimCount;
- }
+ List newSet = new List(group.Parts);
+ int numChildren = newSet.Count;
// If there are prims left in a link set, but the root is
// slated for unlink, we need to do this
@@ -1711,16 +1702,13 @@ namespace OpenSim.Region.Framework.Scenes
if (ent is SceneObjectGroup)
{
SceneObjectGroup sog = ent as SceneObjectGroup;
-
- lock (sog.Children)
+
+ foreach (SceneObjectPart part in sog.Parts)
{
- foreach (KeyValuePair subent in sog.Children)
+ if (part.LocalId == localID)
{
- if (subent.Value.LocalId == localID)
- {
- objid = subent.Key;
- obj = subent.Value;
- }
+ objid = part.UUID;
+ obj = part;
}
}
}
@@ -1796,8 +1784,7 @@ namespace OpenSim.Region.Framework.Scenes
copy.SetOwnerId(AgentID);
copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
- List partList =
- new List(copy.Children.Values);
+ SceneObjectPart[] partList = copy.Parts;
if (m_parentScene.Permissions.PropagatePermissions())
{
@@ -1822,7 +1809,7 @@ namespace OpenSim.Region.Framework.Scenes
// think it's selected, so it will never send a deselect...
copy.IsSelected = false;
- m_numPrim += copy.Children.Count;
+ m_numPrim += copy.Parts.Length;
if (rot != Quaternion.Identity)
{
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 9a01a28..a86223c 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -46,13 +46,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ForceInventoryPersistence()
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.Inventory.ForceInventoryPersistence();
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].Inventory.ForceInventoryPersistence();
}
///
@@ -64,10 +60,9 @@ namespace OpenSim.Region.Framework.Scenes
// Don't start scripts if they're turned off in the region!
if (!m_scene.RegionInfo.RegionSettings.DisableScripts)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].Inventory.CreateScriptInstances(startParam, postOnRez, engine, stateSource);
}
}
@@ -80,13 +75,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
}
///
@@ -283,8 +274,11 @@ namespace OpenSim.Region.Framework.Scenes
PermissionMask.Transfer) | 7;
uint ownerMask = 0x7fffffff;
- foreach (SceneObjectPart part in m_parts.Values)
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart part = parts[i];
ownerMask &= part.OwnerMask;
perms &= part.Inventory.MaskEffectivePermissions();
}
@@ -312,39 +306,40 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyNextOwnerPermissions()
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.ApplyNextOwnerPermissions();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].ApplyNextOwnerPermissions();
}
public string GetStateSnapshot()
{
Dictionary states = new Dictionary();
- foreach (SceneObjectPart part in m_parts.Values)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart part = parts[i];
foreach (KeyValuePair s in part.Inventory.GetScriptStates())
states[s.Key] = s.Value;
}
if (states.Count < 1)
- return "";
+ return String.Empty;
XmlDocument xmldoc = new XmlDocument();
XmlNode xmlnode = xmldoc.CreateNode(XmlNodeType.XmlDeclaration,
- "", "");
+ String.Empty, String.Empty);
xmldoc.AppendChild(xmlnode);
XmlElement rootElement = xmldoc.CreateElement("", "ScriptData",
- "");
+ String.Empty);
xmldoc.AppendChild(rootElement);
XmlElement wrapper = xmldoc.CreateElement("", "ScriptStates",
- "");
+ String.Empty);
rootElement.AppendChild(wrapper);
@@ -424,10 +419,9 @@ namespace OpenSim.Region.Framework.Scenes
public void ResumeScripts()
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.Inventory.ResumeScripts();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].Inventory.ResumeScripts();
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f9a8d41..c984afc 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -158,17 +158,14 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public float scriptScore = 0f;
+ public float scriptScore;
private Vector3 lastPhysGroupPos;
private Quaternion lastPhysGroupRot;
- private bool m_isBackedUp = false;
+ private bool m_isBackedUp;
- ///
- /// The constituent parts of this group
- ///
- protected Dictionary m_parts = new Dictionary();
+ protected MapAndArray m_parts = new MapAndArray();
protected ulong m_regionHandle;
protected SceneObjectPart m_rootPart;
@@ -177,13 +174,13 @@ namespace OpenSim.Region.Framework.Scenes
private Dictionary m_targets = new Dictionary();
private Dictionary m_rotTargets = new Dictionary();
- private bool m_scriptListens_atTarget = false;
- private bool m_scriptListens_notAtTarget = false;
+ private bool m_scriptListens_atTarget;
+ private bool m_scriptListens_notAtTarget;
- private bool m_scriptListens_atRotTarget = false;
- private bool m_scriptListens_notAtRotTarget = false;
+ private bool m_scriptListens_atRotTarget;
+ private bool m_scriptListens_notAtRotTarget;
- internal Dictionary m_savedScriptState = null;
+ internal Dictionary m_savedScriptState;
#region Properties
@@ -194,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes
{
get {
if (RootPart == null)
- return "";
+ return String.Empty;
return RootPart.Name;
}
set { RootPart.Name = value; }
@@ -214,7 +211,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public int PrimCount
{
- get { lock (m_parts) { return m_parts.Count; } }
+ get { return m_parts.Count; }
}
protected Quaternion m_rotation = Quaternion.Identity;
@@ -236,16 +233,14 @@ namespace OpenSim.Region.Framework.Scenes
set { m_rootPart.GroupID = value; }
}
- ///
- /// The parts of this scene object group. You must lock this property before using it.
- /// If you're doing anything other than reading values, please take a copy of the values rather than locking
- /// the dictionary for the entirety of the operation. This increases liveness and reduces the danger of deadlock
- /// If you want to know the number of children, consider using the PrimCount property instead
- ///
- public Dictionary Children
+ public SceneObjectPart[] Parts
+ {
+ get { return m_parts.GetArray(); }
+ }
+
+ public bool ContainsPart(UUID partID)
{
- get { return m_parts; }
- set { m_parts = value; }
+ return m_parts.ContainsKey(partID);
}
///
@@ -262,13 +257,9 @@ namespace OpenSim.Region.Framework.Scenes
set
{
m_regionHandle = value;
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.RegionHandle = m_regionHandle;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].RegionHandle = value;
}
}
@@ -313,14 +304,10 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
}
-
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.GroupPosition = val;
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].GroupPosition = val;
//if (m_rootPart.PhysActor != null)
//{
@@ -342,14 +329,9 @@ namespace OpenSim.Region.Framework.Scenes
{
get { return m_rootPart.UUID; }
set
- {
- m_rootPart.UUID = value;
-
- lock (m_parts)
- {
- m_parts.Remove(m_rootPart.UUID);
- m_parts.Add(m_rootPart.UUID, m_rootPart);
- }
+ {
+ m_rootPart.UUID = value;
+ m_parts.AddOrReplace(value, m_rootPart);
}
}
@@ -411,12 +393,12 @@ namespace OpenSim.Region.Framework.Scenes
{
m_rootPart.PhysActor.Selected = value;
// Pass it on to the children.
- foreach (SceneObjectPart child in Children.Values)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart child = parts[i];
if (child.PhysActor != null)
- {
child.PhysActor.Selected = value;
- }
}
}
}
@@ -519,13 +501,9 @@ namespace OpenSim.Region.Framework.Scenes
public void SetFromItemID(UUID AssetId)
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.FromItemID = AssetId;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].FromItemID = AssetId;
}
public UUID GetFromItemID()
@@ -564,23 +542,18 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart.LocalId == 0)
m_rootPart.LocalId = m_scene.AllocateLocalId();
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (Object.ReferenceEquals(part, m_rootPart))
- {
- continue;
- }
-
- if (part.LocalId == 0)
- {
- part.LocalId = m_scene.AllocateLocalId();
- }
-
- part.ParentID = m_rootPart.LocalId;
- //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);
- }
+ SceneObjectPart part = parts[i];
+ if (Object.ReferenceEquals(part, m_rootPart))
+ continue;
+
+ if (part.LocalId == 0)
+ part.LocalId = m_scene.AllocateLocalId();
+
+ part.ParentID = m_rootPart.LocalId;
+ //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);
}
ApplyPhysics(m_scene.m_physicalPrim);
@@ -596,22 +569,22 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 maxScale = Vector3.Zero;
Vector3 finalScale = new Vector3(0.5f, 0.5f, 0.5f);
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- Vector3 partscale = part.Scale;
- Vector3 partoffset = part.OffsetPosition;
+ SceneObjectPart part = parts[i];
+ Vector3 partscale = part.Scale;
+ Vector3 partoffset = part.OffsetPosition;
- minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
- minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
- minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
+ minScale.X = (partscale.X + partoffset.X < minScale.X) ? partscale.X + partoffset.X : minScale.X;
+ minScale.Y = (partscale.Y + partoffset.Y < minScale.Y) ? partscale.Y + partoffset.Y : minScale.Y;
+ minScale.Z = (partscale.Z + partoffset.Z < minScale.Z) ? partscale.Z + partoffset.Z : minScale.Z;
- maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
- maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
- maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
- }
+ maxScale.X = (partscale.X + partoffset.X > maxScale.X) ? partscale.X + partoffset.X : maxScale.X;
+ maxScale.Y = (partscale.Y + partoffset.Y > maxScale.Y) ? partscale.Y + partoffset.Y : maxScale.Y;
+ maxScale.Z = (partscale.Z + partoffset.Z > maxScale.Z) ? partscale.Z + partoffset.Z : maxScale.Z;
}
+
finalScale.X = (minScale.X > maxScale.X) ? minScale.X : maxScale.X;
finalScale.Y = (minScale.Y > maxScale.Y) ? minScale.Y : maxScale.Y;
finalScale.Z = (minScale.Z > maxScale.Z) ? minScale.Z : maxScale.Z;
@@ -627,39 +600,40 @@ namespace OpenSim.Region.Framework.Scenes
EntityIntersection result = new EntityIntersection();
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- // Temporary commented to stop compiler warning
- //Vector3 partPosition =
- // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
- Quaternion parentrotation = GroupRotation;
+ SceneObjectPart part = parts[i];
- // Telling the prim to raytrace.
- //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
+ // Temporary commented to stop compiler warning
+ //Vector3 partPosition =
+ // new Vector3(part.AbsolutePosition.X, part.AbsolutePosition.Y, part.AbsolutePosition.Z);
+ Quaternion parentrotation = GroupRotation;
- EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation,frontFacesOnly, faceCenters);
+ // Telling the prim to raytrace.
+ //EntityIntersection inter = part.TestIntersection(hRay, parentrotation);
- // This may need to be updated to the maximum draw distance possible..
- // We might (and probably will) be checking for prim creation from other sims
- // when the camera crosses the border.
- float idist = Constants.RegionSize;
+ EntityIntersection inter = part.TestIntersectionOBB(hRay, parentrotation, frontFacesOnly, faceCenters);
- if (inter.HitTF)
+ // This may need to be updated to the maximum draw distance possible..
+ // We might (and probably will) be checking for prim creation from other sims
+ // when the camera crosses the border.
+ float idist = Constants.RegionSize;
+
+ if (inter.HitTF)
+ {
+ // We need to find the closest prim to return to the testcaller along the ray
+ if (inter.distance < idist)
{
- // We need to find the closest prim to return to the testcaller along the ray
- if (inter.distance < idist)
- {
- result.HitTF = true;
- result.ipoint = inter.ipoint;
- result.obj = part;
- result.normal = inter.normal;
- result.distance = inter.distance;
- }
+ result.HitTF = true;
+ result.ipoint = inter.ipoint;
+ result.obj = part;
+ result.normal = inter.normal;
+ result.distance = inter.distance;
}
}
}
+
return result;
}
@@ -678,238 +652,193 @@ namespace OpenSim.Region.Framework.Scenes
minY = 256f;
minZ = 8192f;
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- Vector3 worldPos = part.GetWorldPosition();
- Vector3 offset = worldPos - AbsolutePosition;
- Quaternion worldRot;
- if (part.ParentID == 0)
- {
- worldRot = part.RotationOffset;
- }
- else
- {
- worldRot = part.GetWorldRotation();
- }
+ SceneObjectPart part = parts[i];
- Vector3 frontTopLeft;
- Vector3 frontTopRight;
- Vector3 frontBottomLeft;
- Vector3 frontBottomRight;
-
- Vector3 backTopLeft;
- Vector3 backTopRight;
- Vector3 backBottomLeft;
- Vector3 backBottomRight;
-
- // Vector3[] corners = new Vector3[8];
-
- Vector3 orig = Vector3.Zero;
-
- frontTopLeft.X = orig.X - (part.Scale.X / 2);
- frontTopLeft.Y = orig.Y - (part.Scale.Y / 2);
- frontTopLeft.Z = orig.Z + (part.Scale.Z / 2);
-
- frontTopRight.X = orig.X - (part.Scale.X / 2);
- frontTopRight.Y = orig.Y + (part.Scale.Y / 2);
- frontTopRight.Z = orig.Z + (part.Scale.Z / 2);
-
- frontBottomLeft.X = orig.X - (part.Scale.X / 2);
- frontBottomLeft.Y = orig.Y - (part.Scale.Y / 2);
- frontBottomLeft.Z = orig.Z - (part.Scale.Z / 2);
-
- frontBottomRight.X = orig.X - (part.Scale.X / 2);
- frontBottomRight.Y = orig.Y + (part.Scale.Y / 2);
- frontBottomRight.Z = orig.Z - (part.Scale.Z / 2);
-
- backTopLeft.X = orig.X + (part.Scale.X / 2);
- backTopLeft.Y = orig.Y - (part.Scale.Y / 2);
- backTopLeft.Z = orig.Z + (part.Scale.Z / 2);
-
- backTopRight.X = orig.X + (part.Scale.X / 2);
- backTopRight.Y = orig.Y + (part.Scale.Y / 2);
- backTopRight.Z = orig.Z + (part.Scale.Z / 2);
-
- backBottomLeft.X = orig.X + (part.Scale.X / 2);
- backBottomLeft.Y = orig.Y - (part.Scale.Y / 2);
- backBottomLeft.Z = orig.Z - (part.Scale.Z / 2);
-
- backBottomRight.X = orig.X + (part.Scale.X / 2);
- backBottomRight.Y = orig.Y + (part.Scale.Y / 2);
- backBottomRight.Z = orig.Z - (part.Scale.Z / 2);
-
- //m_log.InfoFormat("pre corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
- //m_log.InfoFormat("pre corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
- //m_log.InfoFormat("pre corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
- //m_log.InfoFormat("pre corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
- //m_log.InfoFormat("pre corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
- //m_log.InfoFormat("pre corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
- //m_log.InfoFormat("pre corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
- //m_log.InfoFormat("pre corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
-
- //for (int i = 0; i < 8; i++)
- //{
- // corners[i] = corners[i] * worldRot;
- // corners[i] += offset;
-
- // if (corners[i].X > maxX)
- // maxX = corners[i].X;
- // if (corners[i].X < minX)
- // minX = corners[i].X;
-
- // if (corners[i].Y > maxY)
- // maxY = corners[i].Y;
- // if (corners[i].Y < minY)
- // minY = corners[i].Y;
-
- // if (corners[i].Z > maxZ)
- // maxZ = corners[i].Y;
- // if (corners[i].Z < minZ)
- // minZ = corners[i].Z;
- //}
-
- frontTopLeft = frontTopLeft * worldRot;
- frontTopRight = frontTopRight * worldRot;
- frontBottomLeft = frontBottomLeft * worldRot;
- frontBottomRight = frontBottomRight * worldRot;
-
- backBottomLeft = backBottomLeft * worldRot;
- backBottomRight = backBottomRight * worldRot;
- backTopLeft = backTopLeft * worldRot;
- backTopRight = backTopRight * worldRot;
-
-
- frontTopLeft += offset;
- frontTopRight += offset;
- frontBottomLeft += offset;
- frontBottomRight += offset;
-
- backBottomLeft += offset;
- backBottomRight += offset;
- backTopLeft += offset;
- backTopRight += offset;
-
- //m_log.InfoFormat("corner 1 is {0} {1} {2}", frontTopLeft.X, frontTopLeft.Y, frontTopLeft.Z);
- //m_log.InfoFormat("corner 2 is {0} {1} {2}", frontTopRight.X, frontTopRight.Y, frontTopRight.Z);
- //m_log.InfoFormat("corner 3 is {0} {1} {2}", frontBottomRight.X, frontBottomRight.Y, frontBottomRight.Z);
- //m_log.InfoFormat("corner 4 is {0} {1} {2}", frontBottomLeft.X, frontBottomLeft.Y, frontBottomLeft.Z);
- //m_log.InfoFormat("corner 5 is {0} {1} {2}", backTopLeft.X, backTopLeft.Y, backTopLeft.Z);
- //m_log.InfoFormat("corner 6 is {0} {1} {2}", backTopRight.X, backTopRight.Y, backTopRight.Z);
- //m_log.InfoFormat("corner 7 is {0} {1} {2}", backBottomRight.X, backBottomRight.Y, backBottomRight.Z);
- //m_log.InfoFormat("corner 8 is {0} {1} {2}", backBottomLeft.X, backBottomLeft.Y, backBottomLeft.Z);
-
- if (frontTopRight.X > maxX)
- maxX = frontTopRight.X;
- if (frontTopLeft.X > maxX)
- maxX = frontTopLeft.X;
- if (frontBottomRight.X > maxX)
- maxX = frontBottomRight.X;
- if (frontBottomLeft.X > maxX)
- maxX = frontBottomLeft.X;
-
- if (backTopRight.X > maxX)
- maxX = backTopRight.X;
- if (backTopLeft.X > maxX)
- maxX = backTopLeft.X;
- if (backBottomRight.X > maxX)
- maxX = backBottomRight.X;
- if (backBottomLeft.X > maxX)
- maxX = backBottomLeft.X;
-
- if (frontTopRight.X < minX)
- minX = frontTopRight.X;
- if (frontTopLeft.X < minX)
- minX = frontTopLeft.X;
- if (frontBottomRight.X < minX)
- minX = frontBottomRight.X;
- if (frontBottomLeft.X < minX)
- minX = frontBottomLeft.X;
-
- if (backTopRight.X < minX)
- minX = backTopRight.X;
- if (backTopLeft.X < minX)
- minX = backTopLeft.X;
- if (backBottomRight.X < minX)
- minX = backBottomRight.X;
- if (backBottomLeft.X < minX)
- minX = backBottomLeft.X;
-
- //
- if (frontTopRight.Y > maxY)
- maxY = frontTopRight.Y;
- if (frontTopLeft.Y > maxY)
- maxY = frontTopLeft.Y;
- if (frontBottomRight.Y > maxY)
- maxY = frontBottomRight.Y;
- if (frontBottomLeft.Y > maxY)
- maxY = frontBottomLeft.Y;
-
- if (backTopRight.Y > maxY)
- maxY = backTopRight.Y;
- if (backTopLeft.Y > maxY)
- maxY = backTopLeft.Y;
- if (backBottomRight.Y > maxY)
- maxY = backBottomRight.Y;
- if (backBottomLeft.Y > maxY)
- maxY = backBottomLeft.Y;
-
- if (frontTopRight.Y < minY)
- minY = frontTopRight.Y;
- if (frontTopLeft.Y < minY)
- minY = frontTopLeft.Y;
- if (frontBottomRight.Y < minY)
- minY = frontBottomRight.Y;
- if (frontBottomLeft.Y < minY)
- minY = frontBottomLeft.Y;
-
- if (backTopRight.Y < minY)
- minY = backTopRight.Y;
- if (backTopLeft.Y < minY)
- minY = backTopLeft.Y;
- if (backBottomRight.Y < minY)
- minY = backBottomRight.Y;
- if (backBottomLeft.Y < minY)
- minY = backBottomLeft.Y;
-
- //
- if (frontTopRight.Z > maxZ)
- maxZ = frontTopRight.Z;
- if (frontTopLeft.Z > maxZ)
- maxZ = frontTopLeft.Z;
- if (frontBottomRight.Z > maxZ)
- maxZ = frontBottomRight.Z;
- if (frontBottomLeft.Z > maxZ)
- maxZ = frontBottomLeft.Z;
-
- if (backTopRight.Z > maxZ)
- maxZ = backTopRight.Z;
- if (backTopLeft.Z > maxZ)
- maxZ = backTopLeft.Z;
- if (backBottomRight.Z > maxZ)
- maxZ = backBottomRight.Z;
- if (backBottomLeft.Z > maxZ)
- maxZ = backBottomLeft.Z;
-
- if (frontTopRight.Z < minZ)
- minZ = frontTopRight.Z;
- if (frontTopLeft.Z < minZ)
- minZ = frontTopLeft.Z;
- if (frontBottomRight.Z < minZ)
- minZ = frontBottomRight.Z;
- if (frontBottomLeft.Z < minZ)
- minZ = frontBottomLeft.Z;
-
- if (backTopRight.Z < minZ)
- minZ = backTopRight.Z;
- if (backTopLeft.Z < minZ)
- minZ = backTopLeft.Z;
- if (backBottomRight.Z < minZ)
- minZ = backBottomRight.Z;
- if (backBottomLeft.Z < minZ)
- minZ = backBottomLeft.Z;
- }
+ Vector3 worldPos = part.GetWorldPosition();
+ Vector3 offset = worldPos - AbsolutePosition;
+ Quaternion worldRot;
+ if (part.ParentID == 0)
+ worldRot = part.RotationOffset;
+ else
+ worldRot = part.GetWorldRotation();
+
+ Vector3 frontTopLeft;
+ Vector3 frontTopRight;
+ Vector3 frontBottomLeft;
+ Vector3 frontBottomRight;
+
+ Vector3 backTopLeft;
+ Vector3 backTopRight;
+ Vector3 backBottomLeft;
+ Vector3 backBottomRight;
+
+ Vector3 orig = Vector3.Zero;
+
+ frontTopLeft.X = orig.X - (part.Scale.X / 2);
+ frontTopLeft.Y = orig.Y - (part.Scale.Y / 2);
+ frontTopLeft.Z = orig.Z + (part.Scale.Z / 2);
+
+ frontTopRight.X = orig.X - (part.Scale.X / 2);
+ frontTopRight.Y = orig.Y + (part.Scale.Y / 2);
+ frontTopRight.Z = orig.Z + (part.Scale.Z / 2);
+
+ frontBottomLeft.X = orig.X - (part.Scale.X / 2);
+ frontBottomLeft.Y = orig.Y - (part.Scale.Y / 2);
+ frontBottomLeft.Z = orig.Z - (part.Scale.Z / 2);
+
+ frontBottomRight.X = orig.X - (part.Scale.X / 2);
+ frontBottomRight.Y = orig.Y + (part.Scale.Y / 2);
+ frontBottomRight.Z = orig.Z - (part.Scale.Z / 2);
+
+ backTopLeft.X = orig.X + (part.Scale.X / 2);
+ backTopLeft.Y = orig.Y - (part.Scale.Y / 2);
+ backTopLeft.Z = orig.Z + (part.Scale.Z / 2);
+
+ backTopRight.X = orig.X + (part.Scale.X / 2);
+ backTopRight.Y = orig.Y + (part.Scale.Y / 2);
+ backTopRight.Z = orig.Z + (part.Scale.Z / 2);
+
+ backBottomLeft.X = orig.X + (part.Scale.X / 2);
+ backBottomLeft.Y = orig.Y - (part.Scale.Y / 2);
+ backBottomLeft.Z = orig.Z - (part.Scale.Z / 2);
+
+ backBottomRight.X = orig.X + (part.Scale.X / 2);
+ backBottomRight.Y = orig.Y + (part.Scale.Y / 2);
+ backBottomRight.Z = orig.Z - (part.Scale.Z / 2);
+
+ frontTopLeft = frontTopLeft * worldRot;
+ frontTopRight = frontTopRight * worldRot;
+ frontBottomLeft = frontBottomLeft * worldRot;
+ frontBottomRight = frontBottomRight * worldRot;
+
+ backBottomLeft = backBottomLeft * worldRot;
+ backBottomRight = backBottomRight * worldRot;
+ backTopLeft = backTopLeft * worldRot;
+ backTopRight = backTopRight * worldRot;
+
+
+ frontTopLeft += offset;
+ frontTopRight += offset;
+ frontBottomLeft += offset;
+ frontBottomRight += offset;
+
+ backBottomLeft += offset;
+ backBottomRight += offset;
+ backTopLeft += offset;
+ backTopRight += offset;
+
+ if (frontTopRight.X > maxX)
+ maxX = frontTopRight.X;
+ if (frontTopLeft.X > maxX)
+ maxX = frontTopLeft.X;
+ if (frontBottomRight.X > maxX)
+ maxX = frontBottomRight.X;
+ if (frontBottomLeft.X > maxX)
+ maxX = frontBottomLeft.X;
+
+ if (backTopRight.X > maxX)
+ maxX = backTopRight.X;
+ if (backTopLeft.X > maxX)
+ maxX = backTopLeft.X;
+ if (backBottomRight.X > maxX)
+ maxX = backBottomRight.X;
+ if (backBottomLeft.X > maxX)
+ maxX = backBottomLeft.X;
+
+ if (frontTopRight.X < minX)
+ minX = frontTopRight.X;
+ if (frontTopLeft.X < minX)
+ minX = frontTopLeft.X;
+ if (frontBottomRight.X < minX)
+ minX = frontBottomRight.X;
+ if (frontBottomLeft.X < minX)
+ minX = frontBottomLeft.X;
+
+ if (backTopRight.X < minX)
+ minX = backTopRight.X;
+ if (backTopLeft.X < minX)
+ minX = backTopLeft.X;
+ if (backBottomRight.X < minX)
+ minX = backBottomRight.X;
+ if (backBottomLeft.X < minX)
+ minX = backBottomLeft.X;
+
+ //
+ if (frontTopRight.Y > maxY)
+ maxY = frontTopRight.Y;
+ if (frontTopLeft.Y > maxY)
+ maxY = frontTopLeft.Y;
+ if (frontBottomRight.Y > maxY)
+ maxY = frontBottomRight.Y;
+ if (frontBottomLeft.Y > maxY)
+ maxY = frontBottomLeft.Y;
+
+ if (backTopRight.Y > maxY)
+ maxY = backTopRight.Y;
+ if (backTopLeft.Y > maxY)
+ maxY = backTopLeft.Y;
+ if (backBottomRight.Y > maxY)
+ maxY = backBottomRight.Y;
+ if (backBottomLeft.Y > maxY)
+ maxY = backBottomLeft.Y;
+
+ if (frontTopRight.Y < minY)
+ minY = frontTopRight.Y;
+ if (frontTopLeft.Y < minY)
+ minY = frontTopLeft.Y;
+ if (frontBottomRight.Y < minY)
+ minY = frontBottomRight.Y;
+ if (frontBottomLeft.Y < minY)
+ minY = frontBottomLeft.Y;
+
+ if (backTopRight.Y < minY)
+ minY = backTopRight.Y;
+ if (backTopLeft.Y < minY)
+ minY = backTopLeft.Y;
+ if (backBottomRight.Y < minY)
+ minY = backBottomRight.Y;
+ if (backBottomLeft.Y < minY)
+ minY = backBottomLeft.Y;
+
+ //
+ if (frontTopRight.Z > maxZ)
+ maxZ = frontTopRight.Z;
+ if (frontTopLeft.Z > maxZ)
+ maxZ = frontTopLeft.Z;
+ if (frontBottomRight.Z > maxZ)
+ maxZ = frontBottomRight.Z;
+ if (frontBottomLeft.Z > maxZ)
+ maxZ = frontBottomLeft.Z;
+
+ if (backTopRight.Z > maxZ)
+ maxZ = backTopRight.Z;
+ if (backTopLeft.Z > maxZ)
+ maxZ = backTopLeft.Z;
+ if (backBottomRight.Z > maxZ)
+ maxZ = backBottomRight.Z;
+ if (backBottomLeft.Z > maxZ)
+ maxZ = backBottomLeft.Z;
+
+ if (frontTopRight.Z < minZ)
+ minZ = frontTopRight.Z;
+ if (frontTopLeft.Z < minZ)
+ minZ = frontTopLeft.Z;
+ if (frontBottomRight.Z < minZ)
+ minZ = frontBottomRight.Z;
+ if (frontBottomLeft.Z < minZ)
+ minZ = frontBottomLeft.Z;
+
+ if (backTopRight.Z < minZ)
+ minZ = backTopRight.Z;
+ if (backTopLeft.Z < minZ)
+ minZ = backTopLeft.Z;
+ if (backBottomRight.Z < minZ)
+ minZ = backBottomRight.Z;
+ if (backBottomLeft.Z < minZ)
+ minZ = backBottomLeft.Z;
}
}
@@ -949,17 +878,12 @@ namespace OpenSim.Region.Framework.Scenes
XmlDocument doc = new XmlDocument();
Dictionary states = new Dictionary();
- // Capture script state while holding the lock
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- Dictionary pstates = part.Inventory.GetScriptStates();
- foreach (UUID itemid in pstates.Keys)
- {
- states.Add(itemid, pstates[itemid]);
- }
- }
+ Dictionary pstates = parts[i].Inventory.GetScriptStates();
+ foreach (KeyValuePair kvp in pstates)
+ states.Add(kvp.Key, kvp.Value);
}
if (states.Count > 0)
@@ -1005,15 +929,10 @@ namespace OpenSim.Region.Framework.Scenes
AbsolutePosition = detachedpos;
m_rootPart.AttachedAvatar = UUID.Zero;
-
- //Anakin Lohner bug #3839
- lock (m_parts)
- {
- foreach (SceneObjectPart p in m_parts.Values)
- {
- p.AttachedAvatar = UUID.Zero;
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0);
SetAttachmentPoint((byte)0);
@@ -1038,15 +957,10 @@ namespace OpenSim.Region.Framework.Scenes
}
m_rootPart.AttachedAvatar = UUID.Zero;
-
- //Anakin Lohner bug #3839
- lock (m_parts)
- {
- foreach (SceneObjectPart p in m_parts.Values)
- {
- p.AttachedAvatar = UUID.Zero;
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].AttachedAvatar = UUID.Zero;
m_rootPart.SetParentLocalId(0);
//m_rootPart.SetAttachmentPoint((byte)0);
@@ -1069,13 +983,9 @@ namespace OpenSim.Region.Framework.Scenes
public override void UpdateMovement()
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.UpdateMovement();
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].UpdateMovement();
}
public ushort GetTimeDilation()
@@ -1108,8 +1018,7 @@ namespace OpenSim.Region.Framework.Scenes
part.ParentID = 0;
part.LinkNum = 0;
- lock (m_parts)
- m_parts.Add(m_rootPart.UUID, m_rootPart);
+ m_parts.Add(m_rootPart.UUID, m_rootPart);
}
///
@@ -1118,16 +1027,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public void AddPart(SceneObjectPart part)
{
- lock (m_parts)
- {
- part.SetParent(this);
- m_parts.Add(part.UUID, part);
-
- part.LinkNum = m_parts.Count;
-
- if (part.LinkNum == 2 && RootPart != null)
- RootPart.LinkNum = 1;
- }
+ part.SetParent(this);
+ part.LinkNum = m_parts.Add(part.UUID, part);
+ if (part.LinkNum == 2 && RootPart != null)
+ RootPart.LinkNum = 1;
}
///
@@ -1135,28 +1038,20 @@ namespace OpenSim.Region.Framework.Scenes
///
private void UpdateParentIDs()
{
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part.UUID != m_rootPart.UUID)
- {
- part.ParentID = m_rootPart.LocalId;
- }
- }
+ SceneObjectPart part = parts[i];
+ if (part.UUID != m_rootPart.UUID)
+ part.ParentID = m_rootPart.LocalId;
}
}
public void RegenerateFullIDs()
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.UUID = UUID.Random();
-
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].UUID = UUID.Random();
}
// helper provided for parts.
@@ -1189,7 +1084,7 @@ namespace OpenSim.Region.Framework.Scenes
// teravus: AbsolutePosition is NOT a normal property!
// the code in the getter of AbsolutePosition is significantly different then the code in the setter!
-
+ // jhurliman: Then why is it a property instead of two methods?
}
public UUID GetPartsFullID(uint localID)
@@ -1237,19 +1132,15 @@ namespace OpenSim.Region.Framework.Scenes
/// If true then deletion is not broadcast to clients
public void DeleteGroupFromScene(bool silent)
{
- List parts;
-
- lock (m_parts)
- parts = m_parts.Values.ToList();
-
- foreach (SceneObjectPart part in parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart part = parts[i];
+
Scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
if (avatar.ParentID == LocalId)
- {
avatar.StandUp();
- }
if (!silent)
{
@@ -1283,16 +1174,15 @@ namespace OpenSim.Region.Framework.Scenes
scriptEvents aggregateScriptEvents = 0;
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part == null)
- continue;
- if (part != RootPart)
- part.Flags = objectflagupdate;
- aggregateScriptEvents |= part.AggregateScriptEvents;
- }
+ SceneObjectPart part = parts[i];
+ if (part == null)
+ continue;
+ if (part != RootPart)
+ part.Flags = objectflagupdate;
+ aggregateScriptEvents |= part.AggregateScriptEvents;
}
m_scriptListens_atTarget = ((aggregateScriptEvents & scriptEvents.at_target) != 0);
@@ -1335,26 +1225,22 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ApplyPhysics(bool m_physicalPrim)
{
- lock (m_parts)
+ // Apply physics to the root prim
+ m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
+
+ // Apply physics to child prims
+ SceneObjectPart[] parts = m_parts.GetArray();
+ if (parts.Length > 1)
{
- if (m_parts.Count > 1)
- {
- m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part.LocalId != m_rootPart.LocalId)
- {
- part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim);
- }
- }
-
- // Hack to get the physics scene geometries in the right spot
- ResetChildPrimPhysicsPositions();
- }
- else
+ for (int i = 0; i < parts.Length; i++)
{
- m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive, m_physicalPrim);
+ SceneObjectPart part = parts[i];
+ if (part.LocalId != m_rootPart.LocalId)
+ part.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), part.VolumeDetectActive, m_physicalPrim);
}
+
+ // Hack to get the physics scene geometries in the right spot
+ ResetChildPrimPhysicsPositions();
}
}
@@ -1365,13 +1251,9 @@ namespace OpenSim.Region.Framework.Scenes
public void ForEachPart(Action whatToDo)
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- whatToDo(part);
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ whatToDo(parts[i]);
}
#region Events
@@ -1476,14 +1358,12 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.SendFullUpdate(
remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, RootPart.UUID));
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part != RootPart)
- part.SendFullUpdate(
- remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID));
- }
+ SceneObjectPart part = parts[i];
+ if (part != RootPart)
+ part.SendFullUpdate(remoteClient, m_scene.Permissions.GenerateClientFlags(remoteClient.AgentId, part.UUID));
}
}
@@ -1498,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
dupe.m_isBackedUp = false;
- dupe.m_parts = new Dictionary();
+ dupe.m_parts.Clear();
// Warning, The following code related to previousAttachmentStatus is needed so that clones of
// attachments do not bordercross while they're being duplicated. This is hacktastic!
@@ -1527,12 +1407,7 @@ namespace OpenSim.Region.Framework.Scenes
if (userExposed)
dupe.m_rootPart.TrimPermissions();
- List partList;
-
- lock (m_parts)
- {
- partList = new List(m_parts.Values);
- }
+ List partList = new List(m_parts.GetArray());
partList.Sort(delegate(SceneObjectPart p1, SceneObjectPart p2)
{
@@ -1837,17 +1712,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public SceneObjectPart CopyPart(SceneObjectPart part, UUID cAgentID, UUID cGroupID, bool userExposed)
{
- SceneObjectPart newPart = null;
-
- lock (m_parts)
- {
- newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
- newPart.SetParent(this);
- m_parts.Add(newPart.UUID, newPart);
- }
+ SceneObjectPart newPart = part.Copy(m_scene.AllocateLocalId(), OwnerID, GroupID, m_parts.Count, userExposed);
+ AddPart(newPart);
SetPartAsNonRoot(newPart);
-
return newPart;
}
@@ -1859,9 +1727,9 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ResetIDs()
{
- lock (m_parts)
+ lock (m_parts.SyncRoot)
{
- List partsList = new List(m_parts.Values);
+ List partsList = new List(m_parts.GetArray());
m_parts.Clear();
foreach (SceneObjectPart part in partsList)
{
@@ -1877,7 +1745,6 @@ namespace OpenSim.Region.Framework.Scenes
///
public void ServiceObjectPropertiesFamilyRequest(IClientAPI remoteClient, UUID AgentID, uint RequestFlags)
{
-
remoteClient.SendObjectPropertiesFamilyData(RequestFlags, RootPart.UUID, RootPart.OwnerID, RootPart.GroupID, RootPart.BaseMask,
RootPart.OwnerMask, RootPart.GroupMask, RootPart.EveryoneMask, RootPart.NextOwnerMask,
RootPart.OwnershipCost, RootPart.ObjectSaleType, RootPart.SalePrice, RootPart.Category,
@@ -1922,12 +1789,10 @@ namespace OpenSim.Region.Framework.Scenes
lastPhysGroupRot = GroupRotation;
}
- List partList = null;
- lock (m_parts)
- partList = new List(m_parts.Values);
-
- foreach (SceneObjectPart part in partList)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart part = parts[i];
if (!IsSelected)
part.UpdateLookAt();
part.SendScheduledUpdates();
@@ -1940,27 +1805,22 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.AddFullUpdateToAvatar(presence);
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part != RootPart)
- part.AddFullUpdateToAvatar(presence);
- }
+ SceneObjectPart part = parts[i];
+ if (part != RootPart)
+ part.AddFullUpdateToAvatar(presence);
}
}
public void ScheduleTerseUpdateToAvatar(ScenePresence presence)
{
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1} just to avatar {2}", Name, UUID, presence.Name);
-
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.AddTerseUpdateToAvatar(presence);
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].AddTerseUpdateToAvatar(presence);
}
///
@@ -1974,13 +1834,12 @@ namespace OpenSim.Region.Framework.Scenes
checkAtTargets();
RootPart.ScheduleFullUpdate();
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part != RootPart)
- part.ScheduleFullUpdate();
- }
+ SceneObjectPart part = parts[i];
+ if (part != RootPart)
+ part.ScheduleFullUpdate();
}
}
@@ -1990,14 +1849,10 @@ namespace OpenSim.Region.Framework.Scenes
public void ScheduleGroupForTerseUpdate()
{
// m_log.DebugFormat("[SOG]: Scheduling terse update for {0} {1}", Name, UUID);
-
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.ScheduleTerseUpdate();
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].ScheduleTerseUpdate();
}
///
@@ -2012,13 +1867,12 @@ namespace OpenSim.Region.Framework.Scenes
RootPart.SendFullUpdateToAllClients();
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part != RootPart)
- part.SendFullUpdateToAllClients();
- }
+ SceneObjectPart part = parts[i];
+ if (part != RootPart)
+ part.SendFullUpdateToAllClients();
}
}
@@ -2051,14 +1905,10 @@ namespace OpenSim.Region.Framework.Scenes
{
if (IsDeleted)
return;
-
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.SendTerseUpdateToAllClients();
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].SendTerseUpdateToAllClients();
}
#endregion
@@ -2072,15 +1922,11 @@ namespace OpenSim.Region.Framework.Scenes
/// null if no child part with that linknum or child part
public SceneObjectPart GetLinkNumPart(int linknum)
{
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part.LinkNum == linknum)
- {
- return part;
- }
- }
+ if (parts[i].LinkNum == linknum)
+ return parts[i];
}
return null;
@@ -2094,8 +1940,7 @@ namespace OpenSim.Region.Framework.Scenes
public SceneObjectPart GetChildPart(UUID primID)
{
SceneObjectPart childPart;
- lock (m_parts)
- m_parts.TryGetValue(primID, out childPart);
+ m_parts.TryGetValue(primID, out childPart);
return childPart;
}
@@ -2106,17 +1951,11 @@ namespace OpenSim.Region.Framework.Scenes
/// null if a child part with the local ID was not found
public SceneObjectPart GetChildPart(uint localID)
{
- //m_log.DebugFormat("Entered looking for {0}", localID);
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- //m_log.DebugFormat("Found {0}", part.LocalId);
- if (part.LocalId == localID)
- {
- return part;
- }
- }
+ if (parts[i].LocalId == localID)
+ return parts[i];
}
return null;
@@ -2130,13 +1969,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool HasChildPrim(UUID primID)
{
- lock (m_parts)
- {
- if (m_parts.ContainsKey(primID))
- return true;
- }
-
- return false;
+ return m_parts.ContainsKey(primID);
}
///
@@ -2147,17 +1980,11 @@ namespace OpenSim.Region.Framework.Scenes
///
public bool HasChildPrim(uint localID)
{
- //m_log.DebugFormat("Entered HasChildPrim looking for {0}", localID);
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- //m_log.DebugFormat("Found {0}", part.LocalId);
- if (part.LocalId == localID)
- {
- return true;
- }
- }
+ if (parts[i].LocalId == localID)
+ return true;
}
return false;
@@ -2208,19 +2035,21 @@ namespace OpenSim.Region.Framework.Scenes
if (m_rootPart.LinkNum == 0)
m_rootPart.LinkNum = 1;
- lock (m_parts)
+ lock (m_parts.SyncRoot)
{
m_parts.Add(linkPart.UUID, linkPart);
// Insert in terms of link numbers, the new links
// before the current ones (with the exception of
// the root prim. Shuffle the old ones up
- foreach (KeyValuePair kvp in m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- if (kvp.Value.LinkNum != 1)
+ SceneObjectPart part = parts[i];
+ if (part.LinkNum != 1)
{
// Don't update root prim link number
- kvp.Value.LinkNum += objectGroup.PrimCount;
+ part.LinkNum += objectGroup.PrimCount;
}
}
@@ -2232,29 +2061,26 @@ namespace OpenSim.Region.Framework.Scenes
//if (linkPart.PhysActor != null)
//{
// m_scene.PhysicsScene.RemovePrim(linkPart.PhysActor);
-
+
//linkPart.PhysActor = null;
//}
//TODO: rest of parts
int linkNum = 3;
- foreach (SceneObjectPart part in objectGroup.Children.Values)
+ SceneObjectPart[] ogParts = objectGroup.Parts;
+ for (int i = 0; i < ogParts.Length; i++)
{
+ SceneObjectPart part = ogParts[i];
if (part.UUID != objectGroup.m_rootPart.UUID)
- {
LinkNonRootPart(part, oldGroupPosition, oldRootRotation, linkNum++);
- }
part.ClearUndoState();
}
}
m_scene.UnlinkSceneObject(objectGroup, true);
objectGroup.m_isDeleted = true;
-
- lock (objectGroup.m_parts)
- {
- objectGroup.m_parts.Clear();
- }
+
+ objectGroup.m_parts.Clear();
// Can't do this yet since backup still makes use of the root part without any synchronization
// objectGroup.m_rootPart = null;
@@ -2324,20 +2150,24 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion worldRot = linkPart.GetWorldRotation();
// Remove the part from this object
- lock (m_parts)
+ lock (m_parts.SyncRoot)
{
m_parts.Remove(linkPart.UUID);
-
- if (m_parts.Count == 1 && RootPart != null) //Single prim is left
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+
+ if (parts.Length == 1 && RootPart != null)
{
+ // Single prim left
RootPart.LinkNum = 0;
}
else
{
- foreach (SceneObjectPart p in m_parts.Values)
+ for (int i = 0; i < parts.Length; i++)
{
- if (p.LinkNum > linkPart.LinkNum)
- p.LinkNum--;
+ SceneObjectPart part = parts[i];
+ if (part.LinkNum > linkPart.LinkNum)
+ part.LinkNum--;
}
}
}
@@ -2409,7 +2239,6 @@ namespace OpenSim.Region.Framework.Scenes
part.SetParent(this);
part.ParentID = m_rootPart.LocalId;
- // Caller locks m_parts for us
m_parts.Add(part.UUID, part);
part.LinkNum = linkNum;
@@ -2662,24 +2491,21 @@ namespace OpenSim.Region.Framework.Scenes
if (selectionPart != null)
{
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
+ SceneObjectPart part = parts[i];
+ if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
+ part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
+ part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
{
- if (part.Scale.X > m_scene.RegionInfo.PhysPrimMax ||
- part.Scale.Y > m_scene.RegionInfo.PhysPrimMax ||
- part.Scale.Z > m_scene.RegionInfo.PhysPrimMax)
- {
- UsePhysics = false; // Reset physics
- break;
- }
- }
-
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
+ UsePhysics = false; // Reset physics
+ break;
}
}
+
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].UpdatePrimFlags(UsePhysics, IsTemporary, IsPhantom, IsVolumeDetect);
}
}
@@ -2693,18 +2519,6 @@ namespace OpenSim.Region.Framework.Scenes
}
///
- /// Get the parts of this scene object
- ///
- ///
- public SceneObjectPart[] GetParts()
- {
- int numParts = Children.Count;
- SceneObjectPart[] partArray = new SceneObjectPart[numParts];
- Children.Values.CopyTo(partArray, 0);
- return partArray;
- }
-
- ///
/// Update the texture entry for this part
///
///
@@ -2721,12 +2535,9 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdatePermissions(UUID AgentID, byte field, uint localID,
uint mask, byte addRemTF)
{
- List partList = null;
- lock (m_parts)
- partList = new List(m_parts.Values);
-
- foreach (SceneObjectPart part in partList)
- part.UpdatePermissions(AgentID, field, localID, mask, addRemTF);
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].UpdatePermissions(AgentID, field, localID, mask, addRemTF);
HasGroupChanged = true;
}
@@ -2829,77 +2640,77 @@ namespace OpenSim.Region.Framework.Scenes
float y = (scale.Y / part.Scale.Y);
float z = (scale.Z / part.Scale.Z);
- lock (m_parts)
+ SceneObjectPart[] parts;
+ if (x > 1.0f || y > 1.0f || z > 1.0f)
{
- if (x > 1.0f || y > 1.0f || z > 1.0f)
+ parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart obPart in m_parts.Values)
+ SceneObjectPart obPart = parts[i];
+ if (obPart.UUID != m_rootPart.UUID)
{
- if (obPart.UUID != m_rootPart.UUID)
- {
- obPart.IgnoreUndoUpdate = true;
- Vector3 oldSize = new Vector3(obPart.Scale);
+ obPart.IgnoreUndoUpdate = true;
+ Vector3 oldSize = new Vector3(obPart.Scale);
- float f = 1.0f;
- float a = 1.0f;
+ float f = 1.0f;
+ float a = 1.0f;
- if (part.PhysActor != null && part.PhysActor.IsPhysical)
+ if (part.PhysActor != null && part.PhysActor.IsPhysical)
+ {
+ if (oldSize.X * x > m_scene.m_maxPhys)
+ {
+ f = m_scene.m_maxPhys / oldSize.X;
+ a = f / x;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
+ if (oldSize.Y * y > m_scene.m_maxPhys)
+ {
+ f = m_scene.m_maxPhys / oldSize.Y;
+ a = f / y;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
+ if (oldSize.Z * z > m_scene.m_maxPhys)
+ {
+ f = m_scene.m_maxPhys / oldSize.Z;
+ a = f / z;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
+ }
+ else
+ {
+ if (oldSize.X * x > m_scene.m_maxNonphys)
+ {
+ f = m_scene.m_maxNonphys / oldSize.X;
+ a = f / x;
+ x *= a;
+ y *= a;
+ z *= a;
+ }
+ if (oldSize.Y * y > m_scene.m_maxNonphys)
{
- if (oldSize.X*x > m_scene.m_maxPhys)
- {
- f = m_scene.m_maxPhys / oldSize.X;
- a = f / x;
- x *= a;
- y *= a;
- z *= a;
- }
- if (oldSize.Y*y > m_scene.m_maxPhys)
- {
- f = m_scene.m_maxPhys / oldSize.Y;
- a = f / y;
- x *= a;
- y *= a;
- z *= a;
- }
- if (oldSize.Z*z > m_scene.m_maxPhys)
- {
- f = m_scene.m_maxPhys / oldSize.Z;
- a = f / z;
- x *= a;
- y *= a;
- z *= a;
- }
+ f = m_scene.m_maxNonphys / oldSize.Y;
+ a = f / y;
+ x *= a;
+ y *= a;
+ z *= a;
}
- else
+ if (oldSize.Z * z > m_scene.m_maxNonphys)
{
- if (oldSize.X*x > m_scene.m_maxNonphys)
- {
- f = m_scene.m_maxNonphys / oldSize.X;
- a = f / x;
- x *= a;
- y *= a;
- z *= a;
- }
- if (oldSize.Y*y > m_scene.m_maxNonphys)
- {
- f = m_scene.m_maxNonphys / oldSize.Y;
- a = f / y;
- x *= a;
- y *= a;
- z *= a;
- }
- if (oldSize.Z*z > m_scene.m_maxNonphys)
- {
- f = m_scene.m_maxNonphys / oldSize.Z;
- a = f / z;
- x *= a;
- y *= a;
- z *= a;
- }
+ f = m_scene.m_maxNonphys / oldSize.Z;
+ a = f / z;
+ x *= a;
+ y *= a;
+ z *= a;
}
- obPart.IgnoreUndoUpdate = false;
- obPart.StoreUndoState();
}
+ obPart.IgnoreUndoUpdate = false;
+ obPart.StoreUndoState();
}
}
}
@@ -2910,27 +2721,26 @@ namespace OpenSim.Region.Framework.Scenes
prevScale.Z *= z;
part.Resize(prevScale);
- lock (m_parts)
+ parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart obPart in m_parts.Values)
+ SceneObjectPart obPart = parts[i];
+ obPart.IgnoreUndoUpdate = true;
+ if (obPart.UUID != m_rootPart.UUID)
{
- obPart.IgnoreUndoUpdate = true;
- if (obPart.UUID != m_rootPart.UUID)
- {
- Vector3 currentpos = new Vector3(obPart.OffsetPosition);
- currentpos.X *= x;
- currentpos.Y *= y;
- currentpos.Z *= z;
- Vector3 newSize = new Vector3(obPart.Scale);
- newSize.X *= x;
- newSize.Y *= y;
- newSize.Z *= z;
- obPart.Resize(newSize);
- obPart.UpdateOffSet(currentpos);
- }
- obPart.IgnoreUndoUpdate = false;
- obPart.StoreUndoState();
+ Vector3 currentpos = new Vector3(obPart.OffsetPosition);
+ currentpos.X *= x;
+ currentpos.Y *= y;
+ currentpos.Z *= z;
+ Vector3 newSize = new Vector3(obPart.Scale);
+ newSize.X *= x;
+ newSize.Y *= y;
+ newSize.Z *= z;
+ obPart.Resize(newSize);
+ obPart.UpdateOffSet(currentpos);
}
+ obPart.IgnoreUndoUpdate = false;
+ obPart.StoreUndoState();
}
if (part.PhysActor != null)
@@ -2956,10 +2766,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public void UpdateGroupPosition(Vector3 pos)
{
- foreach (SceneObjectPart part in Children.Values)
- {
- part.StoreUndoState();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
if (m_scene.EventManager.TriggerGroupMove(UUID, pos))
{
if (IsAttachment)
@@ -2994,10 +2804,11 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateSinglePosition(Vector3 pos, uint localID)
{
SceneObjectPart part = GetChildPart(localID);
- foreach (SceneObjectPart parts in Children.Values)
- {
- parts.StoreUndoState();
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
if (part != null)
{
if (part.UUID == m_rootPart.UUID)
@@ -3019,10 +2830,10 @@ namespace OpenSim.Region.Framework.Scenes
///
private void UpdateRootPosition(Vector3 pos)
{
- foreach (SceneObjectPart part in Children.Values)
- {
- part.StoreUndoState();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
Vector3 newPos = new Vector3(pos.X, pos.Y, pos.Z);
Vector3 oldPos =
new Vector3(AbsolutePosition.X + m_rootPart.OffsetPosition.X,
@@ -3034,15 +2845,12 @@ namespace OpenSim.Region.Framework.Scenes
axDiff *= Quaternion.Inverse(partRotation);
diff = axDiff;
- lock (m_parts)
+ parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart obPart in m_parts.Values)
- {
- if (obPart.UUID != m_rootPart.UUID)
- {
- obPart.OffsetPosition = obPart.OffsetPosition + diff;
- }
- }
+ SceneObjectPart obPart = parts[i];
+ if (obPart.UUID != m_rootPart.UUID)
+ obPart.OffsetPosition = obPart.OffsetPosition + diff;
}
AbsolutePosition = newPos;
@@ -3066,10 +2874,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public void UpdateGroupRotationR(Quaternion rot)
{
- foreach (SceneObjectPart parts in Children.Values)
- {
- parts.StoreUndoState();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
m_rootPart.UpdateRotation(rot);
PhysicsActor actor = m_rootPart.PhysActor;
@@ -3090,10 +2898,10 @@ namespace OpenSim.Region.Framework.Scenes
///
public void UpdateGroupRotationPR(Vector3 pos, Quaternion rot)
{
- foreach (SceneObjectPart parts in Children.Values)
- {
- parts.StoreUndoState();
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
m_rootPart.UpdateRotation(rot);
PhysicsActor actor = m_rootPart.PhysActor;
@@ -3117,10 +2925,11 @@ namespace OpenSim.Region.Framework.Scenes
public void UpdateSingleRotation(Quaternion rot, uint localID)
{
SceneObjectPart part = GetChildPart(localID);
- foreach (SceneObjectPart parts in Children.Values)
- {
- parts.StoreUndoState();
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].StoreUndoState();
+
if (part != null)
{
if (part.UUID == m_rootPart.UUID)
@@ -3177,33 +2986,35 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.AddPhysicsActorTaint(m_rootPart.PhysActor);
}
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart prim in m_parts.Values)
+ SceneObjectPart prim = parts[i];
+ if (prim.UUID != m_rootPart.UUID)
{
- if (prim.UUID != m_rootPart.UUID)
- {
- prim.IgnoreUndoUpdate = true;
- Vector3 axPos = prim.OffsetPosition;
- axPos *= oldParentRot;
- axPos *= Quaternion.Inverse(axRot);
- prim.OffsetPosition = axPos;
- Quaternion primsRot = prim.RotationOffset;
- Quaternion newRot = primsRot * oldParentRot;
- newRot *= Quaternion.Inverse(axRot);
- prim.RotationOffset = newRot;
- prim.ScheduleTerseUpdate();
- }
+ prim.IgnoreUndoUpdate = true;
+ Vector3 axPos = prim.OffsetPosition;
+ axPos *= oldParentRot;
+ axPos *= Quaternion.Inverse(axRot);
+ prim.OffsetPosition = axPos;
+ Quaternion primsRot = prim.RotationOffset;
+ Quaternion newRot = primsRot * oldParentRot;
+ newRot *= Quaternion.Inverse(axRot);
+ prim.RotationOffset = newRot;
+ prim.ScheduleTerseUpdate();
}
}
- foreach (SceneObjectPart childpart in Children.Values)
+
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart childpart = parts[i];
if (childpart != m_rootPart)
{
childpart.IgnoreUndoUpdate = false;
childpart.StoreUndoState();
}
}
+
m_rootPart.ScheduleTerseUpdate();
}
@@ -3324,17 +3135,10 @@ namespace OpenSim.Region.Framework.Scenes
if (atTargets.Count > 0)
{
- uint[] localids = new uint[0];
- lock (m_parts)
- {
- localids = new uint[m_parts.Count];
- int cntr = 0;
- foreach (SceneObjectPart part in m_parts.Values)
- {
- localids[cntr] = part.LocalId;
- cntr++;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ uint[] localids = new uint[parts.Length];
+ for (int i = 0; i < parts.Length; i++)
+ localids[i] = parts[i].LocalId;
for (int ctr = 0; ctr < localids.Length; ctr++)
{
@@ -3352,17 +3156,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scriptListens_notAtTarget && !at_target)
{
//trigger not_at_target
- uint[] localids = new uint[0];
- lock (m_parts)
- {
- localids = new uint[m_parts.Count];
- int cntr = 0;
- foreach (SceneObjectPart part in m_parts.Values)
- {
- localids[cntr] = part.LocalId;
- cntr++;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ uint[] localids = new uint[parts.Length];
+ for (int i = 0; i < parts.Length; i++)
+ localids[i] = parts[i].LocalId;
for (int ctr = 0; ctr < localids.Length; ctr++)
{
@@ -3403,17 +3200,10 @@ namespace OpenSim.Region.Framework.Scenes
if (atRotTargets.Count > 0)
{
- uint[] localids = new uint[0];
- lock (m_parts)
- {
- localids = new uint[m_parts.Count];
- int cntr = 0;
- foreach (SceneObjectPart part in m_parts.Values)
- {
- localids[cntr] = part.LocalId;
- cntr++;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ uint[] localids = new uint[parts.Length];
+ for (int i = 0; i < parts.Length; i++)
+ localids[i] = parts[i].LocalId;
for (int ctr = 0; ctr < localids.Length; ctr++)
{
@@ -3431,17 +3221,10 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scriptListens_notAtRotTarget && !at_Rottarget)
{
//trigger not_at_target
- uint[] localids = new uint[0];
- lock (m_parts)
- {
- localids = new uint[m_parts.Count];
- int cntr = 0;
- foreach (SceneObjectPart part in m_parts.Values)
- {
- localids[cntr] = part.LocalId;
- cntr++;
- }
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ uint[] localids = new uint[parts.Length];
+ for (int i = 0; i < parts.Length; i++)
+ localids[i] = parts[i].LocalId;
for (int ctr = 0; ctr < localids.Length; ctr++)
{
@@ -3455,40 +3238,36 @@ namespace OpenSim.Region.Framework.Scenes
public float GetMass()
{
float retmass = 0f;
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- {
- retmass += part.GetMass();
- }
- }
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ retmass += parts[i].GetMass();
+
return retmass;
}
public void CheckSculptAndLoad()
{
- lock (m_parts)
+ if (IsDeleted)
+ return;
+ if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) != 0)
+ return;
+
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- if (!IsDeleted)
+ SceneObjectPart part = parts[i];
+ if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero)
{
- if ((RootPart.GetEffectiveObjectFlags() & (uint)PrimFlags.Phantom) == 0)
+ // check if a previously decoded sculpt map has been cached
+ if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString())))
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- if (part.Shape.SculptEntry && part.Shape.SculptTexture != UUID.Zero)
- {
- // check if a previously decoded sculpt map has been cached
- if (File.Exists(System.IO.Path.Combine("j2kDecodeCache", "smap_" + part.Shape.SculptTexture.ToString())))
- {
- part.SculptTextureCallback(part.Shape.SculptTexture, null);
- }
- else
- {
- m_scene.AssetService.Get(
- part.Shape.SculptTexture.ToString(), part, AssetReceived);
- }
- }
- }
+ part.SculptTextureCallback(part.Shape.SculptTexture, null);
+ }
+ else
+ {
+ m_scene.AssetService.Get(
+ part.Shape.SculptTexture.ToString(), part, AssetReceived);
}
}
}
@@ -3512,15 +3291,12 @@ namespace OpenSim.Region.Framework.Scenes
///
public void SetGroup(UUID GroupID, IClientAPI client)
{
- lock (m_parts)
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in m_parts.Values)
- {
- part.SetGroup(GroupID, client);
- part.Inventory.ChangeInventoryGroup(GroupID);
- }
-
- HasGroupChanged = true;
+ SceneObjectPart part = parts[i];
+ part.SetGroup(GroupID, client);
+ part.Inventory.ChangeInventoryGroup(GroupID);
}
// Don't trigger the update here - otherwise some client issues occur when multiple updates are scheduled
@@ -3530,10 +3306,9 @@ namespace OpenSim.Region.Framework.Scenes
public void TriggerScriptChangedEvent(Changed val)
{
- foreach (SceneObjectPart part in Children.Values)
- {
- part.TriggerScriptChangedEvent(val);
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].TriggerScriptChangedEvent(val);
}
public override string ToString()
@@ -3543,11 +3318,9 @@ namespace OpenSim.Region.Framework.Scenes
public void SetAttachmentPoint(byte point)
{
- lock (m_parts)
- {
- foreach (SceneObjectPart part in m_parts.Values)
- part.SetAttachmentPoint(point);
- }
+ SceneObjectPart[] parts = m_parts.GetArray();
+ for (int i = 0; i < parts.Length; i++)
+ parts[i].SetAttachmentPoint(point);
}
#region ISceneObject
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 53ddb5d..0e3daf76 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -603,10 +603,7 @@ namespace OpenSim.Region.Framework.Scenes
rootPart.Name = item.Name;
rootPart.Description = item.Description;
- List partList = null;
-
- lock (group.Children)
- partList = new List(group.Children.Values);
+ SceneObjectPart[] partList = group.Parts;
group.SetGroup(m_part.GroupID, null);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index a77f38c..a4533fa 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1709,7 +1709,7 @@ namespace OpenSim.Region.Framework.Scenes
// If the primitive the player clicked on has no sit target, and one or more other linked objects have sit targets that are not full, the sit target of the object with the lowest link number will be used.
// Get our own copy of the part array, and sort into the order we want to test
- SceneObjectPart[] partArray = targetPart.ParentGroup.GetParts();
+ SceneObjectPart[] partArray = targetPart.ParentGroup.Parts;
Array.Sort(partArray, delegate(SceneObjectPart p1, SceneObjectPart p2)
{
// we want the originally selected part first, then the rest in link order -- so make the selected part link num (-1)
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 5bdaa17..f5f6b90 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -158,16 +158,15 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
writer.WriteEndElement();
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
- lock (sceneObject.Children)
+ SceneObjectPart[] parts = sceneObject.Parts;
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in sceneObject.Children.Values)
+ SceneObjectPart part = parts[i];
+ if (part.UUID != sceneObject.RootPart.UUID)
{
- if (part.UUID != sceneObject.RootPart.UUID)
- {
- writer.WriteStartElement(String.Empty, "Part", String.Empty);
- ToOriginalXmlFormat(part, writer);
- writer.WriteEndElement();
- }
+ writer.WriteStartElement(String.Empty, "Part", String.Empty);
+ ToOriginalXmlFormat(part, writer);
+ writer.WriteEndElement();
}
}
@@ -281,15 +280,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
sceneObject.RootPart.ToXml(writer);
writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);
- lock (sceneObject.Children)
+ SceneObjectPart[] parts = sceneObject.Parts;
+ for (int i = 0; i < parts.Length; i++)
{
- foreach (SceneObjectPart part in sceneObject.Children.Values)
- {
- if (part.UUID != sceneObject.RootPart.UUID)
- {
- part.ToXml(writer);
- }
- }
+ SceneObjectPart part = parts[i];
+ if (part.UUID != sceneObject.RootPart.UUID)
+ part.ToXml(writer);
}
writer.WriteEndElement(); // End of OtherParts
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
index 7d9a6a9..9244bc3 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneGraphTests.cs
@@ -68,7 +68,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup dupeSo
= scene.SceneGraph.DuplicateObject(
part1.LocalId, new Vector3(10, 0, 0), 0, ownerId, UUID.Zero, Quaternion.Identity);
- Assert.That(dupeSo.Children.Count, Is.EqualTo(2));
+ Assert.That(dupeSo.Parts.Length, Is.EqualTo(2));
SceneObjectPart dupePart1 = dupeSo.GetLinkNumPart(1);
SceneObjectPart dupePart2 = dupeSo.GetLinkNumPart(2);
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
index 60824be..f57cf98 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs
@@ -81,12 +81,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// FIXME: Can't do this test yet since group 2 still has its root part! We can't yet null this since
// it might cause SOG.ProcessBackup() to fail due to the race condition. This really needs to be fixed.
Assert.That(grp2.IsDeleted, "SOG 2 was not registered as deleted after link.");
- Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained children after delink.");
- Assert.That(grp1.Children.Count == 2);
+ Assert.That(grp2.Parts.Length, Is.EqualTo(0), "Group 2 still contained children after delink.");
+ Assert.That(grp1.Parts.Length == 2);
if (debugtest)
{
- m_log.Debug("parts: " + grp1.Children.Count);
+ m_log.Debug("parts: " + grp1.Parts.Length);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation);
m_log.Debug("Group1: Prim1: OffsetPosition:"+ part1.OffsetPosition+", OffsetRotation:"+part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+part2.RotationOffset);
@@ -126,7 +126,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
if (debugtest)
m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
- Assert.That(grp1.Children.Count, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
+ Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
}
@@ -177,22 +177,22 @@ namespace OpenSim.Region.Framework.Scenes.Tests
grp3.LinkToGroup(grp4);
// At this point we should have 4 parts total in two groups.
- Assert.That(grp1.Children.Count == 2, "Group1 children count should be 2");
+ Assert.That(grp1.Parts.Length == 2, "Group1 children count should be 2");
Assert.That(grp2.IsDeleted, "Group 2 was not registered as deleted after link.");
- Assert.That(grp2.Children.Count, Is.EqualTo(0), "Group 2 still contained parts after delink.");
- Assert.That(grp3.Children.Count == 2, "Group3 children count should be 2");
+ Assert.That(grp2.Parts.Length, Is.EqualTo(0), "Group 2 still contained parts after delink.");
+ Assert.That(grp3.Parts.Length == 2, "Group3 children count should be 2");
Assert.That(grp4.IsDeleted, "Group 4 was not registered as deleted after link.");
- Assert.That(grp4.Children.Count, Is.EqualTo(0), "Group 4 still contained parts after delink.");
+ Assert.That(grp4.Parts.Length, Is.EqualTo(0), "Group 4 still contained parts after delink.");
if (debugtest)
{
m_log.Debug("--------After Link-------");
- m_log.Debug("Group1: parts:" + grp1.Children.Count);
+ m_log.Debug("Group1: parts:" + grp1.Parts.Length);
m_log.Debug("Group1: Pos:"+grp1.AbsolutePosition+", Rot:"+grp1.Rotation);
m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:"+part2.OffsetPosition+", OffsetRotation:"+ part2.RotationOffset);
-
- m_log.Debug("Group3: parts:"+grp3.Children.Count);
+
+ m_log.Debug("Group3: parts:" + grp3.Parts.Length);
m_log.Debug("Group3: Pos:"+grp3.AbsolutePosition+", Rot:"+grp3.Rotation);
m_log.Debug("Group3: Prim1: OffsetPosition:"+part3.OffsetPosition+", OffsetRotation:"+part3.RotationOffset);
m_log.Debug("Group3: Prim2: OffsetPosition:"+part4.OffsetPosition+", OffsetRotation:"+part4.RotationOffset);
@@ -240,12 +240,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
if (debugtest)
{
m_log.Debug("--------After De-Link-------");
- m_log.Debug("Group1: parts:" + grp1.Children.Count);
+ m_log.Debug("Group1: parts:" + grp1.Parts.Length);
m_log.Debug("Group1: Pos:" + grp1.AbsolutePosition + ", Rot:" + grp1.Rotation);
m_log.Debug("Group1: Prim1: OffsetPosition:" + part1.OffsetPosition + ", OffsetRotation:" + part1.RotationOffset);
m_log.Debug("Group1: Prim2: OffsetPosition:" + part2.OffsetPosition + ", OffsetRotation:" + part2.RotationOffset);
- m_log.Debug("Group3: parts:" + grp3.Children.Count);
+ m_log.Debug("Group3: parts:" + grp3.Parts.Length);
m_log.Debug("Group3: Pos:" + grp3.AbsolutePosition + ", Rot:" + grp3.Rotation);
m_log.Debug("Group3: Prim1: OffsetPosition:" + part3.OffsetPosition + ", OffsetRotation:" + part3.RotationOffset);
m_log.Debug("Group3: Prim2: OffsetPosition:" + part4.OffsetPosition + ", OffsetRotation:" + part4.RotationOffset);
@@ -295,9 +295,9 @@ namespace OpenSim.Region.Framework.Scenes.Tests
List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
- Assert.That(storedObjects[0].Children.Count, Is.EqualTo(2));
- Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
- Assert.That(storedObjects[0].Children.ContainsKey(linkPartUuid));
+ Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(2));
+ Assert.That(storedObjects[0].ContainsPart(rootPartUuid));
+ Assert.That(storedObjects[0].ContainsPart(linkPartUuid));
}
///
@@ -338,8 +338,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
List storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);
Assert.That(storedObjects.Count, Is.EqualTo(1));
- Assert.That(storedObjects[0].Children.Count, Is.EqualTo(1));
- Assert.That(storedObjects[0].Children.ContainsKey(rootPartUuid));
+ Assert.That(storedObjects[0].Parts.Length, Is.EqualTo(1));
+ Assert.That(storedObjects[0].ContainsPart(rootPartUuid));
}
}
}
diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
index e3965ce..65baa52 100644
--- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
+++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs
@@ -121,8 +121,11 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat(
// "[ASSET GATHERER]: Getting assets for object {0}, {1}", sceneObject.Name, sceneObject.UUID);
- foreach (SceneObjectPart part in sceneObject.GetParts())
+ SceneObjectPart[] parts = sceneObject.Parts;
+ for (int i = 0; i < parts.Length; i++)
{
+ SceneObjectPart part = parts[i];
+
// m_log.DebugFormat(
// "[ARCHIVER]: Getting part {0}, {1} for object {2}", part.Name, part.UUID, sceneObject.UUID);
--
cgit v1.1
From b49cb3355f3e5d2f3fa131ed3a5b0020cce503e2 Mon Sep 17 00:00:00 2001
From: John Hurliman
Date: Thu, 16 Sep 2010 17:57:00 -0700
Subject: Fixed a regression in SOG.Copy()
---
OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c984afc..994b9e3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1378,7 +1378,7 @@ namespace OpenSim.Region.Framework.Scenes
{
SceneObjectGroup dupe = (SceneObjectGroup)MemberwiseClone();
dupe.m_isBackedUp = false;
- dupe.m_parts.Clear();
+ dupe.m_parts = new MapAndArray();
// Warning, The following code related to previousAttachmentStatus is needed so that clones of
// attachments do not bordercross while they're being duplicated. This is hacktastic!
--
cgit v1.1