Merge branch 'master' into careminster-presence-refactor

Integrate the next large patch.
Don't use this version, it has a ghost avatar issue. Next push
will fix it.
avinationmerge
Melanie 2010-09-17 03:49:30 +01:00
commit 7df4383235
36 changed files with 1052 additions and 1293 deletions

View File

@ -241,7 +241,7 @@ namespace OpenSim.Data.MSSQL
/// <param name="regionUUID"></param>
public void StoreObject(SceneObjectGroup obj, UUID regionUUID)
{
_Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Children.Count);
_Log.DebugFormat("[MSSQL]: Adding/Changing SceneObjectGroup: {0} to region: {1}, object has {2} prims.", obj.UUID, regionUUID, obj.Parts.Length);
using (SqlConnection conn = new SqlConnection(m_connectionString))
{
@ -250,7 +250,7 @@ namespace OpenSim.Data.MSSQL
try
{
foreach (SceneObjectPart sceneObjectPart in obj.Children.Values)
foreach (SceneObjectPart sceneObjectPart in obj.Parts)
{
//Update prim
using (SqlCommand sqlCommand = conn.CreateCommand())

View File

@ -144,7 +144,7 @@ namespace OpenSim.Data.MySQL
dbcon.Open();
MySqlCommand cmd = dbcon.CreateCommand();
foreach (SceneObjectPart prim in obj.Children.Values)
foreach (SceneObjectPart prim in obj.Parts)
{
cmd.Parameters.Clear();

View File

@ -368,7 +368,7 @@ namespace OpenSim.Data.SQLite
lock (ds)
{
foreach (SceneObjectPart prim in obj.Children.Values)
foreach (SceneObjectPart prim in obj.Parts)
{
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);

View File

@ -335,7 +335,7 @@ namespace OpenSim.Data.SQLiteLegacy
lock (ds)
{
foreach (SceneObjectPart prim in obj.Children.Values)
foreach (SceneObjectPart prim in obj.Parts)
{
// m_log.Info("[REGION DB]: Adding obj: " + obj.UUID + " to region: " + regionUUID);
addPrim(prim, obj.UUID, regionUUID);

View File

@ -232,15 +232,15 @@ namespace OpenSim.Data.Tests
sog.AddPart(p2);
sog.AddPart(p3);
SceneObjectPart[] parts = sog.GetParts();
SceneObjectPart[] parts = sog.Parts;
Assert.That(parts.Length,Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))");
db.StoreObject(sog, newregion);
List<SceneObjectGroup> sogs = db.LoadObjects(newregion);
Assert.That(sogs.Count,Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))");
SceneObjectGroup newsog = sogs[0];
SceneObjectPart[] newparts = newsog.GetParts();
SceneObjectPart[] newparts = newsog.Parts;
Assert.That(newparts.Length,Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))");
Assert.That(newsog.HasChildPrim(tmp0), "Assert.That(newsog.HasChildPrim(tmp0))");
@ -560,7 +560,7 @@ namespace OpenSim.Data.Tests
}
SceneObjectGroup retsog = FindSOG("Test SOG", region4);
SceneObjectPart[] parts = retsog.GetParts();
SceneObjectPart[] parts = retsog.Parts;
for (int i=0;i<30;i++)
{
SceneObjectPart cursop = mydic[parts[i].UUID];
@ -607,7 +607,7 @@ namespace OpenSim.Data.Tests
sog.AddPart(p2);
sog.AddPart(p3);
SceneObjectPart[] parts = sog.GetParts();
SceneObjectPart[] parts = sog.Parts;
Assert.That(parts.Length, Is.EqualTo(4), "Assert.That(parts.Length,Is.EqualTo(4))");
db.StoreObject(sog, newregion);
@ -615,7 +615,7 @@ namespace OpenSim.Data.Tests
Assert.That(sogs.Count, Is.EqualTo(1), "Assert.That(sogs.Count,Is.EqualTo(1))");
SceneObjectGroup newsog = sogs[0];
SceneObjectPart[] newparts = newsog.GetParts();
SceneObjectPart[] newparts = newsog.Parts;
Assert.That(newparts.Length, Is.EqualTo(4), "Assert.That(newparts.Length,Is.EqualTo(4))");
Assert.That(newsog, Constraints.PropertyCompareConstraint(sog)
@ -625,7 +625,7 @@ namespace OpenSim.Data.Tests
.IgnoreProperty(x=>x.RegionHandle)
.IgnoreProperty(x=>x.RegionUUID)
.IgnoreProperty(x=>x.Scene)
.IgnoreProperty(x=>x.Children)
.IgnoreProperty(x=>x.Parts)
.IgnoreProperty(x=>x.PassCollision)
.IgnoreProperty(x=>x.RootPart));
}

View File

@ -0,0 +1,188 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using System.Collections.Generic;
namespace OpenSim.Framework
{
/// <summary>
/// Stores two synchronized collections: a mutable dictionary and an
/// immutable array. Slower inserts/removes than a normal dictionary,
/// but provides safe iteration while maintaining fast hash lookups
/// </summary>
/// <typeparam name="TKey">Key type to use for hash lookups</typeparam>
/// <typeparam name="TValue">Value type to store</typeparam>
public sealed class MapAndArray<TKey, TValue>
{
private Dictionary<TKey, TValue> m_dict;
private TValue[] m_array;
private object m_syncRoot = new object();
/// <summary>Number of values currently stored in the collection</summary>
public int Count { get { return m_array.Length; } }
/// <summary>NOTE: This collection is thread safe. You do not need to
/// acquire a lock to add, remove, or enumerate entries. This
/// synchronization object should only be locked for larger
/// transactions</summary>
public object SyncRoot { get { return m_syncRoot; } }
/// <summary>
/// Constructor
/// </summary>
public MapAndArray()
{
m_dict = new Dictionary<TKey, TValue>();
m_array = new TValue[0];
}
/// <summary>
/// Constructor
/// </summary>
/// <param name="capacity">Initial capacity of the dictionary</param>
public MapAndArray(int capacity)
{
m_dict = new Dictionary<TKey, TValue>(capacity);
m_array = new TValue[0];
}
/// <summary>
/// Adds a key/value pair to the collection, or updates an existing key
/// with a new value
/// </summary>
/// <param name="key">Key to add or update</param>
/// <param name="value">Value to add</param>
/// <returns>True if a new key was added, false if an existing key was
/// updated</returns>
public bool AddOrReplace(TKey key, TValue value)
{
lock (m_syncRoot)
{
bool containedKey = m_dict.ContainsKey(key);
m_dict[key] = value;
CreateArray();
return !containedKey;
}
}
/// <summary>
/// Adds a key/value pair to the collection. This will throw an
/// exception if the key is already present in the collection
/// </summary>
/// <param name="key">Key to add or update</param>
/// <param name="value">Value to add</param>
/// <returns>Index of the inserted item</returns>
public int Add(TKey key, TValue value)
{
lock (m_syncRoot)
{
m_dict.Add(key, value);
CreateArray();
return m_array.Length;
}
}
/// <summary>
/// Removes a key/value pair from the collection
/// </summary>
/// <param name="key">Key to remove</param>
/// <returns>True if the key was found and removed, otherwise false</returns>
public bool Remove(TKey key)
{
lock (m_syncRoot)
{
bool removed = m_dict.Remove(key);
CreateArray();
return removed;
}
}
/// <summary>
/// Determines whether the collections contains a specified key
/// </summary>
/// <param name="key">Key to search for</param>
/// <returns>True if the key was found, otherwise false</returns>
public bool ContainsKey(TKey key)
{
return m_dict.ContainsKey(key);
}
/// <summary>
/// Gets the value associated with the specified key
/// </summary>
/// <param name="key">Key of the value to get</param>
/// <param name="value">Will contain the value associated with the
/// given key if the key is found. If the key is not found it will
/// contain the default value for the type of the value parameter</param>
/// <returns>True if the key was found and a value was retrieved,
/// otherwise false</returns>
public bool TryGetValue(TKey key, out TValue value)
{
lock (m_syncRoot)
return m_dict.TryGetValue(key, out value);
}
/// <summary>
/// Clears all key/value pairs from the collection
/// </summary>
public void Clear()
{
lock (m_syncRoot)
{
m_dict = new Dictionary<TKey, TValue>();
m_array = new TValue[0];
}
}
/// <summary>
/// Gets a reference to the immutable array of values stored in this
/// collection. This array is thread safe for iteration
/// </summary>
/// <returns>A thread safe reference ton an array of all of the stored
/// values</returns>
public TValue[] GetArray()
{
return m_array;
}
private void CreateArray()
{
// Rebuild the array from the dictionary. This method must be
// called from inside a lock
TValue[] array = new TValue[m_dict.Count];
int i = 0;
foreach (TValue value in m_dict.Values)
array[i++] = value;
m_array = array;
}
}
}

View File

@ -1533,7 +1533,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP
lock (m_entityUpdates.SyncRoot)
{
m_killRecord.Add(localID);
OutPacket(kill, ThrottleOutPacketType.State);
// The throttle queue used here must match that being used for updates. Otherwise, there is a
// chance that a kill packet put on a separate queue will be sent to the client before an existing
// update packet on another queue. Receiving updates after kills results in unowned and undeletable
// scene objects in a viewer until that viewer is relogged in.
OutPacket(kill, ThrottleOutPacketType.Task);
}
}
}

View File

@ -420,8 +420,14 @@ namespace OpenSim.Region.ClientStack.LindenUDP
/// <summary>
/// Loops through all of the packet queues for this client and tries to send
/// any outgoing packets, obeying the throttling bucket limits
/// an outgoing packet from each, obeying the throttling bucket limits
/// </summary>
///
/// Packet queues are inspected in ascending numerical order starting from 0. Therefore, queues with a lower
/// ThrottleOutPacketType number will see their packet get sent first (e.g. if both Land and Wind queues have
/// packets, then the packet at the front of the Land queue will be sent before the packet at the front of the
/// wind queue).
///
/// <remarks>This function is only called from a synchronous loop in the
/// UDPServer so we don't need to bother making this thread safe</remarks>
/// <returns>True if any packets were sent, otherwise false</returns>

View File

@ -500,6 +500,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// FIXME: Implement?
}
/// <summary>
/// Actually send a packet to a client.
/// </summary>
/// <param name="outgoingPacket"></param>
internal void SendPacketFinal(OutgoingPacket outgoingPacket)
{
UDPPacketBuffer buffer = outgoingPacket.Buffer;

View File

@ -586,13 +586,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
so.RootPart.AttachedAvatar = avatar.UUID;
//Anakin Lohner bug #3839
lock (so.Children)
{
foreach (SceneObjectPart p in so.Children.Values)
{
p.AttachedAvatar = avatar.UUID;
}
}
SceneObjectPart[] parts = so.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].AttachedAvatar = avatar.UUID;
if (so.RootPart.PhysActor != null)
{

View File

@ -544,7 +544,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (!attachment)
{
group.RootPart.CreateSelected = true;
foreach (SceneObjectPart child in group.Children.Values)
foreach (SceneObjectPart child in group.Parts)
child.CreateSelected = true;
}
@ -629,10 +629,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
rootPart.Name = item.Name;
rootPart.Description = item.Description;
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
group.SetGroup(remoteClient.ActiveGroupId, remoteClient);
if ((rootPart.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
{
@ -642,7 +638,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
if (m_Scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart part in partList)
foreach (SceneObjectPart part in group.Parts)
{
part.EveryoneMask = item.EveryOnePermissions;
part.NextOwnerMask = item.NextPermissions;
@ -656,7 +652,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
{
m_log.Debug("[InventoryAccessModule]: Inventory object has UUID.Zero! Position 8");
}
foreach (SceneObjectPart part in partList)
foreach (SceneObjectPart part in group.Parts)
{
if ((part.OwnerID != item.Owner) || (item.CurrentPermissions & 16) != 0)
{

View File

@ -243,11 +243,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// to the same scene (when this is possible).
sceneObject.ResetIDs();
List<SceneObjectPart> partList = null;
lock (sceneObject.Children)
partList = new List<SceneObjectPart>(sceneObject.Children.Values);
foreach (SceneObjectPart part in partList)
foreach (SceneObjectPart part in sceneObject.Parts)
{
if (!ResolveUserUuid(part.CreatorID))
part.CreatorID = m_scene.RegionInfo.EstateSettings.EstateOwner;

View File

@ -128,14 +128,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.BuySell
group.SetOwnerId(remoteClient.AgentId);
group.SetRootPartOwner(part, remoteClient.AgentId, remoteClient.ActiveGroupId);
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
if (m_scene.Permissions.PropagatePermissions())
{
foreach (SceneObjectPart child in partList)
foreach (SceneObjectPart child in group.Parts)
{
child.Inventory.ChangeInventoryOwner(remoteClient.AgentId);
child.TriggerScriptChangedEvent(Changed.OWNER);

View File

@ -229,11 +229,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
Color mapdotspot = Color.Gray; // Default color when prim color is white
// Loop over prim in group
List<SceneObjectPart> partList = null;
lock (mapdot.Children)
partList = new List<SceneObjectPart>(mapdot.Children.Values);
foreach (SceneObjectPart part in partList)
foreach (SceneObjectPart part in mapdot.Parts)
{
if (part == null)
continue;

View File

@ -2064,9 +2064,7 @@ namespace OpenSim.Region.Framework.Scenes
sog.SetGroup(groupID, remoteClient);
sog.ScheduleGroupForFullUpdate();
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart child in partList)
child.Inventory.ChangeInventoryOwner(ownerID);
@ -2079,9 +2077,7 @@ namespace OpenSim.Region.Framework.Scenes
if (sog.GroupID != groupID)
continue;
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart child in partList)
{

View File

@ -161,11 +161,8 @@ namespace OpenSim.Region.Framework.Scenes
bool foundPrim = false;
SceneObjectGroup sog = ent as SceneObjectGroup;
List<SceneObjectPart> partList = null;
lock (sog.Children)
partList = new List<SceneObjectPart>(sog.Children.Values);
SceneObjectPart[] partList = sog.Parts;
foreach (SceneObjectPart part in partList)
{
if (part.LocalId == primLocalID)

View File

@ -1819,7 +1819,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);
@ -2160,9 +2160,7 @@ namespace OpenSim.Region.Framework.Scenes
group.RemoveScriptInstances(true);
}
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
SceneObjectPart[] partList = group.Parts;
foreach (SceneObjectPart part in partList)
{
@ -2540,11 +2538,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
{

View File

@ -270,7 +270,7 @@ namespace OpenSim.Region.Framework.Scenes
if (npos.X > Constants.RegionSize) npos.X = Constants.RegionSize - 1.0f;
if (npos.Y > Constants.RegionSize) npos.Y = Constants.RegionSize - 1.0f;
foreach (SceneObjectPart part in sceneObject.Children.Values)
foreach (SceneObjectPart part in sceneObject.Parts)
{
part.GroupPosition = npos;
}
@ -370,9 +370,7 @@ namespace OpenSim.Region.Framework.Scenes
if (Entities.ContainsKey(sceneObject.UUID))
return false;
List<SceneObjectPart> children;
lock (sceneObject.Children)
children = new List<SceneObjectPart>(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)
@ -391,7 +389,7 @@ namespace OpenSim.Region.Framework.Scenes
part.Shape.Scale = scale;
}
}
m_numPrim += children.Count;
m_numPrim += children.Length;
sceneObject.AttachToScene(m_parentScene);
@ -448,15 +446,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);
}
@ -943,11 +943,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);
@ -1021,7 +1018,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)
{
@ -1686,14 +1683,8 @@ namespace OpenSim.Region.Framework.Scenes
SceneObjectGroup group = root.ParentGroup;
group.areUpdatesSuspended = true;
List<SceneObjectPart> newSet = null;
int numChildren;
lock (group.Children)
{
newSet = new List<SceneObjectPart>(group.Children.Values);
numChildren = group.PrimCount;
}
List<SceneObjectPart> newSet = new List<SceneObjectPart>(group.Parts);
int numChildren = newSet.Count;
if (numChildren == 1)
break;
@ -1783,16 +1774,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<UUID, SceneObjectPart> subent in sog.Children)
if (part.LocalId == localID)
{
if (subent.Value.LocalId == localID)
{
objid = subent.Key;
obj = subent.Value;
}
objid = part.UUID;
obj = part;
}
}
}
@ -1868,8 +1856,7 @@ namespace OpenSim.Region.Framework.Scenes
copy.SetOwnerId(AgentID);
copy.SetRootPartOwner(copy.RootPart, AgentID, GroupID);
List<SceneObjectPart> partList =
new List<SceneObjectPart>(copy.Children.Values);
SceneObjectPart[] partList = copy.Parts;
if (m_parentScene.Permissions.PropagatePermissions())
{
@ -1891,7 +1878,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)
{

View File

@ -46,13 +46,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void ForceInventoryPersistence()
{
lockPartsForRead(true);
List<SceneObjectPart> values = new List<SceneObjectPart>(m_parts.Values);
lockPartsForRead(false);
foreach (SceneObjectPart part in values)
{
part.Inventory.ForceInventoryPersistence();
}
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].Inventory.ForceInventoryPersistence();
}
/// <summary>
@ -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);
}
}
@ -76,15 +71,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void RemoveScriptInstances(bool sceneObjectBeingDeleted)
{
lockPartsForRead(true);
List<SceneObjectPart> values = new List<SceneObjectPart>(m_parts.Values);
lockPartsForRead(false);
foreach (SceneObjectPart part in values)
{
part.Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
}
SceneObjectPart[] parts = m_parts.GetArray();
for (int i = 0; i < parts.Length; i++)
parts[i].Inventory.RemoveScriptInstances(sceneObjectBeingDeleted);
}
/// <summary>
@ -281,8 +270,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();
}
@ -310,39 +302,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<UUID, string> states = new Dictionary<UUID, string>();
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<UUID, string> 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);
@ -425,10 +418,9 @@ namespace OpenSim.Region.Framework.Scenes
if (m_scene.RegionInfo.RegionSettings.DisableScripts)
return;
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();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -780,10 +780,7 @@ namespace OpenSim.Region.Framework.Scenes
rootPart.Name = item.Name;
rootPart.Description = item.Description;
List<SceneObjectPart> partList = null;
lock (group.Children)
partList = new List<SceneObjectPart>(group.Children.Values);
SceneObjectPart[] partList = group.Parts;
group.SetGroup(m_part.GroupID, null);

