mantis 8632: stop trigering Changed on just scale checks

This commit is contained in:
UbitUmarov
2019-12-03 14:27:31 +00:00
parent 5c5e4bd830
commit 052e4a060c
2 changed files with 51 additions and 21 deletions

View File

@@ -2313,15 +2313,7 @@ namespace OpenSim.Region.Framework.Scenes
if (pa != null)
{
if (UsePhysics != pa.IsPhysical)
{
float minsize = UsePhysics ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys;
float maxsize = UsePhysics ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys;
Vector3 scale = Scale;
scale.X = Util.Clamp(scale.X, minsize, maxsize);
scale.Y = Util.Clamp(scale.Y, minsize, maxsize);
scale.Z = Util.Clamp(scale.Z, minsize, maxsize);
Scale = scale;
}
ClampScale(UsePhysics);
if (UsePhysics != pa.IsPhysical || isNew)
{
@@ -3042,6 +3034,51 @@ namespace OpenSim.Region.Framework.Scenes
Inventory.ResetInventoryIDs();
}
private void ClampScale(bool isPhysical)
{
float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys;
float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys;
Vector3 scale = Scale;
bool changed = false;
if (scale.X < minsize)
{
scale.X = minsize;
changed = true;
}
else if (scale.X > maxsize)
{
scale.X = maxsize;
changed = true;
}
if (scale.Y < minsize)
{
scale.Y = minsize;
changed = true;
}
else if (scale.Y > maxsize)
{
scale.Y = maxsize;
changed = true;
}
if (scale.Z < minsize)
{
scale.Z = minsize;
changed = true;
}
else if (scale.Z > maxsize)
{
scale.Z = maxsize;
changed = true;
}
if (changed)
Scale = scale;
}
/// <summary>
/// Set the scale of this part.
/// </summary>
@@ -4777,15 +4814,7 @@ namespace OpenSim.Region.Framework.Scenes
private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics)
{
if (ParentGroup.Scene != null)
{
float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys;
float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys;
Vector3 scale = Scale;
scale.X = Util.Clamp(scale.X, minsize, maxsize);
scale.Y = Util.Clamp(scale.Y, minsize, maxsize);
scale.Z = Util.Clamp(scale.Z, minsize, maxsize);
Scale = scale;
}
ClampScale(isPhysical);
PhysicsActor pa;
Vector3 velocity = Velocity;