aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs')
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs93
1 files changed, 63 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
index 6a09caf..1305545 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs
@@ -49,24 +49,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver
49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ArchiverModule")] 49 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "ArchiverModule")]
50 public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule 50 public class ArchiverModule : INonSharedRegionModule, IRegionArchiverModule
51 { 51 {
52 private static readonly ILog m_log = 52 private static readonly ILog m_log =
53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 53 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 54
55 public Scene Scene { get; private set; } 55 public Scene Scene { get; private set; }
56 public IRegionCombinerModule RegionCombinerModule { get; private set; }
57 56
58 /// <value> 57 /// <value>
59 /// The file used to load and save an opensimulator archive if no filename has been specified 58 /// The file used to load and save an opensimulator archive if no filename has been specified
60 /// </value> 59 /// </value>
61 protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar"; 60 protected const string DEFAULT_OAR_BACKUP_FILENAME = "region.oar";
62 61
63 public string Name 62 public string Name
64 { 63 {
65 get { return "RegionArchiverModule"; } 64 get { return "RegionArchiverModule"; }
66 } 65 }
67 66
68 public Type ReplaceableInterface 67 public Type ReplaceableInterface
69 { 68 {
70 get { return null; } 69 get { return null; }
71 } 70 }
72 71
@@ -85,7 +84,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
85 84
86 public void RegionLoaded(Scene scene) 85 public void RegionLoaded(Scene scene)
87 { 86 {
88 RegionCombinerModule = scene.RequestModuleInterface<IRegionCombinerModule>();
89 } 87 }
90 88
91 public void RemoveRegion(Scene scene) 89 public void RemoveRegion(Scene scene)
@@ -110,18 +108,22 @@ namespace OpenSim.Region.CoreModules.World.Archiver
110 Vector3 displacement = new Vector3(0f, 0f, 0f); 108 Vector3 displacement = new Vector3(0f, 0f, 0f);
111 String defaultUser = ""; 109 String defaultUser = "";
112 float rotation = 0f; 110 float rotation = 0f;
113 Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); 111 Vector3 rotationCenter = new Vector3(Scene.RegionInfo.RegionSizeX / 2f, Scene.RegionInfo.RegionSizeY / 2f, 0);
114 112 Vector3 boundingOrigin = new Vector3(0f, 0f, 0f);
113 Vector3 boundingSize = new Vector3(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY, float.MaxValue);
114 bool debug = false;
115
115 OptionSet options = new OptionSet(); 116 OptionSet options = new OptionSet();
116 options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); 117 options.Add("m|merge", delegate(string v) { mergeOar = (v != null); });
117 options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); 118 options.Add("s|skip-assets", delegate(string v) { skipAssets = (v != null); });
118 options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); 119 options.Add("force-terrain", delegate(string v) { forceTerrain = (v != null); });
119 options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility 120 options.Add("forceterrain", delegate(string v) { forceTerrain = (v != null); }); // downward compatibility
120 options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); 121 options.Add("force-parcels", delegate(string v) { forceParcels = (v != null); });
121 options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility 122 options.Add("forceparcels", delegate(string v) { forceParcels = (v != null); }); // downward compatibility
122 options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); 123 options.Add("no-objects", delegate(string v) { noObjects = (v != null); });
123 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; }); 124 options.Add("default-user=", delegate(string v) { defaultUser = (v == null) ? "" : v; });
124 options.Add("displacement=", delegate (string v) { 125 options.Add("displacement=", delegate(string v)
126 {
125 try 127 try
126 { 128 {
127 displacement = v == null ? Vector3.Zero : Vector3.Parse(v); 129 displacement = v == null ? Vector3.Zero : Vector3.Parse(v);
@@ -145,12 +147,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver
145 m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45"); 147 m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45");
146 return; 148 return;
147 } 149 }
148 // Convert to radians for internals 150 //pass this in as degrees now, convert to radians later during actual work phase
149 rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; 151 rotation = Util.Clamp<float>(rotation, -359f, 359f);
150 }); 152 });
151 options.Add("rotation-center=", delegate (string v) { 153 options.Add("rotation-center=", delegate(string v)
154 {
152 try 155 try
153 { 156 {
157 m_log.Info("[ARCHIVER MODULE] Warning: --rotation-center no longer does anything and will be removed soon!");
154 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); 158 rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v);
155 } 159 }
156 catch 160 catch
@@ -160,6 +164,33 @@ namespace OpenSim.Region.CoreModules.World.Archiver
160 return; 164 return;
161 } 165 }
162 }); 166 });
167 options.Add("bounding-origin=", delegate(string v)
168 {
169 try
170 {
171 boundingOrigin = v == null ? Vector3.Zero : Vector3.Parse(v);
172 }
173 catch
174 {
175 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing bounding cube origin");
176 m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --bounding-origin \"<128,128,0>\"");
177 return;
178 }
179 });
180 options.Add("bounding-size=", delegate(string v)
181 {
182 try
183 {
184 boundingSize = v == null ? new Vector3(Scene.RegionInfo.RegionSizeX, Scene.RegionInfo.RegionSizeY, float.MaxValue) : Vector3.Parse(v);
185 }
186 catch
187 {
188 m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing bounding cube size");
189 m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as a positive vector3: --bounding-size \"<256,256,4096>\"");
190 return;
191 }
192 });
193 options.Add("d|debug", delegate(string v) { debug = (v != null); });
163 194
164 // Send a message to the region ready module 195 // Send a message to the region ready module
165 /* bluewall* Disable this for the time being 196 /* bluewall* Disable this for the time being
@@ -170,9 +201,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
170 rready.OarLoadingAlert("load"); 201 rready.OarLoadingAlert("load");
171 } 202 }
172 */ 203 */
173 204
174 List<string> mainParams = options.Parse(cmdparams); 205 List<string> mainParams = options.Parse(cmdparams);
175 206
176// m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar); 207// m_log.DebugFormat("MERGE OAR IS [{0}]", mergeOar);
177// 208//
178// foreach (string param in mainParams) 209// foreach (string param in mainParams)
@@ -208,6 +239,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
208 archiveOptions.Add("displacement", displacement); 239 archiveOptions.Add("displacement", displacement);
209 archiveOptions.Add("rotation", rotation); 240 archiveOptions.Add("rotation", rotation);
210 archiveOptions.Add("rotation-center", rotationCenter); 241 archiveOptions.Add("rotation-center", rotationCenter);
242 archiveOptions.Add("bounding-origin", boundingOrigin);
243 archiveOptions.Add("bounding-size", boundingSize);
244 if (debug) archiveOptions.Add("debug", null);
211 245
212 if (mainParams.Count > 2) 246 if (mainParams.Count > 2)
213 { 247 {
@@ -254,7 +288,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
254 288
255 ArchiveRegion(path, options); 289 ArchiveRegion(path, options);
256 } 290 }
257 291
258 public void ArchiveRegion(string savePath, Dictionary<string, object> options) 292 public void ArchiveRegion(string savePath, Dictionary<string, object> options)
259 { 293 {
260 ArchiveRegion(savePath, Guid.Empty, options); 294 ArchiveRegion(savePath, Guid.Empty, options);
@@ -264,7 +298,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
264 { 298 {
265 m_log.InfoFormat( 299 m_log.InfoFormat(
266 "[ARCHIVER]: Writing archive for region {0} to {1}", Scene.RegionInfo.RegionName, savePath); 300 "[ARCHIVER]: Writing archive for region {0} to {1}", Scene.RegionInfo.RegionName, savePath);
267 301
268 new ArchiveWriteRequest(Scene, savePath, requestId).ArchiveRegion(options); 302 new ArchiveWriteRequest(Scene, savePath, requestId).ArchiveRegion(options);
269 } 303 }
270 304
@@ -288,21 +322,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver
288 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 322 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
289 DearchiveRegion(loadPath, Guid.Empty, archiveOptions); 323 DearchiveRegion(loadPath, Guid.Empty, archiveOptions);
290 } 324 }
291 325
292 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options) 326 public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string, object> options)
293 { 327 {
294 m_log.InfoFormat( 328 m_log.InfoFormat(
295 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); 329 "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath);
296 330
297 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); 331 new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion();
298 } 332 }
299 333
300 public void DearchiveRegion(Stream loadStream) 334 public void DearchiveRegion(Stream loadStream)
301 { 335 {
302 Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); 336 Dictionary<string, object> archiveOptions = new Dictionary<string, object>();
303 DearchiveRegion(loadStream, Guid.Empty, archiveOptions); 337 DearchiveRegion(loadStream, Guid.Empty, archiveOptions);
304 } 338 }
305
306 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) 339 public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options)
307 { 340 {
308 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); 341 new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion();