diff options
author | UbitUmarov | 2019-12-03 14:27:31 +0000 |
---|---|---|
committer | UbitUmarov | 2019-12-03 14:27:31 +0000 |
commit | 052e4a060ceed35eeda623cee9a9826cc1e7b8f8 (patch) | |
tree | 85c824194c575a1b3af71635a2a950763a4be0f2 /OpenSim/Region | |
parent | a few changes on check targets for lsl (diff) | |
download | opensim-SC-052e4a060ceed35eeda623cee9a9826cc1e7b8f8.zip opensim-SC-052e4a060ceed35eeda623cee9a9826cc1e7b8f8.tar.gz opensim-SC-052e4a060ceed35eeda623cee9a9826cc1e7b8f8.tar.bz2 opensim-SC-052e4a060ceed35eeda623cee9a9826cc1e7b8f8.tar.xz |
mantis 8632: stop trigering Changed on just scale checks
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 65 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 7 |
2 files changed, 51 insertions, 21 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6cbdc43..1942dfe 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | |||
@@ -2313,15 +2313,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2313 | if (pa != null) | 2313 | if (pa != null) |
2314 | { | 2314 | { |
2315 | if (UsePhysics != pa.IsPhysical) | 2315 | if (UsePhysics != pa.IsPhysical) |
2316 | { | 2316 | ClampScale(UsePhysics); |
2317 | float minsize = UsePhysics ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
2318 | float maxsize = UsePhysics ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
2319 | Vector3 scale = Scale; | ||
2320 | scale.X = Util.Clamp(scale.X, minsize, maxsize); | ||
2321 | scale.Y = Util.Clamp(scale.Y, minsize, maxsize); | ||
2322 | scale.Z = Util.Clamp(scale.Z, minsize, maxsize); | ||
2323 | Scale = scale; | ||
2324 | } | ||
2325 | 2317 | ||
2326 | if (UsePhysics != pa.IsPhysical || isNew) | 2318 | if (UsePhysics != pa.IsPhysical || isNew) |
2327 | { | 2319 | { |
@@ -3042,6 +3034,51 @@ namespace OpenSim.Region.Framework.Scenes | |||
3042 | Inventory.ResetInventoryIDs(); | 3034 | Inventory.ResetInventoryIDs(); |
3043 | } | 3035 | } |
3044 | 3036 | ||
3037 | |||
3038 | private void ClampScale(bool isPhysical) | ||
3039 | { | ||
3040 | float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
3041 | float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
3042 | Vector3 scale = Scale; | ||
3043 | bool changed = false; | ||
3044 | |||
3045 | if (scale.X < minsize) | ||
3046 | { | ||
3047 | scale.X = minsize; | ||
3048 | changed = true; | ||
3049 | } | ||
3050 | else if (scale.X > maxsize) | ||
3051 | { | ||
3052 | scale.X = maxsize; | ||
3053 | changed = true; | ||
3054 | } | ||
3055 | |||
3056 | if (scale.Y < minsize) | ||
3057 | { | ||
3058 | scale.Y = minsize; | ||
3059 | changed = true; | ||
3060 | } | ||
3061 | else if (scale.Y > maxsize) | ||
3062 | { | ||
3063 | scale.Y = maxsize; | ||
3064 | changed = true; | ||
3065 | } | ||
3066 | |||
3067 | if (scale.Z < minsize) | ||
3068 | { | ||
3069 | scale.Z = minsize; | ||
3070 | changed = true; | ||
3071 | } | ||
3072 | else if (scale.Z > maxsize) | ||
3073 | { | ||
3074 | scale.Z = maxsize; | ||
3075 | changed = true; | ||
3076 | } | ||
3077 | |||
3078 | if (changed) | ||
3079 | Scale = scale; | ||
3080 | } | ||
3081 | |||
3045 | /// <summary> | 3082 | /// <summary> |
3046 | /// Set the scale of this part. | 3083 | /// Set the scale of this part. |
3047 | /// </summary> | 3084 | /// </summary> |
@@ -4777,15 +4814,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
4777 | private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) | 4814 | private void AddToPhysics(bool isPhysical, bool isPhantom, bool building, bool applyDynamics) |
4778 | { | 4815 | { |
4779 | if (ParentGroup.Scene != null) | 4816 | if (ParentGroup.Scene != null) |
4780 | { | 4817 | ClampScale(isPhysical); |
4781 | float minsize = isPhysical ? ParentGroup.Scene.m_minPhys : ParentGroup.Scene.m_minNonphys; | ||
4782 | float maxsize = isPhysical ? ParentGroup.Scene.m_maxPhys : ParentGroup.Scene.m_maxNonphys; | ||
4783 | Vector3 scale = Scale; | ||
4784 | scale.X = Util.Clamp(scale.X, minsize, maxsize); | ||
4785 | scale.Y = Util.Clamp(scale.Y, minsize, maxsize); | ||
4786 | scale.Z = Util.Clamp(scale.Z, minsize, maxsize); | ||
4787 | Scale = scale; | ||
4788 | } | ||
4789 | 4818 | ||
4790 | PhysicsActor pa; | 4819 | PhysicsActor pa; |
4791 | Vector3 velocity = Velocity; | 4820 | Vector3 velocity = Velocity; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 1591cb1..8815a28 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -8912,6 +8912,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8912 | elemLength = 3; | 8912 | elemLength = 3; |
8913 | 8913 | ||
8914 | List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>(); | 8914 | List<KeyframeMotion.Keyframe> keyframes = new List<KeyframeMotion.Keyframe>(); |
8915 | bool hasTranslation = (data & KeyframeMotion.DataFormat.Translation) != 0; | ||
8916 | bool hasRotation = (data & KeyframeMotion.DataFormat.Rotation) != 0; | ||
8915 | while (idx < frames.Data.Length) | 8917 | while (idx < frames.Data.Length) |
8916 | { | 8918 | { |
8917 | int remain = frames.Data.Length - idx; | 8919 | int remain = frames.Data.Length - idx; |
@@ -8923,16 +8925,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8923 | frame.Position = null; | 8925 | frame.Position = null; |
8924 | frame.Rotation = null; | 8926 | frame.Rotation = null; |
8925 | 8927 | ||
8926 | if ((data & KeyframeMotion.DataFormat.Translation) != 0) | 8928 | if (hasTranslation) |
8927 | { | 8929 | { |
8928 | LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++); | 8930 | LSL_Types.Vector3 tempv = frames.GetVector3Item(idx++); |
8929 | frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z); | 8931 | frame.Position = new Vector3((float)tempv.x, (float)tempv.y, (float)tempv.z); |
8930 | } | 8932 | } |
8931 | if ((data & KeyframeMotion.DataFormat.Rotation) != 0) | 8933 | if (hasRotation) |
8932 | { | 8934 | { |
8933 | LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); | 8935 | LSL_Types.Quaternion tempq = frames.GetQuaternionItem(idx++); |
8934 | Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); | 8936 | Quaternion q = new Quaternion((float)tempq.x, (float)tempq.y, (float)tempq.z, (float)tempq.s); |
8935 | q.Normalize(); | ||
8936 | frame.Rotation = q; | 8937 | frame.Rotation = q; |
8937 | } | 8938 | } |
8938 | 8939 | ||