From d841c593b983cbbacae953cfa81c466471f08813 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 31 Dec 2018 09:54:54 +0000 Subject: [PATCH] add a bit more persistence (still mysql only) --- .../Framework/Scenes/SceneObjectPart.cs | 1 - .../Serialization/SceneObjectSerializer.cs | 31 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 479fb91eb6..651884fe48 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -5750,7 +5750,6 @@ namespace OpenSim.Region.Framework.Scenes if (AnimationsNames == null) return null; - lock (animsLock) { if (AnimationsNames.Count == 0) diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 590a5d49f2..a664d0c519 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -235,7 +235,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization if (doScriptStates) sceneObject.SaveScriptedState(writer); - if (!noRootElement) writer.WriteEndElement(); // SceneObjectGroup @@ -499,6 +498,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization m_SOPXmlProcessors.Add("SoundRadius", ProcessSoundRadius); m_SOPXmlProcessors.Add("SoundQueueing", ProcessSoundQueueing); + m_SOPXmlProcessors.Add("SOPAnims", ProcessSOPAnims); + #endregion #region TaskInventoryXmlProcessors initialization @@ -826,6 +827,27 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } } + private static void ProcessSOPAnims(SceneObjectPart obj, XmlReader reader) + { + obj.Animations = null; + try + { + string datastr; + datastr = reader.ReadElementContentAsString(); + if(string.IsNullOrEmpty(datastr)) + return; + + byte[] pdata = Convert.FromBase64String(datastr); + obj.DeSerializeAnimations(pdata); + return; + } + catch {} + + m_log.DebugFormat( + "[SceneObjectSerializer]: Parsing ProcessSOPAnims for object part {0} {1} encountered errors", + obj.Name, obj.UUID); + } + private static void ProcessShape(SceneObjectPart obj, XmlReader reader) { List errorNodeNames; @@ -1588,6 +1610,13 @@ namespace OpenSim.Region.Framework.Scenes.Serialization } writer.WriteElementString("SoundQueueing", sop.SoundQueueing.ToString().ToLower()); + if (sop.Animations != null) + { + Byte[] data = sop.SerializeAnimations(); + if(data != null && data.Length > 0) + writer.WriteElementString("SOPAnims", Convert.ToBase64String(data)); + } + writer.WriteEndElement(); }