aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorUbitUmarov2014-09-08 23:58:49 +0100
committerUbitUmarov2014-09-08 23:58:49 +0100
commit8e15d4ad57de6f2a0c900968ef778fba7cdced63 (patch)
tree658bf83163998e842ab5d453441370a61a2a43a4 /OpenSim/Region
parent on drop send full update on root prim, terse on others ( as sl ). Fix (diff)
downloadopensim-SC-8e15d4ad57de6f2a0c900968ef778fba7cdced63.zip
opensim-SC-8e15d4ad57de6f2a0c900968ef778fba7cdced63.tar.gz
opensim-SC-8e15d4ad57de6f2a0c900968ef778fba7cdced63.tar.bz2
opensim-SC-8e15d4ad57de6f2a0c900968ef778fba7cdced63.tar.xz
limit number of prims on physical objects. Not all cases covered still
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.Inventory.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs46
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs11
5 files changed, 78 insertions, 3 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
index 8634a3a..e003a59 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs
@@ -2705,12 +2705,17 @@ namespace OpenSim.Region.Framework.Scenes
2705 return; 2705 return;
2706 } 2706 }
2707 2707
2708 bool oldUsePhysics = (root.Flags & PrimFlags.Physics) != 0;
2708 m_sceneGraph.LinkObjects(root, children); 2709 m_sceneGraph.LinkObjects(root, children);
2709 2710
2710 ScenePresence sp; 2711 ScenePresence sp;
2711 if (TryGetScenePresence(agentId, out sp)) 2712 if (TryGetScenePresence(agentId, out sp))
2712 { 2713 {
2713 root.SendPropertiesToClient(sp.ControllingClient); 2714 root.SendPropertiesToClient(sp.ControllingClient);
2715 if (oldUsePhysics && (root.Flags & PrimFlags.Physics) == 0)
2716 {
2717 sp.ControllingClient.SendAlertMessage("Object physics canceled");
2718 }
2714 } 2719 }
2715 } 2720 }
2716 2721
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index aa81000..323b588 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -204,6 +204,12 @@ namespace OpenSim.Region.Framework.Scenes
204 /// </summary> 204 /// </summary>
205 public int m_linksetCapacity = 0; 205 public int m_linksetCapacity = 0;
206 206
207 /// <summary>
208 /// Max prims an Physical object will hold
209 /// </summary>
210 ///
211 public int m_linksetPhysCapacity = 5;
212
207 public bool m_clampPrimSize; 213 public bool m_clampPrimSize;
208 public bool m_trustBinaries; 214 public bool m_trustBinaries;
209 public bool m_allowScriptCrossings; 215 public bool m_allowScriptCrossings;
@@ -901,6 +907,9 @@ namespace OpenSim.Region.Framework.Scenes
901 m_linksetCapacity = RegionInfo.LinksetCapacity; 907 m_linksetCapacity = RegionInfo.LinksetCapacity;
902 } 908 }
903 909
910 m_linksetPhysCapacity = startupConfig.GetInt("LinksetPhysPrims", m_linksetPhysCapacity);
911
912
904 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest"); 913 SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
905 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false); 914 TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
906 915
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index b0f8991..973891b 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -1547,6 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
1547 // VolumeDetect can't be set via UI and will always be off when a change is made there 1547 // VolumeDetect can't be set via UI and will always be off when a change is made there
1548 // now only change volume dtc if phantom off 1548 // now only change volume dtc if phantom off
1549 1549
1550 bool wantedPhys = UsePhysics;
1550 if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data 1551 if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
1551 { 1552 {
1552 bool vdtc; 1553 bool vdtc;
@@ -1563,10 +1564,17 @@ namespace OpenSim.Region.Framework.Scenes
1563 if (part != null) 1564 if (part != null)
1564 { 1565 {
1565 part.UpdateExtraPhysics(PhysData); 1566 part.UpdateExtraPhysics(PhysData);
1566 if (part.UpdatePhysRequired) 1567 if (part.UpdatePhysRequired && remoteClient != null)
1567 remoteClient.SendPartPhysicsProprieties(part); 1568 remoteClient.SendPartPhysicsProprieties(part);
1568 } 1569 }
1569 } 1570 }
1571
1572 if (wantedPhys != group.UsesPhysics && remoteClient != null)
1573 {
1574 remoteClient.SendAlertMessage("Object physics canceled because exceeds the limit of " +
1575 m_parentScene.m_linksetPhysCapacity + " physical prims with shape type not set to None");
1576 group.RootPart.ScheduleFullUpdate();
1577 }
1570 } 1578 }
1571 } 1579 }
1572 } 1580 }
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index d3dd5d7..d4a563f 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -1712,7 +1712,9 @@ namespace OpenSim.Region.Framework.Scenes
1712 m_rootPart.SetParentLocalId(0); 1712 m_rootPart.SetParentLocalId(0);
1713 AttachmentPoint = (byte)0; 1713 AttachmentPoint = (byte)0;
1714 // must check if buildind should be true or false here 1714 // must check if buildind should be true or false here
1715 m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false); 1715// m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
1716 ApplyPhysics();
1717
1716 HasGroupChanged = true; 1718 HasGroupChanged = true;
1717 RootPart.Rezzed = DateTime.Now; 1719 RootPart.Rezzed = DateTime.Now;
1718 RootPart.RemFlag(PrimFlags.TemporaryOnRez); 1720 RootPart.RemFlag(PrimFlags.TemporaryOnRez);
@@ -2879,6 +2881,33 @@ namespace OpenSim.Region.Framework.Scenes
2879 return; 2881 return;
2880 } 2882 }
2881 2883
2884 // physical prims count limit
2885 // not very eficient :(
2886
2887 if (UsesPhysics && m_scene.m_linksetPhysCapacity > 0 && (PrimCount + objectGroup.PrimCount) >
2888 m_scene.m_linksetPhysCapacity)
2889 {
2890 int cntr = 0;
2891 foreach (SceneObjectPart part in Parts)
2892 {
2893 if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
2894 cntr++;
2895 }
2896 foreach (SceneObjectPart part in objectGroup.Parts)
2897 {
2898 if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
2899 cntr++;
2900 }
2901
2902 if (cntr > m_scene.m_linksetPhysCapacity)
2903 {
2904 // cancel physics
2905 RootPart.Flags &= ~PrimFlags.Physics;
2906 ApplyPhysics();
2907 }
2908 }
2909
2910
2882 // 'linkPart' == the root of the group being linked into this group 2911 // 'linkPart' == the root of the group being linked into this group
2883 SceneObjectPart linkPart = objectGroup.m_rootPart; 2912 SceneObjectPart linkPart = objectGroup.m_rootPart;
2884 2913
@@ -3477,8 +3506,12 @@ namespace OpenSim.Region.Framework.Scenes
3477 { 3506 {
3478 SceneObjectPart[] parts = m_parts.GetArray(); 3507 SceneObjectPart[] parts = m_parts.GetArray();
3479 3508
3480 if (Scene != null) 3509 if (Scene != null && UsePhysics)
3481 { 3510 {
3511 int maxprims = m_scene.m_linksetPhysCapacity;
3512 bool checkShape = (maxprims > 0 &&
3513 parts.Length > maxprims);
3514
3482 for (int i = 0; i < parts.Length; i++) 3515 for (int i = 0; i < parts.Length; i++)
3483 { 3516 {
3484 SceneObjectPart part = parts[i]; 3517 SceneObjectPart part = parts[i];
@@ -3489,6 +3522,15 @@ namespace OpenSim.Region.Framework.Scenes
3489 UsePhysics = false; // Reset physics 3522 UsePhysics = false; // Reset physics
3490 break; 3523 break;
3491 } 3524 }
3525
3526 if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
3527 {
3528 if (--maxprims < 0)
3529 {
3530 UsePhysics = false;
3531 break;
3532 }
3533 }
3492 } 3534 }
3493 } 3535 }
3494 3536
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index b569194..bb083fa 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -1400,6 +1400,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1400 SceneObjectGroup group = m_host.ParentGroup; 1400 SceneObjectGroup group = m_host.ParentGroup;
1401 bool allow = true; 1401 bool allow = true;
1402 1402
1403 int maxprims = World.m_linksetPhysCapacity;
1404 bool checkShape = (maxprims > 0 && group.PrimCount > maxprims);
1405
1403 foreach (SceneObjectPart part in group.Parts) 1406 foreach (SceneObjectPart part in group.Parts)
1404 { 1407 {
1405 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys) 1408 if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
@@ -1407,6 +1410,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
1407 allow = false; 1410 allow = false;
1408 break; 1411 break;
1409 } 1412 }
1413 if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
1414 {
1415 if (--maxprims < 0)
1416 {
1417 allow = false;
1418 break;
1419 }
1420 }
1410 } 1421 }
1411 1422
1412 if (!allow) 1423 if (!allow)