From 5a9ec0748b901051ce0ec54e332ae4af002d570e Mon Sep 17 00:00:00 2001 From: dahlia Date: Tue, 26 Nov 2013 17:18:44 -0800 Subject: [PATCH] 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 :) --- OpenSim/Region/Application/OpenSim.cs | 33 +++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e31c3fcb5a..beb546dcb5 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -296,6 +296,11 @@ namespace OpenSim "Change the scale of a named prim", HandleEditScale); + m_console.Commands.AddCommand("Objects", false, "rotate scene", + "rotate scene ", + "Rotates all scene objects around x:128, y:128", + HandleRotateScene); + m_console.Commands.AddCommand("Users", false, "kick user", "kick user [--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 "; + + 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); + } + }); + }); + } + /// /// Creates a new region based on the parameters specified. This will ask the user questions on the console ///