View File

@ -1884,7 +1884,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)

View File

@ -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

View File

@ -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);

View File

@ -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<SceneObjectGroup> 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));
}
/// <summary>
@ -338,8 +338,8 @@ namespace OpenSim.Region.Framework.Scenes.Tests
List<SceneObjectGroup> 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));
}
}
}

View File

@ -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);

View File

@ -121,19 +121,16 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
continue;
temp = (SceneObjectGroup) currObj;
lock (temp.Children)
if (m_CMEntityHash.ContainsKey(temp.UUID))
{
if (m_CMEntityHash.ContainsKey(temp.UUID))
{
foreach (SceneObjectPart part in temp.Children.Values)
if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
missingList.Add(part);
}
else //Entire group is missing from revision. (and is a new part in region)
{
foreach (SceneObjectPart part in temp.Children.Values)
foreach (SceneObjectPart part in temp.Parts)
if (!((ContentManagementEntity)m_CMEntityHash[temp.UUID]).HasChildPrim(part.UUID))
missingList.Add(part);
}
}
else //Entire group is missing from revision. (and is a new part in region)
{
foreach (SceneObjectPart part in temp.Parts)
missingList.Add(part);
}
}
return missingList;

View File

@ -167,11 +167,11 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
public void RemoveOrUpdateDeletedEntity(SceneObjectGroup group)
{
// Deal with new parts not revisioned that have been deleted.
lock (group.Children)
SceneObjectPart[] parts = group.Parts;
for (int i = 0; i < parts.Length; i++)
{
foreach (SceneObjectPart part in group.Children.Values)
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(part.UUID);
if (m_MetaEntityCollection.Auras.ContainsKey(parts[i].UUID))
m_MetaEntityCollection.RemoveNewlyCreatedEntityAura(parts[i].UUID);
}
}
@ -210,12 +210,10 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
{
temp = SceneObjectSerializer.FromXml2Format(xml);
temp.SetScene(scene);
lock (temp.Children)
{
foreach (SceneObjectPart part in temp.Children.Values)
part.RegionHandle = scene.RegionInfo.RegionHandle;
}
SceneObjectPart[] parts = temp.Parts;
for (int i = 0; i < parts.Length; i++)
parts[i].RegionHandle = scene.RegionInfo.RegionHandle;
ReplacementList.Add(temp.UUID, (EntityBase)temp);
}
@ -346,17 +344,16 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
System.Collections.ArrayList auraList = new System.Collections.ArrayList();
if (group == null)
return null;
lock (group.Children)
SceneObjectPart[] parts = group.Parts;
for (int i = 0; i < parts.Length; i++)
{
foreach (SceneObjectPart part in group.Children.Values)
SceneObjectPart part = parts[i];
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
{
if (m_MetaEntityCollection.Auras.ContainsKey(part.UUID))
{
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new Vector3(0,254,0), part.Scale);
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
}
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).SetAura(new Vector3(0, 254, 0), part.Scale);
((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]).RootPart.GroupPosition = part.GetWorldPosition();
auraList.Add((AuraMetaEntity)m_MetaEntityCollection.Auras[part.UUID]);
}
}

