mantis 8632: stop trigering Changed on just scale checks
parent
5c5e4bd830
commit
052e4a060c
|
@ -2313,15 +2313,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
if (pa != null)
|
if (pa != null)
|
||||||
{
|
{
|
||||||
if (UsePhysics != pa.IsPhysical)
|
if (UsePhysics != pa.IsPhysical)
|
||||||
{
|
ClampScale(UsePhysics);
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UsePhysics != pa.IsPhysical || isNew)
|
if (UsePhysics != pa.IsPhysical || isNew)
|
||||||
{
|
{
|
||||||
|
@ -3042,6 +3034,51 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
Inventory.ResetInventoryIDs();
|
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>
|
/// <summary>
|
||||||
/// Set the scale of this part.
|
/// Set the scale of this part.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -4777,15 +4814,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics)
|
private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics)
|
||||||
{
|
{
|
||||||
if (ParentGroup.Scene != null)
|
if (ParentGroup.Scene != null)
|
||||||
{
|
ClampScale(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;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysicsActor pa;
|
PhysicsActor pa;
|
||||||
Vector3 velocity = Velocity;
|
Vector3 velocity = Velocity;
|
||||||
|
|
|
@ -8912,6 +8912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
elemLength = 3;
|
elemLength = 3;
|
||||||
|
|
||||||
List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>();
|
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)
|
while (idx < frames.Data.Length)
|
||||||
{
|
{
|
||||||
int remain = frames.Data.Length - idx;
|
int remain = frames.Data.Length - idx;
|
||||||
|
@ -8923,16 +8925,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
frame.Position = null;
|
frame.Position = null;
|
||||||
frame.Rotation = null;
|
frame.Rotation = null;
|
||||||
|
|
||||||
if ((data & KeyframeMotion.DataFormat.Translation) != 0)
|
if (hasTranslation)
|
||||||
{
|
{
|
||||||
LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++);
|
LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++);
|
||||||
frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z);
|
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++);
|
LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++);
|
||||||
Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
|
Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s);
|
||||||
q.Normalize();
|
|
||||||
frame.Rotation = q;
|
frame.Rotation = q;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue