Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
commit
6b963e73d9
|
@ -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);
|
||||
|
@ -413,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -284,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
|||
{
|
||||
sceneObjectsLoadedCount++;
|
||||
sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0);
|
||||
sceneObject.ResumeScripts();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -282,36 +282,32 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
return;
|
||||
}
|
||||
|
||||
m_part.ParentGroup.Scene.AssetService.Get(
|
||||
item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset)
|
||||
{
|
||||
if (null == asset)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
||||
item.Name, item.ItemID, m_part.AbsolutePosition,
|
||||
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString());
|
||||
if (null == asset)
|
||||
{
|
||||
m_log.ErrorFormat(
|
||||
"[PRIM INVENTORY]: " +
|
||||
"Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found",
|
||||
item.Name, item.ItemID, m_part.AbsolutePosition,
|
||||
m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_part.ParentGroup.m_savedScriptState != null)
|
||||
RestoreSavedScriptState(item.OldItemID, item.ItemID);
|
||||
|
||||
lock (m_items)
|
||||
{
|
||||
m_items[item.ItemID].PermsMask = 0;
|
||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||
}
|
||||
|
||||
string script = Utils.BytesToString(asset.Data);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||
m_part.ScheduleFullUpdate();
|
||||
}
|
||||
lock (m_items)
|
||||
{
|
||||
m_items[item.ItemID].PermsMask = 0;
|
||||
m_items[item.ItemID].PermsGranter = UUID.Zero;
|
||||
}
|
||||
);
|
||||
|
||||
string script = Utils.BytesToString(asset.Data);
|
||||
m_part.ParentGroup.Scene.EventManager.TriggerRezScript(
|
||||
m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource);
|
||||
m_part.ParentGroup.AddActiveScriptCount(1);
|
||||
m_part.ScheduleFullUpdate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
|
|||
foreach (SceneObjectGroup sceneObject in sceneObjects)
|
||||
{
|
||||
sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0);
|
||||
sceneObject.ResumeScripts();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue