limit number of prims on physical objects. Not all cases covered still
parent
93143ba012
commit
8e15d4ad57
|
@ -2705,12 +2705,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool oldUsePhysics = (root.Flags & PrimFlags.Physics) != 0;
|
||||||
m_sceneGraph.LinkObjects(root, children);
|
m_sceneGraph.LinkObjects(root, children);
|
||||||
|
|
||||||
ScenePresence sp;
|
ScenePresence sp;
|
||||||
if (TryGetScenePresence(agentId, out sp))
|
if (TryGetScenePresence(agentId, out sp))
|
||||||
{
|
{
|
||||||
root.SendPropertiesToClient(sp.ControllingClient);
|
root.SendPropertiesToClient(sp.ControllingClient);
|
||||||
|
if (oldUsePhysics && (root.Flags & PrimFlags.Physics) == 0)
|
||||||
|
{
|
||||||
|
sp.ControllingClient.SendAlertMessage("Object physics canceled");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -204,6 +204,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int m_linksetCapacity = 0;
|
public int m_linksetCapacity = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Max prims an Physical object will hold
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
public int m_linksetPhysCapacity = 5;
|
||||||
|
|
||||||
public bool m_clampPrimSize;
|
public bool m_clampPrimSize;
|
||||||
public bool m_trustBinaries;
|
public bool m_trustBinaries;
|
||||||
public bool m_allowScriptCrossings;
|
public bool m_allowScriptCrossings;
|
||||||
|
@ -901,6 +907,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_linksetCapacity = RegionInfo.LinksetCapacity;
|
m_linksetCapacity = RegionInfo.LinksetCapacity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_linksetPhysCapacity = startupConfig.GetInt("LinksetPhysPrims", m_linksetPhysCapacity);
|
||||||
|
|
||||||
|
|
||||||
SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
|
SpawnPointRouting = startupConfig.GetString("SpawnPointRouting", "closest");
|
||||||
TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
|
TelehubAllowLandmarks = startupConfig.GetBoolean("TelehubAllowLandmark", false);
|
||||||
|
|
||||||
|
|
|
@ -1547,6 +1547,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// VolumeDetect can't be set via UI and will always be off when a change is made there
|
// VolumeDetect can't be set via UI and will always be off when a change is made there
|
||||||
// now only change volume dtc if phantom off
|
// now only change volume dtc if phantom off
|
||||||
|
|
||||||
|
bool wantedPhys = UsePhysics;
|
||||||
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
|
if (PhysData.PhysShapeType == PhysShapeType.invalid) // check for extraPhysics data
|
||||||
{
|
{
|
||||||
bool vdtc;
|
bool vdtc;
|
||||||
|
@ -1563,10 +1564,17 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (part != null)
|
if (part != null)
|
||||||
{
|
{
|
||||||
part.UpdateExtraPhysics(PhysData);
|
part.UpdateExtraPhysics(PhysData);
|
||||||
if (part.UpdatePhysRequired)
|
if (part.UpdatePhysRequired && remoteClient != null)
|
||||||
remoteClient.SendPartPhysicsProprieties(part);
|
remoteClient.SendPartPhysicsProprieties(part);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (wantedPhys != group.UsesPhysics && remoteClient != null)
|
||||||
|
{
|
||||||
|
remoteClient.SendAlertMessage("Object physics canceled because exceeds the limit of " +
|
||||||
|
m_parentScene.m_linksetPhysCapacity + " physical prims with shape type not set to None");
|
||||||
|
group.RootPart.ScheduleFullUpdate();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1712,7 +1712,9 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
m_rootPart.SetParentLocalId(0);
|
m_rootPart.SetParentLocalId(0);
|
||||||
AttachmentPoint = (byte)0;
|
AttachmentPoint = (byte)0;
|
||||||
// must check if buildind should be true or false here
|
// must check if buildind should be true or false here
|
||||||
m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
|
// m_rootPart.ApplyPhysics(m_rootPart.GetEffectiveObjectFlags(), m_rootPart.VolumeDetectActive,false);
|
||||||
|
ApplyPhysics();
|
||||||
|
|
||||||
HasGroupChanged = true;
|
HasGroupChanged = true;
|
||||||
RootPart.Rezzed = DateTime.Now;
|
RootPart.Rezzed = DateTime.Now;
|
||||||
RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
RootPart.RemFlag(PrimFlags.TemporaryOnRez);
|
||||||
|
@ -2879,6 +2881,33 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// physical prims count limit
|
||||||
|
// not very eficient :(
|
||||||
|
|
||||||
|
if (UsesPhysics && m_scene.m_linksetPhysCapacity > 0 && (PrimCount + objectGroup.PrimCount) >
|
||||||
|
m_scene.m_linksetPhysCapacity)
|
||||||
|
{
|
||||||
|
int cntr = 0;
|
||||||
|
foreach (SceneObjectPart part in Parts)
|
||||||
|
{
|
||||||
|
if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
|
||||||
|
cntr++;
|
||||||
|
}
|
||||||
|
foreach (SceneObjectPart part in objectGroup.Parts)
|
||||||
|
{
|
||||||
|
if (part.PhysicsShapeType != (byte)PhysicsShapeType.None)
|
||||||
|
cntr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cntr > m_scene.m_linksetPhysCapacity)
|
||||||
|
{
|
||||||
|
// cancel physics
|
||||||
|
RootPart.Flags &= ~PrimFlags.Physics;
|
||||||
|
ApplyPhysics();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 'linkPart' == the root of the group being linked into this group
|
// 'linkPart' == the root of the group being linked into this group
|
||||||
SceneObjectPart linkPart = objectGroup.m_rootPart;
|
SceneObjectPart linkPart = objectGroup.m_rootPart;
|
||||||
|
|
||||||
|
@ -3477,8 +3506,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
{
|
{
|
||||||
SceneObjectPart[] parts = m_parts.GetArray();
|
SceneObjectPart[] parts = m_parts.GetArray();
|
||||||
|
|
||||||
if (Scene != null)
|
if (Scene != null && UsePhysics)
|
||||||
{
|
{
|
||||||
|
int maxprims = m_scene.m_linksetPhysCapacity;
|
||||||
|
bool checkShape = (maxprims > 0 &&
|
||||||
|
parts.Length > maxprims);
|
||||||
|
|
||||||
for (int i = 0; i < parts.Length; i++)
|
for (int i = 0; i < parts.Length; i++)
|
||||||
{
|
{
|
||||||
SceneObjectPart part = parts[i];
|
SceneObjectPart part = parts[i];
|
||||||
|
@ -3489,6 +3522,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
UsePhysics = false; // Reset physics
|
UsePhysics = false; // Reset physics
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
|
||||||
|
{
|
||||||
|
if (--maxprims < 0)
|
||||||
|
{
|
||||||
|
UsePhysics = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1400,6 +1400,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
SceneObjectGroup group = m_host.ParentGroup;
|
SceneObjectGroup group = m_host.ParentGroup;
|
||||||
bool allow = true;
|
bool allow = true;
|
||||||
|
|
||||||
|
int maxprims = World.m_linksetPhysCapacity;
|
||||||
|
bool checkShape = (maxprims > 0 && group.PrimCount > maxprims);
|
||||||
|
|
||||||
foreach (SceneObjectPart part in group.Parts)
|
foreach (SceneObjectPart part in group.Parts)
|
||||||
{
|
{
|
||||||
if (part.Scale.X > World.m_maxPhys || part.Scale.Y > World.m_maxPhys || part.Scale.Z > World.m_maxPhys)
|
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
|
||||||
allow = false;
|
allow = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if (checkShape && part.PhysicsShapeType != (byte)PhysicsShapeType.None)
|
||||||
|
{
|
||||||
|
if (--maxprims < 0)
|
||||||
|
{
|
||||||
|
allow = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!allow)
|
if (!allow)
|
||||||
|
|
Loading…
Reference in New Issue