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/AsyncSceneObjectGroupDeleter.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs99
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs25
6 files changed, 36 insertions, 111 deletions
diff --git a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
index 5b571c7..9a7863b 100644
--- a/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
+++ b/OpenSim/Region/Framework/Scenes/AsyncSceneObjectGroupDeleter.cs
@@ -131,11 +131,6 @@ namespace OpenSim.Region.Framework.Scenes
131 if (left > 0) 131 if (left > 0)
132 { 132 {
133 x = m_inventoryDeletes.Dequeue(); 133 x = m_inventoryDeletes.Dequeue();
134 if (!x.objectGroup.CanBeDeleted())
135 {
136 m_inventoryDeletes.Enqueue(x);
137 return true;
138 }
139 134
140 m_log.DebugFormat( 135 m_log.DebugFormat(
141 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left); 136 "[SCENE]: Sending object to user's inventory, {0} item(s) remaining.", left);
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0ee818d..eb8567f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -618,7 +618,7 @@ namespace OpenSim.Region.Framework.Scenes
618 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE); 618 startupConfig.GetLong("MaximumTimeBeforePersistenceConsidered", DEFAULT_MAX_TIME_FOR_PERSISTENCE);
619 m_persistAfter *= 10000000; 619 m_persistAfter *= 10000000;
620 620
621 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "DotNetEngine"); 621 m_defaultScriptEngine = startupConfig.GetString("DefaultScriptEngine", "XEngine");
622 622
623 IConfig packetConfig = m_config.Configs["PacketPool"]; 623 IConfig packetConfig = m_config.Configs["PacketPool"];
624 if (packetConfig != null) 624 if (packetConfig != null)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
index 9a6f2b8..5a06bdb 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.Inventory.cs
@@ -351,12 +351,29 @@ namespace OpenSim.Region.Framework.Scenes
351 return xmldoc.InnerXml; 351 return xmldoc.InnerXml;
352 } 352 }
353 353
354 public void SetState(string objXMLData, UUID RegionID) 354 public void SetState(string objXMLData, IScene ins)
355 { 355 {
356m_log.Debug("SetState called with " + objXMLData); 356 if (!(ins is Scene))
357 return;
358
359 Scene s = (Scene)ins;
360
357 if (objXMLData == String.Empty) 361 if (objXMLData == String.Empty)
358 return; 362 return;
359 363
364 IScriptModule scriptModule = null;
365
366 foreach (IScriptModule sm in s.RequestModuleInterfaces<IScriptModule>())
367 {
368 if (sm.ScriptEngineName == s.DefaultScriptEngine)
369 scriptModule = sm;
370 else if (scriptModule == null)
371 scriptModule = sm;
372 }
373
374 if (scriptModule == null)
375 return;
376
360 XmlDocument doc = new XmlDocument(); 377 XmlDocument doc = new XmlDocument();
361 try 378 try
362 { 379 {
@@ -374,69 +391,23 @@ m_log.Debug("SetState called with " + objXMLData);
374 } 391 }
375 392
376 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData"); 393 XmlNodeList rootL = doc.GetElementsByTagName("ScriptData");
377 if (rootL.Count == 1) 394 if (rootL.Count != 1)
395 return;
396
397 XmlElement rootE = (XmlElement)rootL[0];
398
399 XmlNodeList dataL = rootE.GetElementsByTagName("ScriptStates");
400 if (dataL.Count != 1)
401 return;
402
403 XmlElement dataE = (XmlElement)dataL[0];
404
405 foreach (XmlNode n in dataE.ChildNodes)
378 { 406 {
379 XmlNode rootNode = rootL[0]; 407 XmlElement stateE = (XmlElement)n;
380 if (rootNode != null) 408 UUID itemID = new UUID(stateE.GetAttribute("UUID"));
381 { 409
382 XmlNodeList partL = rootNode.ChildNodes; 410 scriptModule.SetXMLState(itemID, n.OuterXml);
383
384 foreach (XmlNode part in partL)
385 {
386 XmlNodeList nodeL = part.ChildNodes;
387
388 switch (part.Name)
389 {
390 case "Assemblies":
391 foreach (XmlNode asm in nodeL)
392 {
393 string fn = asm.Attributes.GetNamedItem("Filename").Value;
394
395 Byte[] filedata = Convert.FromBase64String(asm.InnerText);
396 string path = Path.Combine("ScriptEngines", RegionID.ToString());
397 path = Path.Combine(path, fn);
398
399 if (!File.Exists(path))
400 {
401 FileStream fs = File.Create(path);
402 fs.Write(filedata, 0, filedata.Length);
403 fs.Close();
404
405 Byte[] textbytes = new System.Text.ASCIIEncoding().GetBytes(asm.InnerText);
406 fs = File.Create(path+".text");
407 fs.Write(textbytes, 0, textbytes.Length);
408 fs.Close();
409 }
410 }
411 break;
412 case "ScriptStates":
413 foreach (XmlNode st in nodeL)
414 {
415 string id = st.Attributes.GetNamedItem("UUID").Value;
416 UUID uuid = new UUID(id);
417 XmlNode state = st.ChildNodes[0];
418
419 XmlDocument sdoc = new XmlDocument();
420 XmlNode sxmlnode = sdoc.CreateNode(
421 XmlNodeType.XmlDeclaration,
422 "", "");
423 sdoc.AppendChild(sxmlnode);
424
425 XmlNode newnode = sdoc.ImportNode(state, true);
426 sdoc.AppendChild(newnode);
427
428 string spath = Path.Combine("ScriptEngines", RegionID.ToString());
429 spath = Path.Combine(spath, uuid.ToString());
430 FileStream sfs = File.Create(spath + ".state");
431 System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding();
432 Byte[] buf = enc.GetBytes(sdoc.InnerXml);
433 sfs.Write(buf, 0, buf.Length);
434 sfs.Close();
435 }
436 break;
437 }
438 }
439 }
440 } 411 }
441 } 412 }
442 } 413 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index bcc9b37..6ec2a01 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3341,17 +3341,6 @@ namespace OpenSim.Region.Framework.Scenes
3341 } 3341 }
3342 #endregion 3342 #endregion
3343 3343
3344 public bool CanBeDeleted()
3345 {
3346 foreach (SceneObjectPart part in Children.Values)
3347 {
3348 if (!part.CanBeDeleted())
3349 return false;
3350 }
3351
3352 return true;
3353 }
3354
3355 public double GetUpdatePriority(IClientAPI client) 3344 public double GetUpdatePriority(IClientAPI client)
3356 { 3345 {
3357 switch (Scene.UpdatePrioritizationScheme) 3346 switch (Scene.UpdatePrioritizationScheme)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 6f1b458..b6916f2 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -3797,10 +3797,5 @@ namespace OpenSim.Region.Framework.Scenes
3797 3797
3798 Inventory.ApplyNextOwnerPermissions(); 3798 Inventory.ApplyNextOwnerPermissions();
3799 } 3799 }
3800
3801 public bool CanBeDeleted()
3802 {
3803 return Inventory.CanBeDeleted();
3804 }
3805 } 3800 }
3806} 3801}
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 7f49ced..7a0d7b7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -886,30 +886,5 @@ namespace OpenSim.Region.Framework.Scenes
886 } 886 }
887 return ret; 887 return ret;
888 } 888 }
889
890 public bool CanBeDeleted()
891 {
892 if (!ContainsScripts())
893 return true;
894
895 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
896
897 if (engines == null) // No engine at all
898 return true;
899
900 foreach (TaskInventoryItem item in m_items.Values)
901 {
902 if (item.InvType == (int)InventoryType.LSL)
903 {
904 foreach (IScriptModule e in engines)
905 {
906 if (!e.CanBeDeleted(item.ItemID))
907 return false;
908 }
909 }
910 }
911
912 return true;
913 }
914 } 889 }
915} 890}