Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim

slimupdates
Justin Clark-Casey (justincc) 2010-04-19 21:28:30 +01:00
commit 6b963e73d9
14 changed files with 113 additions and 31 deletions

View File

@ -239,6 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
// Fire after attach, so we don't get messy perms dialogs
// 3 == AttachedRez
objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3);
objatt.ResumeScripts();
// Do this last so that event listeners have access to all the effects of the attachment
m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId);

View File

@ -601,6 +601,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
// Fire on_rez
group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0);
rootPart.ParentGroup.ResumeScripts();
rootPart.ScheduleFullUpdate();
}

View File

@ -284,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
sceneObjectsLoadedCount++;
sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
sceneObject.ResumeScripts();
}
}

View File

@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces
void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource);
ArrayList GetScriptErrors(UUID itemID);
void ResumeScripts();
/// <summary>
/// Stop all the scripts in this entity.

View File

@ -41,6 +41,14 @@ namespace OpenSim.Region.Framework.Interfaces
bool PostScriptEvent(UUID itemID, string name, Object[] args);
bool PostObjectEvent(UUID itemID, string name, Object[] args);
// Suspend ALL scripts in a given scene object. The item ID
// is the UUID of a SOG, and the method acts on all contained
// scripts. This is different from the suspend/resume that
// can be issued by a client.
//
void SuspendScript(UUID itemID);
void ResumeScript(UUID itemID);
ArrayList GetScriptErrors(UUID itemID);
}
}

View File

@ -63,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes
if (group is SceneObjectGroup)
{
((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup) group).ResumeScripts();
}
}
}
@ -220,6 +221,7 @@ namespace OpenSim.Region.Framework.Scenes
{
remoteClient.SendAgentAlertMessage("Script saved", false);
}
part.ParentGroup.ResumeScripts();
return errors;
}
@ -1281,6 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes
// "Rezzed script {0} into prim local ID {1} for user {2}",
// item.inventoryName, localID, remoteClient.Name);
part.GetProperties(remoteClient);
part.ParentGroup.ResumeScripts();
}
else
{
@ -1350,6 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes
part.GetProperties(remoteClient);
part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0);
part.ParentGroup.ResumeScripts();
}
}
@ -1453,6 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes
destPart.Inventory.CreateScriptInstance(destTaskItem, start_param, false, DefaultScriptEngine, 0);
}
destPart.ParentGroup.ResumeScripts();
ScenePresence avatar;
if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar))

View File

@ -1131,7 +1131,6 @@ namespace OpenSim.Region.Framework.Scenes
{
if (m_scripts_enabled != !ScriptEngine)
{
// Tedd! Here's the method to disable the scripting engine!
if (ScriptEngine)
{
m_log.Info("Stopping all Scripts in Scene");
@ -1153,6 +1152,7 @@ namespace OpenSim.Region.Framework.Scenes
if (ent is SceneObjectGroup)
{
((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0);
((SceneObjectGroup)ent).ResumeScripts();
}
}
}

View File

@ -1755,6 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes
copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0);
copy.HasGroupChanged = true;
copy.ScheduleGroupForFullUpdate();
copy.ResumeScripts();
// required for physics to update it's position
copy.AbsolutePosition = copy.AbsolutePosition;

View File

@ -416,5 +416,13 @@ namespace OpenSim.Region.Framework.Scenes
scriptModule.SetXMLState(itemID, n.OuterXml);
}
}
public void ResumeScripts()
{
foreach (SceneObjectPart part in m_parts.Values)
{
part.Inventory.ResumeScripts();
}
}
}
}

View File

@ -282,9 +282,7 @@ namespace OpenSim.Region.Framework.Scenes
return;
}
m_part.ParentGroup.Scene.AssetService.Get(
item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
{
AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
if (null == asset)
{
m_log.ErrorFormat(
@ -311,8 +309,6 @@ namespace OpenSim.Region.Framework.Scenes
m_part.ScheduleFullUpdate();
}
}
);
}
}
private void RestoreSavedScriptState(UUID oldID, UUID newID)
@ -1032,5 +1028,28 @@ namespace OpenSim.Region.Framework.Scenes
return ret;
}
public void ResumeScripts()
{
IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
if (engines == null)
return;
lock (m_items)
{
foreach (TaskInventoryItem item in m_items.Values)
{
if (item.InvType == (int)InventoryType.LSL)
{
foreach (IScriptModule engine in engines)
{
if (engine != null)
engine.ResumeScript(item.ItemID);
}
}
}
}
}
}
}

View File

@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
foreach (SceneObjectGroup sceneObject in sceneObjects)
{
sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0);
sceneObject.ResumeScripts();
}
}

View File

@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
void PostEvent(EventParams data);
void Suspend();
void Resume();
/// <summary>
/// Process the next event queued for this script
/// </summary>

View File

@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
private bool m_startedFromSavedState;
private UUID m_CurrentStateHash;
private UUID m_RegionID;
private bool m_Suspended = false;
private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>>
m_LineMap;
@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
/// <returns></returns>
public object EventProcessor()
{
if (m_Suspended)
return 0;
lock (m_Script)
{
EventParams data = null;
@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
{
get { return m_RegionID; }
}
public void Suspend()
{
m_Suspended = true;
}
public void Resume()
{
m_Suspended = false;
}
}
}

View File

@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine
return new ArrayList();
}
}
public void SuspendScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return;
instance.Suspend();
}
public void ResumeScript(UUID itemID)
{
IScriptInstance instance = GetInstance(itemID);
if (instance == null)
return;
instance.Resume();
}
}
}