add a "rotate scene" console command. Seems to work for prims/sculpts/mesh but not for foliage, don't know why. Also doesn't work on terrain. Successive use of this command will likely introduce floating point error accumulation. Back up your region before using it :)

master-beforevarregion
dahlia 2013-11-26 17:18:44 -08:00
parent 0ad45531a1
commit 5a9ec0748b
1 changed files with 33 additions and 0 deletions

View File

@ -296,6 +296,11 @@ namespace OpenSim
"Change the scale of a named prim",
HandleEditScale);
m_console.Commands.AddCommand("Objects", false, "rotate scene",
"rotate scene <degrees>",
"Rotates all scene objects around x:128, y:128",
HandleRotateScene);
m_console.Commands.AddCommand("Users", false, "kick user",
"kick user <first> <last> [--force] [message]",
"Kick a user off the simulator",
@ -505,6 +510,34 @@ namespace OpenSim
}
}
private void HandleRotateScene(string module, string[] args)
{
string usage = "Usage: rotate scene <angle in degrees>";
if (args.Length != 3)
{
MainConsole.Instance.Output(usage);
return;
}
float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI);
OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle);
SceneManager.ForEachSelectedScene(delegate(Scene scene)
{
scene.ForEachSOG(delegate(SceneObjectGroup sog)
{
if (sog.AttachmentPoint == 0)
{
sog.RootPart.UpdateRotation(rot * sog.GroupRotation);
Vector3 offset = sog.AbsolutePosition - new Vector3(128.0f, 128.0f, 0.0f);
offset *= rot;
sog.UpdateGroupPosition(new Vector3(128.0f, 128.0f, 0.0f) + offset);
}
});
});
}
/// <summary>
/// Creates a new region based on the parameters specified. This will ask the user questions on the console
/// </summary>