aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-09-26 23:17:21 +0100
committerJustin Clark-Casey (justincc)2012-09-26 23:17:21 +0100
commit36e3123069fb7524d3872d095c0f54c155c55a28 (patch)
tree63fbd5099bc821c79d7fc210913df95fd30ee0f2 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
parentEnforce existing 5 action hardcoded undo limit. (diff)
downloadopensim-SC_OLD-36e3123069fb7524d3872d095c0f54c155c55a28.zip
opensim-SC_OLD-36e3123069fb7524d3872d095c0f54c155c55a28.tar.gz
opensim-SC_OLD-36e3123069fb7524d3872d095c0f54c155c55a28.tar.bz2
opensim-SC_OLD-36e3123069fb7524d3872d095c0f54c155c55a28.tar.xz
Make it possible to rescale SOGs when they are not in a scene.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs54
1 files changed, 28 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index ac26be7..85a37e9 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2703,29 +2703,32 @@ namespace OpenSim.Region.Framework.Scenes
2703// m_log.DebugFormat( 2703// m_log.DebugFormat(
2704// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale); 2704// "[SCENE OBJECT GROUP]: Group resizing {0} {1} from {2} to {3}", Name, LocalId, RootPart.Scale, scale);
2705 2705
2706 RootPart.StoreUndoState(true);
2707
2708 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
2709 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
2710 scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
2711
2712 PhysicsActor pa = m_rootPart.PhysActor; 2706 PhysicsActor pa = m_rootPart.PhysActor;
2713 2707
2714 if (pa != null && pa.IsPhysical) 2708 RootPart.StoreUndoState(true);
2709
2710 if (Scene != null)
2715 { 2711 {
2716 scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); 2712 scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X));
2717 scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); 2713 scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y));
2718 scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); 2714 scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z));
2715
2716 if (pa != null && pa.IsPhysical)
2717 {
2718 scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X));
2719 scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y));
2720 scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z));
2721 }
2719 } 2722 }
2720 2723
2721 float x = (scale.X / RootPart.Scale.X); 2724 float x = (scale.X / RootPart.Scale.X);
2722 float y = (scale.Y / RootPart.Scale.Y); 2725 float y = (scale.Y / RootPart.Scale.Y);
2723 float z = (scale.Z / RootPart.Scale.Z); 2726 float z = (scale.Z / RootPart.Scale.Z);
2724 2727
2725 SceneObjectPart[] parts; 2728 SceneObjectPart[] parts = m_parts.GetArray();
2726 if (x > 1.0f || y > 1.0f || z > 1.0f) 2729
2730 if (Scene != null & (x > 1.0f || y > 1.0f || z > 1.0f))
2727 { 2731 {
2728 parts = m_parts.GetArray();
2729 for (int i = 0; i < parts.Length; i++) 2732 for (int i = 0; i < parts.Length; i++)
2730 { 2733 {
2731 SceneObjectPart obPart = parts[i]; 2734 SceneObjectPart obPart = parts[i];
@@ -2739,7 +2742,7 @@ namespace OpenSim.Region.Framework.Scenes
2739 2742
2740 if (pa != null && pa.IsPhysical) 2743 if (pa != null && pa.IsPhysical)
2741 { 2744 {
2742 if (oldSize.X * x > m_scene.m_maxPhys) 2745 if (oldSize.X * x > Scene.m_maxPhys)
2743 { 2746 {
2744 f = m_scene.m_maxPhys / oldSize.X; 2747 f = m_scene.m_maxPhys / oldSize.X;
2745 a = f / x; 2748 a = f / x;
@@ -2747,7 +2750,7 @@ namespace OpenSim.Region.Framework.Scenes
2747 y *= a; 2750 y *= a;
2748 z *= a; 2751 z *= a;
2749 } 2752 }
2750 else if (oldSize.X * x < m_scene.m_minPhys) 2753 else if (oldSize.X * x < Scene.m_minPhys)
2751 { 2754 {
2752 f = m_scene.m_minPhys / oldSize.X; 2755 f = m_scene.m_minPhys / oldSize.X;
2753 a = f / x; 2756 a = f / x;
@@ -2756,7 +2759,7 @@ namespace OpenSim.Region.Framework.Scenes
2756 z *= a; 2759 z *= a;
2757 } 2760 }
2758 2761
2759 if (oldSize.Y * y > m_scene.m_maxPhys) 2762 if (oldSize.Y * y > Scene.m_maxPhys)
2760 { 2763 {
2761 f = m_scene.m_maxPhys / oldSize.Y; 2764 f = m_scene.m_maxPhys / oldSize.Y;
2762 a = f / y; 2765 a = f / y;
@@ -2764,7 +2767,7 @@ namespace OpenSim.Region.Framework.Scenes
2764 y *= a; 2767 y *= a;
2765 z *= a; 2768 z *= a;
2766 } 2769 }
2767 else if (oldSize.Y * y < m_scene.m_minPhys) 2770 else if (oldSize.Y * y < Scene.m_minPhys)
2768 { 2771 {
2769 f = m_scene.m_minPhys / oldSize.Y; 2772 f = m_scene.m_minPhys / oldSize.Y;
2770 a = f / y; 2773 a = f / y;
@@ -2773,7 +2776,7 @@ namespace OpenSim.Region.Framework.Scenes
2773 z *= a; 2776 z *= a;
2774 } 2777 }
2775 2778
2776 if (oldSize.Z * z > m_scene.m_maxPhys) 2779 if (oldSize.Z * z > Scene.m_maxPhys)
2777 { 2780 {
2778 f = m_scene.m_maxPhys / oldSize.Z; 2781 f = m_scene.m_maxPhys / oldSize.Z;
2779 a = f / z; 2782 a = f / z;
@@ -2781,7 +2784,7 @@ namespace OpenSim.Region.Framework.Scenes
2781 y *= a; 2784 y *= a;
2782 z *= a; 2785 z *= a;
2783 } 2786 }
2784 else if (oldSize.Z * z < m_scene.m_minPhys) 2787 else if (oldSize.Z * z < Scene.m_minPhys)
2785 { 2788 {
2786 f = m_scene.m_minPhys / oldSize.Z; 2789 f = m_scene.m_minPhys / oldSize.Z;
2787 a = f / z; 2790 a = f / z;
@@ -2792,7 +2795,7 @@ namespace OpenSim.Region.Framework.Scenes
2792 } 2795 }
2793 else 2796 else
2794 { 2797 {
2795 if (oldSize.X * x > m_scene.m_maxNonphys) 2798 if (oldSize.X * x > Scene.m_maxNonphys)
2796 { 2799 {
2797 f = m_scene.m_maxNonphys / oldSize.X; 2800 f = m_scene.m_maxNonphys / oldSize.X;
2798 a = f / x; 2801 a = f / x;
@@ -2800,7 +2803,7 @@ namespace OpenSim.Region.Framework.Scenes
2800 y *= a; 2803 y *= a;
2801 z *= a; 2804 z *= a;
2802 } 2805 }
2803 else if (oldSize.X * x < m_scene.m_minNonphys) 2806 else if (oldSize.X * x < Scene.m_minNonphys)
2804 { 2807 {
2805 f = m_scene.m_minNonphys / oldSize.X; 2808 f = m_scene.m_minNonphys / oldSize.X;
2806 a = f / x; 2809 a = f / x;
@@ -2809,7 +2812,7 @@ namespace OpenSim.Region.Framework.Scenes
2809 z *= a; 2812 z *= a;
2810 } 2813 }
2811 2814
2812 if (oldSize.Y * y > m_scene.m_maxNonphys) 2815 if (oldSize.Y * y > Scene.m_maxNonphys)
2813 { 2816 {
2814 f = m_scene.m_maxNonphys / oldSize.Y; 2817 f = m_scene.m_maxNonphys / oldSize.Y;
2815 a = f / y; 2818 a = f / y;
@@ -2817,7 +2820,7 @@ namespace OpenSim.Region.Framework.Scenes
2817 y *= a; 2820 y *= a;
2818 z *= a; 2821 z *= a;
2819 } 2822 }
2820 else if (oldSize.Y * y < m_scene.m_minNonphys) 2823 else if (oldSize.Y * y < Scene.m_minNonphys)
2821 { 2824 {
2822 f = m_scene.m_minNonphys / oldSize.Y; 2825 f = m_scene.m_minNonphys / oldSize.Y;
2823 a = f / y; 2826 a = f / y;
@@ -2826,7 +2829,7 @@ namespace OpenSim.Region.Framework.Scenes
2826 z *= a; 2829 z *= a;
2827 } 2830 }
2828 2831
2829 if (oldSize.Z * z > m_scene.m_maxNonphys) 2832 if (oldSize.Z * z > Scene.m_maxNonphys)
2830 { 2833 {
2831 f = m_scene.m_maxNonphys / oldSize.Z; 2834 f = m_scene.m_maxNonphys / oldSize.Z;
2832 a = f / z; 2835 a = f / z;
@@ -2834,7 +2837,7 @@ namespace OpenSim.Region.Framework.Scenes
2834 y *= a; 2837 y *= a;
2835 z *= a; 2838 z *= a;
2836 } 2839 }
2837 else if (oldSize.Z * z < m_scene.m_minNonphys) 2840 else if (oldSize.Z * z < Scene.m_minNonphys)
2838 { 2841 {
2839 f = m_scene.m_minNonphys / oldSize.Z; 2842 f = m_scene.m_minNonphys / oldSize.Z;
2840 a = f / z; 2843 a = f / z;
@@ -2858,7 +2861,6 @@ namespace OpenSim.Region.Framework.Scenes
2858 RootPart.Resize(prevScale); 2861 RootPart.Resize(prevScale);
2859// RootPart.IgnoreUndoUpdate = false; 2862// RootPart.IgnoreUndoUpdate = false;
2860 2863
2861 parts = m_parts.GetArray();
2862 for (int i = 0; i < parts.Length; i++) 2864 for (int i = 0; i < parts.Length; i++)
2863 { 2865 {
2864 SceneObjectPart obPart = parts[i]; 2866 SceneObjectPart obPart = parts[i];