diff options
author | Robert Adams | 2014-01-19 10:09:43 -0800 |
---|---|---|
committer | Robert Adams | 2014-01-19 10:09:43 -0800 |
commit | dd6db7293975bffc3693e0164dda8307a4e4bcf7 (patch) | |
tree | cfd275e8cbc9e64913b1dbf033164956b37098c5 /OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |
parent | Merge branch 'master' into varregion (diff) | |
download | opensim-SC_OLD-dd6db7293975bffc3693e0164dda8307a4e4bcf7.zip opensim-SC_OLD-dd6db7293975bffc3693e0164dda8307a4e4bcf7.tar.gz opensim-SC_OLD-dd6db7293975bffc3693e0164dda8307a4e4bcf7.tar.bz2 opensim-SC_OLD-dd6db7293975bffc3693e0164dda8307a4e4bcf7.tar.xz |
varregion: add --displacement parameter to 'load oar'.
Adds displacment to all objects and terrain loaded from the oar.
As an example, if you have a 512x512 region and an old 256x256 oar, doing
load oar --displacement "<128,128,0>" oarFile.oar
will load the object (and terrain) into the middle of the 512x512 region.
If displacement is not specified, 'load oar' works like it always has.
If you have a 5
Diffstat (limited to 'OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index d451b9e..d249129 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -104,6 +104,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
104 | /// </value> | 104 | /// </value> |
105 | protected bool m_skipAssets; | 105 | protected bool m_skipAssets; |
106 | 106 | ||
107 | /// <value> | ||
108 | /// Displacement added to each object as it is added to the world | ||
109 | /// </value> | ||
110 | protected Vector3 m_displacement = new Vector3(0f, 0f, 0f); | ||
111 | |||
107 | /// <summary> | 112 | /// <summary> |
108 | /// Used to cache lookups for valid uuids. | 113 | /// Used to cache lookups for valid uuids. |
109 | /// </summary> | 114 | /// </summary> |
@@ -132,7 +137,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
132 | private IAssetService m_assetService = null; | 137 | private IAssetService m_assetService = null; |
133 | 138 | ||
134 | 139 | ||
135 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Guid requestId) | 140 | public ArchiveReadRequest(Scene scene, string loadPath, bool merge, bool skipAssets, Vector3 displacement, Guid requestId) |
136 | { | 141 | { |
137 | m_rootScene = scene; | 142 | m_rootScene = scene; |
138 | 143 | ||
@@ -153,6 +158,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
153 | m_merge = merge; | 158 | m_merge = merge; |
154 | m_skipAssets = skipAssets; | 159 | m_skipAssets = skipAssets; |
155 | m_requestId = requestId; | 160 | m_requestId = requestId; |
161 | m_displacement = displacement; | ||
156 | 162 | ||
157 | // Zero can never be a valid user id | 163 | // Zero can never be a valid user id |
158 | m_validUserUuids[UUID.Zero] = false; | 164 | m_validUserUuids[UUID.Zero] = false; |
@@ -445,6 +451,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
445 | 451 | ||
446 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); | 452 | SceneObjectGroup sceneObject = serialiser.DeserializeGroupFromXml2(serialisedSceneObject); |
447 | 453 | ||
454 | // Happily this does not do much to the object since it hasn't been added to the scene yet | ||
455 | sceneObject.AbsolutePosition += m_displacement; | ||
456 | |||
457 | |||
448 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); | 458 | bool isTelehub = (sceneObject.UUID == oldTelehubUUID) && (oldTelehubUUID != UUID.Zero); |
449 | 459 | ||
450 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned | 460 | // For now, give all incoming scene objects new uuids. This will allow scenes to be cloned |
@@ -809,7 +819,15 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
809 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); | 819 | ITerrainModule terrainModule = scene.RequestModuleInterface<ITerrainModule>(); |
810 | 820 | ||
811 | MemoryStream ms = new MemoryStream(data); | 821 | MemoryStream ms = new MemoryStream(data); |
812 | terrainModule.LoadFromStream(terrainPath, ms); | 822 | if (m_displacement != Vector3.Zero) |
823 | { | ||
824 | Vector2 terrainDisplacement = new Vector2(m_displacement.X, m_displacement.Y); | ||
825 | terrainModule.LoadFromStream(terrainPath, terrainDisplacement, ms); | ||
826 | } | ||
827 | else | ||
828 | { | ||
829 | terrainModule.LoadFromStream(terrainPath, ms); | ||
830 | } | ||
813 | ms.Close(); | 831 | ms.Close(); |
814 | 832 | ||
815 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); | 833 | m_log.DebugFormat("[ARCHIVER]: Restored terrain {0}", terrainPath); |