mirror of
https://github.com/opensim/opensim.git
synced 2026-07-31 22:05:36 +08:00
Mantis#1707. Thank you, Melanie for a patch that:
This patch limits the maximum size of prims that can be created using libsl bots or modified clients to 65536mper side. It also limits LSL functions to that size. If a prim is already physical, the enforced constraint is 10m. A prim that is larger than 10m cannot be turned physical, either via script or UI. Linksets are handled correctly, so scaling of physical linksets is constrained by the size of it's largest component prim. Also, turning linksets physical is based on the size of it's largest ptim.
This commit is contained in:
@@ -831,7 +831,24 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
if ((status & BuiltIn_Commands_BaseClass.STATUS_PHYSICS) == BuiltIn_Commands_BaseClass.STATUS_PHYSICS)
|
||||
{
|
||||
if (value == 1)
|
||||
{
|
||||
SceneObjectGroup group = m_host.ParentGroup;
|
||||
if(group == null)
|
||||
return;
|
||||
bool allow = true;
|
||||
foreach(SceneObjectPart part in group.Children.Values)
|
||||
{
|
||||
if(part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
|
||||
{
|
||||
allow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!allow)
|
||||
return;
|
||||
m_host.ScriptSetPhysicsStatus(true);
|
||||
}
|
||||
else
|
||||
m_host.ScriptSetPhysicsStatus(false);
|
||||
|
||||
@@ -948,6 +965,25 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||
private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale)
|
||||
{
|
||||
// TODO: this needs to trigger a persistance save as well
|
||||
|
||||
if(part == null || part.ParentGroup == null || part.ParentGroup.RootPart == null)
|
||||
return;
|
||||
|
||||
if(part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
if(scale.x > 10.0)
|
||||
scale.x = 10.0;
|
||||
if(scale.y > 10.0)
|
||||
scale.y = 10.0;
|
||||
if(scale.z > 10.0)
|
||||
scale.z = 10.0;
|
||||
}
|
||||
if(scale.x > 65536.0)
|
||||
scale.x = 65536.0;
|
||||
if(scale.y > 65536.0)
|
||||
scale.y = 65536.0;
|
||||
if(scale.z > 65536.0)
|
||||
scale.z = 65536.0;
|
||||
LLVector3 tmp = part.Scale;
|
||||
tmp.X = (float)scale.x;
|
||||
tmp.Y = (float)scale.y;
|
||||
|
||||
@@ -671,7 +671,24 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
if ((status & ScriptBaseClass.STATUS_PHYSICS) == ScriptBaseClass.STATUS_PHYSICS)
|
||||
{
|
||||
if (value == 1)
|
||||
{
|
||||
SceneObjectGroup group = m_host.ParentGroup;
|
||||
if(group == null)
|
||||
return;
|
||||
bool allow = true;
|
||||
foreach(SceneObjectPart part in group.Children.Values)
|
||||
{
|
||||
if(part.Scale.X > 10.0 || part.Scale.Y > 10.0 || part.Scale.Z > 10.0)
|
||||
{
|
||||
allow = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(!allow)
|
||||
return;
|
||||
m_host.ScriptSetPhysicsStatus(true);
|
||||
}
|
||||
else
|
||||
m_host.ScriptSetPhysicsStatus(false);
|
||||
}
|
||||
@@ -802,6 +819,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
private void SetScale(SceneObjectPart part, LSL_Types.Vector3 scale)
|
||||
{
|
||||
// TODO: this needs to trigger a persistance save as well
|
||||
|
||||
if(part == null || part.ParentGroup == null || part.ParentGroup.RootPart == null)
|
||||
return;
|
||||
|
||||
if(part.ParentGroup.RootPart.PhysActor != null && part.ParentGroup.RootPart.PhysActor.IsPhysical)
|
||||
{
|
||||
if(scale.x > 10.0)
|
||||
scale.x = 10.0;
|
||||
if(scale.y > 10.0)
|
||||
scale.y = 10.0;
|
||||
if(scale.z > 10.0)
|
||||
scale.z = 10.0;
|
||||
}
|
||||
if(scale.x > 65536.0)
|
||||
scale.x = 65536.0;
|
||||
if(scale.y > 65536.0)
|
||||
scale.y = 65536.0;
|
||||
if(scale.z > 65536.0)
|
||||
scale.z = 65536.0;
|
||||
LLVector3 tmp = part.Scale;
|
||||
tmp.X = (float)scale.x;
|
||||
tmp.Y = (float)scale.y;
|
||||
|
||||
Reference in New Issue
Block a user