diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 264625d197..7bbb290892 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -321,7 +321,7 @@ namespace OpenSim.Framework.Servers
TimeSpan timeTaken = DateTime.Now - m_startuptime;
m_log.InfoFormat(
- "[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS.",
+ "[STARTUP]: Non-script portion of startup took {0}m {1}s. PLEASE WAIT FOR LOGINS TO BE ENABLED ON REGIONS ONCE SCRIPTS HAVE STARTED.",
timeTaken.Minutes, timeTaken.Seconds);
}
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
index 9d512c6249..3089351a69 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceEventArgs.cs
@@ -28,6 +28,7 @@
using System;
using System.Collections;
using OpenMetaverse;
+
namespace OpenSim.Framework.Servers.HttpServer
{
public delegate void RequestMethod(UUID requestID, Hashtable request);
@@ -44,7 +45,11 @@ namespace OpenSim.Framework.Servers.HttpServer
public NoEventsMethod NoEvents;
public RequestMethod Request;
public UUID Id;
- public PollServiceEventArgs(RequestMethod pRequest, HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,UUID pId)
+
+ public PollServiceEventArgs(
+ RequestMethod pRequest,
+ HasEventsMethod pHasEvents, GetEventsMethod pGetEvents, NoEventsMethod pNoEvents,
+ UUID pId)
{
Request = pRequest;
HasEvents = pHasEvents;
@@ -53,4 +58,4 @@ namespace OpenSim.Framework.Servers.HttpServer
Id = pId;
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
index 553a7eb123..723530ae15 100644
--- a/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
+++ b/OpenSim/Framework/Servers/HttpServer/PollServiceHttpRequest.cs
@@ -31,7 +31,6 @@ using OpenMetaverse;
namespace OpenSim.Framework.Servers.HttpServer
{
-
public class PollServiceHttpRequest
{
public readonly PollServiceEventArgs PollServiceArgs;
@@ -39,7 +38,9 @@ namespace OpenSim.Framework.Servers.HttpServer
public readonly IHttpRequest Request;
public readonly int RequestTime;
public readonly UUID RequestID;
- public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
+
+ public PollServiceHttpRequest(
+ PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
{
PollServiceArgs = pPollServiceArgs;
HttpContext = pHttpContext;
@@ -48,4 +49,4 @@ namespace OpenSim.Framework.Servers.HttpServer
RequestID = UUID.Random();
}
}
-}
+}
\ No newline at end of file
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
index c05ef3cdc7..54cff55aec 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs
@@ -198,31 +198,40 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
}
}
- public void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted)
+ public void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted)
{
-// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
-
if (!Enabled)
return;
- foreach (SceneObjectGroup grp in sp.GetAttachments())
+// m_log.DebugFormat("[ATTACHMENTS MODULE]: Saving changed attachments for {0}", sp.Name);
+
+ lock (sp.AttachmentsSyncLock)
{
- grp.IsAttachment = false;
- grp.AbsolutePosition = grp.RootPart.AttachedPos;
- UpdateKnownItem(sp, grp, saveAllScripted);
- grp.IsAttachment = true;
+ foreach (SceneObjectGroup grp in sp.GetAttachments())
+ {
+ grp.Scene.DeleteSceneObject(grp, false);
+
+ if (saveChanged || saveAllScripted)
+ {
+ grp.IsAttachment = false;
+ grp.AbsolutePosition = grp.RootPart.AttachedPos;
+ UpdateKnownItem(sp, grp, saveAllScripted);
+ }
+ }
+
+ sp.ClearAttachments();
}
}
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent)
{
-// m_log.DebugFormat(
-// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
-// m_scene.RegionInfo.RegionName, sp.Name, silent);
-
if (!Enabled)
return;
+// m_log.DebugFormat(
+// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
+// m_scene.RegionInfo.RegionName, sp.Name, silent);
+
foreach (SceneObjectGroup sop in sp.GetAttachments())
{
sop.Scene.DeleteSceneObject(sop, silent);
@@ -477,17 +486,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!Enabled)
return;
- // First we save the
- // attachment point information, then we update the relative
- // positioning. Then we have to mark the object as NOT an
- // attachment. This is necessary in order to correctly save
- // and retrieve GroupPosition information for the attachment.
- // Finally, we restore the object's attachment status.
- uint attachmentPoint = sog.AttachmentPoint;
sog.UpdateGroupPosition(pos);
- sog.IsAttachment = false;
- sog.AbsolutePosition = sog.RootPart.AttachedPos;
- sog.AttachmentPoint = attachmentPoint;
sog.HasGroupChanged = true;
}
@@ -770,6 +769,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group);
+ m_scene.DeleteSceneObject(group, false);
// Prepare sog for storage
group.AttachedAvatar = UUID.Zero;
@@ -778,7 +778,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
group.AbsolutePosition = group.RootPart.AttachedPos;
UpdateKnownItem(sp, group, true);
- m_scene.DeleteSceneObject(group, false);
return;
}
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
index acf0089848..8969006233 100644
--- a/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Attachments/Tests/AttachmentsModuleTests.cs
@@ -58,6 +58,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
private AttachmentsModule m_attMod;
private ScenePresence m_presence;
+ ///
+ /// Standard user ID
+ ///
+ private UUID m_userId = TestHelpers.ParseTail(0x1);
+
+// ///
+// /// Standard attachment item ID
+// ///
+// private UUID m_attItemId = TestHelpers.ParseTail(0x10);
+//
+// ///
+// /// Standard attachment asset ID
+// ///
+// private UUID m_attAssetId = TestHelpers.ParseTail(0x11);
+
[TestFixtureSetUp]
public void FixtureInit()
{
@@ -86,13 +101,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
}
///
- /// Add the standard presence for a test.
+ /// Creates an attachment item in the given user's inventory. Does not attach.
///
- private void AddPresence()
+ ///
+ /// A user with the given ID and an inventory must already exist.
+ ///
+ ///
+ /// The attachment item.
+ ///
+ ///
+ ///
+ ///
+ ///
+ private InventoryItemBase CreateAttachmentItem(UUID userId, string attName, int rawItemId, int rawAssetId)
{
- UUID userId = TestHelpers.ParseTail(0x1);
- UserAccountHelpers.CreateUserWithInventory(scene, userId);
- m_presence = SceneHelpers.AddScenePresence(scene, userId);
+ return UserInventoryHelpers.CreateInventoryItem(
+ scene,
+ attName,
+ TestHelpers.ParseTail(rawItemId),
+ TestHelpers.ParseTail(rawAssetId),
+ userId,
+ InventoryType.Object);
}
[Test]
@@ -101,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// TestHelpers.EnableLogging();
- AddPresence();
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
+
string attName = "att";
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup;
@@ -140,24 +171,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- AddPresence();
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- UUID attItemId = TestHelpers.ParseTail(0x2);
- UUID attAssetId = TestHelpers.ParseTail(0x3);
- string attName = "att";
-
- UserInventoryHelpers.CreateInventoryItem(
- scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItemId, (uint)AttachmentPoint.Chest);
+ m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
// Check scene presence status
Assert.That(m_presence.HasAttachments(), Is.True);
List attachments = m_presence.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
- Assert.That(attSo.Name, Is.EqualTo(attName));
+ Assert.That(attSo.Name, Is.EqualTo(attItem.Name));
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
@@ -165,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Check appearance status
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1));
- Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
+ Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
}
[Test]
@@ -174,17 +201,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- AddPresence();
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- UUID attItemId = TestHelpers.ParseTail(0x2);
- UUID attAssetId = TestHelpers.ParseTail(0x3);
- string attName = "att";
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
- UserInventoryHelpers.CreateInventoryItem(
- scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
-
- ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItemId, (uint)AttachmentPoint.Chest);
+ ISceneEntity so
+ = m_attMod.RezSingleAttachmentFromInventory(
+ m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId);
// Check scene presence status
@@ -196,7 +220,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0));
// Check item status
- Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItemId)), Is.Null);
+ Assert.That(scene.InventoryService.GetItem(new InventoryItemBase(attItem.ID)), Is.Null);
// Check object in scene
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
@@ -208,18 +232,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- AddPresence();
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
- UUID attItemId = TestHelpers.ParseTail(0x2);
- UUID attAssetId = TestHelpers.ParseTail(0x3);
- string attName = "att";
-
- UserInventoryHelpers.CreateInventoryItem(
- scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
m_attMod.RezSingleAttachmentFromInventory(
- m_presence, attItemId, (uint)AttachmentPoint.Chest);
- m_attMod.DetachSingleAttachmentToInv(m_presence, attItemId);
+ m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
+ m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID);
// Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.False);
@@ -227,7 +247,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attachments.Count, Is.EqualTo(0));
// Check item status
- Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0));
+ Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
}
///
@@ -239,17 +259,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- UUID userId = TestHelpers.ParseTail(0x1);
- UUID attItemId = TestHelpers.ParseTail(0x2);
- UUID attAssetId = TestHelpers.ParseTail(0x3);
- string attName = "att";
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
- UserAccountHelpers.CreateUserWithInventory(scene, userId);
- InventoryItemBase attItem
- = UserInventoryHelpers.CreateInventoryItem(
- scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
-
- AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@@ -268,17 +281,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure();
- UUID userId = TestHelpers.ParseTail(0x1);
- UUID attItemId = TestHelpers.ParseTail(0x2);
- UUID attAssetId = TestHelpers.ParseTail(0x3);
- string attName = "att";
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
- UserAccountHelpers.CreateUserWithInventory(scene, userId);
- InventoryItemBase attItem
- = UserInventoryHelpers.CreateInventoryItem(
- scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
-
- AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@@ -288,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0];
- Assert.That(attSo.Name, Is.EqualTo(attName));
+ Assert.That(attSo.Name, Is.EqualTo(attItem.Name));
Assert.That(attSo.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False);
@@ -298,9 +304,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
List retreivedAttachments = presence.Appearance.GetAttachments();
Assert.That(retreivedAttachments.Count, Is.EqualTo(1));
Assert.That(retreivedAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
- Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItemId));
- Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attAssetId));
- Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest));
+ Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID));
+ Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
+ Assert.That(presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo((int)AttachmentPoint.Chest));
+ }
+
+ [Test]
+ public void TestUpdateAttachmentPosition()
+ {
+ TestHelpers.InMethod();
+
+ UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
+ InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
+
+ AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
+ acd.Appearance = new AvatarAppearance();
+ acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
+ ScenePresence sp = SceneHelpers.AddScenePresence(scene, acd);
+
+ SceneObjectGroup attSo = sp.GetAttachments()[0];
+
+ Vector3 newPosition = new Vector3(1, 2, 4);
+
+ scene.SceneGraph.UpdatePrimGroupPosition(attSo.LocalId, newPosition, sp.ControllingClient);
+
+ Assert.That(attSo.AbsolutePosition, Is.EqualTo(sp.AbsolutePosition));
+ Assert.That(attSo.RootPart.AttachedPos, Is.EqualTo(newPosition));
}
// I'm commenting this test because scene setup NEEDS InventoryService to
diff --git a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
index 0516cb134a..70ea7cfe80 100644
--- a/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAttachmentsModule.cs
@@ -44,10 +44,15 @@ namespace OpenSim.Region.Framework.Interfaces
void RezAttachments(IScenePresence sp);
///
- /// Save the attachments that have change on this presence.
+ /// Derez the attachements for a scene presence that is closing.
///
- ///
- void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted);
+ ///
+ /// Attachment changes are saved.
+ ///
+ /// The presence closing
+ /// Save changed attachments.
+ /// Save attachments with scripts even if they haven't changed.
+ void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted);
///
/// Delete all the presence's attachments from the scene
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 143af48d99..42dbedcd56 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// The item ID of the script.
bool GetScriptState(UUID itemID);
+ void SetRunEnable(UUID instanceID, bool enable);
+
void SaveAllState();
///
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 98b8fccb4a..9776a82403 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2298,10 +2298,24 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null)
return;
+ IScriptModule[] engines = RequestModuleInterfaces();
+
if (running)
+ {
+ foreach (IScriptModule engine in engines)
+ {
+ engine.SetRunEnable(itemID, true);
+ }
EventManager.TriggerStartScript(part.LocalId, itemID);
+ }
else
+ {
+ foreach (IScriptModule engine in engines)
+ {
+ engine.SetRunEnable(itemID, false);
+ }
EventManager.TriggerStopScript(part.LocalId, itemID);
+ }
}
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 757ac9ff1f..8591b09e2e 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -522,6 +522,7 @@ namespace OpenSim.Region.Framework.Scenes
public IAttachmentsModule AttachmentsModule { get; set; }
public IEntityTransferModule EntityTransferModule { get; private set; }
public IAgentAssetTransactions AgentTransactionsModule { get; private set; }
+ public IUserManagement UserManagementModule { get; private set; }
public IAvatarFactoryModule AvatarFactory
{
@@ -1291,6 +1292,7 @@ namespace OpenSim.Region.Framework.Scenes
EntityTransferModule = RequestModuleInterface();
m_groupsModule = RequestModuleInterface();
AgentTransactionsModule = RequestModuleInterface();
+ UserManagementModule = RequestModuleInterface();
}
#endregion
@@ -2094,9 +2096,8 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.SetGroup(groupID, null);
}
- IUserManagement uman = RequestModuleInterface();
- if (uman != null)
- sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID);
+ if (UserManagementModule != null)
+ sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
sceneObject.ScheduleGroupForFullUpdate();
@@ -2855,14 +2856,13 @@ namespace OpenSim.Region.Framework.Scenes
///
private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
{
- IUserManagement uMan = RequestModuleInterface();
- if (uMan != null)
+ if (UserManagementModule != null)
{
string first = aCircuit.firstname, last = aCircuit.lastname;
if (sp.PresenceType == PresenceType.Npc)
{
- uMan.AddUser(aCircuit.AgentID, first, last);
+ UserManagementModule.AddUser(aCircuit.AgentID, first, last);
}
else
{
@@ -2881,7 +2881,7 @@ namespace OpenSim.Region.Framework.Scenes
}
}
- uMan.AddUser(aCircuit.AgentID, first, last, homeURL);
+ UserManagementModule.AddUser(aCircuit.AgentID, first, last, homeURL);
}
}
}
@@ -3445,17 +3445,19 @@ namespace OpenSim.Region.Framework.Scenes
if (!isChildAgent)
{
- if (AttachmentsModule != null && avatar.PresenceType != PresenceType.Npc)
+ if (AttachmentsModule != null)
{
- IUserManagement uMan = RequestModuleInterface();
// Don't save attachments for HG visitors, it
// messes up their inventory. When a HG visitor logs
// out on a foreign grid, their attachments will be
// reloaded in the state they were in when they left
// the home grid. This is best anyway as the visited
// grid may use an incompatible script engine.
- if (uMan == null || uMan.IsLocalGridUser(avatar.UUID))
- AttachmentsModule.SaveChangedAttachments(avatar, false);
+ bool saveChanged
+ = avatar.PresenceType != PresenceType.Npc
+ && (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
+
+ AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
}
ForEachClient(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index 88afee7217..11d703a260 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3640,6 +3640,11 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.AddPhysicsActorTaint(actor);
}
+ if (IsAttachment)
+ {
+ m_rootPart.AttachedPos = pos;
+ }
+
AbsolutePosition = pos;
HasGroupChanged = true;
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 1fc9790d5b..f3e8377ffd 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -3606,9 +3606,6 @@ namespace OpenSim.Region.Framework.Scenes
public void Close()
{
- if (!IsChildAgent && m_scene.AttachmentsModule != null)
- m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
-
// Clear known regions
KnownRegions = new Dictionary();
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
index 453e077c8a..81add43062 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectBasicTests.cs
@@ -187,8 +187,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene();
SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
+
+ Assert.That(part.ParentGroup.IsDeleted, Is.False);
+
scene.DeleteSceneObject(part.ParentGroup, false);
+ Assert.That(part.ParentGroup.IsDeleted, Is.True);
+
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null);
}
@@ -219,8 +224,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(retrievedPart, Is.Not.Null);
+ Assert.That(part.ParentGroup.IsDeleted, Is.False);
+
sogd.InventoryDeQueueAndDelete();
+ Assert.That(part.ParentGroup.IsDeleted, Is.True);
+
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart2, Is.Null);
}
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index b04f6b6624..ec13b6cc01 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -63,6 +63,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
///
bool Running { get; set; }
+ ///
+ /// Gets or sets a value indicating whether this
+ /// is run.
+ /// For viewer script editor control
+ ///
+ ///
+ /// true if run; otherwise, false.
+ ///
+ bool Run { get; set; }
+
///
/// Is the script suspended?
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 1c59d4511c..3797683ee8 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -121,6 +121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Running { get; set; }
+ public bool Run { get; set; }
+
public bool Suspended
{
get { return m_Suspended; }
@@ -216,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_postOnRez = postOnRez;
m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
+ Run = true;
if (part != null)
{
@@ -330,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
- m_log.ErrorFormat(
- "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}: Memory limit exceeded",
- assembly);
+ m_log.WarnFormat(
+ "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded",
+ savedState, ScriptName, ItemID, PrimName, ObjectID, assembly);
}
}
catch (Exception e)
{
m_log.ErrorFormat(
- "[SCRIPT INSTANCE]: Unable to load script state from assembly {0}. XML is {1}. Exception {2}{3}",
- assembly, xml, e.Message, e.StackTrace);
+ "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). XML is {6}. Exception {7}{8}",
+ savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace);
}
}
// else
@@ -354,10 +357,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Init()
{
- if (!m_startOnInit) return;
+ if (!m_startOnInit)
+ return;
if (m_startedFromSavedState)
{
+ if (!Run)
+ return;
+
Start();
if (m_postOnRez)
{
@@ -390,6 +397,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
else
{
+ if (!Run)
+ return;
+
Start();
PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0]));
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
index bcdc7bf5dd..797bce3ce1 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptSerializer.cs
@@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public static string Serialize(ScriptInstance instance)
{
bool running = instance.Running;
+ bool enabled = instance.Run;
XmlDocument xmldoc = new XmlDocument();
@@ -77,6 +78,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
rootElement.AppendChild(run);
+ XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
+ run_enable.AppendChild(xmldoc.CreateTextNode(
+ enabled.ToString()));
+
+ rootElement.AppendChild(run_enable);
+
Dictionary vars = instance.GetVars();
XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@@ -225,6 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
object varValue;
XmlNodeList partL = rootNode.ChildNodes;
+ instance.Run = true;
foreach (XmlNode part in partL)
{
@@ -236,6 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
case "Running":
instance.Running=bool.Parse(part.InnerText);
break;
+ case "Run":
+ instance.Run = bool.Parse(part.InnerText);
+ break;
case "Variables":
XmlNodeList varL = part.ChildNodes;
foreach (XmlNode var in varL)
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 01021c9c9e..b1583b28b7 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -920,15 +920,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
if (m_InitialStartup)
{
- m_InitialStartup = false;
+ // This delay exists to stop mono problems where script compilation and startup would stop the sim
+ // working properly for the session.
System.Threading.Thread.Sleep(15000);
-
- if (m_CompileQueue.Count == 0)
- {
- // No scripts on region, so won't get triggered later
- // by the queue becoming empty so we trigger it here
- m_Scene.EventManager.TriggerEmptyScriptCompileQueue(0, String.Empty);
- }
}
object[] o;
@@ -941,14 +935,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{
scriptsStarted++;
-// if (scriptsStarted % 50 == 0)
-// m_log.DebugFormat(
-// "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
+ if (m_InitialStartup)
+ if (scriptsStarted % 50 == 0)
+ m_log.InfoFormat(
+ "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
}
}
-// m_log.DebugFormat(
-// "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
+ if (m_InitialStartup)
+ m_log.InfoFormat(
+ "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
// NOTE: Despite having a lockless queue, this lock is required
// to make sure there is never no compile thread while there
@@ -956,12 +952,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
// due to a race condition
//
lock (m_CompileQueue)
- {
m_CurrentCompile = null;
- }
+
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
m_ScriptErrorMessage);
+
m_ScriptFailCount = 0;
+ m_InitialStartup = false;
return null;
}
@@ -1451,24 +1448,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false;
uuids = m_PrimObjects[localID];
-
- foreach (UUID itemID in uuids)
- {
- IScriptInstance instance = null;
- try
+ foreach (UUID itemID in uuids)
{
- if (m_Scripts.ContainsKey(itemID))
- instance = m_Scripts[itemID];
+ IScriptInstance instance = null;
+ try
+ {
+ if (m_Scripts.ContainsKey(itemID))
+ instance = m_Scripts[itemID];
+ }
+ catch { /* ignore race conditions */ }
+
+ if (instance != null)
+ {
+ instance.PostEvent(p);
+ result = true;
+ }
}
- catch { /* ignore race conditions */ }
-
- if (instance != null)
- {
- instance.PostEvent(p);
- result = true;
- }
- }
}
return result;
@@ -1594,6 +1590,13 @@ namespace OpenSim.Region.ScriptEngine.XEngine
}
}
+ public void SetRunEnable(UUID instanceID, bool enable)
+ {
+ IScriptInstance instance = GetInstance(instanceID);
+ if (instance != null)
+ instance.Run = enable;
+ }
+
public bool GetScriptState(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
diff --git a/bin/OpenSim.exe.config b/bin/OpenSim.exe.config
index f1e3709688..e3107abc87 100755
--- a/bin/OpenSim.exe.config
+++ b/bin/OpenSim.exe.config
@@ -33,7 +33,7 @@
-
+