diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 85 |
1 files changed, 75 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 1be6386..2b2da6f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -33,11 +33,14 @@ using log4net; | |||
33 | using NDesk.Options; | 33 | using NDesk.Options; |
34 | using Nini.Config; | 34 | using Nini.Config; |
35 | using Mono.Addins; | 35 | using Mono.Addins; |
36 | |||
36 | using OpenSim.Framework; | 37 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 38 | using OpenSim.Framework.Console; |
38 | using OpenSim.Region.Framework.Interfaces; | 39 | using OpenSim.Region.Framework.Interfaces; |
39 | using OpenSim.Region.Framework.Scenes; | 40 | using OpenSim.Region.Framework.Scenes; |
40 | 41 | ||
42 | using OpenMetaverse; | ||
43 | |||
41 | namespace OpenSim.Region.CoreModules.World.Archiver | 44 | namespace OpenSim.Region.CoreModules.World.Archiver |
42 | { | 45 | { |
43 | /// <summary> | 46 | /// <summary> |
@@ -101,9 +104,59 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
101 | { | 104 | { |
102 | bool mergeOar = false; | 105 | bool mergeOar = false; |
103 | bool skipAssets = false; | 106 | bool skipAssets = false; |
107 | bool forceTerrain = false; | ||
108 | bool forceParcels = false; | ||
109 | bool noObjects = false; | ||
110 | Vector3 displacement = new Vector3(0f, 0f, 0f); | ||
111 | float rotation = 0f; | ||
112 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | ||
104 | 113 | ||
105 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); | 114 | OptionSet options = new OptionSet(); |
106 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); | 115 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); |
116 | options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); | ||
117 | options.Add("force-terrain", delegate (string v) { forceTerrain = (v != null); }); | ||
118 | options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); // downward compatibility | ||
119 | options.Add("force-parcels", delegate (string v) { forceParcels = (v != null); }); | ||
120 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility | ||
121 | options.Add("no-objects", delegate (string v) { noObjects = (v != null); }); | ||
122 | options.Add("displacement=", delegate (string v) { | ||
123 | try | ||
124 | { | ||
125 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); | ||
126 | } | ||
127 | catch | ||
128 | { | ||
129 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); | ||
130 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --displacement \"<128,128,0>\""); | ||
131 | return; | ||
132 | } | ||
133 | }); | ||
134 | options.Add("rotation=", delegate (string v) { | ||
135 | try | ||
136 | { | ||
137 | rotation = v == null ? 0f : float.Parse(v); | ||
138 | } | ||
139 | catch | ||
140 | { | ||
141 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation"); | ||
142 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45"); | ||
143 | return; | ||
144 | } | ||
145 | // Convert to radians for internals | ||
146 | rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; | ||
147 | }); | ||
148 | options.Add("rotation-center=", delegate (string v) { | ||
149 | try | ||
150 | { | ||
151 | rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); | ||
152 | } | ||
153 | catch | ||
154 | { | ||
155 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement"); | ||
156 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotation-center \"<128,128,0>\""); | ||
157 | return; | ||
158 | } | ||
159 | }); | ||
107 | 160 | ||
108 | // Send a message to the region ready module | 161 | // Send a message to the region ready module |
109 | /* bluewall* Disable this for the time being | 162 | /* bluewall* Disable this for the time being |
@@ -122,13 +175,23 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
122 | // foreach (string param in mainParams) | 175 | // foreach (string param in mainParams) |
123 | // m_log.DebugFormat("GOT PARAM [{0}]", param); | 176 | // m_log.DebugFormat("GOT PARAM [{0}]", param); |
124 | 177 | ||
178 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | ||
179 | if (mergeOar) archiveOptions.Add("merge", null); | ||
180 | if (skipAssets) archiveOptions.Add("skipAssets", null); | ||
181 | if (forceTerrain) archiveOptions.Add("force-terrain", null); | ||
182 | if (forceParcels) archiveOptions.Add("force-parcels", null); | ||
183 | if (noObjects) archiveOptions.Add("no-objects", null); | ||
184 | archiveOptions.Add("displacement", displacement); | ||
185 | archiveOptions.Add("rotation", rotation); | ||
186 | archiveOptions.Add("rotation-center", rotationCenter); | ||
187 | |||
125 | if (mainParams.Count > 2) | 188 | if (mainParams.Count > 2) |
126 | { | 189 | { |
127 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); | 190 | DearchiveRegion(mainParams[2], Guid.Empty, archiveOptions); |
128 | } | 191 | } |
129 | else | 192 | else |
130 | { | 193 | { |
131 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, skipAssets, Guid.Empty); | 194 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, Guid.Empty, archiveOptions); |
132 | } | 195 | } |
133 | } | 196 | } |
134 | 197 | ||
@@ -198,25 +261,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
198 | 261 | ||
199 | public void DearchiveRegion(string loadPath) | 262 | public void DearchiveRegion(string loadPath) |
200 | { | 263 | { |
201 | DearchiveRegion(loadPath, false, false, Guid.Empty); | 264 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
265 | DearchiveRegion(loadPath, Guid.Empty, archiveOptions); | ||
202 | } | 266 | } |
203 | 267 | ||
204 | public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId) | 268 | public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options) |
205 | { | 269 | { |
206 | m_log.InfoFormat( | 270 | m_log.InfoFormat( |
207 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); | 271 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); |
208 | 272 | ||
209 | new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, requestId).DearchiveRegion(); | 273 | new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); |
210 | } | 274 | } |
211 | 275 | ||
212 | public void DearchiveRegion(Stream loadStream) | 276 | public void DearchiveRegion(Stream loadStream) |
213 | { | 277 | { |
214 | DearchiveRegion(loadStream, false, false, Guid.Empty); | 278 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
279 | DearchiveRegion(loadStream, Guid.Empty, archiveOptions); | ||
215 | } | 280 | } |
216 | 281 | ||
217 | public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId) | 282 | public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) |
218 | { | 283 | { |
219 | new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion(); | 284 | new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); |
220 | } | 285 | } |
221 | } | 286 | } |
222 | } | 287 | } |