aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs12
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs3
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs23
5 files changed, 50 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 7ca779a..bce7d32 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -27,6 +27,7 @@
27 27
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Collections;
30using System.Reflection; 31using System.Reflection;
31using System.Text; 32using System.Text;
32using System.Timers; 33using System.Timers;
@@ -215,13 +216,13 @@ namespace OpenSim.Region.Framework.Scenes
215 /// <param name="primID">The prim which contains the item to update</param> 216 /// <param name="primID">The prim which contains the item to update</param>
216 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param> 217 /// <param name="isScriptRunning">Indicates whether the script to update is currently running</param>
217 /// <param name="data"></param> 218 /// <param name="data"></param>
218 public void CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId, 219 public ArrayList CapsUpdateTaskInventoryScriptAsset(IClientAPI remoteClient, UUID itemId,
219 UUID primId, bool isScriptRunning, byte[] data) 220 UUID primId, bool isScriptRunning, byte[] data)
220 { 221 {
221 if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId)) 222 if (!Permissions.CanEditScript(itemId, primId, remoteClient.AgentId))
222 { 223 {
223 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false); 224 remoteClient.SendAgentAlertMessage("Insufficient permissions to edit script", false);
224 return; 225 return new ArrayList();
225 } 226 }
226 227
227 // Retrieve group 228 // Retrieve group
@@ -234,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes
234 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist", 235 "Prim inventory update requested for item ID {0} in prim ID {1} but this prim does not exist",
235 itemId, primId); 236 itemId, primId);
236 237
237 return; 238 return new ArrayList();
238 } 239 }
239 240
240 // Retrieve item 241 // Retrieve item
@@ -247,7 +248,7 @@ namespace OpenSim.Region.Framework.Scenes
247 + " but the item does not exist in this inventory", 248 + " but the item does not exist in this inventory",
248 itemId, part.Name, part.UUID); 249 itemId, part.Name, part.UUID);
249 250
250 return; 251 return new ArrayList();
251 } 252 }
252 253
253 AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data); 254 AssetBase asset = CreateAsset(item.Name, item.Description, (sbyte)AssetType.LSLText, data);
@@ -264,29 +265,33 @@ namespace OpenSim.Region.Framework.Scenes
264 part.GetProperties(remoteClient); 265 part.GetProperties(remoteClient);
265 266
266 // Trigger rerunning of script (use TriggerRezScript event, see RezScript) 267 // Trigger rerunning of script (use TriggerRezScript event, see RezScript)
268 ArrayList errors = new ArrayList();
269
267 if (isScriptRunning) 270 if (isScriptRunning)
268 { 271 {
269 // Needs to determine which engine was running it and use that 272 // Needs to determine which engine was running it and use that
270 // 273 //
271 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0); 274 part.Inventory.CreateScriptInstance(item.ItemID, 0, false, DefaultScriptEngine, 0);
275 errors = part.Inventory.GetScriptErrors(item.ItemID);
272 } 276 }
273 else 277 else
274 { 278 {
275 remoteClient.SendAgentAlertMessage("Script saved", false); 279 remoteClient.SendAgentAlertMessage("Script saved", false);
276 } 280 }
281 return errors;
277 } 282 }
278 283
279 /// <summary> 284 /// <summary>
280 /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see> 285 /// <see>CapsUpdateTaskInventoryScriptAsset(IClientAPI, UUID, UUID, bool, byte[])</see>
281 /// </summary> 286 /// </summary>
282 public void CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId, 287 public ArrayList CapsUpdateTaskInventoryScriptAsset(UUID avatarId, UUID itemId,
283 UUID primId, bool isScriptRunning, byte[] data) 288 UUID primId, bool isScriptRunning, byte[] data)
284 { 289 {
285 ScenePresence avatar; 290 ScenePresence avatar;
286 291
287 if (TryGetAvatar(avatarId, out avatar)) 292 if (TryGetAvatar(avatarId, out avatar))
288 { 293 {
289 CapsUpdateTaskInventoryScriptAsset( 294 return CapsUpdateTaskInventoryScriptAsset(
290 avatar.ControllingClient, itemId, primId, isScriptRunning, data); 295 avatar.ControllingClient, itemId, primId, isScriptRunning, data);
291 } 296 }
292 else 297 else
@@ -295,6 +300,7 @@ namespace OpenSim.Region.Framework.Scenes
295 "[PRIM INVENTORY]: " + 300 "[PRIM INVENTORY]: " +
296 "Avatar {0} cannot be found to update its prim item asset", 301 "Avatar {0} cannot be found to update its prim item asset",
297 avatarId); 302 avatarId);
303 return new ArrayList();
298 } 304 }
299 } 305 }
300 306
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index f74fd5d..b0fb8b3 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -542,6 +542,18 @@ namespace OpenSim.Region.Framework.Scenes
542 if (group.GetFromItemID() == itemID) 542 if (group.GetFromItemID() == itemID)
543 { 543 {
544 m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero); 544 m_parentScene.SendAttachEvent(group.LocalId, itemID, UUID.Zero);
545 bool hasScripts = false;
546 foreach (SceneObjectPart part in group.Children.Values)
547 {
548 if (part.Inventory.ContainsScripts())
549 {
550 hasScripts = true;
551 break;
552 }
553 }
554
555 if (hasScripts) // Allow the object to execute the attach(NULL_KEY) event
556 System.Threading.Thread.Sleep(100);
545 group.DetachToInventoryPrep(); 557 group.DetachToInventoryPrep();
546 m_log.Debug("[DETACH]: Saving attachpoint: " + 558 m_log.Debug("[DETACH]: Saving attachpoint: " +
547 ((uint)group.GetAttachmentPoint()).ToString()); 559 ((uint)group.GetAttachmentPoint()).ToString());
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index eacd219..f8498c6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1853,7 +1853,7 @@ namespace OpenSim.Region.Framework.Scenes
1853 } 1853 }
1854 } 1854 }
1855 } 1855 }
1856 1856
1857 public void rotLookAt(Quaternion target, float strength, float damping) 1857 public void rotLookAt(Quaternion target, float strength, float damping)
1858 { 1858 {
1859 SceneObjectPart rootpart = m_rootPart; 1859 SceneObjectPart rootpart = m_rootPart;
@@ -1880,6 +1880,7 @@ namespace OpenSim.Region.Framework.Scenes
1880 } 1880 }
1881 } 1881 }
1882 } 1882 }
1883
1883 public void stopLookAt() 1884 public void stopLookAt()
1884 { 1885 {
1885 SceneObjectPart rootpart = m_rootPart; 1886 SceneObjectPart rootpart = m_rootPart;
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 0eddbfd..6b562e5 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -2684,7 +2684,7 @@ namespace OpenSim.Region.Framework.Scenes
2684 ParentGroup.HasGroupChanged = true; 2684 ParentGroup.HasGroupChanged = true;
2685 ScheduleFullUpdate(); 2685 ScheduleFullUpdate();
2686 } 2686 }
2687 2687
2688 /// <summary> 2688 /// <summary>
2689 /// Set the text displayed for this part. 2689 /// Set the text displayed for this part.
2690 /// </summary> 2690 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 0321c41..c3c6342 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -29,6 +29,7 @@ using System;
29using System.Xml; 29using System.Xml;
30using System.IO; 30using System.IO;
31using System.Collections.Generic; 31using System.Collections.Generic;
32using System.Collections;
32using System.Reflection; 33using System.Reflection;
33using OpenMetaverse; 34using OpenMetaverse;
34using log4net; 35using log4net;
@@ -210,6 +211,27 @@ namespace OpenSim.Region.Framework.Scenes
210 } 211 }
211 } 212 }
212 213
214 public ArrayList GetScriptErrors(UUID itemID)
215 {
216 ArrayList ret = new ArrayList();
217
218 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
219 if (engines == null) // No engine at all
220 return ret;
221
222 foreach (IScriptModule e in engines)
223 {
224 if (e != null)
225 {
226 ArrayList errors = e.GetScriptErrors(itemID);
227 foreach (Object line in errors)
228 ret.Add(line);
229 }
230 }
231
232 return ret;
233 }
234
213 /// <summary> 235 /// <summary>
214 /// Stop all the scripts in this prim. 236 /// Stop all the scripts in this prim.
215 /// </summary> 237 /// </summary>
@@ -345,6 +367,7 @@ namespace OpenSim.Region.Framework.Scenes
345 break; 367 break;
346 } 368 }
347 } 369 }
370 m_part.ParentGroup.m_savedScriptState.Remove(oldID);
348 } 371 }
349 } 372 }
350 373