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/CoreModules/World/Archiver/ArchiveReadRequest.cs | |
parent | varregion: add --noterrain and --noparcel to 'load oar'. (diff) | |
download | opensim-SC_OLD-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.zip opensim-SC_OLD-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.tar.gz opensim-SC_OLD-5e6a47f13f3dbc273dda0f76e506b60fd27d7f66.tar.bz2 opensim-SC_OLD-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 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 55 |
1 files changed, 46 insertions, 9 deletions
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 | ||