aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2015-01-22 23:12:10 +0000
committerJustin Clark-Casey (justincc)2015-01-23 00:27:57 +0000
commitd0a2ea0857c1342a42db31bce282c62c88c57e55 (patch)
treeb727ce53574216d12cc6549e74982ce5de850654 /OpenSim
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-d0a2ea0857c1342a42db31bce282c62c88c57e55.zip
opensim-SC-d0a2ea0857c1342a42db31bce282c62c88c57e55.tar.gz
opensim-SC-d0a2ea0857c1342a42db31bce282c62c88c57e55.tar.bz2
opensim-SC-d0a2ea0857c1342a42db31bce282c62c88c57e55.tar.xz
Fix regression where the stored state of every second script in an object rezzed from inventory (e.g. attachments) was no longer loaded.
Likely a regression since f132f642 (2014-08-28) Relates to http://opensimulator.org/mantis/view.php?id=7278
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs34
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs8
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs3
4 files changed, 35 insertions, 15 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index f537124..f958510 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -297,6 +297,10 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
297 { 297 {
298 if (item != null && item.Owner == ownerID && asset != null) 298 if (item != null && item.Owner == ownerID && asset != null)
299 { 299 {
300// m_log.DebugFormat(
301// "[INVENTORY ACCESS MODULE]: Updating item {0} {1} with new asset {2}",
302// item.Name, item.ID, asset.ID);
303
300 item.AssetID = asset.FullID; 304 item.AssetID = asset.FullID;
301 item.Description = asset.Description; 305 item.Description = asset.Description;
302 item.Name = asset.Name; 306 item.Name = asset.Name;
@@ -314,7 +318,6 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
314 (item == null || asset == null? "null item or asset" : "wrong owner")); 318 (item == null || asset == null? "null item or asset" : "wrong owner"));
315 return false; 319 return false;
316 } 320 }
317
318 } 321 }
319 322
320 public virtual List<InventoryItemBase> CopyToInventory( 323 public virtual List<InventoryItemBase> CopyToInventory(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ec37836..19e557f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -911,28 +911,36 @@ namespace OpenSim.Region.Framework.Scenes
911 911
912 public void LoadScriptState(XmlReader reader) 912 public void LoadScriptState(XmlReader reader)
913 { 913 {
914// m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0} in {1}", Name); 914// m_log.DebugFormat("[SCENE OBJECT GROUP]: Looking for script state for {0}", Name);
915 915
916 while (reader.ReadToFollowing("SavedScriptState")) 916 while (true)
917 { 917 {
918// m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name); 918 if (reader.Name == "SavedScriptState" && reader.NodeType == XmlNodeType.Element)
919 {
920// m_log.DebugFormat("[SCENE OBJECT GROUP]: Loading script state for {0}", Name);
919 921
920 if (m_savedScriptState == null) 922 if (m_savedScriptState == null)
921 m_savedScriptState = new Dictionary<UUID, string>(); 923 m_savedScriptState = new Dictionary<UUID, string>();
922 924
923 string uuid = reader.GetAttribute("UUID"); 925 string uuid = reader.GetAttribute("UUID");
924 926
925 if (uuid != null) 927 if (uuid != null)
926 { 928 {
927// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name); 929// m_log.DebugFormat("[SCENE OBJECT GROUP]: Found state for item ID {0} in object {1}", uuid, Name);
928 930
929 UUID itemid = new UUID(uuid); 931 UUID itemid = new UUID(uuid);
930 if (itemid != UUID.Zero) 932 if (itemid != UUID.Zero)
931 m_savedScriptState[itemid] = reader.ReadInnerXml(); 933 m_savedScriptState[itemid] = reader.ReadInnerXml();
934 }
935 else
936 {
937 m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name);
938 }
932 } 939 }
933 else 940 else
934 { 941 {
935 m_log.WarnFormat("[SCENE OBJECT GROUP]: SavedScriptState element had no UUID in object {0}", Name); 942 if (!reader.Read())
943 break;
936 } 944 }
937 } 945 }
938 } 946 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 578909c..ec39726 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -400,6 +400,10 @@ namespace OpenSim.Region.Framework.Scenes
400 400
401 private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID) 401 private UUID RestoreSavedScriptState(UUID loadedID, UUID oldID, UUID newID)
402 { 402 {
403// m_log.DebugFormat(
404// "[PRIM INVENTORY]: Restoring scripted state for item {0}, oldID {1}, loadedID {2}",
405// newID, oldID, loadedID);
406
403 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>(); 407 IScriptModule[] engines = m_part.ParentGroup.Scene.RequestModuleInterfaces<IScriptModule>();
404 if (engines.Length == 0) // No engine at all 408 if (engines.Length == 0) // No engine at all
405 return oldID; 409 return oldID;
@@ -412,7 +416,7 @@ namespace OpenSim.Region.Framework.Scenes
412 XmlDocument doc = new XmlDocument(); 416 XmlDocument doc = new XmlDocument();
413 417
414 doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]); 418 doc.LoadXml(m_part.ParentGroup.m_savedScriptState[stateID]);
415 419
416 ////////// CRUFT WARNING /////////////////////////////////// 420 ////////// CRUFT WARNING ///////////////////////////////////
417 // 421 //
418 // Old objects will have <ScriptState><State> ... 422 // Old objects will have <ScriptState><State> ...
@@ -442,6 +446,8 @@ namespace OpenSim.Region.Framework.Scenes
442 // This created document has only the minimun data 446 // This created document has only the minimun data
443 // necessary for XEngine to parse it successfully 447 // necessary for XEngine to parse it successfully
444 448
449// m_log.DebugFormat("[PRIM INVENTORY]: Adding legacy state {0} in {1}", stateID, newID);
450
445 m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml; 451 m_part.ParentGroup.m_savedScriptState[stateID] = newDoc.OuterXml;
446 } 452 }
447 453
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index e202a24..b4b4fa0 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -1043,6 +1043,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
1043 1043
1044 public void SetVars(Dictionary<string, object> vars) 1044 public void SetVars(Dictionary<string, object> vars)
1045 { 1045 {
1046// foreach (KeyValuePair<string, object> kvp in vars)
1047// m_log.DebugFormat("[SCRIPT INSTANCE]: Setting var {0}={1}", kvp.Key, kvp.Value);
1048
1046 m_Script.SetVars(vars); 1049 m_Script.SetVars(vars);
1047 } 1050 }
1048 1051