View File

@ -186,12 +186,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
((ContentManagementEntity)m_model.MetaEntityCollection.Entities[group.UUID]).SendFullDiffUpdateToAll();
// Deal with new parts not revisioned that have been deleted.
lock (group.Children)
{
foreach (SceneObjectPart part in group.Children.Values)
if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
}
foreach (SceneObjectPart part in group.Parts)
if (m_model.MetaEntityCollection.Auras.ContainsKey(part.UUID))
((AuraMetaEntity)m_model.MetaEntityCollection.Auras[part.UUID]).HideFromAll();
}
public void SendMetaEntitiesToNewClient(IClientAPI client)

View File

@ -132,33 +132,30 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
// if group is not contained in scene's list
if (!ContainsKey(sceneEntityList, m_UnchangedEntity.UUID))
{
lock (m_UnchangedEntity.Children)
foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
{
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
// if scene list no longer contains this part, display translucent part and mark with red aura
if (!ContainsKey(sceneEntityList, part.UUID))
{
// if scene list no longer contains this part, display translucent part and mark with red aura
if (!ContainsKey(sceneEntityList, part.UUID))
// if already displaying a red aura over part, make sure its red
if (m_AuraEntities.ContainsKey(part.UUID))
{
// if already displaying a red aura over part, make sure its red
if (m_AuraEntities.ContainsKey(part.UUID))
{
m_AuraEntities[part.UUID].SetAura(new Vector3(254,0,0), part.Scale);
}
else
{
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
part.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(254,0,0),
part.Scale
);
m_AuraEntities.Add(part.UUID, auraGroup);
}
SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum);
SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT);
m_AuraEntities[part.UUID].SetAura(new Vector3(254, 0, 0), part.Scale);
}
// otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
else
{
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
part.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(254, 0, 0),
part.Scale
);
m_AuraEntities.Add(part.UUID, auraGroup);
}
SceneObjectPart metaPart = m_Entity.GetLinkNumPart(part.LinkNum);
SetPartTransparency(metaPart, MetaEntity.TRANSLUCENT);
}
// otherwise, scene will not contain the part. note: a group can not remove a part without changing group id
}
// a deleted part has no where to point a beam particle system,
@ -183,11 +180,7 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public bool HasChildPrim(UUID uuid)
{
lock (m_UnchangedEntity.Children)
if (m_UnchangedEntity.Children.ContainsKey(uuid))
return true;
return false;
return m_UnchangedEntity.ContainsPart(uuid);
}
/// <summary>
@ -195,12 +188,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public bool HasChildPrim(uint localID)
{
lock (m_UnchangedEntity.Children)
{
foreach (SceneObjectPart part in m_UnchangedEntity.Children.Values)
if (part.LocalId == localID)
return true;
}
foreach (SceneObjectPart part in m_UnchangedEntity.Parts)
if (part.LocalId == localID)
return true;
return false;
}
@ -237,72 +227,37 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
// Use "UnchangedEntity" to do comparisons because its text, transparency, and other attributes will be just as the user
// had originally saved.
// m_Entity will NOT necessarily be the same entity as the user had saved.
lock (m_UnchangedEntity.Children)
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Parts)
{
foreach (SceneObjectPart UnchangedPart in m_UnchangedEntity.Children.Values)
//This is the part that we use to show changes.
metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
if (sceneEntityGroup.ContainsPart(UnchangedPart.UUID))
{
//This is the part that we use to show changes.
metaEntityPart = m_Entity.GetLinkNumPart(UnchangedPart.LinkNum);
if (sceneEntityGroup.Children.ContainsKey(UnchangedPart.UUID))
sceneEntityPart = sceneEntityGroup.GetChildPart(UnchangedPart.UUID);
differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
if (differences != Diff.NONE)
metaEntityPart.Text = "CHANGE: " + differences.ToString();
if (differences != 0)
{
sceneEntityPart = sceneEntityGroup.Children[UnchangedPart.UUID];
differences = Difference.FindDifferences(UnchangedPart, sceneEntityPart);
if (differences != Diff.NONE)
metaEntityPart.Text = "CHANGE: " + differences.ToString();
if (differences != 0)
{
// Root Part that has been modified
if ((differences&Diff.POSITION) > 0)
{
// If the position of any part has changed, make sure the RootPart of the
// meta entity is pointing with a beam particle system
if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
{
m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
}
BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
m_UnchangedEntity.RootPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
sceneEntityPart,
new Vector3(0,0,254)
);
m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
}
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(0,0,254),
UnchangedPart.Scale
);
m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
DiffersFromSceneGroup = true;
}
else // no differences between scene part and meta part
// Root Part that has been modified
if ((differences & Diff.POSITION) > 0)
{
// If the position of any part has changed, make sure the RootPart of the
// meta entity is pointing with a beam particle system
if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
{
m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
}
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
SetPartTransparency(metaEntityPart, MetaEntity.NONE);
BeamMetaEntity beamGroup = new BeamMetaEntity(m_Entity.Scene,
m_UnchangedEntity.RootPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
sceneEntityPart,
new Vector3(0, 0, 254)
);
m_BeamEntities.Add(m_UnchangedEntity.RootPart.UUID, beamGroup);
}
}
else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
{
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
@ -311,14 +266,46 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(254,0,0),
new Vector3(0, 0, 254),
UnchangedPart.Scale
);
m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
DiffersFromSceneGroup = true;
}
else // no differences between scene part and meta part
{
if (m_BeamEntities.ContainsKey(m_UnchangedEntity.RootPart.UUID))
{
m_BeamEntities[m_UnchangedEntity.RootPart.UUID].HideFromAll();
m_BeamEntities.Remove(m_UnchangedEntity.RootPart.UUID);
}
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
SetPartTransparency(metaEntityPart, MetaEntity.NONE);
}
}
else //The entity currently in the scene is missing parts from the metaentity saved, so mark parts red as deleted.
{
if (m_AuraEntities.ContainsKey(UnchangedPart.UUID))
{
m_AuraEntities[UnchangedPart.UUID].HideFromAll();
m_AuraEntities.Remove(UnchangedPart.UUID);
}
AuraMetaEntity auraGroup = new AuraMetaEntity(m_Entity.Scene,
UnchangedPart.GetWorldPosition(),
MetaEntity.TRANSLUCENT,
new Vector3(254, 0, 0),
UnchangedPart.Scale
);
m_AuraEntities.Add(UnchangedPart.UUID, auraGroup);
SetPartTransparency(metaEntityPart, MetaEntity.TRANSLUCENT);
DiffersFromSceneGroup = true;
}
}

