Merge commit '08750501617ca332ab196b2f25030e3c635c9dd6' into careminster

avinationmerge
Melanie 2014-01-05 20:03:48 +00:00
commit 31279a3308
1 changed files with 88 additions and 2 deletions

View File

@ -297,10 +297,20 @@ namespace OpenSim
HandleEditScale); HandleEditScale);
m_console.Commands.AddCommand("Objects", false, "rotate scene", m_console.Commands.AddCommand("Objects", false, "rotate scene",
"rotate scene <degrees>", "rotate scene <degrees> [centerX, centerY]",
"Rotates all scene objects around x:128, y:128", "Rotates all scene objects around centerX, centerY (defailt 128, 128) (please back up your region before using)",
HandleRotateScene); HandleRotateScene);
m_console.Commands.AddCommand("Objects", false, "scale scene",
"scale scene <factor>",
"Scales the scene objects (please back up your region before using)",
HandleScaleScene);
m_console.Commands.AddCommand("Objects", false, "translate scene",
"translate scene xOffset yOffset zOffset",
"translates the scene objects (please back up your region before using)",
HandleTranslateScene);
m_console.Commands.AddCommand("Users", false, "kick user", m_console.Commands.AddCommand("Users", false, "kick user",
"kick user <first> <last> [--force] [message]", "kick user <first> <last> [--force] [message]",
"Kick a user off the simulator", "Kick a user off the simulator",
@ -549,6 +559,82 @@ namespace OpenSim
}); });
} }
private void HandleScaleScene(string module, string[] args)
{
string usage = "Usage: scale scene <factor>";
if (args.Length < 3)
{
MainConsole.Instance.Output(usage);
return;
}
float factor = (float)(Convert.ToSingle(args[2]));
float minZ = float.MaxValue;
SceneManager.ForEachSelectedScene(delegate(Scene scene)
{
scene.ForEachSOG(delegate(SceneObjectGroup sog)
{
if (sog.AttachmentPoint == 0)
{
if (sog.RootPart.AbsolutePosition.Z < minZ)
minZ = sog.RootPart.AbsolutePosition.Z;
}
});
});
SceneManager.ForEachSelectedScene(delegate(Scene scene)
{
scene.ForEachSOG(delegate(SceneObjectGroup sog)
{
if (sog.AttachmentPoint == 0)
{
Vector3 tmpRootPos = sog.RootPart.AbsolutePosition;
tmpRootPos.Z -= minZ;
tmpRootPos *= factor;
tmpRootPos.Z += minZ;
foreach (SceneObjectPart sop in sog.Parts)
{
if (sop.ParentID != 0)
sop.OffsetPosition *= factor;
sop.Scale *= factor;
}
sog.UpdateGroupPosition(tmpRootPos);
}
});
});
}
private void HandleTranslateScene(string module, string[] args)
{
string usage = "Usage: translate scene <xOffset, yOffset, zOffset>";
if (args.Length < 5)
{
MainConsole.Instance.Output(usage);
return;
}
float xOFfset = (float)Convert.ToSingle(args[2]);
float yOffset = (float)Convert.ToSingle(args[3]);
float zOffset = (float)Convert.ToSingle(args[4]);
Vector3 offset = new Vector3(xOFfset, yOffset, zOffset);
SceneManager.ForEachSelectedScene(delegate(Scene scene)
{
scene.ForEachSOG(delegate(SceneObjectGroup sog)
{
if (sog.AttachmentPoint == 0)
sog.UpdateGroupPosition(sog.AbsolutePosition + offset);
});
});
}
/// <summary> /// <summary>
/// Creates a new region based on the parameters specified. This will ask the user questions on the console /// Creates a new region based on the parameters specified. This will ask the user questions on the console
/// </summary> /// </summary>