diff options
author | SignpostMarv | 2012-08-06 15:35:40 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-08-15 23:35:23 +0100 |
commit | ef4122213c440c55d32c097c08e52170f4b4346a (patch) | |
tree | ba7aa3047bac89053992d2539907f07d110f415e /OpenSim/Region/Framework | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-ef4122213c440c55d32c097c08e52170f4b4346a.zip opensim-SC_OLD-ef4122213c440c55d32c097c08e52170f4b4346a.tar.gz opensim-SC_OLD-ef4122213c440c55d32c097c08e52170f4b4346a.tar.bz2 opensim-SC_OLD-ef4122213c440c55d32c097c08e52170f4b4346a.tar.xz |
enables configurable minimum sizes for physical & non-physical prims
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 31 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 9 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 60 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 13 |
4 files changed, 93 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 0e5ddfd..d2d6aba 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -103,8 +103,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
103 | /// </summary> | 103 | /// </summary> |
104 | public bool CollidablePrims { get; private set; } | 104 | public bool CollidablePrims { get; private set; } |
105 | 105 | ||
106 | /// <summary> | ||
107 | /// Minimum value of the size of a non-physical prim in each axis | ||
108 | /// </summary> | ||
109 | public float m_minNonphys = 0.01f; | ||
110 | |||
111 | /// <summary> | ||
112 | /// Maximum value of the size of a non-physical prim in each axis | ||
113 | /// </summary> | ||
106 | public float m_maxNonphys = 256; | 114 | public float m_maxNonphys = 256; |
115 | |||
116 | /// <summary> | ||
117 | /// Minimum value of the size of a physical prim in each axis | ||
118 | /// </summary> | ||
119 | public float m_minPhys = 0.01f; | ||
120 | |||
121 | /// <summary> | ||
122 | /// Maximum value of the size of a physical prim in each axis | ||
123 | /// </summary> | ||
107 | public float m_maxPhys = 10; | 124 | public float m_maxPhys = 10; |
125 | |||
108 | public bool m_clampPrimSize; | 126 | public bool m_clampPrimSize; |
109 | public bool m_trustBinaries; | 127 | public bool m_trustBinaries; |
110 | public bool m_allowScriptCrossings; | 128 | public bool m_allowScriptCrossings; |
@@ -721,14 +739,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
721 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); | 739 | PhysicalPrims = startupConfig.GetBoolean("physical_prim", PhysicalPrims); |
722 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); | 740 | CollidablePrims = startupConfig.GetBoolean("collidable_prim", CollidablePrims); |
723 | 741 | ||
742 | m_minNonphys = startupConfig.GetFloat("NonphysicalPrimMin", m_minNonphys); | ||
743 | if (RegionInfo.NonphysPrimMin > 0) | ||
744 | { | ||
745 | m_minNonphys = RegionInfo.NonphysPrimMin; | ||
746 | } | ||
747 | |||
724 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); | 748 | m_maxNonphys = startupConfig.GetFloat("NonphysicalPrimMax", m_maxNonphys); |
725 | if (RegionInfo.NonphysPrimMax > 0) | 749 | if (RegionInfo.NonphysPrimMax > 0) |
726 | { | 750 | { |
727 | m_maxNonphys = RegionInfo.NonphysPrimMax; | 751 | m_maxNonphys = RegionInfo.NonphysPrimMax; |
728 | } | 752 | } |
729 | 753 | ||
730 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | 754 | m_minPhys = startupConfig.GetFloat("PhysicalPrimMin", m_minPhys); |
755 | if (RegionInfo.PhysPrimMin > 0) | ||
756 | { | ||
757 | m_minPhys = RegionInfo.PhysPrimMin; | ||
758 | } | ||
731 | 759 | ||
760 | m_maxPhys = startupConfig.GetFloat("PhysicalPrimMax", m_maxPhys); | ||
732 | if (RegionInfo.PhysPrimMax > 0) | 761 | if (RegionInfo.PhysPrimMax > 0) |
733 | { | 762 | { |
734 | m_maxPhys = RegionInfo.PhysPrimMax; | 763 | m_maxPhys = RegionInfo.PhysPrimMax; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 13842ad..b6339fb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -375,12 +375,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
375 | { | 375 | { |
376 | Vector3 scale = part.Shape.Scale; | 376 | Vector3 scale = part.Shape.Scale; |
377 | 377 | ||
378 | if (scale.X > m_parentScene.m_maxNonphys) | 378 | scale.X = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.X)); |
379 | scale.X = m_parentScene.m_maxNonphys; | 379 | scale.Y = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Y)); |
380 | if (scale.Y > m_parentScene.m_maxNonphys) | 380 | scale.Z = Math.Max(m_parentScene.m_minNonphys, Math.Min(m_parentScene.m_maxNonphys, scale.Z)); |
381 | scale.Y = m_parentScene.m_maxNonphys; | ||
382 | if (scale.Z > m_parentScene.m_maxNonphys) | ||
383 | scale.Z = m_parentScene.m_maxNonphys; | ||
384 | 381 | ||
385 | part.Shape.Scale = scale; | 382 | part.Shape.Scale = scale; |
386 | } | 383 | } |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5f90035..f6c725b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -2674,17 +2674,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
2674 | 2674 | ||
2675 | RootPart.StoreUndoState(true); | 2675 | RootPart.StoreUndoState(true); |
2676 | 2676 | ||
2677 | scale.X = Math.Min(scale.X, Scene.m_maxNonphys); | 2677 | scale.X = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.X)); |
2678 | scale.Y = Math.Min(scale.Y, Scene.m_maxNonphys); | 2678 | scale.Y = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Y)); |
2679 | scale.Z = Math.Min(scale.Z, Scene.m_maxNonphys); | 2679 | scale.Z = Math.Max(Scene.m_minNonphys, Math.Min(Scene.m_maxNonphys, scale.Z)); |
2680 | 2680 | ||
2681 | PhysicsActor pa = m_rootPart.PhysActor; | 2681 | PhysicsActor pa = m_rootPart.PhysActor; |
2682 | 2682 | ||
2683 | if (pa != null && pa.IsPhysical) | 2683 | if (pa != null && pa.IsPhysical) |
2684 | { | 2684 | { |
2685 | scale.X = Math.Min(scale.X, Scene.m_maxPhys); | 2685 | scale.X = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.X)); |
2686 | scale.Y = Math.Min(scale.Y, Scene.m_maxPhys); | 2686 | scale.Y = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Y)); |
2687 | scale.Z = Math.Min(scale.Z, Scene.m_maxPhys); | 2687 | scale.Z = Math.Max(Scene.m_minPhys, Math.Min(Scene.m_maxPhys, scale.Z)); |
2688 | } | 2688 | } |
2689 | 2689 | ||
2690 | float x = (scale.X / RootPart.Scale.X); | 2690 | float x = (scale.X / RootPart.Scale.X); |
@@ -2716,6 +2716,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2716 | y *= a; | 2716 | y *= a; |
2717 | z *= a; | 2717 | z *= a; |
2718 | } | 2718 | } |
2719 | else if (oldSize.X * x < m_scene.m_minPhys) | ||
2720 | { | ||
2721 | f = m_scene.m_minPhys / oldSize.X; | ||
2722 | a = f / x; | ||
2723 | x *= a; | ||
2724 | y *= a; | ||
2725 | z *= a; | ||
2726 | } | ||
2719 | 2727 | ||
2720 | if (oldSize.Y * y > m_scene.m_maxPhys) | 2728 | if (oldSize.Y * y > m_scene.m_maxPhys) |
2721 | { | 2729 | { |
@@ -2725,6 +2733,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2725 | y *= a; | 2733 | y *= a; |
2726 | z *= a; | 2734 | z *= a; |
2727 | } | 2735 | } |
2736 | else if (oldSize.Y * y < m_scene.m_minPhys) | ||
2737 | { | ||
2738 | f = m_scene.m_minPhys / oldSize.Y; | ||
2739 | a = f / y; | ||
2740 | x *= a; | ||
2741 | y *= a; | ||
2742 | z *= a; | ||
2743 | } | ||
2728 | 2744 | ||
2729 | if (oldSize.Z * z > m_scene.m_maxPhys) | 2745 | if (oldSize.Z * z > m_scene.m_maxPhys) |
2730 | { | 2746 | { |
@@ -2734,6 +2750,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2734 | y *= a; | 2750 | y *= a; |
2735 | z *= a; | 2751 | z *= a; |
2736 | } | 2752 | } |
2753 | else if (oldSize.Z * z < m_scene.m_minPhys) | ||
2754 | { | ||
2755 | f = m_scene.m_minPhys / oldSize.Z; | ||
2756 | a = f / z; | ||
2757 | x *= a; | ||
2758 | y *= a; | ||
2759 | z *= a; | ||
2760 | } | ||
2737 | } | 2761 | } |
2738 | else | 2762 | else |
2739 | { | 2763 | { |
@@ -2745,6 +2769,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2745 | y *= a; | 2769 | y *= a; |
2746 | z *= a; | 2770 | z *= a; |
2747 | } | 2771 | } |
2772 | else if (oldSize.X * x < m_scene.m_minNonphys) | ||
2773 | { | ||
2774 | f = m_scene.m_minNonphys / oldSize.X; | ||
2775 | a = f / x; | ||
2776 | x *= a; | ||
2777 | y *= a; | ||
2778 | z *= a; | ||
2779 | } | ||
2748 | 2780 | ||
2749 | if (oldSize.Y * y > m_scene.m_maxNonphys) | 2781 | if (oldSize.Y * y > m_scene.m_maxNonphys) |
2750 | { | 2782 | { |
@@ -2754,6 +2786,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2754 | y *= a; | 2786 | y *= a; |
2755 | z *= a; | 2787 | z *= a; |
2756 | } | 2788 | } |
2789 | else if (oldSize.Y * y < m_scene.m_minNonphys) | ||
2790 | { | ||
2791 | f = m_scene.m_minNonphys / oldSize.Y; | ||
2792 | a = f / y; | ||
2793 | x *= a; | ||
2794 | y *= a; | ||
2795 | z *= a; | ||
2796 | } | ||
2757 | 2797 | ||
2758 | if (oldSize.Z * z > m_scene.m_maxNonphys) | 2798 | if (oldSize.Z * z > m_scene.m_maxNonphys) |
2759 | { | 2799 | { |
@@ -2763,6 +2803,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2763 | y *= a; | 2803 | y *= a; |
2764 | z *= a; | 2804 | z *= a; |
2765 | } | 2805 | } |
2806 | else if (oldSize.Z * z < m_scene.m_minNonphys) | ||
2807 | { | ||
2808 | f = m_scene.m_minNonphys / oldSize.Z; | ||
2809 | a = f / z; | ||
2810 | x *= a; | ||
2811 | y *= a; | ||
2812 | z *= a; | ||
2813 | } | ||
2766 | } | 2814 | } |
2767 | 2815 | ||
2768 | // obPart.IgnoreUndoUpdate = false; | 2816 | // obPart.IgnoreUndoUpdate = false; |
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 4c87639..cd75224 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2368,17 +2368,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
2368 | /// <param name="scale"></param> | 2368 | /// <param name="scale"></param> |
2369 | public void Resize(Vector3 scale) | 2369 | public void Resize(Vector3 scale) |
2370 | { | 2370 | { |
2371 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxNonphys); | 2371 | scale.X = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.X)); |
2372 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxNonphys); | 2372 | scale.Y = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Y)); |
2373 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxNonphys); | 2373 | scale.Z = Math.Max(ParentGroup.Scene.m_minNonphys, Math.Min(ParentGroup.Scene.m_maxNonphys, scale.Z)); |
2374 | 2374 | ||
2375 | PhysicsActor pa = PhysActor; | 2375 | PhysicsActor pa = PhysActor; |
2376 | |||
2377 | if (pa != null && pa.IsPhysical) | 2376 | if (pa != null && pa.IsPhysical) |
2378 | { | 2377 | { |
2379 | scale.X = Math.Min(scale.X, ParentGroup.Scene.m_maxPhys); | 2378 | scale.X = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.X)); |
2380 | scale.Y = Math.Min(scale.Y, ParentGroup.Scene.m_maxPhys); | 2379 | scale.Y = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Y)); |
2381 | scale.Z = Math.Min(scale.Z, ParentGroup.Scene.m_maxPhys); | 2380 | scale.Z = Math.Max(ParentGroup.Scene.m_minPhys, Math.Min(ParentGroup.Scene.m_maxPhys, scale.Z)); |
2382 | } | 2381 | } |
2383 | 2382 | ||
2384 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); | 2383 | // m_log.DebugFormat("[SCENE OBJECT PART]: Resizing {0} {1} to {2}", Name, LocalId, scale); |