aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSim.cs
diff options
context:
space:
mode:
authordahlia2013-11-26 21:07:37 -0800
committerdahlia2013-11-26 21:07:37 -0800
commite52a8d388fb1fe85b78b5b584cbb7d5444f464c0 (patch)
tree904712fdd79524ad9f9fbea7b79041cda759bbfc /OpenSim/Region/Application/OpenSim.cs
parentadd a "rotate scene" console command. Seems to work for prims/sculpts/mesh bu... (diff)
downloadopensim-SC_OLD-e52a8d388fb1fe85b78b5b584cbb7d5444f464c0.zip
opensim-SC_OLD-e52a8d388fb1fe85b78b5b584cbb7d5444f464c0.tar.gz
opensim-SC_OLD-e52a8d388fb1fe85b78b5b584cbb7d5444f464c0.tar.bz2
opensim-SC_OLD-e52a8d388fb1fe85b78b5b584cbb7d5444f464c0.tar.xz
"rotate scene" command now uses Constants.RegionSize / 2 to pick the center of rotation and center can be optionally overridden in the command line
Diffstat (limited to 'OpenSim/Region/Application/OpenSim.cs')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs19
1 files changed, 15 insertions, 4 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index beb546d..c2d9942 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -512,9 +512,12 @@ namespace OpenSim
512 512
513 private void HandleRotateScene(string module, string[] args) 513 private void HandleRotateScene(string module, string[] args)
514 { 514 {
515 string usage = "Usage: rotate scene <angle in degrees>"; 515 string usage = "Usage: rotate scene <angle in degrees> [centerX centerY] (centerX and centerY are optional and default to Constants.RegionSize / 2";
516 516
517 if (args.Length != 3) 517 float centerX = Constants.RegionSize * 0.5f;
518 float centerY = Constants.RegionSize * 0.5f;
519
520 if (args.Length < 3 || args.Length == 4)
518 { 521 {
519 MainConsole.Instance.Output(usage); 522 MainConsole.Instance.Output(usage);
520 return; 523 return;
@@ -523,6 +526,14 @@ namespace OpenSim
523 float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI); 526 float angle = (float)(Convert.ToSingle(args[2]) / 180.0 * Math.PI);
524 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle); 527 OpenMetaverse.Quaternion rot = OpenMetaverse.Quaternion.CreateFromAxisAngle(0, 0, 1, angle);
525 528
529 if (args.Length > 4)
530 {
531 centerX = Convert.ToSingle(args[3]);
532 centerY = Convert.ToSingle(args[4]);
533 }
534
535 Vector3 center = new Vector3(centerX, centerY, 0.0f);
536
526 SceneManager.ForEachSelectedScene(delegate(Scene scene) 537 SceneManager.ForEachSelectedScene(delegate(Scene scene)
527 { 538 {
528 scene.ForEachSOG(delegate(SceneObjectGroup sog) 539 scene.ForEachSOG(delegate(SceneObjectGroup sog)
@@ -530,9 +541,9 @@ namespace OpenSim
530 if (sog.AttachmentPoint == 0) 541 if (sog.AttachmentPoint == 0)
531 { 542 {
532 sog.RootPart.UpdateRotation(rot * sog.GroupRotation); 543 sog.RootPart.UpdateRotation(rot * sog.GroupRotation);
533 Vector3 offset = sog.AbsolutePosition - new Vector3(128.0f, 128.0f, 0.0f); 544 Vector3 offset = sog.AbsolutePosition - center;
534 offset *= rot; 545 offset *= rot;
535 sog.UpdateGroupPosition(new Vector3(128.0f, 128.0f, 0.0f) + offset); 546 sog.UpdateGroupPosition(center + offset);
536 } 547 }
537 }); 548 });
538 }); 549 });