diff options
author | Robert Adams | 2014-01-19 12:45:16 -0800 |
---|---|---|
committer | Robert Adams | 2014-01-19 12:45:16 -0800 |
commit | 5e6a47f13f3dbc273dda0f76e506b60fd27d7f66 (patch) | |
tree | 1184bed69a3eb16745ba63d08c2bfc83f95774a5 /OpenSim/Region | |
parent | varregion: add --noterrain and --noparcel to 'load oar'. (diff) | |
download | opensim-SC-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.zip opensim-SC-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.tar.gz opensim-SC-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.tar.bz2 opensim-SC-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.tar.xz |
varregion: remove --noterrain and --noparcel parameters in 'load oar'.
Add --forceterrain and --forceparcel to 'load oar'. In order to not change
the operation of --merge (which does an object merge and suppresses terrain
and parcel information loading), added the --force* parameters to be used
when loading multiple oars to build up a varregion.
Added --rotation and --rotationcenter parameters to 'load oar' which apply a rotation to
the loaded oar objects before displacing. The rotation is in degrees (pos or neg)
and the center defaults to "<128, 128, 0>".
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 55 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | 28 |
3 files changed, 76 insertions, 21 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 30e2b1b..1e36853 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -266,13 +266,19 @@ namespace OpenSim | |||
266 | SavePrimsXml2); | 266 | SavePrimsXml2); |
267 | 267 | ||
268 | m_console.Commands.AddCommand("Archiving", false, "load oar", | 268 | m_console.Commands.AddCommand("Archiving", false, "load oar", |
269 | "load oar [--merge] [--skip-assets] [--noterrain] [--displacement \"<x,y,z>\"] [<OAR path>]", | 269 | "load oar [--merge] [--skip-assets]" |
270 | + " [--forceterrain] [--forceparcels]" | ||
271 | + " [--rotation degrees] [--rotationCenter \"<x,y,z>\"]" | ||
272 | + " [--displacement \"<x,y,z>\"]" | ||
273 | + " [<OAR path>]", | ||
270 | "Load a region's data from an OAR archive.", | 274 | "Load a region's data from an OAR archive.", |
271 | "--merge will merge the OAR with the existing scene." + Environment.NewLine | 275 | "--merge will merge the OAR with the existing scene (suppresses terrain and parcel info loading)." + Environment.NewLine |
272 | + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine | 276 | + "--skip-assets will load the OAR but ignore the assets it contains." + Environment.NewLine |
273 | + "--displacement will add this value to the position of every object loaded" + Environment.NewLine | 277 | + "--displacement will add this value to the position of every object loaded" + Environment.NewLine |
274 | + "--noterrain suppresses the loading of terrain from the oar" + Environment.NewLine | 278 | + "--forceterrain forces the loading of terrain from the oar (undoes suppression done by --merge)" + Environment.NewLine |
275 | + "--noparcels suppresses the loading of parcels from the oar" + Environment.NewLine | 279 | + "--forceparcels forces the loading of parcels from the oar (undoes suppression done by --merge)" + Environment.NewLine |
280 | + "--rotation specified rotation to be applied to the oar. Specified in degrees." + Environment.NewLine | ||
281 | + "--rotationcenter Location (relative to original OAR) to apply rotation. Default is <128,128,0>" + Environment.NewLine | ||
276 | + "The path can be either a filesystem location or a URI." | 282 | + "The path can be either a filesystem location or a URI." |
277 | + " If this is not given then the command looks for an OAR named region.oar in the current directory.", | 283 | + " If this is not given then the command looks for an OAR named region.oar in the current directory.", |
278 | LoadOar); | 284 | LoadOar); |
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 637c4a3..f4807ad 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -96,18 +96,19 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
96 | 96 | ||
97 | /// <value> | 97 | /// <value> |
98 | /// Should the archive being loaded be merged with what is already on the region? | 98 | /// Should the archive being loaded be merged with what is already on the region? |
99 | /// Merging usually suppresses terrain and parcel loading | ||
99 | /// </value> | 100 | /// </value> |
100 | protected bool m_merge; | 101 | protected bool m_merge; |
101 | 102 | ||
102 | /// <value> | 103 | /// <value> |
103 | /// If true, suppresses the loading of terrain from the oar file | 104 | /// If true, force the loading of terrain from the oar file |
104 | /// </value> | 105 | /// </value> |
105 | protected bool m_noTerrain; | 106 | protected bool m_forceTerrain; |
106 | 107 | ||
107 | /// <value> | 108 | /// <value> |
108 | /// If true, suppresses the loading of parcels from the oar file | 109 | /// If true, force the loading of parcels from the oar file |
109 | /// </value> | 110 | /// </value> |
110 | protected bool m_noParcels; | 111 | protected bool m_forceParcels; |
111 | 112 | ||
112 | /// <value> | 113 | /// <value> |
113 | /// Should we ignore any assets when reloading the archive? | 114 | /// Should we ignore any assets when reloading the archive? |
@@ -119,6 +120,16 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
119 | /// </value> | 120 | /// </value> |
120 | protected Vector3 m_displacement = Vector3.Zero; | 121 | protected Vector3 m_displacement = Vector3.Zero; |
121 | 122 | ||
123 | /// <value> | ||
124 | /// Rotation to apply to the objects as they are loaded. | ||
125 | /// </value> | ||
126 | protected float m_rotation = 0f; | ||
127 | |||
128 | /// <value> | ||
129 | /// Center around which to apply the rotation relative to the origional oar position | ||
130 | /// </value> | ||
131 | protected Vector3 m_rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); | ||
132 | |||
122 | /// <summary> | 133 | /// <summary> |
123 | /// Used to cache lookups for valid uuids. | 134 | /// Used to cache lookups for valid uuids. |
124 | /// </summary> | 135 | /// </summary> |
@@ -166,11 +177,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
166 | 177 | ||
167 | m_errorMessage = String.Empty; | 178 | m_errorMessage = String.Empty; |
168 | m_merge = options.ContainsKey("merge"); | 179 | m_merge = options.ContainsKey("merge"); |
169 | m_noTerrain = options.ContainsKey("noTerrain"); | 180 | m_forceTerrain = options.ContainsKey("forceTerrain"); |
170 | m_noParcels = options.ContainsKey("noParcels"); | 181 | m_forceParcels = options.ContainsKey("forceParcels"); |
171 | m_skipAssets = options.ContainsKey("skipAssets"); | 182 | m_skipAssets = options.ContainsKey("skipAssets"); |
172 | m_requestId = requestId; | 183 | m_requestId = requestId; |
173 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; | 184 | m_displacement = options.ContainsKey("displacement") ? (Vector3)options["displacement"] : Vector3.Zero; |
185 | m_rotation = options.ContainsKey("rotation") ? (float)options["rotation"] : 0f; | ||
186 | m_rotationCenter = options.ContainsKey("rotationCenter") ? (Vector3)options["rotationCenter"] | ||
187 | : new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0f); | ||
174 | 188 | ||
175 | // Zero can never be a valid user id | 189 | // Zero can never be a valid user id |
176 | m_validUserUuids[UUID.Zero] = false; | 190 | m_validUserUuids[UUID.Zero] = false; |
@@ -261,7 +275,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
261 | if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) | 275 | if ((successfulAssetRestores + failedAssetRestores) % 250 == 0) |
262 | m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); | 276 | m_log.Debug("[ARCHIVER]: Loaded " + successfulAssetRestores + " assets and failed to load " + failedAssetRestores + " assets..."); |
263 | } | 277 | } |
264 | else if (!m_noTerrain && !m_merge && filePath.StartsWith(ArchiveConstants.TERRAINS_PATH)) | 278 | else if (filePath.StartsWith(ArchiveConstants.TERRAINS_PATH) && (!m_merge || m_forceTerrain)) |
265 | { | 279 | { |
266 | LoadTerrain(scene, filePath, data); | 280 | LoadTerrain(scene, filePath, data); |
267 | } | 281 | } |
@@ -269,7 +283,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
269 | { | 283 | { |
270 | LoadRegionSettings(scene, filePath, data, dearchivedScenes); | 284 | LoadRegionSettings(scene, filePath, data, dearchivedScenes); |
271 | } | 285 | } |
272 | else if (!m_noParcels && !m_merge && filePath.StartsWith(ArchiveConstants.LANDDATA_PATH)) | 286 | else if (filePath.StartsWith(ArchiveConstants.LANDDATA_PATH) && (!m_merge || m_forceParcels)) |
273 | { | 287 | { |
274 | sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); | 288 | sceneContext.SerialisedParcels.Add(Encoding.UTF8.GetString(data)); |
275 | } | 289 | } |
@@ -440,6 +454,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
440 | // Reload serialized prims | 454 | // Reload serialized prims |
441 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); | 455 | m_log.InfoFormat("[ARCHIVER]: Loading {0} scene objects. Please wait.", serialisedSceneObjects.Count); |
442 | 456 | ||
457 | float angle = (float)(m_rotation / 180.0 * Math.PI); | ||
458 | OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); | ||
459 | |||
443 | UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; | 460 | UUID oldTelehubUUID = scene.RegionInfo.RegionSettings.TelehubObject; |
444 | 461 | ||
445 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); | 462 | IRegionSerialiserModule serialiser = scene.RequestModuleInterface<IRegionSerialiserModule>(); |
@@ -464,7 +481,20 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
464 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); | 481 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); |
465 | 482 | ||
466 | // Happily this does not do much to the object since it hasn't been added to the scene yet | 483 | // Happily this does not do much to the object since it hasn't been added to the scene yet |
467 | sceneObject.AbsolutePosition += m_displacement; | 484 | if (sceneObject.AttachmentPoint == 0) |
485 | { | ||
486 | if (angle != 0f) | ||
487 | { | ||
488 | sceneObject.RootPart.RotationOffset = rot * sceneObject.GroupRotation; | ||
489 | Vector3 offset = sceneObject.AbsolutePosition - m_rotationCenter; | ||
490 | offset *= rot; | ||
491 | sceneObject.AbsolutePosition = m_rotationCenter + offset; | ||
492 | } | ||
493 | if (m_displacement != Vector3.Zero) | ||
494 | { | ||
495 | sceneObject.AbsolutePosition += m_displacement; | ||
496 | } | ||
497 | } | ||
468 | 498 | ||
469 | 499 | ||
470 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); | 500 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); |
@@ -571,6 +601,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
571 | foreach (string serialisedParcel in serialisedParcels) | 601 | foreach (string serialisedParcel in serialisedParcels) |
572 | { | 602 | { |
573 | LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); | 603 | LandData parcel = LandDataSerializer.Deserialize(serialisedParcel); |
604 | |||
605 | if (m_displacement != Vector3.Zero) | ||
606 | { | ||
607 | Vector3 parcelDisp = new Vector3(m_displacement.X, m_displacement.Y, 0f); | ||
608 | parcel.AABBMin += parcelDisp; | ||
609 | parcel.AABBMax += parcelDisp; | ||
610 | } | ||
574 | 611 | ||
575 | // Validate User and Group UUID's | 612 | // Validate User and Group UUID's |
576 | 613 | ||
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs index df5b443..2a6f1eb 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiverModule.cs | |||
@@ -104,19 +104,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | { | 104 | { |
105 | bool mergeOar = false; | 105 | bool mergeOar = false; |
106 | bool skipAssets = false; | 106 | bool skipAssets = false; |
107 | bool noTerrain = false; | 107 | bool forceTerrain = false; |
108 | bool noParcels = false; | 108 | bool forceParcels = false; |
109 | Vector3 displacement = new Vector3(0f, 0f, 0f); | 109 | Vector3 displacement = new Vector3(0f, 0f, 0f); |
110 | float rotation = 0f; | ||
111 | Vector3 rotationCenter = new Vector3(Constants.RegionSize / 2f, Constants.RegionSize / 2f, 0); | ||
110 | 112 | ||
111 | OptionSet options = new OptionSet(); | 113 | OptionSet options = new OptionSet(); |
112 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); | 114 | options.Add("m|merge", delegate (string v) { mergeOar = (v != null); }); |
113 | options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); | 115 | options.Add("s|skip-assets", delegate (string v) { skipAssets = (v != null); }); |
114 | options.Add("noterrain", delegate (string v) { noTerrain = (v != null); }); | 116 | options.Add("forceterrain", delegate (string v) { forceTerrain = (v != null); }); |
115 | options.Add("noparcels", delegate (string v) { noParcels = (v != null); }); | 117 | options.Add("forceparcels", delegate (string v) { forceParcels = (v != null); }); |
116 | options.Add("displacement=", delegate (string v) { | 118 | options.Add("displacement=", delegate (string v) { |
117 | try | 119 | try |
118 | { | 120 | { |
119 | displacement = v == null ? new Vector3(0f, 0f, 0f) : Vector3.Parse(v); | 121 | displacement = v == null ? Vector3.Zero : Vector3.Parse(v); |
120 | } | 122 | } |
121 | catch (Exception e) | 123 | catch (Exception e) |
122 | { | 124 | { |
@@ -124,6 +126,14 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
124 | displacement = new Vector3(0f, 0f, 0f); | 126 | displacement = new Vector3(0f, 0f, 0f); |
125 | } | 127 | } |
126 | }); | 128 | }); |
129 | options.Add("rotation=", delegate (string v) { | ||
130 | rotation = float.Parse(v); | ||
131 | rotation = Util.Clamp<float>(rotation, -359f, 359f); | ||
132 | }); | ||
133 | options.Add("rotationcenter=", delegate (string v) { | ||
134 | // RA 20130119: libomv's Vector2.Parse doesn't work. Need to use vector3 for the moment | ||
135 | rotationCenter = Vector3.Parse(v); | ||
136 | }); | ||
127 | 137 | ||
128 | // Send a message to the region ready module | 138 | // Send a message to the region ready module |
129 | /* bluewall* Disable this for the time being | 139 | /* bluewall* Disable this for the time being |
@@ -145,9 +155,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
145 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); | 155 | Dictionary<string, object> archiveOptions = new Dictionary<string, object>(); |
146 | if (mergeOar) archiveOptions.Add("merge", null); | 156 | if (mergeOar) archiveOptions.Add("merge", null); |
147 | if (skipAssets) archiveOptions.Add("skipAssets", null); | 157 | if (skipAssets) archiveOptions.Add("skipAssets", null); |
148 | if (noTerrain) archiveOptions.Add("noTerrain", null); | 158 | if (forceTerrain) archiveOptions.Add("forceTerrain", null); |
149 | if (noParcels) archiveOptions.Add("noParcels", null); | 159 | if (forceParcels) archiveOptions.Add("forceParcels", null); |
150 | if (displacement != Vector3.Zero) archiveOptions.Add("displacement", displacement); | 160 | archiveOptions.Add("displacement", displacement); |
161 | archiveOptions.Add("rotation", rotation); | ||
162 | archiveOptions.Add("rotationCenter", rotationCenter); | ||
151 | 163 | ||
152 | if (mainParams.Count > 2) | 164 | if (mainParams.Count > 2) |
153 | { | 165 | { |