diff options
author | Justin Clark-Casey (justincc) | 2010-04-19 21:28:30 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-04-19 21:28:30 +0100 |
commit | 6b963e73d954b9ae8a6d283b5c83460d6a192ba6 (patch) | |
tree | f7c3db7ccb54a27cdb4ed5d38645275792c56266 | |
parent | Make the "notecard saved" text appear in the saver rather than the notecard o... (diff) | |
parent | Avoid duplicate script resumes. Move resume calls to more logical places (diff) | |
download | opensim-SC_OLD-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.zip opensim-SC_OLD-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.gz opensim-SC_OLD-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.bz2 opensim-SC_OLD-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
14 files changed, 113 insertions, 31 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index c87a383..f050dcf 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs | |||
@@ -239,6 +239,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
239 | // Fire after attach, so we don't get messy perms dialogs | 239 | // Fire after attach, so we don't get messy perms dialogs |
240 | // 3 == AttachedRez | 240 | // 3 == AttachedRez |
241 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); | 241 | objatt.CreateScriptInstances(0, true, m_scene.DefaultScriptEngine, 3); |
242 | objatt.ResumeScripts(); | ||
242 | 243 | ||
243 | // Do this last so that event listeners have access to all the effects of the attachment | 244 | // Do this last so that event listeners have access to all the effects of the attachment |
244 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); | 245 | m_scene.EventManager.TriggerOnAttach(objatt.LocalId, itemID, remoteClient.AgentId); |
@@ -413,4 +414,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments | |||
413 | } | 414 | } |
414 | } | 415 | } |
415 | } | 416 | } |
416 | } \ No newline at end of file | 417 | } |
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs index 16e05b7..2352ced 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs | |||
@@ -601,6 +601,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess | |||
601 | 601 | ||
602 | // Fire on_rez | 602 | // Fire on_rez |
603 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0); | 603 | group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 0); |
604 | rootPart.ParentGroup.ResumeScripts(); | ||
604 | 605 | ||
605 | rootPart.ScheduleFullUpdate(); | 606 | rootPart.ScheduleFullUpdate(); |
606 | } | 607 | } |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 55028d0..c52f029 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -284,6 +284,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
284 | { | 284 | { |
285 | sceneObjectsLoadedCount++; | 285 | sceneObjectsLoadedCount++; |
286 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); | 286 | sceneObject.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); |
287 | sceneObject.ResumeScripts(); | ||
287 | } | 288 | } |
288 | } | 289 | } |
289 | 290 | ||
diff --git a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs index f58904f..2b90960 100644 --- a/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs +++ b/OpenSim/Region/Framework/Interfaces/IEntityInventory.cs | |||
@@ -74,6 +74,7 @@ namespace OpenSim.Region.Framework.Interfaces | |||
74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); | 74 | void CreateScriptInstances(int startParam, bool postOnRez, string engine, int stateSource); |
75 | 75 | ||
76 | ArrayList GetScriptErrors(UUID itemID); | 76 | ArrayList GetScriptErrors(UUID itemID); |
77 | void ResumeScripts(); | ||
77 | 78 | ||
78 | /// <summary> | 79 | /// <summary> |
79 | /// Stop all the scripts in this entity. | 80 | /// Stop all the scripts in this entity. |
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs index e90b300..fecdd1b 100644 --- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs | |||
@@ -41,6 +41,14 @@ namespace OpenSim.Region.Framework.Interfaces | |||
41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); | 41 | bool PostScriptEvent(UUID itemID, string name, Object[] args); |
42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); | 42 | bool PostObjectEvent(UUID itemID, string name, Object[] args); |
43 | 43 | ||
44 | // Suspend ALL scripts in a given scene object. The item ID | ||
45 | // is the UUID of a SOG, and the method acts on all contained | ||
46 | // scripts. This is different from the suspend/resume that | ||
47 | // can be issued by a client. | ||
48 | // | ||
49 | void SuspendScript(UUID itemID); | ||
50 | void ResumeScript(UUID itemID); | ||
51 | |||
44 | ArrayList GetScriptErrors(UUID itemID); | 52 | ArrayList GetScriptErrors(UUID itemID); |
45 | } | 53 | } |
46 | } | 54 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 144de43..15b5230 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | |||
@@ -63,6 +63,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
63 | if (group is SceneObjectGroup) | 63 | if (group is SceneObjectGroup) |
64 | { | 64 | { |
65 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 65 | ((SceneObjectGroup) group).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
66 | ((SceneObjectGroup) group).ResumeScripts(); | ||
66 | } | 67 | } |
67 | } | 68 | } |
68 | } | 69 | } |
@@ -220,6 +221,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | { | 221 | { |
221 | remoteClient.SendAgentAlertMessage("Script saved", false); | 222 | remoteClient.SendAgentAlertMessage("Script saved", false); |
222 | } | 223 | } |
224 | part.ParentGroup.ResumeScripts(); | ||
223 | return errors; | 225 | return errors; |
224 | } | 226 | } |
225 | 227 | ||
@@ -1281,6 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1281 | // "Rezzed script {0} into prim local ID {1} for user {2}", | 1283 | // "Rezzed script {0} into prim local ID {1} for user {2}", |
1282 | // item.inventoryName, localID, remoteClient.Name); | 1284 | // item.inventoryName, localID, remoteClient.Name); |
1283 | part.GetProperties(remoteClient); | 1285 | part.GetProperties(remoteClient); |
1286 | part.ParentGroup.ResumeScripts(); | ||
1284 | } | 1287 | } |
1285 | else | 1288 | else |
1286 | { | 1289 | { |
@@ -1350,6 +1353,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1350 | part.GetProperties(remoteClient); | 1353 | part.GetProperties(remoteClient); |
1351 | 1354 | ||
1352 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); | 1355 | part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); |
1356 | part.ParentGroup.ResumeScripts(); | ||
1353 | } | 1357 | } |
1354 | } | 1358 | } |
1355 | 1359 | ||
@@ -1453,6 +1457,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1453 | destPart.Inventory.CreateScriptInstance(destTaskItem, start_param, false, DefaultScriptEngine, 0); | 1457 | destPart.Inventory.CreateScriptInstance(destTaskItem, start_param, false, DefaultScriptEngine, 0); |
1454 | } | 1458 | } |
1455 | 1459 | ||
1460 | destPart.ParentGroup.ResumeScripts(); | ||
1461 | |||
1456 | ScenePresence avatar; | 1462 | ScenePresence avatar; |
1457 | 1463 | ||
1458 | if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) | 1464 | if (TryGetScenePresence(srcTaskItem.OwnerID, out avatar)) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index a34f57e..57587be 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1131,7 +1131,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1131 | { | 1131 | { |
1132 | if (m_scripts_enabled != !ScriptEngine) | 1132 | if (m_scripts_enabled != !ScriptEngine) |
1133 | { | 1133 | { |
1134 | // Tedd! Here's the method to disable the scripting engine! | ||
1135 | if (ScriptEngine) | 1134 | if (ScriptEngine) |
1136 | { | 1135 | { |
1137 | m_log.Info("Stopping all Scripts in Scene"); | 1136 | m_log.Info("Stopping all Scripts in Scene"); |
@@ -1153,6 +1152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1153 | if (ent is SceneObjectGroup) | 1152 | if (ent is SceneObjectGroup) |
1154 | { | 1153 | { |
1155 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1154 | ((SceneObjectGroup)ent).CreateScriptInstances(0, false, DefaultScriptEngine, 0); |
1155 | ((SceneObjectGroup)ent).ResumeScripts(); | ||
1156 | } | 1156 | } |
1157 | } | 1157 | } |
1158 | } | 1158 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 89eb54d..1421d0e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -1755,6 +1755,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1755 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); | 1755 | copy.CreateScriptInstances(0, false, m_parentScene.DefaultScriptEngine, 0); |
1756 | copy.HasGroupChanged = true; | 1756 | copy.HasGroupChanged = true; |
1757 | copy.ScheduleGroupForFullUpdate(); | 1757 | copy.ScheduleGroupForFullUpdate(); |
1758 | copy.ResumeScripts(); | ||
1758 | 1759 | ||
1759 | // required for physics to update it's position | 1760 | // required for physics to update it's position |
1760 | copy.AbsolutePosition = copy.AbsolutePosition; | 1761 | copy.AbsolutePosition = copy.AbsolutePosition; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs index 4034744..f7e46af 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs | |||
@@ -416,5 +416,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
416 | scriptModule.SetXMLState(itemID, n.OuterXml); | 416 | scriptModule.SetXMLState(itemID, n.OuterXml); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | |||
420 | public void ResumeScripts() | ||
421 | { | ||
422 | foreach (SceneObjectPart part in m_parts.Values) | ||
423 | { | ||
424 | part.Inventory.ResumeScripts(); | ||
425 | } | ||
426 | } | ||
419 | } | 427 | } |
420 | } | 428 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs index 4b9a2ad..3b1b567 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs | |||
@@ -282,36 +282,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
282 | return; | 282 | return; |
283 | } | 283 | } |
284 | 284 | ||
285 | m_part.ParentGroup.Scene.AssetService.Get( | 285 | AssetBase asset = m_part.ParentGroup.Scene.AssetService.Get(item.AssetID.ToString()); |
286 | item.AssetID.ToString(), this, delegate(string id, object sender, AssetBase asset) | 286 | if (null == asset) |
287 | { | 287 | { |
288 | if (null == asset) | 288 | m_log.ErrorFormat( |
289 | { | 289 | "[PRIM INVENTORY]: " + |
290 | m_log.ErrorFormat( | 290 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", |
291 | "[PRIM INVENTORY]: " + | 291 | item.Name, item.ItemID, m_part.AbsolutePosition, |
292 | "Couldn't start script {0}, {1} at {2} in {3} since asset ID {4} could not be found", | 292 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); |
293 | item.Name, item.ItemID, m_part.AbsolutePosition, | 293 | } |
294 | m_part.ParentGroup.Scene.RegionInfo.RegionName, item.AssetID); | 294 | else |
295 | } | 295 | { |
296 | else | 296 | if (m_part.ParentGroup.m_savedScriptState != null) |
297 | { | 297 | RestoreSavedScriptState(item.OldItemID, item.ItemID); |
298 | if (m_part.ParentGroup.m_savedScriptState != null) | ||
299 | RestoreSavedScriptState(item.OldItemID, item.ItemID); | ||
300 | 298 | ||
301 | lock (m_items) | 299 | lock (m_items) |
302 | { | 300 | { |
303 | m_items[item.ItemID].PermsMask = 0; | 301 | m_items[item.ItemID].PermsMask = 0; |
304 | m_items[item.ItemID].PermsGranter = UUID.Zero; | 302 | m_items[item.ItemID].PermsGranter = UUID.Zero; |
305 | } | ||
306 | |||
307 | string script = Utils.BytesToString(asset.Data); | ||
308 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
309 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
310 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
311 | m_part.ScheduleFullUpdate(); | ||
312 | } | ||
313 | } | 303 | } |
314 | ); | 304 | |
305 | string script = Utils.BytesToString(asset.Data); | ||
306 | m_part.ParentGroup.Scene.EventManager.TriggerRezScript( | ||
307 | m_part.LocalId, item.ItemID, script, startParam, postOnRez, engine, stateSource); | ||
308 | m_part.ParentGroup.AddActiveScriptCount(1); | ||
309 | m_part.ScheduleFullUpdate(); | ||
310 | } | ||
315 | } | 311 | } |
316 | } | 312 | } |
317 | 313 | ||
@@ -1032,5 +1028,28 @@ namespace OpenSim.Region.Framework.Scenes | |||
1032 | 1028 | ||
1033 | return ret; | 1029 | return ret; |
1034 | } | 1030 | } |
1031 | |||
1032 | public void ResumeScripts() | ||
1033 | { | ||
1034 | IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); | ||
1035 | if (engines == null) | ||
1036 | return; | ||
1037 | |||
1038 | |||
1039 | lock (m_items) | ||
1040 | { | ||
1041 | foreach (TaskInventoryItem item in m_items.Values) | ||
1042 | { | ||
1043 | if (item.InvType == (int)InventoryType.LSL) | ||
1044 | { | ||
1045 | foreach (IScriptModule engine in engines) | ||
1046 | { | ||
1047 | if (engine != null) | ||
1048 | engine.ResumeScript(item.ItemID); | ||
1049 | } | ||
1050 | } | ||
1051 | } | ||
1052 | } | ||
1053 | } | ||
1035 | } | 1054 | } |
1036 | } \ No newline at end of file | 1055 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs index cf0f345..b6677f0 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneXmlLoader.cs | |||
@@ -182,6 +182,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization | |||
182 | foreach (SceneObjectGroup sceneObject in sceneObjects) | 182 | foreach (SceneObjectGroup sceneObject in sceneObjects) |
183 | { | 183 | { |
184 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0); | 184 | sceneObject.CreateScriptInstances(0, true, scene.DefaultScriptEngine, 0); |
185 | sceneObject.ResumeScripts(); | ||
185 | } | 186 | } |
186 | } | 187 | } |
187 | 188 | ||
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index ae148a9..9f6ea35 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | |||
@@ -81,6 +81,9 @@ namespace OpenSim.Region.ScriptEngine.Interfaces | |||
81 | 81 | ||
82 | void PostEvent(EventParams data); | 82 | void PostEvent(EventParams data); |
83 | 83 | ||
84 | void Suspend(); | ||
85 | void Resume(); | ||
86 | |||
84 | /// <summary> | 87 | /// <summary> |
85 | /// Process the next event queued for this script | 88 | /// Process the next event queued for this script |
86 | /// </summary> | 89 | /// </summary> |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index d30d2dc..3dd381d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -95,6 +95,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
95 | private bool m_startedFromSavedState; | 95 | private bool m_startedFromSavedState; |
96 | private UUID m_CurrentStateHash; | 96 | private UUID m_CurrentStateHash; |
97 | private UUID m_RegionID; | 97 | private UUID m_RegionID; |
98 | private bool m_Suspended = false; | ||
98 | 99 | ||
99 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> | 100 | private Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> |
100 | m_LineMap; | 101 | m_LineMap; |
@@ -638,6 +639,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
638 | /// <returns></returns> | 639 | /// <returns></returns> |
639 | public object EventProcessor() | 640 | public object EventProcessor() |
640 | { | 641 | { |
642 | if (m_Suspended) | ||
643 | return 0; | ||
644 | |||
641 | lock (m_Script) | 645 | lock (m_Script) |
642 | { | 646 | { |
643 | EventParams data = null; | 647 | EventParams data = null; |
@@ -1011,5 +1015,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
1011 | { | 1015 | { |
1012 | get { return m_RegionID; } | 1016 | get { return m_RegionID; } |
1013 | } | 1017 | } |
1018 | |||
1019 | public void Suspend() | ||
1020 | { | ||
1021 | m_Suspended = true; | ||
1022 | } | ||
1023 | |||
1024 | public void Resume() | ||
1025 | { | ||
1026 | m_Suspended = false; | ||
1027 | } | ||
1014 | } | 1028 | } |
1015 | } | 1029 | } |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 98e77c0..54074ed 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1488,5 +1488,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1488 | return new ArrayList(); | 1488 | return new ArrayList(); |
1489 | } | 1489 | } |
1490 | } | 1490 | } |
1491 | |||
1492 | public void SuspendScript(UUID itemID) | ||
1493 | { | ||
1494 | IScriptInstance instance = GetInstance(itemID); | ||
1495 | if (instance == null) | ||
1496 | return; | ||
1497 | |||
1498 | instance.Suspend(); | ||
1499 | } | ||
1500 | |||
1501 | public void ResumeScript(UUID itemID) | ||
1502 | { | ||
1503 | IScriptInstance instance = GetInstance(itemID); | ||
1504 | if (instance == null) | ||
1505 | return; | ||
1506 | |||
1507 | instance.Resume(); | ||
1508 | } | ||
1491 | } | 1509 | } |
1492 | } | 1510 | } |