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 /OpenSim/Region/Framework | |
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-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.zip opensim-SC-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.gz opensim-SC-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.bz2 opensim-SC-6b963e73d954b9ae8a6d283b5c83460d6a192ba6.tar.xz |
Merge branch 'master' of ssh://justincc@opensimulator.org/var/git/opensim
Diffstat (limited to 'OpenSim/Region/Framework')
8 files changed, 74 insertions, 30 deletions
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 | ||