View File

@ -98,10 +98,9 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
#region Public Properties
public Dictionary<UUID, SceneObjectPart> Children
public SceneObjectPart[] Parts
{
get { return m_Entity.Children; }
set { m_Entity.Children = value; }
get { return m_Entity.Parts; }
}
public uint LocalId
@ -150,19 +149,17 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
{
//make new uuids
Dictionary<UUID, SceneObjectPart> parts = new Dictionary<UUID, SceneObjectPart>();
lock (m_Entity.Children)
foreach (SceneObjectPart part in m_Entity.Parts)
{
foreach (SceneObjectPart part in m_Entity.Children.Values)
{
part.ResetIDs(part.LinkNum);
parts.Add(part.UUID, part);
}
//finalize
m_Entity.RootPart.PhysActor = null;
m_Entity.Children = parts;
part.ResetIDs(part.LinkNum);
parts.Add(part.UUID, part);
}
//finalize
m_Entity.RootPart.PhysActor = null;
foreach (SceneObjectPart part in parts.Values)
m_Entity.AddPart(part);
}
#endregion Protected Methods
@ -177,11 +174,8 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
//This deletes the group without removing from any databases.
//This is important because we are not IN any database.
//m_Entity.FakeDeleteGroup();
lock (m_Entity.Children)
{
foreach (SceneObjectPart part in m_Entity.Children.Values)
client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
}
foreach (SceneObjectPart part in m_Entity.Parts)
client.SendKillObject(m_Entity.RegionHandle, part.LocalId);
}
/// <summary>
@ -189,15 +183,12 @@ namespace OpenSim.Region.OptionalModules.ContentManagement
/// </summary>
public virtual void HideFromAll()
{
lock (m_Entity.Children)
foreach (SceneObjectPart part in m_Entity.Parts)
{
foreach (SceneObjectPart part in m_Entity.Children.Values)
{
m_Entity.Scene.ForEachClient(
delegate(IClientAPI controller)
{ controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
);
}
m_Entity.Scene.ForEachClient(
delegate(IClientAPI controller)
{ controller.SendKillObject(m_Entity.RegionHandle, part.LocalId); }
);
}
}

View File

@ -193,11 +193,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
int i = 0;
List<SceneObjectPart> partList = null;
lock (my.ParentGroup.Children)
partList = new List<SceneObjectPart>(my.ParentGroup.Children.Values);
foreach (SceneObjectPart part in partList)
foreach (SceneObjectPart part in my.ParentGroup.Parts)
{
rets[i++] = new SOPObject(m_rootScene, part.LocalId, m_security);
}

View File

@ -294,8 +294,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_SET:
if (m_host.ParentGroup != null)
{
lock (m_host.ParentGroup.Children)
return new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
return new List<SceneObjectPart>(m_host.ParentGroup.Parts);
}
return ret;
@ -312,8 +311,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentGroup == null)
return new List<SceneObjectPart>();
lock (m_host.ParentGroup.Children)
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host))
ret.Remove(m_host);
@ -323,8 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (m_host.ParentGroup == null)
return new List<SceneObjectPart>();
lock (m_host.ParentGroup.Children)
ret = new List<SceneObjectPart>(m_host.ParentGroup.Children.Values);
ret = new List<SceneObjectPart>(m_host.ParentGroup.Parts);
if (ret.Contains(m_host.ParentGroup.RootPart))
ret.Remove(m_host.ParentGroup.RootPart);
@ -1281,16 +1278,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (group == null)
return;
bool allow = true;
lock (group.Children)
foreach (SceneObjectPart part in group.Parts)
{
foreach (SceneObjectPart part in group.Children.Values)
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
{
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
{
allow = false;
break;
}
allow = false;
break;
}
}
@ -3889,18 +3883,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case ScriptBaseClass.LINK_ALL_OTHERS:
case ScriptBaseClass.LINK_ALL_CHILDREN:
case ScriptBaseClass.LINK_THIS:
lock (parentPrim.Children)
foreach (SceneObjectPart part in parentPrim.Parts)
{
foreach (SceneObjectPart part in parentPrim.Children.Values)
if (part.UUID != m_host.UUID)
{
if (part.UUID != m_host.UUID)
{
childPrim = part;
break;
}
childPrim = part;
break;
}
break;
}
break;
default:
childPrim = parentPrim.GetLinkNumPart(linknum);
if (childPrim.UUID == m_host.UUID)
@ -3911,7 +3902,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (linknum == ScriptBaseClass.LINK_ROOT)
{
// Restructuring Multiple Prims.
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
parts.Remove(parentPrim.RootPart);
if (parts.Count > 0)
{
@ -3976,19 +3967,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (parentPrim.RootPart.AttachmentPoint != 0)
return; // Fail silently if attached
lock (parentPrim.Children)
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Parts);
parts.Remove(parentPrim.RootPart);
foreach (SceneObjectPart part in parts)
{
List<SceneObjectPart> parts = new List<SceneObjectPart>(parentPrim.Children.Values);
parts.Remove(parentPrim.RootPart);
foreach (SceneObjectPart part in parts)
{
parentPrim.DelinkFromGroup(part.LocalId, true);
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
}
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
parentPrim.DelinkFromGroup(part.LocalId, true);
parentPrim.TriggerScriptChangedEvent(Changed.LINK);
}
parentPrim.HasGroupChanged = true;
parentPrim.ScheduleGroupForFullUpdate();
}
public LSL_String llGetLinkKey(int linknum)

