From 9c81b8a430b7fc8b0181310132f4bc9de414f19d Mon Sep 17 00:00:00 2001 From: Sean Dague Date: Wed, 5 Dec 2007 18:45:05 +0000 Subject: From Gary Chernega (IBM) This patch adds x, y, and z offsets to the load-xml command. If you had a prim at 100,100,20 thats where it would get loaded everytime. This patch lets you place it at an offset from 100,100,20.. as such: load-xml -newUI 3 1 2 Loading the prim at 103, 101, 22 --- OpenSim/Region/Environment/Scenes/Scene.cs | 4 ++-- OpenSim/Region/Environment/Scenes/SceneManager.cs | 4 ++-- OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs | 9 ++++++--- 3 files changed, 10 insertions(+), 7 deletions(-) (limited to 'OpenSim/Region/Environment') diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index 5ae26d3..f3ea89a 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -885,9 +885,9 @@ namespace OpenSim.Region.Environment.Scenes prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; } - public void LoadPrimsFromXml(string fileName, bool newIdsFlag) + public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) { - m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag); + m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag, loadOffset); } public void SavePrimsToXml(string fileName) diff --git a/OpenSim/Region/Environment/Scenes/SceneManager.cs b/OpenSim/Region/Environment/Scenes/SceneManager.cs index 2af9af2..3f88617 100644 --- a/OpenSim/Region/Environment/Scenes/SceneManager.cs +++ b/OpenSim/Region/Environment/Scenes/SceneManager.cs @@ -160,9 +160,9 @@ namespace OpenSim.Region.Environment.Scenes CurrentOrFirstScene.SavePrimsToXml(filename); } - public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs) + public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, LLVector3 loadOffset) { - CurrentOrFirstScene.LoadPrimsFromXml(filename, generateNewIDs); + CurrentOrFirstScene.LoadPrimsFromXml(filename, generateNewIDs, loadOffset); } public void SaveCurrentSceneToXml2(string filename) diff --git a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs index ab8f835..9316989 100644 --- a/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs +++ b/OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs @@ -23,7 +23,7 @@ namespace OpenSim.Region.Environment.Scenes m_regInfo = regionInfo; } - public void LoadPrimsFromXml(string fileName, bool newIDS) + public void LoadPrimsFromXml(string fileName, bool newIDS, LLVector3 loadOffset) { XmlDocument doc = new XmlDocument(); XmlNode rootNode; @@ -48,14 +48,17 @@ namespace OpenSim.Region.Environment.Scenes m_innerScene.AddEntity(obj); SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); + // Apply loadOffsets for load/import and move combinations + rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset; bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) { rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( rootPart.Name, rootPart.Shape, - new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, - rootPart.AbsolutePosition.Z), + new PhysicsVector(rootPart.AbsolutePosition.X + loadOffset.X, + rootPart.AbsolutePosition.Y + loadOffset.Y, + rootPart.AbsolutePosition.Z + loadOffset.Z), new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); -- cgit v1.1