Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
	OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
	OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
avinationmerge
Melanie 2012-06-26 17:35:55 +01:00
commit 7cc5b3d7d3
17 changed files with 245 additions and 143 deletions

View File

@ -321,7 +321,7 @@ namespace OpenSim.Framework.Servers
TimeSpan timeTaken = DateTime.Now - m_startuptime; TimeSpan timeTaken = DateTime.Now - m_startuptime;
m_log.InfoFormat( 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); timeTaken.Minutes, timeTaken.Seconds);
} }

View File

@ -28,6 +28,7 @@
using System; using System;
using System.Collections; using System.Collections;
using OpenMetaverse; using OpenMetaverse;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
public delegate void RequestMethod(UUID requestID, Hashtable request); public delegate void RequestMethod(UUID requestID, Hashtable request);
@ -44,7 +45,11 @@ namespace OpenSim.Framework.Servers.HttpServer
public NoEventsMethod NoEvents; public NoEventsMethod NoEvents;
public RequestMethod Request; public RequestMethod Request;
public UUID Id; 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; Request = pRequest;
HasEvents = pHasEvents; HasEvents = pHasEvents;
@ -53,4 +58,4 @@ namespace OpenSim.Framework.Servers.HttpServer
Id = pId; Id = pId;
} }
} }
} }

View File

@ -31,7 +31,6 @@ using OpenMetaverse;
namespace OpenSim.Framework.Servers.HttpServer namespace OpenSim.Framework.Servers.HttpServer
{ {
public class PollServiceHttpRequest public class PollServiceHttpRequest
{ {
public readonly PollServiceEventArgs PollServiceArgs; public readonly PollServiceEventArgs PollServiceArgs;
@ -39,7 +38,9 @@ namespace OpenSim.Framework.Servers.HttpServer
public readonly IHttpRequest Request; public readonly IHttpRequest Request;
public readonly int RequestTime; public readonly int RequestTime;
public readonly UUID RequestID; public readonly UUID RequestID;
public PollServiceHttpRequest(PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
public PollServiceHttpRequest(
PollServiceEventArgs pPollServiceArgs, IHttpClientContext pHttpContext, IHttpRequest pRequest)
{ {
PollServiceArgs = pPollServiceArgs; PollServiceArgs = pPollServiceArgs;
HttpContext = pHttpContext; HttpContext = pHttpContext;
@ -48,4 +49,4 @@ namespace OpenSim.Framework.Servers.HttpServer
RequestID = UUID.Random(); RequestID = UUID.Random();
} }
} }
} }

View File

@ -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) if (!Enabled)
return; 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; foreach (SceneObjectGroup grp in sp.GetAttachments())
grp.AbsolutePosition = grp.RootPart.AttachedPos; {
UpdateKnownItem(sp, grp, saveAllScripted); grp.Scene.DeleteSceneObject(grp, false);
grp.IsAttachment = true;
if (saveChanged || saveAllScripted)
{
grp.IsAttachment = false;
grp.AbsolutePosition = grp.RootPart.AttachedPos;
UpdateKnownItem(sp, grp, saveAllScripted);
}
}
sp.ClearAttachments();
} }
} }
public void DeleteAttachmentsFromScene(IScenePresence sp, bool silent) 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) if (!Enabled)
return; 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()) foreach (SceneObjectGroup sop in sp.GetAttachments())
{ {
sop.Scene.DeleteSceneObject(sop, silent); sop.Scene.DeleteSceneObject(sop, silent);
@ -477,17 +486,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!Enabled) if (!Enabled)
return; 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.UpdateGroupPosition(pos);
sog.IsAttachment = false;
sog.AbsolutePosition = sog.RootPart.AttachedPos;
sog.AttachmentPoint = attachmentPoint;
sog.HasGroupChanged = true; sog.HasGroupChanged = true;
} }
@ -770,6 +769,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
{ {
m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero); m_scene.EventManager.TriggerOnAttach(group.LocalId, itemID, UUID.Zero);
sp.RemoveAttachment(group); sp.RemoveAttachment(group);
m_scene.DeleteSceneObject(group, false);
// Prepare sog for storage // Prepare sog for storage
group.AttachedAvatar = UUID.Zero; group.AttachedAvatar = UUID.Zero;
@ -778,7 +778,6 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
group.AbsolutePosition = group.RootPart.AttachedPos; group.AbsolutePosition = group.RootPart.AttachedPos;
UpdateKnownItem(sp, group, true); UpdateKnownItem(sp, group, true);
m_scene.DeleteSceneObject(group, false);
return; return;
} }

