From ae2174d8f526b225c3cccf551f1a9f01d6569203 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jan 2010 18:11:53 +0000
Subject: Add method to get all items with the same name from a particular prim
Extend load oar test to check loading of a sound item
---
.../Framework/Scenes/SceneObjectPartInventory.cs | 26 +++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 5f13278..b37e1a2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -554,8 +554,32 @@ namespace OpenSim.Region.Framework.Scenes
m_items.TryGetValue(itemId, out item);
return item;
- }
+ }
+
+ ///
+ /// Get inventory items by name.
+ ///
+ ///
+ ///
+ /// A list of inventory items with that name.
+ /// If no inventory item has that name then an empty list is returned.
+ ///
+ public IList GetInventoryItems(string name)
+ {
+ IList items = new List();
+ lock (m_items)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ if (item.Name == name)
+ items.Add(item);
+ }
+ }
+
+ return items;
+ }
+
///
/// Update an existing inventory item.
///
--
cgit v1.1
From 968b9e160d70568fbdea5b190d1386e9431316e3 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jan 2010 20:36:13 +0000
Subject: improve locking of m_items in SceneObjectPartInventory
---
.../Framework/Scenes/SceneObjectPartInventory.cs | 218 +++++++++++++--------
1 file changed, 133 insertions(+), 85 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index b37e1a2..87c1a95 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -44,6 +44,8 @@ namespace OpenSim.Region.Framework.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
+ static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+
private string m_inventoryFileName = String.Empty;
private int m_inventoryFileNameSerial = 0;
@@ -270,8 +272,12 @@ namespace OpenSim.Region.Framework.Scenes
if (stateSource == 1 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries)
{
- m_items[item.ItemID].PermsMask = 0;
- m_items[item.ItemID].PermsGranter = UUID.Zero;
+ lock (m_items)
+ {
+ m_items[item.ItemID].PermsMask = 0;
+ m_items[item.ItemID].PermsGranter = UUID.Zero;
+ }
+
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
@@ -279,33 +285,38 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
- m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
- {
- if (null == asset)
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
- item.Name, item.ItemID, m_part.AbsolutePosition,
- m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
- }
- else
- {
- if (m_part.ParentGroup.m_savedScriptState != null)
- RestoreSavedScriptState(item.OldItemID, item.ItemID);
- m_items[item.ItemID].PermsMask = 0;
- m_items[item.ItemID].PermsGranter = UUID.Zero;
- string script = Utils.BytesToString(asset.Data);
- m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
- m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
- m_part.ParentGroup.AddActiveScriptCount(1);
- m_part.ScheduleFullUpdate();
- }
- });
- }
- }
+ m_part.ParentGroup.Scene.AssetService.Get(
+ item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
+ {
+ if (null == asset)
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
+ item.Name, item.ItemID, m_part.AbsolutePosition,
+ m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
+ }
+ else
+ {
+ if (m_part.ParentGroup.m_savedScriptState != null)
+ RestoreSavedScriptState(item.OldItemID, item.ItemID);
- static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
+ lock (m_items)
+ {
+ m_items[item.ItemID].PermsMask = 0;
+ m_items[item.ItemID].PermsGranter = UUID.Zero;
+ }
+
+ string script = Utils.BytesToString(asset.Data);
+ m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
+ m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
+ m_part.ParentGroup.AddActiveScriptCount(1);
+ m_part.ScheduleFullUpdate();
+ }
+ }
+ );
+ }
+ }
private void RestoreSavedScriptState(UUID oldID, UUID newID)
{
@@ -397,7 +408,15 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted)
{
- if (m_items.ContainsKey(itemId))
+ bool scriptPresent = false;
+
+ lock (m_items)
+ {
+ if (m_items.ContainsKey(itemId))
+ scriptPresent = true;
+ }
+
+ if (scriptPresent)
{
if (!sceneObjectBeingDeleted)
m_part.RemoveScriptEvents(itemId);
@@ -469,7 +488,13 @@ namespace OpenSim.Region.Framework.Scenes
///
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
{
- List il = new List(m_items.Values);
+ List il;
+
+ lock (m_items)
+ {
+ il = new List(m_items.Values);
+ }
+
foreach (TaskInventoryItem i in il)
{
if (i.Name == item.Name)
@@ -551,7 +576,9 @@ namespace OpenSim.Region.Framework.Scenes
public TaskInventoryItem GetInventoryItem(UUID itemId)
{
TaskInventoryItem item;
- m_items.TryGetValue(itemId, out item);
+
+ lock (m_items)
+ m_items.TryGetValue(itemId, out item);
return item;
}
@@ -877,54 +904,61 @@ namespace OpenSim.Region.Framework.Scenes
{
uint mask=0x7fffffff;
- foreach (TaskInventoryItem item in m_items.Values)
+ lock (m_items)
{
- if (item.InvType != (int)InventoryType.Object)
- {
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
- mask &= ~((uint)PermissionMask.Copy >> 13);
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
- mask &= ~((uint)PermissionMask.Transfer >> 13);
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
- mask &= ~((uint)PermissionMask.Modify >> 13);
- }
- else
+ foreach (TaskInventoryItem item in m_items.Values)
{
- if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Copy >> 13);
- if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Transfer >> 13);
- if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Modify >> 13);
+ if (item.InvType != (int)InventoryType.Object)
+ {
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
+ mask &= ~((uint)PermissionMask.Copy >> 13);
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
+ mask &= ~((uint)PermissionMask.Transfer >> 13);
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
+ mask &= ~((uint)PermissionMask.Modify >> 13);
+ }
+ else
+ {
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Copy >> 13);
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Transfer >> 13);
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Modify >> 13);
+ }
+
+ if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+ mask &= ~(uint)PermissionMask.Copy;
+ if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
+ mask &= ~(uint)PermissionMask.Transfer;
+ if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
+ mask &= ~(uint)PermissionMask.Modify;
}
-
- if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
- mask &= ~(uint)PermissionMask.Copy;
- if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
- mask &= ~(uint)PermissionMask.Transfer;
- if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
- mask &= ~(uint)PermissionMask.Modify;
}
+
return mask;
}
public void ApplyNextOwnerPermissions()
{
- foreach (TaskInventoryItem item in m_items.Values)
+ lock (m_items)
{
- if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
- item.CurrentPermissions |= 8;
+ if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
+ {
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
+ item.CurrentPermissions |= 8;
+ }
+ item.CurrentPermissions &= item.NextPermissions;
+ item.BasePermissions &= item.NextPermissions;
+ item.EveryonePermissions &= item.NextPermissions;
}
- item.CurrentPermissions &= item.NextPermissions;
- item.BasePermissions &= item.NextPermissions;
- item.EveryonePermissions &= item.NextPermissions;
}
m_part.TriggerScriptChangedEvent(Changed.OWNER);
@@ -932,22 +966,29 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyGodPermissions(uint perms)
{
- foreach (TaskInventoryItem item in m_items.Values)
+ lock (m_items)
{
- item.CurrentPermissions = perms;
- item.BasePermissions = perms;
+ foreach (TaskInventoryItem item in m_items.Values)
+ {
+ item.CurrentPermissions = perms;
+ item.BasePermissions = perms;
+ }
}
}
public bool ContainsScripts()
{
- foreach (TaskInventoryItem item in m_items.Values)
+ lock (m_items)
{
- if (item.InvType == (int)InventoryType.LSL)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- return true;
+ if (item.InvType == (int)InventoryType.LSL)
+ {
+ return true;
+ }
}
}
+
return false;
}
@@ -955,8 +996,11 @@ namespace OpenSim.Region.Framework.Scenes
{
List ret = new List();
- foreach (TaskInventoryItem item in m_items.Values)
- ret.Add(item.ItemID);
+ lock (m_items)
+ {
+ foreach (TaskInventoryItem item in m_items.Values)
+ ret.Add(item.ItemID);
+ }
return ret;
}
@@ -969,26 +1013,30 @@ namespace OpenSim.Region.Framework.Scenes
if (engines == null) // No engine at all
return ret;
- foreach (TaskInventoryItem item in m_items.Values)
+ lock (m_items)
{
- if (item.InvType == (int)InventoryType.LSL)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (IScriptModule e in engines)
+ if (item.InvType == (int)InventoryType.LSL)
{
- if (e != null)
+ foreach (IScriptModule e in engines)
{
- string n = e.GetXMLState(item.ItemID);
- if (n != String.Empty)
+ if (e != null)
{
- if (!ret.ContainsKey(item.ItemID))
- ret[item.ItemID] = n;
- break;
+ string n = e.GetXMLState(item.ItemID);
+ if (n != String.Empty)
+ {
+ if (!ret.ContainsKey(item.ItemID))
+ ret[item.ItemID] = n;
+ break;
+ }
}
}
}
}
}
+
return ret;
}
}
-}
+}
\ No newline at end of file
--
cgit v1.1
From 05a3e37b853fc870b83eb67b47bc70eb724f652e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 29 Jan 2010 23:12:08 +0000
Subject: Apply http://opensimulator.org/mantis/view.php?id=3334 Send
continuous touch() events if the left mouse button is held down while moving
over an object This conforms with Linden Lab practice Thanks Revolution
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 11 ++++++
.../Framework/Scenes/Scene.PacketHandlers.cs | 40 ++++++++++++++++++++++
OpenSim/Region/Framework/Scenes/Scene.cs | 1 +
3 files changed, 52 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 399379e..004ea1f 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -104,6 +104,7 @@ namespace OpenSim.Region.Framework.Scenes
public event OnSetRootAgentSceneDelegate OnSetRootAgentScene;
public event ObjectGrabDelegate OnObjectGrab;
+ public event ObjectGrabDelegate OnObjectGrabbing;
public event ObjectDeGrabDelegate OnObjectDeGrab;
public event ScriptResetDelegate OnScriptReset;
@@ -408,6 +409,7 @@ namespace OpenSim.Region.Framework.Scenes
private OnParcelPrimCountAddDelegate handlerParcelPrimCountAdd = null; //OnParcelPrimCountAdd;
private OnShutdownDelegate handlerShutdown = null; //OnShutdown;
private ObjectGrabDelegate handlerObjectGrab = null; //OnObjectGrab;
+ private ObjectGrabDelegate handlerObjectGrabbing = null; //OnObjectGrabbing;
private ObjectDeGrabDelegate handlerObjectDeGrab = null; //OnObjectDeGrab;
private ScriptResetDelegate handlerScriptReset = null; // OnScriptReset
private NewRezScript handlerRezScript = null; //OnRezScript;
@@ -620,6 +622,15 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public void TriggerObjectGrabbing(uint localID, uint originalID, Vector3 offsetPos, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
+ {
+ handlerObjectGrabbing = OnObjectGrabbing;
+ if (handlerObjectGrabbing != null)
+ {
+ handlerObjectGrabbing(localID, originalID, offsetPos, remoteClient, surfaceArgs);
+ }
+ }
+
public void TriggerObjectDeGrab(uint localID, uint originalID, IClientAPI remoteClient, SurfaceTouchEventArgs surfaceArgs)
{
handlerObjectDeGrab = OnObjectDeGrab;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
index 47fbeb4..ac04dc7 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs
@@ -292,6 +292,46 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ public virtual void ProcessObjectGrabUpdate(UUID objectID, Vector3 offset, Vector3 pos, IClientAPI remoteClient, List surfaceArgs)
+ {
+ List EntityList = GetEntities();
+
+ SurfaceTouchEventArgs surfaceArg = null;
+ if (surfaceArgs != null && surfaceArgs.Count > 0)
+ surfaceArg = surfaceArgs[0];
+
+ foreach (EntityBase ent in EntityList)
+ {
+ if (ent is SceneObjectGroup)
+ {
+ SceneObjectGroup obj = ent as SceneObjectGroup;
+ if (obj != null)
+ {
+ // Is this prim part of the group
+ if (obj.HasChildPrim(objectID))
+ {
+ SceneObjectPart part = obj.GetChildPart(objectID);
+
+ // If the touched prim handles touches, deliver it
+ // If not, deliver to root prim
+ if ((part.ScriptEvents & scriptEvents.touch) != 0)
+ EventManager.TriggerObjectGrabbing(part.LocalId, 0, part.OffsetPosition, remoteClient, surfaceArg);
+ // Deliver to the root prim if the touched prim doesn't handle touches
+ // or if we're meant to pass on touches anyway. Don't send to root prim
+ // if prim touched is the root prim as we just did it
+ if (((part.ScriptEvents & scriptEvents.touch) == 0) ||
+ (part.PassTouches && (part.LocalId != obj.RootPart.LocalId)))
+ {
+ EventManager.TriggerObjectGrabbing(obj.RootPart.LocalId, part.LocalId, part.OffsetPosition, remoteClient, surfaceArg);
+ }
+
+ return;
+ }
+ }
+ }
+ }
+ }
+
public virtual void ProcessObjectDeGrab(uint localID, IClientAPI remoteClient, List surfaceArgs)
{
List EntityList = GetEntities();
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 4da05cf..73b0b3e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2675,6 +2675,7 @@ namespace OpenSim.Region.Framework.Scenes
client.OnRequestObjectPropertiesFamily += m_sceneGraph.RequestObjectPropertiesFamily;
client.OnObjectPermissions += HandleObjectPermissionsUpdate;
client.OnGrabObject += ProcessObjectGrab;
+ client.OnGrabUpdate += ProcessObjectGrabUpdate;
client.OnDeGrabObject += ProcessObjectDeGrab;
client.OnUndo += m_sceneGraph.HandleUndo;
client.OnObjectDescription += m_sceneGraph.PrimDescription;
--
cgit v1.1
From 53a01dc42273b9252eb290187e87a47a898af86a Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 20:06:43 +0000
Subject: Don't try to start attachment scripts or send updates if the
attachment itself has been unsuccessful
---
OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 14 +++-
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 77 +++++++++++++++-------
2 files changed, 64 insertions(+), 27 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 11754ea..7df3e50 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2376,9 +2376,19 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- public void AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
+ ///
+ /// Attach an object.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the object was successfully attached, false otherwise
+ public bool AttachObject(IClientAPI controllingClient, uint localID, uint attachPoint, Quaternion rot, Vector3 pos, bool silent)
{
- m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
+ return m_sceneGraph.AttachObject(controllingClient, localID, attachPoint, rot, pos, silent);
}
public void AttachObject(IClientAPI remoteClient, uint AttachmentPt, UUID itemID, SceneObjectGroup att)
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f74fd5d..fc2798d 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -478,46 +478,59 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null)
return;
- if (!m_parentScene.Permissions.CanTakeObject(
- part.UUID, remoteClient.AgentId))
+ if (!m_parentScene.Permissions.CanTakeObject(part.UUID, remoteClient.AgentId))
return;
// Calls attach with a Zero position
- AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false);
- m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
-
- // Save avatar attachment information
- ScenePresence presence;
- if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
+ if (AttachObject(remoteClient, objectLocalID, AttachmentPt, rot, Vector3.Zero, false))
{
- m_log.Info("[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId + ", AttachmentPoint: " + AttachmentPt);
- m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
+ m_parentScene.SendAttachEvent(objectLocalID, part.ParentGroup.GetFromItemID(), remoteClient.AgentId);
+
+ // Save avatar attachment information
+ ScenePresence presence;
+ if (m_parentScene.AvatarFactory != null && m_parentScene.TryGetAvatar(remoteClient.AgentId, out presence))
+ {
+ m_log.Info(
+ "[SCENE]: Saving avatar attachment. AgentID: " + remoteClient.AgentId
+ + ", AttachmentPoint: " + AttachmentPt);
+
+ m_parentScene.AvatarFactory.UpdateDatabase(remoteClient.AgentId, presence.Appearance);
+ }
}
}
- public SceneObjectGroup RezSingleAttachment(
- IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
+ ///
+ /// Rez an attachment
+ ///
+ ///
+ ///
+ ///
+ /// The scene object that was attached. Null if the scene object could not be found
+ public SceneObjectGroup RezSingleAttachment(IClientAPI remoteClient, UUID itemID, uint AttachmentPt)
{
SceneObjectGroup objatt = m_parentScene.RezObject(remoteClient,
itemID, Vector3.Zero, Vector3.Zero, UUID.Zero, (byte)1, true,
false, false, remoteClient.AgentId, true);
-
if (objatt != null)
{
bool tainted = false;
if (AttachmentPt != 0 && AttachmentPt != objatt.GetAttachmentPoint())
tainted = true;
- AttachObject(remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false);
- objatt.ScheduleGroupForFullUpdate();
- if (tainted)
- objatt.HasGroupChanged = true;
-
- // Fire after attach, so we don't get messy perms dialogs
- // 3 == AttachedRez
- objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
+ if (AttachObject(
+ remoteClient, objatt.LocalId, AttachmentPt, Quaternion.Identity, objatt.AbsolutePosition, false))
+ {
+ objatt.ScheduleGroupForFullUpdate();
+ if (tainted)
+ objatt.HasGroupChanged = true;
+
+ // Fire after attach, so we don't get messy perms dialogs
+ // 3 == AttachedRez
+ objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
+ }
}
+
return objatt;
}
@@ -554,7 +567,17 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- protected internal void AttachObject(
+ ///
+ /// Attach a scene object to an avatar.
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ /// true if the attachment was successful, false otherwise
+ protected internal bool AttachObject(
IClientAPI remoteClient, uint objectLocalID, uint AttachmentPt, Quaternion rot, Vector3 attachPos, bool silent)
{
SceneObjectGroup group = GetGroupByPrim(objectLocalID);
@@ -583,10 +606,8 @@ namespace OpenSim.Region.Framework.Scenes
// Stick it on left hand with Zero Offset from the attachment point.
AttachmentPt = (uint)AttachmentPoint.LeftHand;
attachPos = Vector3.Zero;
-
}
-
group.SetAttachmentPoint((byte)AttachmentPt);
group.AbsolutePosition = attachPos;
@@ -609,15 +630,21 @@ namespace OpenSim.Region.Framework.Scenes
// it get cleaned up
//
group.RootPart.RemFlag(PrimFlags.TemporaryOnRez);
- group.HasGroupChanged = false;
+ group.HasGroupChanged = false;
}
else
{
remoteClient.SendAgentAlertMessage("You don't have sufficient permissions to attach this object", false);
+ return false;
}
}
else
+ {
m_log.DebugFormat("[SCENE GRAPH]: AttachObject found no such scene object {0}", objectLocalID);
+ return false;
+ }
+
+ return true;
}
protected internal ScenePresence CreateAndAddChildScenePresence(IClientAPI client, AvatarAppearance appearance)
--
cgit v1.1
From 4c1740f7d8e4e577167a84438cce83a7cc32f56d Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 20:15:36 +0000
Subject: Actually make EventManager.OnAttach() fire when an object is
attached. Previously, only detach was firing!
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 5 +++--
OpenSim/Region/Framework/Scenes/SceneGraph.cs | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 004ea1f..464ead8 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -313,9 +313,10 @@ namespace OpenSim.Region.Framework.Scenes
public event EmptyScriptCompileQueue OnEmptyScriptCompileQueue;
///
- /// Called whenever an object is attached, or detached
- /// from an in-world presence.
+ /// Called whenever an object is attached, or detached from an in-world presence.
///
+ /// If the object is being attached, then the avatarID will be present. If the object is being detached then
+ /// the avatarID is UUID.Zero (I know, this doesn't make much sense but now it's historical).
public delegate void Attach(uint localID, UUID itemID, UUID avatarID);
public event Attach OnAttach;
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index fc2798d..1ac061a 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -528,6 +528,9 @@ namespace OpenSim.Region.Framework.Scenes
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_parentScene.DefaultScriptEngine, 3);
+
+ // Do this last so that event listeners have access to all the effects of the attachment
+ m_parentScene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);
}
}
--
cgit v1.1
From 3863cd1d2395fb87489ed4e544fc33048c81761c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 21:35:05 +0000
Subject: Copy prim face color setting code from LSL_Api down into SOP so that
non-LSL callers can use it
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 192 +++++++++++++++++++++
1 file changed, 192 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index a5296eb..8b5c348 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -90,10 +90,27 @@ namespace OpenSim.Region.Framework.Scenes
SCALE = 0x40
}
+ public enum PrimType : int
+ {
+ BOX = 0,
+ CYLINDER = 1,
+ PRISM = 2,
+ SPHERE = 3,
+ TORUS = 4,
+ TUBE = 5,
+ RING = 6,
+ SCULPT = 7
+ }
+
#endregion Enumerations
public class SceneObjectPart : IScriptHost
{
+ ///
+ /// Denote all sides of the prim
+ ///
+ public const int ALL_SIDES = -1;
+
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
// use only one serializer to give the runtime a chance to optimize it (it won't do that if you
@@ -737,6 +754,9 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ///
+ /// Text color.
+ ///
public Color Color
{
get { return m_color; }
@@ -2955,6 +2975,178 @@ namespace OpenSim.Region.Framework.Scenes
}
}
+ ///
+ /// Set the color of prim faces
+ ///
+ ///
+ ///
+ public void SetFaceColor(Vector3 color, int face)
+ {
+ Primitive.TextureEntry tex = Shape.Textures;
+ Color4 texcolor;
+ if (face >= 0 && face < GetNumberOfSides())
+ {
+ texcolor = tex.CreateFace((uint)face).RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ tex.FaceTextures[face].RGBA = texcolor;
+ UpdateTexture(tex);
+ return;
+ }
+ else if (face == ALL_SIDES)
+ {
+ for (uint i = 0; i < GetNumberOfSides(); i++)
+ {
+ if (tex.FaceTextures[i] != null)
+ {
+ texcolor = tex.FaceTextures[i].RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ tex.FaceTextures[i].RGBA = texcolor;
+ }
+ texcolor = tex.DefaultTexture.RGBA;
+ texcolor.R = Util.Clip((float)color.X, 0.0f, 1.0f);
+ texcolor.G = Util.Clip((float)color.Y, 0.0f, 1.0f);
+ texcolor.B = Util.Clip((float)color.Z, 0.0f, 1.0f);
+ tex.DefaultTexture.RGBA = texcolor;
+ }
+ UpdateTexture(tex);
+ return;
+ }
+ }
+
+ ///
+ /// Get the number of sides that this part has.
+ ///
+ ///
+ public int GetNumberOfSides()
+ {
+ int ret = 0;
+ bool hasCut;
+ bool hasHollow;
+ bool hasDimple;
+ bool hasProfileCut;
+
+ PrimType primType = getScriptPrimType();
+ hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
+
+ switch (primType)
+ {
+ case PrimType.BOX:
+ ret = 6;
+ if (hasCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.CYLINDER:
+ ret = 3;
+ if (hasCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.PRISM:
+ ret = 5;
+ if (hasCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.SPHERE:
+ ret = 1;
+ if (hasCut) ret += 2;
+ if (hasDimple) ret += 2;
+ if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1)
+ break;
+ case PrimType.TORUS:
+ ret = 1;
+ if (hasCut) ret += 2;
+ if (hasProfileCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.TUBE:
+ ret = 4;
+ if (hasCut) ret += 2;
+ if (hasProfileCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.RING:
+ ret = 3;
+ if (hasCut) ret += 2;
+ if (hasProfileCut) ret += 2;
+ if (hasHollow) ret += 1;
+ break;
+ case PrimType.SCULPT:
+ ret = 1;
+ break;
+ }
+ return ret;
+ }
+
+ ///
+ /// Tell us what type this prim is
+ ///
+ ///
+ ///
+ public PrimType getScriptPrimType()
+ {
+ if (Shape.SculptEntry)
+ return PrimType.SCULPT;
+ if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Square)
+ {
+ if (Shape.PathCurve == (byte)Extrusion.Straight)
+ return PrimType.BOX;
+ else if (Shape.PathCurve == (byte)Extrusion.Curve1)
+ return PrimType.TUBE;
+ }
+ else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.Circle)
+ {
+ if (Shape.PathCurve == (byte)Extrusion.Straight)
+ return PrimType.CYLINDER;
+ // ProfileCurve seems to combine hole shape and profile curve so we need to only compare against the lower 3 bits
+ else if (Shape.PathCurve == (byte)Extrusion.Curve1)
+ return PrimType.TORUS;
+ }
+ else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.HalfCircle)
+ {
+ if (Shape.PathCurve == (byte)Extrusion.Curve1 || Shape.PathCurve == (byte)Extrusion.Curve2)
+ return PrimType.SPHERE;
+ }
+ else if ((Shape.ProfileCurve & 0x07) == (byte)ProfileShape.EquilateralTriangle)
+ {
+ if (Shape.PathCurve == (byte)Extrusion.Straight)
+ return PrimType.PRISM;
+ else if (Shape.PathCurve == (byte)Extrusion.Curve1)
+ return PrimType.RING;
+ }
+
+ return PrimType.BOX;
+ }
+
+ ///
+ /// Tell us if this object has cut, hollow, dimple, and other factors affecting the number of faces
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
+ out bool hasDimple, out bool hasProfileCut)
+ {
+ if (primType == PrimType.BOX
+ ||
+ primType == PrimType.CYLINDER
+ ||
+ primType == PrimType.PRISM)
+
+ hasCut = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0);
+ else
+ hasCut = (shape.PathBegin > 0) || (shape.PathEnd > 0);
+
+ hasHollow = shape.ProfileHollow > 0;
+ hasDimple = (shape.ProfileBegin > 0) || (shape.ProfileEnd > 0); // taken from llSetPrimitiveParms
+ hasProfileCut = hasDimple; // is it the same thing?
+ }
+
public void SetGroup(UUID groupID, IClientAPI client)
{
_groupID = groupID;
--
cgit v1.1
From ecc068fbe0b8a95563281c3aaf8e7392e5ef49e9 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 22:08:00 +0000
Subject: remove now duplicated shape code from LSL_Api.cs
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 8b5c348..33c3fcf 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3029,8 +3029,8 @@ namespace OpenSim.Region.Framework.Scenes
bool hasDimple;
bool hasProfileCut;
- PrimType primType = getScriptPrimType();
- hasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
+ PrimType primType = GetScriptPrimType();
+ HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
switch (primType)
{
@@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public PrimType getScriptPrimType()
+ public PrimType GetScriptPrimType()
{
if (Shape.SculptEntry)
return PrimType.SCULPT;
@@ -3129,7 +3129,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- protected static void hasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
+ protected static void HasCutHollowDimpleProfileCut(PrimType primType, PrimitiveBaseShape shape, out bool hasCut, out bool hasHollow,
out bool hasDimple, out bool hasProfileCut)
{
if (primType == PrimType.BOX
--
cgit v1.1
From 5432925a3b153737adf7f59483e05202068ce2af Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 22:29:21 +0000
Subject: move hollow sphere faces bug back up to LSL_Api.cs
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 33c3fcf..4f9beb7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3053,7 +3053,7 @@ namespace OpenSim.Region.Framework.Scenes
ret = 1;
if (hasCut) ret += 2;
if (hasDimple) ret += 2;
- if (hasHollow) ret += 3; // Emulate lsl on secondlife (according to documentation it should have added only +1)
+ if (hasHollow) ret += 1;
break;
case PrimType.TORUS:
ret = 1;
--
cgit v1.1
From 08721be3740624fb10a205bcf1ddcfd58bff7f87 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 1 Feb 2010 22:33:15 +0000
Subject: minor: rename GetScriptPrimType() to GetPrimType()
---
OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 4f9beb7..ef9005f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3029,7 +3029,7 @@ namespace OpenSim.Region.Framework.Scenes
bool hasDimple;
bool hasProfileCut;
- PrimType primType = GetScriptPrimType();
+ PrimType primType = GetPrimType();
HasCutHollowDimpleProfileCut(primType, Shape, out hasCut, out hasHollow, out hasDimple, out hasProfileCut);
switch (primType)
@@ -3085,7 +3085,7 @@ namespace OpenSim.Region.Framework.Scenes
///
///
///
- public PrimType GetScriptPrimType()
+ public PrimType GetPrimType()
{
if (Shape.SculptEntry)
return PrimType.SCULPT;
--
cgit v1.1
From 6478617c932e87bf091266dba2db4d73fcdd046f Mon Sep 17 00:00:00 2001
From: Melanie
Date: Tue, 2 Feb 2010 03:49:00 +0000
Subject: Revert "improve locking of m_items in SceneObjectPartInventory"
This reverts commit 968b9e160d70568fbdea5b190d1386e9431316e3.
---
.../Framework/Scenes/SceneObjectPartInventory.cs | 218 ++++++++-------------
1 file changed, 85 insertions(+), 133 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 87c1a95..b37e1a2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -44,8 +44,6 @@ namespace OpenSim.Region.Framework.Scenes
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
- static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
-
private string m_inventoryFileName = String.Empty;
private int m_inventoryFileNameSerial = 0;
@@ -272,12 +270,8 @@ namespace OpenSim.Region.Framework.Scenes
if (stateSource == 1 && // Prim crossing
m_part.ParentGroup.Scene.m_trustBinaries)
{
- lock (m_items)
- {
- m_items[item.ItemID].PermsMask = 0;
- m_items[item.ItemID].PermsGranter = UUID.Zero;
- }
-
+ m_items[item.ItemID].PermsMask = 0;
+ m_items[item.ItemID].PermsGranter = UUID.Zero;
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
m_part.LocalId, item.ItemID, String.Empty, startParam, postOnRez, engine, stateSource);
m_part.ParentGroup.AddActiveScriptCount(1);
@@ -285,38 +279,33 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
- m_part.ParentGroup.Scene.AssetService.Get(
- item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
- {
- if (null == asset)
- {
- m_log.ErrorFormat(
- "[PRIM INVENTORY]: " +
- "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
- item.Name, item.ItemID, m_part.AbsolutePosition,
- m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
- }
- else
- {
- if (m_part.ParentGroup.m_savedScriptState != null)
- RestoreSavedScriptState(item.OldItemID, item.ItemID);
-
- lock (m_items)
- {
- m_items[item.ItemID].PermsMask = 0;
- m_items[item.ItemID].PermsGranter = UUID.Zero;
- }
-
- string script = Utils.BytesToString(asset.Data);
- m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
- m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
- m_part.ParentGroup.AddActiveScriptCount(1);
- m_part.ScheduleFullUpdate();
- }
- }
- );
+ m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
+ {
+ if (null == asset)
+ {
+ m_log.ErrorFormat(
+ "[PRIM INVENTORY]: " +
+ "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
+ item.Name, item.ItemID, m_part.AbsolutePosition,
+ m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
+ }
+ else
+ {
+ if (m_part.ParentGroup.m_savedScriptState != null)
+ RestoreSavedScriptState(item.OldItemID, item.ItemID);
+ m_items[item.ItemID].PermsMask = 0;
+ m_items[item.ItemID].PermsGranter = UUID.Zero;
+ string script = Utils.BytesToString(asset.Data);
+ m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
+ m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
+ m_part.ParentGroup.AddActiveScriptCount(1);
+ m_part.ScheduleFullUpdate();
+ }
+ });
}
- }
+ }
+
+ static System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
private void RestoreSavedScriptState(UUID oldID, UUID newID)
{
@@ -408,15 +397,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void RemoveScriptInstance(UUID itemId, bool sceneObjectBeingDeleted)
{
- bool scriptPresent = false;
-
- lock (m_items)
- {
- if (m_items.ContainsKey(itemId))
- scriptPresent = true;
- }
-
- if (scriptPresent)
+ if (m_items.ContainsKey(itemId))
{
if (!sceneObjectBeingDeleted)
m_part.RemoveScriptEvents(itemId);
@@ -488,13 +469,7 @@ namespace OpenSim.Region.Framework.Scenes
///
public void AddInventoryItemExclusive(TaskInventoryItem item, bool allowedDrop)
{
- List il;
-
- lock (m_items)
- {
- il = new List(m_items.Values);
- }
-
+ List il = new List(m_items.Values);
foreach (TaskInventoryItem i in il)
{
if (i.Name == item.Name)
@@ -576,9 +551,7 @@ namespace OpenSim.Region.Framework.Scenes
public TaskInventoryItem GetInventoryItem(UUID itemId)
{
TaskInventoryItem item;
-
- lock (m_items)
- m_items.TryGetValue(itemId, out item);
+ m_items.TryGetValue(itemId, out item);
return item;
}
@@ -904,61 +877,54 @@ namespace OpenSim.Region.Framework.Scenes
{
uint mask=0x7fffffff;
- lock (m_items)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
+ if (item.InvType != (int)InventoryType.Object)
{
- if (item.InvType != (int)InventoryType.Object)
- {
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
- mask &= ~((uint)PermissionMask.Copy >> 13);
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
- mask &= ~((uint)PermissionMask.Transfer >> 13);
- if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
- mask &= ~((uint)PermissionMask.Modify >> 13);
- }
- else
- {
- if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Copy >> 13);
- if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Transfer >> 13);
- if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
- mask &= ~((uint)PermissionMask.Modify >> 13);
- }
-
- if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
- mask &= ~(uint)PermissionMask.Copy;
- if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
- mask &= ~(uint)PermissionMask.Transfer;
- if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
- mask &= ~(uint)PermissionMask.Modify;
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Copy) == 0)
+ mask &= ~((uint)PermissionMask.Copy >> 13);
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Transfer) == 0)
+ mask &= ~((uint)PermissionMask.Transfer >> 13);
+ if ((item.CurrentPermissions & item.NextPermissions & (uint)PermissionMask.Modify) == 0)
+ mask &= ~((uint)PermissionMask.Modify >> 13);
+ }
+ else
+ {
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Copy >> 13);
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Transfer >> 13);
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
+ mask &= ~((uint)PermissionMask.Modify >> 13);
}
+
+ if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0)
+ mask &= ~(uint)PermissionMask.Copy;
+ if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)
+ mask &= ~(uint)PermissionMask.Transfer;
+ if ((item.CurrentPermissions & (uint)PermissionMask.Modify) == 0)
+ mask &= ~(uint)PermissionMask.Modify;
}
-
return mask;
}
public void ApplyNextOwnerPermissions()
{
- lock (m_items)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
+ if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
{
- if (item.InvType == (int)InventoryType.Object && (item.CurrentPermissions & 7) != 0)
- {
- if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
- if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
- item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
- item.CurrentPermissions |= 8;
- }
- item.CurrentPermissions &= item.NextPermissions;
- item.BasePermissions &= item.NextPermissions;
- item.EveryonePermissions &= item.NextPermissions;
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Copy >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Copy;
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Transfer >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Transfer;
+ if ((item.CurrentPermissions & ((uint)PermissionMask.Modify >> 13)) == 0)
+ item.CurrentPermissions &= ~(uint)PermissionMask.Modify;
+ item.CurrentPermissions |= 8;
}
+ item.CurrentPermissions &= item.NextPermissions;
+ item.BasePermissions &= item.NextPermissions;
+ item.EveryonePermissions &= item.NextPermissions;
}
m_part.TriggerScriptChangedEvent(Changed.OWNER);
@@ -966,29 +932,22 @@ namespace OpenSim.Region.Framework.Scenes
public void ApplyGodPermissions(uint perms)
{
- lock (m_items)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
- {
- item.CurrentPermissions = perms;
- item.BasePermissions = perms;
- }
+ item.CurrentPermissions = perms;
+ item.BasePermissions = perms;
}
}
public bool ContainsScripts()
{
- lock (m_items)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
+ if (item.InvType == (int)InventoryType.LSL)
{
- if (item.InvType == (int)InventoryType.LSL)
- {
- return true;
- }
+ return true;
}
}
-
return false;
}
@@ -996,11 +955,8 @@ namespace OpenSim.Region.Framework.Scenes
{
List ret = new List();
- lock (m_items)
- {
- foreach (TaskInventoryItem item in m_items.Values)
- ret.Add(item.ItemID);
- }
+ foreach (TaskInventoryItem item in m_items.Values)
+ ret.Add(item.ItemID);
return ret;
}
@@ -1013,30 +969,26 @@ namespace OpenSim.Region.Framework.Scenes
if (engines == null) // No engine at all
return ret;
- lock (m_items)
+ foreach (TaskInventoryItem item in m_items.Values)
{
- foreach (TaskInventoryItem item in m_items.Values)
+ if (item.InvType == (int)InventoryType.LSL)
{
- if (item.InvType == (int)InventoryType.LSL)
+ foreach (IScriptModule e in engines)
{
- foreach (IScriptModule e in engines)
+ if (e != null)
{
- if (e != null)
+ string n = e.GetXMLState(item.ItemID);
+ if (n != String.Empty)
{
- string n = e.GetXMLState(item.ItemID);
- if (n != String.Empty)
- {
- if (!ret.ContainsKey(item.ItemID))
- ret[item.ItemID] = n;
- break;
- }
+ if (!ret.ContainsKey(item.ItemID))
+ ret[item.ItemID] = n;
+ break;
}
}
}
}
}
-
return ret;
}
}
-}
\ No newline at end of file
+}
--
cgit v1.1