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
afrisby
Sean Dague 2007-12-05 18:45:05 +00:00
parent 71fd737a66
commit 9c81b8a430
4 changed files with 22 additions and 10 deletions

View File

@ -42,6 +42,7 @@ using OpenSim.Region.Environment;
using OpenSim.Region.Environment.Interfaces;
using OpenSim.Region.Environment.Scenes;
using OpenSim.Region.Physics.Manager;
using libsecondlife;
using Mono.Addins;
using Mono.Addins.Description;
@ -664,6 +665,7 @@ namespace OpenSim
break;
case "load-xml":
LLVector3 loadOffset = new LLVector3(0, 0, 0);
if (cmdparams.Length > 0)
{
bool generateNewIDS = false;
@ -672,13 +674,20 @@ namespace OpenSim
if (cmdparams[1] == "-newUID")
{
generateNewIDS = true;
}
}
if (cmdparams.Length > 2)
{
loadOffset.X = (float)Convert.ToDecimal(cmdparams[2]);
if (cmdparams.Length > 3) { loadOffset.Y = (float)Convert.ToDecimal(cmdparams[3]); }
if (cmdparams.Length > 4) { loadOffset.Z = (float)Convert.ToDecimal(cmdparams[4]); }
m_log.Error("loadOffsets <X,Y,Z> = <" + loadOffset.X + "," + loadOffset.Y + "," + loadOffset.Z + ">");
}
}
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS);
m_sceneManager.LoadCurrentSceneFromXml(cmdparams[0], generateNewIDS, loadOffset);
}
else
{
m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false);
m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
}
break;

View File

@ -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)

View File

@ -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)

View File

@ -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);