aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2015-08-24 17:05:16 +0100
committerUbitUmarov2015-08-24 17:05:16 +0100
commit3829df10595911de9ed1ce2f7b6cdd205828f8d0 (patch)
treed95d15c35695f6fa4dc4a6623294b307a7aee493 /OpenSim/Region/Framework
parent rename ImapTileModule as IMAPImageUploadModule to match core (diff)
downloadopensim-SC-3829df10595911de9ed1ce2f7b6cdd205828f8d0.zip
opensim-SC-3829df10595911de9ed1ce2f7b6cdd205828f8d0.tar.gz
opensim-SC-3829df10595911de9ed1ce2f7b6cdd205828f8d0.tar.bz2
opensim-SC-3829df10595911de9ed1ce2f7b6cdd205828f8d0.tar.xz
try to implement core load oar options
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs28
-rw-r--r--OpenSim/Region/Framework/Interfaces/ITerrainModule.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs65
3 files changed, 77 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
index 3fafc47..ed93916 100644
--- a/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IRegionArchiverModule.cs
@@ -29,6 +29,8 @@ using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.IO; 30using System.IO;
31 31
32using OpenMetaverse;
33
32namespace OpenSim.Region.Framework.Interfaces 34namespace OpenSim.Region.Framework.Interfaces
33{ 35{
34 /// <summary> 36 /// <summary>
@@ -100,16 +102,11 @@ namespace OpenSim.Region.Framework.Interfaces
100 /// If you want notification of when it has completed then subscribe to the EventManager.OnOarFileLoaded event. 102 /// If you want notification of when it has completed then subscribe to the EventManager.OnOarFileLoaded event.
101 /// 103 ///
102 /// <param name="loadPath"></param> 104 /// <param name="loadPath"></param>
103 /// <param name="merge">
104 /// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region
105 /// settings in the archive will be ignored.
106 /// </param>
107 /// <param name="skipAssets">
108 /// If true, the archive is loaded without loading any assets contained within it. This is useful if the
109 /// assets are already known to be present in the grid's asset service.
110 /// </param>
111 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 105 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
112 void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId); 106 /// <param name="options">
107 /// Dictionary of options.
108 /// </param>
109 void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options);
113 110
114 /// <summary> 111 /// <summary>
115 /// Dearchive a region from a stream. This replaces the existing scene. 112 /// Dearchive a region from a stream. This replaces the existing scene.
@@ -127,15 +124,10 @@ namespace OpenSim.Region.Framework.Interfaces
127 /// If you want notification of when it has completed then subscribe to the EventManager.OnOarFileLoaded event. 124 /// If you want notification of when it has completed then subscribe to the EventManager.OnOarFileLoaded event.
128 /// 125 ///
129 /// <param name="loadStream"></param> 126 /// <param name="loadStream"></param>
130 /// <param name="merge">
131 /// If true, the loaded region merges with the existing one rather than replacing it. Any terrain or region
132 /// settings in the archive will be ignored.
133 /// </param>
134 /// <param name="skipAssets">
135 /// If true, the archive is loaded without loading any assets contained within it. This is useful if the
136 /// assets are already known to be present in the grid's asset service.
137 /// </param
138 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param> 127 /// <param name="requestId">If supplied, this request Id is later returned in the saved event</param>
139 void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId); 128 /// <param name="options">
129 /// Dictionary of options.
130 /// </param>
131 void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options);
140 } 132 }
141} 133}
diff --git a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
index 4e2f4e1..595e031 100644
--- a/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/ITerrainModule.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Region.Framework.Interfaces
59 /// <param name="stream"></param> 59 /// <param name="stream"></param>
60 void LoadFromStream(string filename, Stream stream); 60 void LoadFromStream(string filename, Stream stream);
61 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap); 61 void LoadFromStream(string filename, System.Uri pathToTerrainHeightmap);
62 void LoadFromStream(string filename, Vector3 displacement,
63 float radianRotation, Vector2 rotationDisplacement, Stream stream);
62 /// <summary> 64 /// <summary>
63 /// Save a terrain to a stream. 65 /// Save a terrain to a stream.
64 /// </summary> 66 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 40e88f1..3d14943 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -299,6 +299,71 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
299 } 299 }
300 } 300 }
301 301
302 /// <summary>
303 /// Modifies a SceneObjectGroup.
304 /// </summary>
305 /// <param name="sog">The object</param>
306 /// <returns>Whether the object was actually modified</returns>
307 public delegate bool SceneObjectModifier(SceneObjectGroup sog);
308
309 /// <summary>
310 /// Modifies an object by deserializing it; applying 'modifier' to each SceneObjectGroup; and reserializing.
311 /// </summary>
312 /// <param name="assetId">The object's UUID</param>
313 /// <param name="data">Serialized data</param>
314 /// <param name="modifier">The function to run on each SceneObjectGroup</param>
315 /// <returns>The new serialized object's data, or null if an error occurred</returns>
316 public static byte[] ModifySerializedObject(UUID assetId, byte[] data, SceneObjectModifier modifier)
317 {
318 List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
319 CoalescedSceneObjects coa = null;
320
321 string xmlData = ExternalRepresentationUtils.SanitizeXml(Utils.BytesToString(data));
322
323 if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
324 {
325 // m_log.DebugFormat("[SERIALIZER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
326
327 if (coa.Objects.Count == 0)
328 {
329 m_log.WarnFormat("[SERIALIZER]: Aborting load of coalesced object from asset {0} as it has zero loaded components", assetId);
330 return null;
331 }
332
333 sceneObjects.AddRange(coa.Objects);
334 }
335 else
336 {
337 SceneObjectGroup deserializedObject = FromOriginalXmlFormat(xmlData);
338
339 if (deserializedObject != null)
340 {
341 sceneObjects.Add(deserializedObject);
342 }
343 else
344 {
345 m_log.WarnFormat("[SERIALIZER]: Aborting load of object from asset {0} as deserialization failed", assetId);
346 return null;
347 }
348 }
349
350 bool modified = false;
351 foreach (SceneObjectGroup sog in sceneObjects)
352 {
353 if (modifier(sog))
354 modified = true;
355 }
356
357 if (modified)
358 {
359 if (coa != null)
360 data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
361 else
362 data = Utils.StringToBytes(ToOriginalXmlFormat(sceneObjects[0]));
363 }
364
365 return data;
366 }
302 367
303 #region manual serialization 368 #region manual serialization
304 369