mirror of
https://github.com/opensim/opensim.git
synced 2026-08-05 17:05:55 +08:00
mantis 8632: stop trigering Changed on just scale checks
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -8912,6 +8912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
elemLength = 3;
|
||||
|
||||
List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>();
|
||||
bool hasTranslation = (data & KeyframeMotion.DataFormat.Translation) != 0;
|
||||
bool hasRotation = (data & KeyframeMotion.DataFormat.Rotation) != 0;
|
||||
while (idx < frames.Data.Length)
|
||||
{
|
||||
int remain = frames.Data.Length - idx;
|
||||
@@ -8923,16 +8925,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
frame.Position = null;
|
||||
frame.Rotation = null;
|
||||
|
||||
if ((data & KeyframeMotion.DataFormat.Translation) != 0)
|
||||
if (hasTranslation)
|
||||
{
|
||||
LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++);
|
||||
frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z);
|
||||
}
|
||||
if ((data & KeyframeMotion.DataFormat.Rotation) != 0)
|
||||
if (hasRotation)
|
||||
{
|
||||
LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++);
|
||||
Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
|
||||
q.Normalize();
|
||||
frame.Rotation = q;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user