View File

@ -209,15 +209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared
else
Type = 0x02; // Passive
lock (part.ParentGroup.Children)
foreach (SceneObjectPart p in part.ParentGroup.Parts)
{
foreach (SceneObjectPart p in part.ParentGroup.Children.Values)
if (p.Inventory.ContainsScripts())
{
if (p.Inventory.ContainsScripts())
{
Type |= 0x08; // Scripted
break;
}
Type |= 0x08; // Scripted
break;
}
}

View File

@ -163,7 +163,7 @@ namespace OpenSim.Data.Null
// We can't simply store groups here because on delinking, OpenSim will not update the original group
// directly. Rather, the newly delinked parts will be updated to be in their own scene object group
// Therefore, we need to store parts rather than groups.
foreach (SceneObjectPart prim in obj.Children.Values)
foreach (SceneObjectPart prim in obj.Parts)
{
m_log.DebugFormat(
"[MOCK REGION DATA PLUGIN]: Storing part {0} {1} in object {2} {3} in region {4}",

View File

@ -84,7 +84,7 @@ namespace OpenSim.Tests.Common.Mock
public List<InventoryItemBase> getInventoryInFolder(UUID folderID)
{
InventoryFolderBase folder = m_folders[folderID];
// InventoryFolderBase folder = m_folders[folderID];
// m_log.DebugFormat("[MOCK INV DB]: Getting items in folder {0} {1}", folder.Name, folder.ID);
@ -116,7 +116,7 @@ namespace OpenSim.Tests.Common.Mock
public List<InventoryFolderBase> getInventoryFolders(UUID parentID)
{
InventoryFolderBase parentFolder = m_folders[parentID];
// InventoryFolderBase parentFolder = m_folders[parentID];
// m_log.DebugFormat("[MOCK INV DB]: Getting folders in folder {0} {1}", parentFolder.Name, parentFolder.ID);
@ -185,7 +185,7 @@ namespace OpenSim.Tests.Common.Mock
public void addInventoryItem(InventoryItemBase item)
{
InventoryFolderBase folder = m_folders[item.Folder];
// InventoryFolderBase folder = m_folders[item.Folder];
// m_log.DebugFormat(
// "[MOCK INV DB]: Adding inventory item {0} {1} in {2} {3}", item.Name, item.ID, folder.Name, folder.ID);