aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/RegionInfo.cs42
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs31
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs60
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs13
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs28
6 files changed, 141 insertions, 42 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index 2080a16..8131089 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -120,7 +120,9 @@ namespace OpenSim.Framework
120 public UUID lastMapUUID = UUID.Zero; 120 public UUID lastMapUUID = UUID.Zero;
121 public string lastMapRefresh = "0"; 121 public string lastMapRefresh = "0";
122 122
123 private float m_nonphysPrimMin = 0;
123 private int m_nonphysPrimMax = 0; 124 private int m_nonphysPrimMax = 0;
125 private float m_physPrimMin = 0;
124 private int m_physPrimMax = 0; 126 private int m_physPrimMax = 0;
125 private bool m_clampPrimSize = false; 127 private bool m_clampPrimSize = false;
126 private int m_objectCapacity = 0; 128 private int m_objectCapacity = 0;
@@ -285,11 +287,21 @@ namespace OpenSim.Framework
285 set { m_windlight = value; } 287 set { m_windlight = value; }
286 } 288 }
287 289
290 public float NonphysPrimMin
291 {
292 get { return m_nonphysPrimMin; }
293 }
294
288 public int NonphysPrimMax 295 public int NonphysPrimMax
289 { 296 {
290 get { return m_nonphysPrimMax; } 297 get { return m_nonphysPrimMax; }
291 } 298 }
292 299
300 public float PhysPrimMin
301 {
302 get { return m_physPrimMin; }
303 }
304
293 public int PhysPrimMax 305 public int PhysPrimMax
294 { 306 {
295 get { return m_physPrimMax; } 307 get { return m_physPrimMax; }
@@ -623,16 +635,28 @@ namespace OpenSim.Framework
623 m_regionType = config.GetString("RegionType", String.Empty); 635 m_regionType = config.GetString("RegionType", String.Empty);
624 allKeys.Remove("RegionType"); 636 allKeys.Remove("RegionType");
625 637
626 // Prim stuff 638 #region Prim stuff
627 // 639
640 m_nonphysPrimMin = config.GetFloat("NonphysicalPrimMin", 0);
641 allKeys.Remove("NonphysicalPrimMin");
642
628 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0); 643 m_nonphysPrimMax = config.GetInt("NonphysicalPrimMax", 0);
629 allKeys.Remove("NonphysicalPrimMax"); 644 allKeys.Remove("NonphysicalPrimMax");
645
646 m_physPrimMin = config.GetFloat("PhysicalPrimMin", 0);
647 allKeys.Remove("PhysicalPrimMin");
648
630 m_physPrimMax = config.GetInt("PhysicalPrimMax", 0); 649 m_physPrimMax = config.GetInt("PhysicalPrimMax", 0);
631 allKeys.Remove("PhysicalPrimMax"); 650 allKeys.Remove("PhysicalPrimMax");
651
632 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false); 652 m_clampPrimSize = config.GetBoolean("ClampPrimSize", false);
633 allKeys.Remove("ClampPrimSize"); 653 allKeys.Remove("ClampPrimSize");
654
634 m_objectCapacity = config.GetInt("MaxPrims", 15000); 655 m_objectCapacity = config.GetInt("MaxPrims", 15000);
635 allKeys.Remove("MaxPrims"); 656 allKeys.Remove("MaxPrims");
657
658 #endregion
659
636 m_agentCapacity = config.GetInt("MaxAgents", 100); 660 m_agentCapacity = config.GetInt("MaxAgents", 100);
637 allKeys.Remove("MaxAgents"); 661 allKeys.Remove("MaxAgents");
638 662
@@ -668,10 +692,18 @@ namespace OpenSim.Framework
668 692
669 config.Set("ExternalHostName", m_externalHostName); 693 config.Set("ExternalHostName", m_externalHostName);
670 694
695 if (m_nonphysPrimMin != 0)
696 config.Set("NonphysicalPrimMax", m_nonphysPrimMin);
697
671 if (m_nonphysPrimMax != 0) 698 if (m_nonphysPrimMax != 0)
672 config.Set("NonphysicalPrimMax", m_nonphysPrimMax); 699 config.Set("NonphysicalPrimMax", m_nonphysPrimMax);
700
701 if (m_physPrimMin != 0)
702 config.Set("PhysicalPrimMax", m_physPrimMin);
703
673 if (m_physPrimMax != 0) 704 if (m_physPrimMax != 0)
674 config.Set("PhysicalPrimMax", m_physPrimMax); 705 config.Set("PhysicalPrimMax", m_physPrimMax);
706
675 config.Set("ClampPrimSize", m_clampPrimSize.ToString()); 707 config.Set("ClampPrimSize", m_clampPrimSize.ToString());
676 708
677 if (m_objectCapacity != 0) 709 if (m_objectCapacity != 0)
@@ -754,9 +786,15 @@ namespace OpenSim.Framework
754 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY, 786 configMember.addConfigurationOption("lastmap_refresh", ConfigurationOption.ConfigurationTypes.TYPE_STRING_NOT_EMPTY,
755 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true); 787 "Last Map Refresh", Util.UnixTimeSinceEpoch().ToString(), true);
756 788
789 configMember.addConfigurationOption("nonphysical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
790 "Minimum size for nonphysical prims", m_nonphysPrimMin.ToString(), true);
791
757 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 792 configMember.addConfigurationOption("nonphysical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
758 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true); 793 "Maximum size for nonphysical prims", m_nonphysPrimMax.ToString(), true);
759 794
795 configMember.addConfigurationOption("physical_prim_min", ConfigurationOption.ConfigurationTypes.TYPE_FLOAT,
796 "Minimum size for nonphysical prims", m_physPrimMin.ToString(), true);
797
760 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32, 798 configMember.addConfigurationOption("physical_prim_max", ConfigurationOption.ConfigurationTypes.TYPE_INT32,
761 "Maximum size for physical prims", m_physPrimMax.ToString(), true); 799 "Maximum size for physical prims", m_physPrimMax.ToString(), true);
762 800
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);
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 55567d1..a7852ec 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1343,31 +1343,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1343 if (part == null || part.ParentGroup.IsDeleted) 1343 if (part == null || part.ParentGroup.IsDeleted)
1344 return; 1344 return;
1345 1345
1346 if (scale.x < 0.01) 1346 // First we need to check whether or not we need to clamp the size of a physics-enabled prim
1347 scale.x = 0.01;
1348 if (scale.y < 0.01)
1349 scale.y = 0.01;
1350 if (scale.z < 0.01)
1351 scale.z = 0.01;
1352
1353 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor; 1347 PhysicsActor pa = part.ParentGroup.RootPart.PhysActor;
1354
1355 if (pa != null && pa.IsPhysical) 1348 if (pa != null && pa.IsPhysical)
1356 { 1349 {
1357 if (scale.x > World.m_maxPhys) 1350 scale.x = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.x));
1358 scale.x = World.m_maxPhys; 1351 scale.y = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.y));
1359 if (scale.y > World.m_maxPhys) 1352 scale.z = Math.Max(World.m_minPhys, Math.Min(World.m_maxPhys, scale.z));
1360 scale.y = World.m_maxPhys;
1361 if (scale.z > World.m_maxPhys)
1362 scale.z = World.m_maxPhys;
1363 } 1353 }
1364 1354
1365 if (scale.x > World.m_maxNonphys) 1355 // Next we clamp the scale to the non-physical min/max
1366 scale.x = World.m_maxNonphys; 1356 scale.x = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.x));
1367 if (scale.y > World.m_maxNonphys) 1357 scale.y = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.y));
1368 scale.y = World.m_maxNonphys; 1358 scale.z = Math.Max(World.m_minNonphys, Math.Min(World.m_maxNonphys, scale.z));
1369 if (scale.z > World.m_maxNonphys)
1370 scale.z = World.m_maxNonphys;
1371 1359
1372 Vector3 tmp = part.Scale; 1360 Vector3 tmp = part.Scale;
1373 tmp.X = (float)scale.x; 1361 tmp.X = (float)scale.x;