View File

@ -58,6 +58,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
private AttachmentsModule m_attMod; private AttachmentsModule m_attMod;
private ScenePresence m_presence; private ScenePresence m_presence;
/// <summary>
/// Standard user ID
/// </summary>
private UUID m_userId = TestHelpers.ParseTail(0x1);
// /// <summary>
// /// Standard attachment item ID
// /// </summary>
// private UUID m_attItemId = TestHelpers.ParseTail(0x10);
//
// /// <summary>
// /// Standard attachment asset ID
// /// </summary>
// private UUID m_attAssetId = TestHelpers.ParseTail(0x11);
[TestFixtureSetUp] [TestFixtureSetUp]
public void FixtureInit() public void FixtureInit()
{ {
@ -86,13 +101,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
} }
/// <summary> /// <summary>
/// Add the standard presence for a test. /// Creates an attachment item in the given user's inventory. Does not attach.
/// </summary> /// </summary>
private void AddPresence() /// <remarks>
/// A user with the given ID and an inventory must already exist.
/// </remarks>
/// <returns>
/// The attachment item.
/// </returns>
/// <param name='userId'></param>
/// <param name='attName'></param>
/// <param name='rawItemId'></param>
/// <param name='rawAssetId'></param>
private InventoryItemBase CreateAttachmentItem(UUID userId, string attName, int rawItemId, int rawAssetId)
{ {
UUID userId = TestHelpers.ParseTail(0x1); return UserInventoryHelpers.CreateInventoryItem(
UserAccountHelpers.CreateUserWithInventory(scene, userId); scene,
m_presence = SceneHelpers.AddScenePresence(scene, userId); attName,
TestHelpers.ParseTail(rawItemId),
TestHelpers.ParseTail(rawAssetId),
userId,
InventoryType.Object);
} }
[Test] [Test]
@ -101,7 +130,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// TestHelpers.EnableLogging(); // TestHelpers.EnableLogging();
AddPresence(); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
string attName = "att"; string attName = "att";
SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup; SceneObjectGroup so = SceneHelpers.AddSceneObject(scene, attName, m_presence.UUID).ParentGroup;
@ -140,24 +171,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
AddPresence(); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
UUID attItemId = TestHelpers.ParseTail(0x2); InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
m_attMod.RezSingleAttachmentFromInventory( m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItemId, (uint)AttachmentPoint.Chest); m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
// Check scene presence status // Check scene presence status
Assert.That(m_presence.HasAttachments(), Is.True); Assert.That(m_presence.HasAttachments(), Is.True);
List<SceneObjectGroup> attachments = m_presence.GetAttachments(); List<SceneObjectGroup> attachments = m_presence.GetAttachments();
Assert.That(attachments.Count, Is.EqualTo(1)); Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0]; 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.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment); Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False); Assert.That(attSo.UsesPhysics, Is.False);
@ -165,7 +192,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
// Check appearance status // Check appearance status
Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(1)); 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] [Test]
@ -174,17 +201,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
AddPresence(); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
UUID attItemId = TestHelpers.ParseTail(0x2); InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserInventoryHelpers.CreateInventoryItem( ISceneEntity so
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object); = m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
ISceneEntity so = m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItemId, (uint)AttachmentPoint.Chest);
m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId); m_attMod.DetachSingleAttachmentToGround(m_presence, so.LocalId);
// Check scene presence status // 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)); Assert.That(m_presence.Appearance.GetAttachments().Count, Is.EqualTo(0));
// Check item status // 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 // Check object in scene
Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null); Assert.That(scene.GetSceneObjectGroup("att"), Is.Not.Null);
@ -208,18 +232,14 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
AddPresence(); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
m_presence = SceneHelpers.AddScenePresence(scene, m_userId);
UUID attItemId = TestHelpers.ParseTail(0x2); InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, m_presence.UUID, InventoryType.Object);
m_attMod.RezSingleAttachmentFromInventory( m_attMod.RezSingleAttachmentFromInventory(
m_presence, attItemId, (uint)AttachmentPoint.Chest); m_presence, attItem.ID, (uint)AttachmentPoint.Chest);
m_attMod.DetachSingleAttachmentToInv(m_presence, attItemId); m_attMod.DetachSingleAttachmentToInv(m_presence, attItem.ID);
// Check status on scene presence // Check status on scene presence
Assert.That(m_presence.HasAttachments(), Is.False); 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)); Assert.That(attachments.Count, Is.EqualTo(0));
// Check item status // Check item status
Assert.That(m_presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo(0)); Assert.That(m_presence.Appearance.GetAttachpoint(attItem.ID), Is.EqualTo(0));
} }
/// <summary> /// <summary>
@ -239,17 +259,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
UUID attItemId = TestHelpers.ParseTail(0x2); InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserAccountHelpers.CreateUserWithInventory(scene, userId); AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
InventoryItemBase attItem
= UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
acd.Appearance = new AvatarAppearance(); acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@ -268,17 +281,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
TestHelpers.InMethod(); TestHelpers.InMethod();
// log4net.Config.XmlConfigurator.Configure(); // log4net.Config.XmlConfigurator.Configure();
UUID userId = TestHelpers.ParseTail(0x1); UserAccountHelpers.CreateUserWithInventory(scene, m_userId);
UUID attItemId = TestHelpers.ParseTail(0x2); InventoryItemBase attItem = CreateAttachmentItem(m_userId, "att", 0x10, 0x20);
UUID attAssetId = TestHelpers.ParseTail(0x3);
string attName = "att";
UserAccountHelpers.CreateUserWithInventory(scene, userId); AgentCircuitData acd = SceneHelpers.GenerateAgentData(m_userId);
InventoryItemBase attItem
= UserInventoryHelpers.CreateInventoryItem(
scene, attName, attItemId, attAssetId, userId, InventoryType.Object);
AgentCircuitData acd = SceneHelpers.GenerateAgentData(userId);
acd.Appearance = new AvatarAppearance(); acd.Appearance = new AvatarAppearance();
acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID); acd.Appearance.SetAttachment((int)AttachmentPoint.Chest, attItem.ID, attItem.AssetID);
ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd); ScenePresence presence = SceneHelpers.AddScenePresence(scene, acd);
@ -288,7 +294,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
Assert.That(attachments.Count, Is.EqualTo(1)); Assert.That(attachments.Count, Is.EqualTo(1));
SceneObjectGroup attSo = attachments[0]; 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.AttachmentPoint, Is.EqualTo((byte)AttachmentPoint.Chest));
Assert.That(attSo.IsAttachment); Assert.That(attSo.IsAttachment);
Assert.That(attSo.UsesPhysics, Is.False); Assert.That(attSo.UsesPhysics, Is.False);
@ -298,9 +304,32 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments(); List<AvatarAttachment> retreivedAttachments = presence.Appearance.GetAttachments();
Assert.That(retreivedAttachments.Count, Is.EqualTo(1)); Assert.That(retreivedAttachments.Count, Is.EqualTo(1));
Assert.That(retreivedAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest)); Assert.That(retreivedAttachments[0].AttachPoint, Is.EqualTo((int)AttachmentPoint.Chest));
Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItemId)); Assert.That(retreivedAttachments[0].ItemID, Is.EqualTo(attItem.ID));
Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attAssetId)); Assert.That(retreivedAttachments[0].AssetID, Is.EqualTo(attItem.AssetID));
Assert.That(presence.Appearance.GetAttachpoint(attItemId), Is.EqualTo((int)AttachmentPoint.Chest)); 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 // I'm commenting this test because scene setup NEEDS InventoryService to

