diff options
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 90 |
1 files changed, 88 insertions, 2 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 2aed61f..85049c9 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -297,10 +297,20 @@ namespace OpenSim | |||
297 | HandleEditScale); | 297 | HandleEditScale); |
298 | 298 | ||
299 | m_console.Commands.AddCommand("Objects", false, "rotate scene", | 299 | m_console.Commands.AddCommand("Objects", false, "rotate scene", |
300 | "rotate scene <degrees>", | 300 | "rotate scene <degrees> [centerX, centerY]", |
301 | "Rotates all scene objects around x:128, y:128", | 301 | "Rotates all scene objects around centerX, centerY (defailt 128, 128) (please back up your region before using)", |
302 | HandleRotateScene); | 302 | HandleRotateScene); |
303 | 303 | ||
304 | m_console.Commands.AddCommand("Objects", false, "scale scene", | ||
305 | "scale scene <factor>", | ||
306 | "Scales the scene objects (please back up your region before using)", | ||
307 | HandleScaleScene); | ||
308 | |||
309 | m_console.Commands.AddCommand("Objects", false, "translate scene", | ||
310 | "translate scene xOffset yOffset zOffset", | ||
311 | "translates the scene objects (please back up your region before using)", | ||
312 | HandleTranslateScene); | ||
313 | |||
304 | m_console.Commands.AddCommand("Users", false, "kick user", | 314 | m_console.Commands.AddCommand("Users", false, "kick user", |
305 | "kick user <first> <last> [--force] [message]", | 315 | "kick user <first> <last> [--force] [message]", |
306 | "Kick a user off the simulator", | 316 | "Kick a user off the simulator", |
@@ -549,6 +559,82 @@ namespace OpenSim | |||
549 | }); | 559 | }); |
550 | } | 560 | } |
551 | 561 | ||
562 | private void HandleScaleScene(string module, string[] args) | ||
563 | { | ||
564 | string usage = "Usage: scale scene <factor>"; | ||
565 | |||
566 | if (args.Length < 3) | ||
567 | { | ||
568 | MainConsole.Instance.Output(usage); | ||
569 | return; | ||
570 | } | ||
571 | |||
572 | float factor = (float)(Convert.ToSingle(args[2])); | ||
573 | |||
574 | float minZ = float.MaxValue; | ||
575 | |||
576 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
577 | { | ||
578 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
579 | { | ||
580 | if (sog.AttachmentPoint == 0) | ||
581 | { | ||
582 | if (sog.RootPart.AbsolutePosition.Z < minZ) | ||
583 | minZ = sog.RootPart.AbsolutePosition.Z; | ||
584 | } | ||
585 | }); | ||
586 | }); | ||
587 | |||
588 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
589 | { | ||
590 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
591 | { | ||
592 | if (sog.AttachmentPoint == 0) | ||
593 | { | ||
594 | Vector3 tmpRootPos = sog.RootPart.AbsolutePosition; | ||
595 | tmpRootPos.Z -= minZ; | ||
596 | tmpRootPos *= factor; | ||
597 | tmpRootPos.Z += minZ; | ||
598 | |||
599 | foreach (SceneObjectPart sop in sog.Parts) | ||
600 | { | ||
601 | if (sop.ParentID != 0) | ||
602 | sop.OffsetPosition *= factor; | ||
603 | sop.Scale *= factor; | ||
604 | } | ||
605 | |||
606 | sog.UpdateGroupPosition(tmpRootPos); | ||
607 | } | ||
608 | }); | ||
609 | }); | ||
610 | } | ||
611 | |||
612 | private void HandleTranslateScene(string module, string[] args) | ||
613 | { | ||
614 | string usage = "Usage: translate scene <xOffset, yOffset, zOffset>"; | ||
615 | |||
616 | if (args.Length < 5) | ||
617 | { | ||
618 | MainConsole.Instance.Output(usage); | ||
619 | return; | ||
620 | } | ||
621 | |||
622 | float xOFfset = (float)Convert.ToSingle(args[2]); | ||
623 | float yOffset = (float)Convert.ToSingle(args[3]); | ||
624 | float zOffset = (float)Convert.ToSingle(args[4]); | ||
625 | |||
626 | Vector3 offset = new Vector3(xOFfset, yOffset, zOffset); | ||
627 | |||
628 | SceneManager.ForEachSelectedScene(delegate(Scene scene) | ||
629 | { | ||
630 | scene.ForEachSOG(delegate(SceneObjectGroup sog) | ||
631 | { | ||
632 | if (sog.AttachmentPoint == 0) | ||
633 | sog.UpdateGroupPosition(sog.AbsolutePosition + offset); | ||
634 | }); | ||
635 | }); | ||
636 | } | ||
637 | |||
552 | /// <summary> | 638 | /// <summary> |
553 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console | 639 | /// Creates a new region based on the parameters specified. This will ask the user questions on the console |
554 | /// </summary> | 640 | /// </summary> |