diff options
author | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
---|---|---|
committer | David Walter Seikel | 2016-11-03 21:44:39 +1000 |
commit | 134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch) | |
tree | 216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |
parent | More changing to production grid. Double oops. (diff) | |
download | opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2 opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz |
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 109 |
1 files changed, 99 insertions, 10 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index 1be6386..6a09caf 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,62 @@ 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 | String defaultUser = ""; | ||
112 | float rotation = 0f; | ||
113 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | ||
104 | 114 | ||
105 | OptionSet options = new OptionSet().Add("m|merge", delegate (string v) { mergeOar = v != null; }); | 115 | OptionSet options = new OptionSet(); |
106 | options.Add("s|skip-assets", delegate (string v) { skipAssets = v != null; }); | 116 | 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("force-terrain", delegate (string v) { forceTerrain = (v != null); }); | ||
119 | 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("forceparcels", delegate (string v) { forceParcels = (v != null); }); // downward compatibility | ||
122 | 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("displacement=", delegate (string v) { | ||
125 | try | ||
126 | { | ||
127 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); | ||
128 | } | ||
129 | catch | ||
130 | { | ||
131 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing displacement"); | ||
132 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --displacement \"<128,128,0>\""); | ||
133 | return; | ||
134 | } | ||
135 | }); | ||
136 | options.Add("rotation=", delegate(string v) | ||
137 | { | ||
138 | try | ||
139 | { | ||
140 | rotation = v == null ? 0f : float.Parse(v); | ||
141 | } | ||
142 | catch | ||
143 | { | ||
144 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation"); | ||
145 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be an angle in degrees between -360 and +360: --rotation 45"); | ||
146 | return; | ||
147 | } | ||
148 | // Convert to radians for internals | ||
149 | rotation = Util.Clamp<float>(rotation, -359f, 359f) / 180f * (float)Math.PI; | ||
150 | }); | ||
151 | options.Add("rotation-center=", delegate (string v) { | ||
152 | try | ||
153 | { | ||
154 | rotationCenter = v == null ? Vector3.Zero : Vector3.Parse(v); | ||
155 | } | ||
156 | catch | ||
157 | { | ||
158 | m_log.ErrorFormat("[ARCHIVER MODULE] failure parsing rotation displacement"); | ||
159 | m_log.ErrorFormat("[ARCHIVER MODULE] Must be represented as vector3: --rotation-center \"<128,128,0>\""); | ||
160 | return; | ||
161 | } | ||
162 | }); | ||
107 | 163 | ||
108 | // Send a message to the region ready module | 164 | // Send a message to the region ready module |
109 | /* bluewall* Disable this for the time being | 165 | /* bluewall* Disable this for the time being |
@@ -122,13 +178,44 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
122 | // foreach (string param in mainParams) | 178 | // foreach (string param in mainParams) |
123 | // m_log.DebugFormat("GOT PARAM [{0}]", param); | 179 | // m_log.DebugFormat("GOT PARAM [{0}]", param); |
124 | 180 | ||
181 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | ||
182 | if (mergeOar) archiveOptions.Add("merge", null); | ||
183 | if (skipAssets) archiveOptions.Add("skipAssets", null); | ||
184 | if (forceTerrain) archiveOptions.Add("force-terrain", null); | ||
185 | if (forceParcels) archiveOptions.Add("force-parcels", null); | ||
186 | if (noObjects) archiveOptions.Add("no-objects", null); | ||
187 | if (defaultUser != "") | ||
188 | { | ||
189 | UUID defaultUserUUID = UUID.Zero; | ||
190 | try | ||
191 | { | ||
192 | defaultUserUUID = Scene.UserManagementModule.GetUserIdByName(defaultUser); | ||
193 | } | ||
194 | catch | ||
195 | { | ||
196 | m_log.ErrorFormat("[ARCHIVER MODULE] default user must be in format \"First Last\"", defaultUser); | ||
197 | } | ||
198 | if (defaultUserUUID == UUID.Zero) | ||
199 | { | ||
200 | m_log.ErrorFormat("[ARCHIVER MODULE] cannot find specified default user {0}", defaultUser); | ||
201 | return; | ||
202 | } | ||
203 | else | ||
204 | { | ||
205 | archiveOptions.Add("default-user", defaultUserUUID); | ||
206 | } | ||
207 | } | ||
208 | archiveOptions.Add("displacement", displacement); | ||
209 | archiveOptions.Add("rotation", rotation); | ||
210 | archiveOptions.Add("rotation-center", rotationCenter); | ||
211 | |||
125 | if (mainParams.Count > 2) | 212 | if (mainParams.Count > 2) |
126 | { | 213 | { |
127 | DearchiveRegion(mainParams[2], mergeOar, skipAssets, Guid.Empty); | 214 | DearchiveRegion(mainParams[2], Guid.Empty, archiveOptions); |
128 | } | 215 | } |
129 | else | 216 | else |
130 | { | 217 | { |
131 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, mergeOar, skipAssets, Guid.Empty); | 218 | DearchiveRegion(DEFAULT_OAR_BACKUP_FILENAME, Guid.Empty, archiveOptions); |
132 | } | 219 | } |
133 | } | 220 | } |
134 | 221 | ||
@@ -198,25 +285,27 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
198 | 285 | ||
199 | public void DearchiveRegion(string loadPath) | 286 | public void DearchiveRegion(string loadPath) |
200 | { | 287 | { |
201 | DearchiveRegion(loadPath, false, false, Guid.Empty); | 288 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
289 | DearchiveRegion(loadPath, Guid.Empty, archiveOptions); | ||
202 | } | 290 | } |
203 | 291 | ||
204 | public void DearchiveRegion(string loadPath, bool merge, bool skipAssets, Guid requestId) | 292 | public void DearchiveRegion(string loadPath, Guid requestId, Dictionary<string,object> options) |
205 | { | 293 | { |
206 | m_log.InfoFormat( | 294 | m_log.InfoFormat( |
207 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); | 295 | "[ARCHIVER]: Loading archive to region {0} from {1}", Scene.RegionInfo.RegionName, loadPath); |
208 | 296 | ||
209 | new ArchiveReadRequest(Scene, loadPath, merge, skipAssets, requestId).DearchiveRegion(); | 297 | new ArchiveReadRequest(Scene, loadPath, requestId, options).DearchiveRegion(); |
210 | } | 298 | } |
211 | 299 | ||
212 | public void DearchiveRegion(Stream loadStream) | 300 | public void DearchiveRegion(Stream loadStream) |
213 | { | 301 | { |
214 | DearchiveRegion(loadStream, false, false, Guid.Empty); | 302 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
303 | DearchiveRegion(loadStream, Guid.Empty, archiveOptions); | ||
215 | } | 304 | } |
216 | 305 | ||
217 | public void DearchiveRegion(Stream loadStream, bool merge, bool skipAssets, Guid requestId) | 306 | public void DearchiveRegion(Stream loadStream, Guid requestId, Dictionary<string, object> options) |
218 | { | 307 | { |
219 | new ArchiveReadRequest(Scene, loadStream, merge, skipAssets, requestId).DearchiveRegion(); | 308 | new ArchiveReadRequest(Scene, loadStream, requestId, options).DearchiveRegion(); |
220 | } | 309 | } |
221 | } | 310 | } |
222 | } | 311 | } |