View File

@ -44,10 +44,15 @@ namespace OpenSim.Region.Framework.Interfaces
void RezAttachments(IScenePresence sp); void RezAttachments(IScenePresence sp);
/// <summary> /// <summary>
/// Save the attachments that have change on this presence. /// Derez the attachements for a scene presence that is closing.
/// </summary> /// </summary>
/// <param name="sp"></param> /// <remarks>
void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted); /// Attachment changes are saved.
/// </remarks>
/// <param name="sp">The presence closing</param>
/// <param name="saveChanged">Save changed attachments.</param>
/// <param name="saveAllScripted">Save attachments with scripts even if they haven't changed.</para>
void DeRezAttachments(IScenePresence sp, bool saveChanged, bool saveAllScripted);
/// <summary> /// <summary>
/// Delete all the presence's attachments from the scene /// Delete all the presence's attachments from the scene

View File

@ -77,6 +77,8 @@ namespace OpenSim.Region.Framework.Interfaces
/// <param name="itemID">The item ID of the script.</param> /// <param name="itemID">The item ID of the script.</param>
bool GetScriptState(UUID itemID); bool GetScriptState(UUID itemID);
void SetRunEnable(UUID instanceID, bool enable);
void SaveAllState(); void SaveAllState();
/// <summary> /// <summary>

