aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorSean Dague2007-12-05 18:45:05 +0000
committerSean Dague2007-12-05 18:45:05 +0000
commit9c81b8a430b7fc8b0181310132f4bc9de414f19d (patch)
treeba6b03695d1bfdebfbc3c81bd55bc8ac41eeac46
parent* Applied MSSQL Patch from akokko, Thanks! akokko (diff)
downloadopensim-SC_OLD-9c81b8a430b7fc8b0181310132f4bc9de414f19d.zip
opensim-SC_OLD-9c81b8a430b7fc8b0181310132f4bc9de414f19d.tar.gz
opensim-SC_OLD-9c81b8a430b7fc8b0181310132f4bc9de414f19d.tar.bz2
opensim-SC_OLD-9c81b8a430b7fc8b0181310132f4bc9de414f19d.tar.xz
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 <filespec> -newUI 3 1 2 Loading the prim at 103, 101, 22
-rw-r--r--OpenSim/Region/Application/OpenSimMain.cs15
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneManager.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneXmlLoader.cs9
4 files changed, 22 insertions, 10 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs
index b941e2d..9ad6c5f 100644
--- a/OpenSim/Region/Application/OpenSimMain.cs
+++ b/OpenSim/Region/Application/OpenSimMain.cs
@@ -42,6 +42,7 @@ using OpenSim.Region.Environment;
42using OpenSim.Region.Environment.Interfaces; 42using OpenSim.Region.Environment.Interfaces;
43using OpenSim.Region.Environment.Scenes; 43using OpenSim.Region.Environment.Scenes;
44using OpenSim.Region.Physics.Manager; 44using OpenSim.Region.Physics.Manager;
45using libsecondlife;
45using Mono.Addins; 46using Mono.Addins;
46using Mono.Addins.Description; 47using Mono.Addins.Description;
47 48
@@ -664,6 +665,7 @@ namespace OpenSim
664 break; 665 break;
665 666
666 case "load-xml": 667 case "load-xml":
668 LLVector3 loadOffset = new LLVector3(0, 0, 0);
667 if (cmdparams.Length > 0) 669 if (cmdparams.Length > 0)
668 { 670 {
669 bool generateNewIDS = false; 671 bool generateNewIDS = false;
@@ -672,13 +674,20 @@ namespace OpenSim
672 if (cmdparams[1] == "-newUID") 674 if (cmdparams[1] == "-newUID")
673 { 675 {
674 generateNewIDS = true; 676 generateNewIDS = true;
675 } 677 }
678 if (cmdparams.Length > 2)
679 {
680 loadOffset.X = (float)Convert.ToDecimal(cmdparams[2]);
681 if (cmdparams.Length > 3) { loadOffset.Y = (float)Convert.ToDecimal(cmdparams[3]); }
682 if (cmdparams.Length > 4) { loadOffset.Z = (float)Convert.ToDecimal(cmdparams[4]); }
683 m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + loadOffset.Z + ">");
684 }
676 } 685 }
677 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS); 686 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
678 } 687 }
679 else 688 else
680 { 689 {
681 m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false); 690 m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
682 } 691 }
683 break; 692 break;
684 693
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
885 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted; 885 prim.OnPrimCountTainted += m_LandManager.setPrimsTainted;
886 } 886 }
887 887
888 public void LoadPrimsFromXml(string fileName, bool newIdsFlag) 888 public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset)
889 { 889 {
890 m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag); 890 m_sceneXmlLoader.LoadPrimsFromXml(fileName, newIdsFlag, loadOffset);
891 } 891 }
892 892
893 public void SavePrimsToXml(string fileName) 893 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
160 CurrentOrFirstScene.SavePrimsToXml(filename); 160 CurrentOrFirstScene.SavePrimsToXml(filename);
161 } 161 }
162 162
163 public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs) 163 public void LoadCurrentSceneFromXml(string filename, bool generateNewIDs, LLVector3 loadOffset)
164 { 164 {
165 CurrentOrFirstScene.LoadPrimsFromXml(filename, generateNewIDs); 165 CurrentOrFirstScene.LoadPrimsFromXml(filename, generateNewIDs, loadOffset);
166 } 166 }
167 167
168 public void SaveCurrentSceneToXml2(string filename) 168 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
23 m_regInfo = regionInfo; 23 m_regInfo = regionInfo;
24 } 24 }
25 25
26 public void LoadPrimsFromXml(string fileName, bool newIDS) 26 public void LoadPrimsFromXml(string fileName, bool newIDS, LLVector3 loadOffset)
27 { 27 {
28 XmlDocument doc = new XmlDocument(); 28 XmlDocument doc = new XmlDocument();
29 XmlNode rootNode; 29 XmlNode rootNode;
@@ -48,14 +48,17 @@ namespace OpenSim.Region.Environment.Scenes
48 m_innerScene.AddEntity(obj); 48 m_innerScene.AddEntity(obj);
49 49
50 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID); 50 SceneObjectPart rootPart = obj.GetChildPart(obj.UUID);
51 // Apply loadOffsets for load/import and move combinations
52 rootPart.GroupPosition = rootPart.AbsolutePosition + loadOffset;
51 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim); 53 bool UsePhysics = (((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Physics) > 0) && m_parentScene.m_physicalPrim);
52 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0) 54 if ((rootPart.ObjectFlags & (uint)LLObject.ObjectFlags.Phantom) == 0)
53 { 55 {
54 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape( 56 rootPart.PhysActor = m_innerScene.PhysicsScene.AddPrimShape(
55 rootPart.Name, 57 rootPart.Name,
56 rootPart.Shape, 58 rootPart.Shape,
57 new PhysicsVector(rootPart.AbsolutePosition.X, rootPart.AbsolutePosition.Y, 59 new PhysicsVector(rootPart.AbsolutePosition.X + loadOffset.X,
58 rootPart.AbsolutePosition.Z), 60 rootPart.AbsolutePosition.Y + loadOffset.Y,
61 rootPart.AbsolutePosition.Z + loadOffset.Z),
59 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z), 62 new PhysicsVector(rootPart.Scale.X, rootPart.Scale.Y, rootPart.Scale.Z),
60 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X, 63 new Quaternion(rootPart.RotationOffset.W, rootPart.RotationOffset.X,
61 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics); 64 rootPart.RotationOffset.Y, rootPart.RotationOffset.Z), UsePhysics);