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

View File

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

View File

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

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)
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)
{
if (!Enabled)
return;
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Deleting attachments from scene {0} for {1}, silent = {2}",
// m_scene.RegionInfo.RegionName, sp.Name, silent);
if (!Enabled)
return;
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;
}

View File

@ -58,6 +58,21 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
private AttachmentsModule m_attMod;
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]
public void FixtureInit()
{
@ -86,13 +101,27 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments.Tests
}
/// <summary>
/// Add the standard presence for a test.
/// Creates an attachment item in the given user's inventory. Does not attach.
/// </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);
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<SceneObjectGroup> 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));
}
/// <summary>
@ -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<AvatarAttachment> 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

View File

@ -44,10 +44,15 @@ namespace OpenSim.Region.Framework.Interfaces
void RezAttachments(IScenePresence sp);
/// <summary>
/// Save the attachments that have change on this presence.
/// Derez the attachements for a scene presence that is closing.
/// </summary>
/// <param name="sp"></param>
void SaveChangedAttachments(IScenePresence sp, bool saveAllScripted);
/// <remarks>
/// 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>
/// 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>
bool GetScriptState(UUID itemID);
void SetRunEnable(UUID instanceID, bool enable);
void SaveAllState();
/// <summary>

View File

@ -2298,10 +2298,24 @@ namespace OpenSim.Region.Framework.Scenes
if (part == null)
return;
IScriptModule[] engines = RequestModuleInterfaces<IScriptModule>();
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)

View File

@ -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<IEntityTransferModule>();
m_groupsModule = RequestModuleInterface<IGroupsModule>();
AgentTransactionsModule = RequestModuleInterface<IAgentAssetTransactions>();
UserManagementModule = RequestModuleInterface<IUserManagement>();
}
#endregion
@ -2094,9 +2096,8 @@ namespace OpenSim.Region.Framework.Scenes
sceneObject.SetGroup(groupID, null);
}
IUserManagement uman = RequestModuleInterface<IUserManagement>();
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
/// <param name="aCircuit"></param>
private void CacheUserName(ScenePresence sp, AgentCircuitData aCircuit)
{
IUserManagement uMan = RequestModuleInterface<IUserManagement>();
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<IUserManagement>();
// 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(

View File

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

View File

@ -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<ulong, string>();

View File

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

View File

@ -63,6 +63,16 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
/// </summary>
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>
/// Is the script suspended?
/// </summary>

View File

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

View File

@ -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<string, Object> 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)

View File

@ -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;
}
@ -1452,24 +1449,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
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];
}
catch { /* ignore race conditions */ }
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;
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);

View File

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