View File

@ -2298,10 +2298,24 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null) if (part == null)
return; return;
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
if (running) if (running)
{
foreach (IScriptModule engine in engines)
{
engine.SetRunEnable(itemID, true);
}
EventManager.TriggerStartScript(part.LocalId, itemID); EventManager.TriggerStartScript(part.LocalId, itemID);
}
else else
{
foreach (IScriptModule engine in engines)
{
engine.SetRunEnable(itemID, false);
}
EventManager.TriggerStopScript(part.LocalId, itemID); EventManager.TriggerStopScript(part.LocalId, itemID);
}
} }
public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID) public void GetScriptRunning(IClientAPI controllingClient, UUID objectID, UUID itemID)

View File

@ -522,6 +522,7 @@ namespace OpenSim.Region.Framework.Scenes
public IAttachmentsModule AttachmentsModule { get; set; } public IAttachmentsModule AttachmentsModule { get; set; }
public IEntityTransferModule EntityTransferModule { get; private set; } public IEntityTransferModule EntityTransferModule { get; private set; }
public IAgentAssetTransactions AgentTransactionsModule { get; private set; } public IAgentAssetTransactions AgentTransactionsModule { get; private set; }
public IUserManagement UserManagementModule { get; private set; }
public IAvatarFactoryModule AvatarFactory public IAvatarFactoryModule AvatarFactory
{ {
@ -1291,6 +1292,7 @@ namespace OpenSim.Region.Framework.Scenes
EntityTransferModule = RequestModuleInterface<IEntityTransferModule>(); EntityTransferModule = RequestModuleInterface<IEntityTransferModule>();
m_groupsModule = RequestModuleInterface<IGroupsModule>(); m_groupsModule = RequestModuleInterface<IGroupsModule>();
AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>(); AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>();
UserManagementModule = RequestModuleInterface<IUserManagement>();
} }
#endregion #endregion
@ -2094,9 +2096,8 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.SetGroup(groupID, null); sceneObject.SetGroup(groupID, null);
} }
IUserManagement uman = RequestModuleInterface<IUserManagement>(); if (UserManagementModule != null)
if (uman != null) sceneObject.RootPart.CreatorIdentification = UserManagementModule.GetUserUUI(ownerID);
sceneObject.RootPart.CreatorIdentification = uman.GetUserUUI(ownerID);
sceneObject.ScheduleGroupForFullUpdate(); sceneObject.ScheduleGroupForFullUpdate();
@ -2855,14 +2856,13 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="aCircuit"></param> /// <param name="aCircuit"></param>
private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit) private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
{ {
IUserManagement uMan = RequestModuleInterface<IUserManagement>(); if (UserManagementModule != null)
if (uMan != null)
{ {
string first = aCircuit.firstname, last = aCircuit.lastname; string first = aCircuit.firstname, last = aCircuit.lastname;
if (sp.PresenceType == PresenceType.Npc) if (sp.PresenceType == PresenceType.Npc)
{ {
uMan.AddUser(aCircuit.AgentID, first, last); UserManagementModule.AddUser(aCircuit.AgentID, first, last);
} }
else 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 (!isChildAgent)
{ {
if (AttachmentsModule != null && avatar.PresenceType != PresenceType.Npc) if (AttachmentsModule != null)
{ {
IUserManagement uMan = RequestModuleInterface<IUserManagement>();
// Don't save attachments for HG visitors, it // Don't save attachments for HG visitors, it
// messes up their inventory. When a HG visitor logs // messes up their inventory. When a HG visitor logs
// out on a foreign grid, their attachments will be // out on a foreign grid, their attachments will be
// reloaded in the state they were in when they left // reloaded in the state they were in when they left
// the home grid. This is best anyway as the visited // the home grid. This is best anyway as the visited
// grid may use an incompatible script engine. // grid may use an incompatible script engine.
if (uMan == null || uMan.IsLocalGridUser(avatar.UUID)) bool saveChanged
AttachmentsModule.SaveChangedAttachments(avatar, false); = avatar.PresenceType != PresenceType.Npc
&& (UserManagementModule == null || UserManagementModule.IsLocalGridUser(avatar.UUID));
AttachmentsModule.DeRezAttachments(avatar, saveChanged, false);
} }
ForEachClient( ForEachClient(

View File

@ -3640,6 +3640,11 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.PhysicsScene.AddPhysicsActorTaint(actor); m_scene.PhysicsScene.AddPhysicsActorTaint(actor);
} }
if (IsAttachment)
{
m_rootPart.AttachedPos = pos;
}
AbsolutePosition = pos; AbsolutePosition = pos;
HasGroupChanged = true; HasGroupChanged = true;

View File

@ -3606,9 +3606,6 @@ namespace OpenSim.Region.Framework.Scenes
public void Close() public void Close()
{ {
if (!IsChildAgent && m_scene.AttachmentsModule != null)
m_scene.AttachmentsModule.DeleteAttachmentsFromScene(this, false);
// Clear known regions // Clear known regions
KnownRegions = new Dictionary<ulong, string>(); KnownRegions = new Dictionary<ulong, string>();

View File

@ -187,8 +187,13 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestScene scene = new SceneHelpers().SetupScene(); TestScene scene = new SceneHelpers().SetupScene();
SceneObjectPart part = SceneHelpers.AddSceneObject(scene); SceneObjectPart part = SceneHelpers.AddSceneObject(scene);
Assert.That(part.ParentGroup.IsDeleted, Is.False);
scene.DeleteSceneObject(part.ParentGroup, false); scene.DeleteSceneObject(part.ParentGroup, false);
Assert.That(part.ParentGroup.IsDeleted, Is.True);
SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId); SceneObjectPart retrievedPart = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart, Is.Null); Assert.That(retrievedPart, Is.Null);
} }
@ -219,8 +224,12 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(retrievedPart, Is.Not.Null); Assert.That(retrievedPart, Is.Not.Null);
Assert.That(part.ParentGroup.IsDeleted, Is.False);
sogd.InventoryDeQueueAndDelete(); sogd.InventoryDeQueueAndDelete();
Assert.That(part.ParentGroup.IsDeleted, Is.True);
SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId); SceneObjectPart retrievedPart2 = scene.GetSceneObjectPart(part.LocalId);
Assert.That(retrievedPart2, Is.Null); Assert.That(retrievedPart2, Is.Null);
} }

View File

@ -63,6 +63,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary> /// </summary>
bool Running { get; set; } bool Running { get; set; }
/// <summary>
/// Gets or sets a value indicating whether this
/// <see cref="OpenSim.Region.ScriptEngine.Interfaces.IScriptInstance"/> is run.
/// For viewer script editor control
/// </summary>
/// <value>
/// <c>true</c> if run; otherwise, <c>false</c>.
/// </value>
bool Run { get; set; }
/// <summary> /// <summary>
/// Is the script suspended? /// Is the script suspended?
/// </summary> /// </summary>

View File

@ -121,6 +121,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public bool Running { get; set; } public bool Running { get; set; }
public bool Run { get; set; }
public bool Suspended public bool Suspended
{ {
get { return m_Suspended; } get { return m_Suspended; }
@ -216,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_postOnRez = postOnRez; m_postOnRez = postOnRez;
m_AttachedAvatar = part.ParentGroup.AttachedAvatar; m_AttachedAvatar = part.ParentGroup.AttachedAvatar;
m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID; m_RegionID = part.ParentGroup.Scene.RegionInfo.RegionID;
Run = true;
if (part != null) if (part != null)
{ {
@ -330,16 +333,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else else
{ {
m_log.ErrorFormat( m_log.WarnFormat(
"[SCRIPT INSTANCE]: Unable to load script state from assembly {0}: Memory limit exceeded", "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). Memory limit exceeded",
assembly); savedState, ScriptName, ItemID, PrimName, ObjectID, assembly);
} }
} }
catch (Exception e) catch (Exception e)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[SCRIPT INSTANCE]: Unable to load script state from assembly {0}. XML is {1}. Exception {2}{3}", "[SCRIPT INSTANCE]: Unable to load script state file {0} for script {1} {2} in {3} {4} (assembly {5}). XML is {6}. Exception {7}{8}",
assembly, xml, e.Message, e.StackTrace); savedState, ScriptName, ItemID, PrimName, ObjectID, assembly, xml, e.Message, e.StackTrace);
} }
} }
// else // else
@ -354,10 +357,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public void Init() public void Init()
{ {
if (!m_startOnInit) return; if (!m_startOnInit)
return;
if (m_startedFromSavedState) if (m_startedFromSavedState)
{ {
if (!Run)
return;
Start(); Start();
if (m_postOnRez) if (m_postOnRez)
{ {
@ -390,6 +397,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
} }
else else
{ {
if (!Run)
return;
Start(); Start();
PostEvent(new EventParams("state_entry", PostEvent(new EventParams("state_entry",
new Object[0], new DetectParams[0])); new Object[0], new DetectParams[0]));

View File

@ -55,6 +55,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public static string Serialize(ScriptInstance instance) public static string Serialize(ScriptInstance instance)
{ {
bool running = instance.Running; bool running = instance.Running;
bool enabled = instance.Run;
XmlDocument xmldoc = new XmlDocument(); XmlDocument xmldoc = new XmlDocument();
@ -77,6 +78,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
rootElement.AppendChild(run); rootElement.AppendChild(run);
XmlElement run_enable = xmldoc.CreateElement("", "Run", "");
run_enable.AppendChild(xmldoc.CreateTextNode(
enabled.ToString()));
rootElement.AppendChild(run_enable);
Dictionary<string, Object> vars = instance.GetVars(); Dictionary<string, Object> vars = instance.GetVars();
XmlElement variables = xmldoc.CreateElement("", "Variables", ""); XmlElement variables = xmldoc.CreateElement("", "Variables", "");
@ -225,6 +232,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{ {
object varValue; object varValue;
XmlNodeList partL = rootNode.ChildNodes; XmlNodeList partL = rootNode.ChildNodes;
instance.Run = true;
foreach (XmlNode part in partL) foreach (XmlNode part in partL)
{ {
@ -236,6 +244,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
case "Running": case "Running":
instance.Running=bool.Parse(part.InnerText); instance.Running=bool.Parse(part.InnerText);
break; break;
case "Run":
instance.Run = bool.Parse(part.InnerText);
break;
case "Variables": case "Variables":
XmlNodeList varL = part.ChildNodes; XmlNodeList varL = part.ChildNodes;
foreach (XmlNode var in varL) foreach (XmlNode var in varL)

View File

@ -920,15 +920,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
if (m_InitialStartup) 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); 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; object[] o;
@ -941,14 +935,16 @@ namespace OpenSim.Region.ScriptEngine.XEngine
{ {
scriptsStarted++; scriptsStarted++;
// if (scriptsStarted % 50 == 0) if (m_InitialStartup)
// m_log.DebugFormat( if (scriptsStarted % 50 == 0)
// "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); m_log.InfoFormat(
"[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName);
} }
} }
// m_log.DebugFormat( if (m_InitialStartup)
// "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); 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 // NOTE: Despite having a lockless queue, this lock is required
// to make sure there is never no compile thread while there // 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 // due to a race condition
// //
lock (m_CompileQueue) lock (m_CompileQueue)
{
m_CurrentCompile = null; m_CurrentCompile = null;
}
m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount, m_Scene.EventManager.TriggerEmptyScriptCompileQueue(m_ScriptFailCount,
m_ScriptErrorMessage); m_ScriptErrorMessage);
m_ScriptFailCount = 0; m_ScriptFailCount = 0;
m_InitialStartup = false;
return null; return null;
} }
@ -1451,24 +1448,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return false; return false;
uuids = m_PrimObjects[localID]; uuids = m_PrimObjects[localID];
foreach (UUID itemID in uuids) foreach (UUID itemID in uuids)
{
IScriptInstance instance = null;
try
{ {
if (m_Scripts.ContainsKey(itemID)) IScriptInstance instance = null;
instance = m_Scripts[itemID]; 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; 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) public bool GetScriptState(UUID itemID)
{ {
IScriptInstance instance = GetInstance(itemID); IScriptInstance instance = GetInstance(itemID);

View File

@ -33,7 +33,7 @@
</root> </root>
<logger name="OpenSim.Region.ScriptEngine.XEngine"> <logger name="OpenSim.Region.ScriptEngine.XEngine">
<level value="WARN"/> <level value="INFO"/>
</logger> </logger>
</log4net> </log4net>