diff options
author | UbitUmarov | 2017-04-25 17:59:53 +0100 |
---|---|---|
committer | UbitUmarov | 2017-04-25 17:59:53 +0100 |
commit | a680d8b8d700f78beb1a9eea98b52d59118efe2e (patch) | |
tree | dd084e74fb61400c704a14dcfa8689670acb9ec2 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Merge branch 'master' into httptests (diff) | |
parent | move mesh pbs creation code out of mesh upload code into to PrimitiveBaseShap... (diff) | |
download | opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.zip opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.gz opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.bz2 opensim-SC-a680d8b8d700f78beb1a9eea98b52d59118efe2e.tar.xz |
fix merge
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 320 |
1 files changed, 224 insertions, 96 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ad7fc6c..47c3cb8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -424,6 +424,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
424 | return lease; | 424 | return lease; |
425 | } | 425 | } |
426 | 426 | ||
427 | protected SceneObjectPart MonitoringObject() | ||
428 | { | ||
429 | UUID m = m_host.ParentGroup.MonitoringObject; | ||
430 | if (m == UUID.Zero) | ||
431 | return null; | ||
432 | |||
433 | SceneObjectPart p = m_ScriptEngine.World.GetSceneObjectPart(m); | ||
434 | if (p == null) | ||
435 | m_host.ParentGroup.MonitoringObject = UUID.Zero; | ||
436 | |||
437 | return p; | ||
438 | } | ||
439 | |||
427 | protected virtual void ScriptSleep(int delay) | 440 | protected virtual void ScriptSleep(int delay) |
428 | { | 441 | { |
429 | delay = (int)((float)delay * m_ScriptDelayFactor); | 442 | delay = (int)((float)delay * m_ScriptDelayFactor); |
@@ -481,12 +494,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
481 | { | 494 | { |
482 | UUID item; | 495 | UUID item; |
483 | 496 | ||
484 | m_host.AddScriptLPS(1); | 497 | if ((item = GetScriptByName(name)) == UUID.Zero) |
485 | 498 | { | |
486 | if ((item = GetScriptByName(name)) != UUID.Zero) | 499 | m_host.AddScriptLPS(1); |
487 | m_ScriptEngine.ResetScript(item); | ||
488 | else | ||
489 | Error("llResetOtherScript", "Can't find script '" + name + "'"); | 500 | Error("llResetOtherScript", "Can't find script '" + name + "'"); |
501 | return; | ||
502 | } | ||
503 | if(item == m_item.ItemID) | ||
504 | llResetScript(); | ||
505 | else | ||
506 | { | ||
507 | m_host.AddScriptLPS(1); | ||
508 | m_ScriptEngine.ResetScript(item); | ||
509 | } | ||
490 | } | 510 | } |
491 | 511 | ||
492 | public LSL_Integer llGetScriptState(string name) | 512 | public LSL_Integer llGetScriptState(string name) |
@@ -2712,9 +2732,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2712 | /// <param name="adjust">if TRUE, will cap the distance to 10m.</param> | 2732 | /// <param name="adjust">if TRUE, will cap the distance to 10m.</param> |
2713 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust) | 2733 | protected void SetPos(SceneObjectPart part, LSL_Vector targetPos, bool adjust) |
2714 | { | 2734 | { |
2715 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted) | 2735 | if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted || part.ParentGroup.inTransit) |
2716 | return; | 2736 | return; |
2717 | 2737 | ||
2738 | |||
2718 | LSL_Vector currentPos = GetPartLocalPos(part); | 2739 | LSL_Vector currentPos = GetPartLocalPos(part); |
2719 | LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust); | 2740 | LSL_Vector toPos = GetSetPosTarget(part, targetPos, currentPos, adjust); |
2720 | 2741 | ||
@@ -2722,7 +2743,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2722 | if (part.ParentGroup.RootPart == part) | 2743 | if (part.ParentGroup.RootPart == part) |
2723 | { | 2744 | { |
2724 | SceneObjectGroup parent = part.ParentGroup; | 2745 | SceneObjectGroup parent = part.ParentGroup; |
2725 | if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent.UUID, false, (Vector3)toPos)) | 2746 | if (!parent.IsAttachment && !World.Permissions.CanObjectEntry(parent, false, (Vector3)toPos)) |
2726 | return; | 2747 | return; |
2727 | parent.UpdateGroupPosition((Vector3)toPos); | 2748 | parent.UpdateGroupPosition((Vector3)toPos); |
2728 | } | 2749 | } |
@@ -5738,29 +5759,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5738 | { | 5759 | { |
5739 | m_host.AddScriptLPS(1); | 5760 | m_host.AddScriptLPS(1); |
5740 | if (index < 0) | 5761 | if (index < 0) |
5741 | { | ||
5742 | index = src.Length + index; | 5762 | index = src.Length + index; |
5743 | } | 5763 | |
5744 | if (index >= src.Length || index < 0) | 5764 | if (index >= src.Length || index < 0) |
5745 | { | ||
5746 | return 0; | 5765 | return 0; |
5747 | } | 5766 | |
5767 | object item = src.Data[index]; | ||
5748 | 5768 | ||
5749 | // Vectors & Rotations always return zero in SL, but | 5769 | // Vectors & Rotations always return zero in SL, but |
5750 | // keys don't always return zero, it seems to be a bit complex. | 5770 | // keys don't always return zero, it seems to be a bit complex. |
5751 | else if (src.Data[index] is LSL_Vector || | 5771 | if (item is LSL_Vector || item is LSL_Rotation) |
5752 | src.Data[index] is LSL_Rotation) | ||
5753 | { | ||
5754 | return 0; | 5772 | return 0; |
5755 | } | 5773 | |
5756 | try | 5774 | try |
5757 | { | 5775 | { |
5758 | 5776 | if (item is LSL_Integer) | |
5759 | if (src.Data[index] is LSL_Integer) | 5777 | return (LSL_Integer)item; |
5760 | return (LSL_Integer)src.Data[index]; | 5778 | else if (item is LSL_Float) |
5761 | else if (src.Data[index] is LSL_Float) | 5779 | return Convert.ToInt32(((LSL_Float)item).value);; |
5762 | return Convert.ToInt32(((LSL_Float)src.Data[index]).value); | 5780 | return new LSL_Integer(item.ToString()); |
5763 | return new LSL_Integer(src.Data[index].ToString()); | ||
5764 | } | 5781 | } |
5765 | catch (FormatException) | 5782 | catch (FormatException) |
5766 | { | 5783 | { |
@@ -5772,38 +5789,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5772 | { | 5789 | { |
5773 | m_host.AddScriptLPS(1); | 5790 | m_host.AddScriptLPS(1); |
5774 | if (index < 0) | 5791 | if (index < 0) |
5775 | { | ||
5776 | index = src.Length + index; | 5792 | index = src.Length + index; |
5777 | } | 5793 | |
5778 | if (index >= src.Length || index < 0) | 5794 | if (index >= src.Length || index < 0) |
5779 | { | 5795 | return 0; |
5780 | return 0.0; | 5796 | |
5781 | } | 5797 | object item = src.Data[index]; |
5782 | 5798 | ||
5783 | // Vectors & Rotations always return zero in SL | 5799 | // Vectors & Rotations always return zero in SL |
5784 | else if (src.Data[index] is LSL_Vector || | 5800 | if(item is LSL_Vector || item is LSL_Rotation) |
5785 | src.Data[index] is LSL_Rotation) | ||
5786 | { | ||
5787 | return 0; | 5801 | return 0; |
5788 | } | 5802 | |
5789 | // valid keys seem to get parsed as integers then converted to floats | 5803 | // valid keys seem to get parsed as integers then converted to floats |
5790 | else | 5804 | if (item is LSL_Key) |
5791 | { | 5805 | { |
5792 | UUID uuidt; | 5806 | UUID uuidt; |
5793 | if (src.Data[index] is LSL_Key && UUID.TryParse(src.Data[index].ToString(), out uuidt)) | 5807 | string s = item.ToString(); |
5794 | { | 5808 | if(UUID.TryParse(s, out uuidt)) |
5795 | return Convert.ToDouble(new LSL_Integer(src.Data[index].ToString()).value); | 5809 | return Convert.ToDouble(new LSL_Integer(s).value); |
5796 | } | 5810 | // we can't do this because a string is also a LSL_Key for now :( |
5811 | // else | ||
5812 | // return 0; | ||
5797 | } | 5813 | } |
5814 | |||
5798 | try | 5815 | try |
5799 | { | 5816 | { |
5800 | if (src.Data[index] is LSL_Integer) | 5817 | if (item is LSL_Integer) |
5801 | return Convert.ToDouble(((LSL_Integer)src.Data[index]).value); | 5818 | return Convert.ToDouble(((LSL_Integer)item).value); |
5802 | else if (src.Data[index] is LSL_Float) | 5819 | else if (item is LSL_Float) |
5803 | return Convert.ToDouble(((LSL_Float)src.Data[index]).value); | 5820 | return Convert.ToDouble(((LSL_Float)item).value); |
5804 | else if (src.Data[index] is LSL_String) | 5821 | else if (item is LSL_String) |
5805 | { | 5822 | { |
5806 | string str = ((LSL_String) src.Data[index]).m_string; | 5823 | string str = ((LSL_String)item).m_string; |
5807 | Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)"); | 5824 | Match m = Regex.Match(str, "^\\s*(-?\\+?[,0-9]+\\.?[0-9]*)"); |
5808 | if (m != Match.Empty) | 5825 | if (m != Match.Empty) |
5809 | { | 5826 | { |
@@ -5811,12 +5828,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5811 | double d = 0.0; | 5828 | double d = 0.0; |
5812 | if (!Double.TryParse(str, out d)) | 5829 | if (!Double.TryParse(str, out d)) |
5813 | return 0.0; | 5830 | return 0.0; |
5814 | |||
5815 | return d; | 5831 | return d; |
5816 | } | 5832 | } |
5817 | return 0.0; | 5833 | return 0.0; |
5818 | } | 5834 | } |
5819 | return Convert.ToDouble(src.Data[index]); | 5835 | return Convert.ToDouble(item); |
5820 | } | 5836 | } |
5821 | catch (FormatException) | 5837 | catch (FormatException) |
5822 | { | 5838 | { |
@@ -5828,13 +5844,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5828 | { | 5844 | { |
5829 | m_host.AddScriptLPS(1); | 5845 | m_host.AddScriptLPS(1); |
5830 | if (index < 0) | 5846 | if (index < 0) |
5831 | { | ||
5832 | index = src.Length + index; | 5847 | index = src.Length + index; |
5833 | } | 5848 | |
5834 | if (index >= src.Length || index < 0) | 5849 | if (index >= src.Length || index < 0) |
5835 | { | ||
5836 | return String.Empty; | 5850 | return String.Empty; |
5837 | } | 5851 | |
5838 | return src.Data[index].ToString(); | 5852 | return src.Data[index].ToString(); |
5839 | } | 5853 | } |
5840 | 5854 | ||
@@ -5842,14 +5856,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5842 | { | 5856 | { |
5843 | m_host.AddScriptLPS(1); | 5857 | m_host.AddScriptLPS(1); |
5844 | if (index < 0) | 5858 | if (index < 0) |
5845 | { | ||
5846 | index = src.Length + index; | 5859 | index = src.Length + index; |
5847 | } | ||
5848 | 5860 | ||
5849 | if (index >= src.Length || index < 0) | 5861 | if (index >= src.Length || index < 0) |
5850 | { | 5862 | return String.Empty; |
5851 | return ""; | 5863 | |
5852 | } | 5864 | object item = src.Data[index]; |
5853 | 5865 | ||
5854 | // SL spits out an empty string for types other than key & string | 5866 | // SL spits out an empty string for types other than key & string |
5855 | // At the time of patching, LSL_Key is currently LSL_String, | 5867 | // At the time of patching, LSL_Key is currently LSL_String, |
@@ -5858,31 +5870,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5858 | // as it's own struct | 5870 | // as it's own struct |
5859 | // NOTE: 3rd case is needed because a NULL_KEY comes through as | 5871 | // NOTE: 3rd case is needed because a NULL_KEY comes through as |
5860 | // type 'obj' and wrongly returns "" | 5872 | // type 'obj' and wrongly returns "" |
5861 | else if (!(src.Data[index] is LSL_String || | 5873 | if (!(item is LSL_String || |
5862 | src.Data[index] is LSL_Key || | 5874 | item is LSL_Key || |
5863 | src.Data[index].ToString() == "00000000-0000-0000-0000-000000000000")) | 5875 | item.ToString() == "00000000-0000-0000-0000-000000000000")) |
5864 | { | 5876 | { |
5865 | return ""; | 5877 | return String.Empty; |
5866 | } | 5878 | } |
5867 | 5879 | ||
5868 | return src.Data[index].ToString(); | 5880 | return item.ToString(); |
5869 | } | 5881 | } |
5870 | 5882 | ||
5871 | public LSL_Vector llList2Vector(LSL_List src, int index) | 5883 | public LSL_Vector llList2Vector(LSL_List src, int index) |
5872 | { | 5884 | { |
5873 | m_host.AddScriptLPS(1); | 5885 | m_host.AddScriptLPS(1); |
5874 | if (index < 0) | 5886 | if (index < 0) |
5875 | { | ||
5876 | index = src.Length + index; | 5887 | index = src.Length + index; |
5877 | } | 5888 | |
5878 | if (index >= src.Length || index < 0) | 5889 | if (index >= src.Length || index < 0) |
5879 | { | ||
5880 | return new LSL_Vector(0, 0, 0); | 5890 | return new LSL_Vector(0, 0, 0); |
5881 | } | 5891 | |
5882 | if (src.Data[index].GetType() == typeof(LSL_Vector)) | 5892 | object item = src.Data[index]; |
5883 | { | 5893 | |
5884 | return (LSL_Vector)src.Data[index]; | 5894 | if (item.GetType() == typeof(LSL_Vector)) |
5885 | } | 5895 | return (LSL_Vector)item; |
5886 | 5896 | ||
5887 | // SL spits always out ZERO_VECTOR for anything other than | 5897 | // SL spits always out ZERO_VECTOR for anything other than |
5888 | // strings or vectors. Although keys always return ZERO_VECTOR, | 5898 | // strings or vectors. Although keys always return ZERO_VECTOR, |
@@ -5890,28 +5900,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5890 | // a string, a key as string and a string that by coincidence | 5900 | // a string, a key as string and a string that by coincidence |
5891 | // is a string, so we're going to leave that up to the | 5901 | // is a string, so we're going to leave that up to the |
5892 | // LSL_Vector constructor. | 5902 | // LSL_Vector constructor. |
5893 | else if (!(src.Data[index] is LSL_String || | 5903 | if(item is LSL_Vector) |
5894 | src.Data[index] is LSL_Vector)) | 5904 | return (LSL_Vector) item; |
5895 | { | 5905 | |
5896 | return new LSL_Vector(0, 0, 0); | 5906 | if (item is LSL_String) |
5897 | } | 5907 | return new LSL_Vector(item.ToString()); |
5898 | else | 5908 | |
5899 | { | 5909 | return new LSL_Vector(0, 0, 0); |
5900 | return new LSL_Vector(src.Data[index].ToString()); | ||
5901 | } | ||
5902 | } | 5910 | } |
5903 | 5911 | ||
5904 | public LSL_Rotation llList2Rot(LSL_List src, int index) | 5912 | public LSL_Rotation llList2Rot(LSL_List src, int index) |
5905 | { | 5913 | { |
5906 | m_host.AddScriptLPS(1); | 5914 | m_host.AddScriptLPS(1); |
5907 | if (index < 0) | 5915 | if (index < 0) |
5908 | { | ||
5909 | index = src.Length + index; | 5916 | index = src.Length + index; |
5910 | } | 5917 | |
5911 | if (index >= src.Length || index < 0) | 5918 | if (index >= src.Length || index < 0) |
5912 | { | ||
5913 | return new LSL_Rotation(0, 0, 0, 1); | 5919 | return new LSL_Rotation(0, 0, 0, 1); |
5914 | } | 5920 | |
5921 | object item = src.Data[index]; | ||
5915 | 5922 | ||
5916 | // SL spits always out ZERO_ROTATION for anything other than | 5923 | // SL spits always out ZERO_ROTATION for anything other than |
5917 | // strings or vectors. Although keys always return ZERO_ROTATION, | 5924 | // strings or vectors. Although keys always return ZERO_ROTATION, |
@@ -5919,19 +5926,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5919 | // a string, a key as string and a string that by coincidence | 5926 | // a string, a key as string and a string that by coincidence |
5920 | // is a string, so we're going to leave that up to the | 5927 | // is a string, so we're going to leave that up to the |
5921 | // LSL_Rotation constructor. | 5928 | // LSL_Rotation constructor. |
5922 | else if (!(src.Data[index] is LSL_String || | 5929 | |
5923 | src.Data[index] is LSL_Rotation)) | 5930 | if (item.GetType() == typeof(LSL_Rotation)) |
5924 | { | 5931 | return (LSL_Rotation)item; |
5925 | return new LSL_Rotation(0, 0, 0, 1); | 5932 | |
5926 | } | 5933 | if (item is LSL_String) |
5927 | else if (src.Data[index].GetType() == typeof(LSL_Rotation)) | ||
5928 | { | ||
5929 | return (LSL_Rotation)src.Data[index]; | ||
5930 | } | ||
5931 | else | ||
5932 | { | ||
5933 | return new LSL_Rotation(src.Data[index].ToString()); | 5934 | return new LSL_Rotation(src.Data[index].ToString()); |
5934 | } | 5935 | |
5936 | return new LSL_Rotation(0, 0, 0, 1); | ||
5935 | } | 5937 | } |
5936 | 5938 | ||
5937 | public LSL_List llList2List(LSL_List src, int start, int end) | 5939 | public LSL_List llList2List(LSL_List src, int start, int end) |
@@ -7963,7 +7965,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7963 | public LSL_Integer llScriptDanger(LSL_Vector pos) | 7965 | public LSL_Integer llScriptDanger(LSL_Vector pos) |
7964 | { | 7966 | { |
7965 | m_host.AddScriptLPS(1); | 7967 | m_host.AddScriptLPS(1); |
7966 | bool result = World.ScriptDanger(m_host.LocalId, pos); | 7968 | bool result = World.LSLScriptDanger(m_host, pos); |
7967 | if (result) | 7969 | if (result) |
7968 | { | 7970 | { |
7969 | return 1; | 7971 | return 1; |
@@ -7972,7 +7974,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7972 | { | 7974 | { |
7973 | return 0; | 7975 | return 0; |
7974 | } | 7976 | } |
7975 | |||
7976 | } | 7977 | } |
7977 | 7978 | ||
7978 | public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) | 7979 | public void llDialog(string avatar, string message, LSL_List buttons, int chat_channel) |
@@ -8849,10 +8850,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
8849 | } | 8850 | } |
8850 | 8851 | ||
8851 | public void llSetPhysicsMaterial(int material_bits, | 8852 | public void llSetPhysicsMaterial(int material_bits, |
8852 | float material_gravity_modifier, float material_restitution, | 8853 | LSL_Float material_gravity_modifier, LSL_Float material_restitution, |
8853 | float material_friction, float material_density) | 8854 | LSL_Float material_friction, LSL_Float material_density) |
8854 | { | 8855 | { |
8855 | SetPhysicsMaterial(m_host, material_bits, material_density, material_friction, material_restitution, material_gravity_modifier); | 8856 | SetPhysicsMaterial(m_host, material_bits, (float)material_density, (float)material_friction, (float)material_restitution, (float)material_gravity_modifier); |
8856 | } | 8857 | } |
8857 | 8858 | ||
8858 | // vector up using libomv (c&p from sop ) | 8859 | // vector up using libomv (c&p from sop ) |
@@ -11297,6 +11298,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11297 | } | 11298 | } |
11298 | break; | 11299 | break; |
11299 | 11300 | ||
11301 | case (int)ScriptBaseClass.PRIM_NORMAL: | ||
11302 | case (int)ScriptBaseClass.PRIM_SPECULAR: | ||
11303 | case (int)ScriptBaseClass.PRIM_ALPHA_MODE: | ||
11304 | if (remain < 1) | ||
11305 | return new LSL_List(); | ||
11306 | |||
11307 | face = (int)rules.GetLSLIntegerItem(idx++); | ||
11308 | tex = part.Shape.Textures; | ||
11309 | if (face == ScriptBaseClass.ALL_SIDES) | ||
11310 | { | ||
11311 | for (face = 0; face < GetNumberOfSides(part); face++) | ||
11312 | { | ||
11313 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | ||
11314 | getLSLFaceMaterial(ref res, code, part, texface); | ||
11315 | } | ||
11316 | } | ||
11317 | else | ||
11318 | { | ||
11319 | if (face >= 0 && face < GetNumberOfSides(part)) | ||
11320 | { | ||
11321 | Primitive.TextureEntryFace texface = tex.GetFace((uint)face); | ||
11322 | getLSLFaceMaterial(ref res, code, part, texface); | ||
11323 | } | ||
11324 | } | ||
11325 | break; | ||
11326 | |||
11300 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: | 11327 | case (int)ScriptBaseClass.PRIM_LINK_TARGET: |
11301 | 11328 | ||
11302 | // TODO: Should be issuing a runtime script warning in this case. | 11329 | // TODO: Should be issuing a runtime script warning in this case. |
@@ -11310,6 +11337,108 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
11310 | return new LSL_List(); | 11337 | return new LSL_List(); |
11311 | } | 11338 | } |
11312 | 11339 | ||
11340 | /* | ||
11341 | private string filterTextureUUIDbyRights(UUID origID, SceneObjectPart part, bool checkTaskInventory, bool returnInvName) | ||
11342 | { | ||
11343 | if(checkTaskInventory) | ||
11344 | { | ||
11345 | lock (part.TaskInventory) | ||
11346 | { | ||
11347 | foreach (KeyValuePair<UUID, TaskInventoryItem> inv in part.TaskInventory) | ||
11348 | { | ||
11349 | if (inv.Value.AssetID == origID) | ||
11350 | { | ||
11351 | if(inv.Value.InvType == (int)InventoryType.Texture) | ||
11352 | { | ||
11353 | if(returnInvName) | ||
11354 | return inv.Value.Name; | ||
11355 | else | ||
11356 | return origID.ToString(); | ||
11357 | } | ||
11358 | else | ||
11359 | return UUID.Zero.ToString(); | ||
11360 | } | ||
11361 | } | ||
11362 | } | ||
11363 | } | ||
11364 | |||
11365 | if(World.Permissions.CanEditObject(m_host.ParentGroup.UUID, m_host.ParentGroup.RootPart.OwnerID)) | ||
11366 | return origID.ToString(); | ||
11367 | |||
11368 | return UUID.Zero.ToString(); | ||
11369 | } | ||
11370 | */ | ||
11371 | private void getLSLFaceMaterial(ref LSL_List res, int code, SceneObjectPart part, Primitive.TextureEntryFace texface) | ||
11372 | { | ||
11373 | UUID matID = texface.MaterialID; | ||
11374 | if(matID != UUID.Zero) | ||
11375 | { | ||
11376 | AssetBase MatAsset = World.AssetService.Get(matID.ToString()); | ||
11377 | if(MatAsset != null) | ||
11378 | { | ||
11379 | Byte[] data = MatAsset.Data; | ||
11380 | OSDMap osdmat = (OSDMap)OSDParser.DeserializeLLSDXml(data); | ||
11381 | if(osdmat != null && osdmat.ContainsKey("NormMap")) | ||
11382 | { | ||
11383 | string mapIDstr; | ||
11384 | FaceMaterial mat = new FaceMaterial(matID, osdmat); | ||
11385 | if(code == ScriptBaseClass.PRIM_NORMAL) | ||
11386 | { | ||
11387 | // mapIDstr = filterTextureUUIDbyRights(mat.NormalMapID, part, true, false); | ||
11388 | mapIDstr = mat.NormalMapID.ToString(); | ||
11389 | res.Add(new LSL_String(mapIDstr)); | ||
11390 | res.Add(new LSL_Vector(mat.NormalRepeatX, mat.NormalRepeatY, 0)); | ||
11391 | res.Add(new LSL_Vector(mat.NormalOffsetX, mat.NormalOffsetY, 0)); | ||
11392 | res.Add(new LSL_Float(mat.NormalRotation)); | ||
11393 | } | ||
11394 | else if(code == ScriptBaseClass.PRIM_SPECULAR ) | ||
11395 | { | ||
11396 | // mapIDstr = filterTextureUUIDbyRights(mat.SpecularMapID, part, true, false); | ||
11397 | const float colorScale = 1.0f/255f; | ||
11398 | mapIDstr = mat.SpecularMapID.ToString(); | ||
11399 | res.Add(new LSL_String(mapIDstr)); | ||
11400 | res.Add(new LSL_Vector(mat.SpecularRepeatX, mat.SpecularRepeatY, 0)); | ||
11401 | res.Add(new LSL_Vector(mat.SpecularOffsetX, mat.SpecularOffsetY, 0)); | ||
11402 | res.Add(new LSL_Float(mat.SpecularRotation)); | ||
11403 | res.Add(new LSL_Vector(mat.SpecularLightColor.R * colorScale, | ||
11404 | mat.SpecularLightColor.G * colorScale, | ||
11405 | mat.SpecularLightColor.B * colorScale)); | ||
11406 | res.Add(new LSL_Integer(mat.SpecularLightExponent)); | ||
11407 | res.Add(new LSL_Integer(mat.EnvironmentIntensity)); | ||
11408 | } | ||
11409 | else if(code == ScriptBaseClass.PRIM_ALPHA_MODE) | ||
11410 | { | ||
11411 | res.Add(new LSL_Integer(mat.DiffuseAlphaMode)); | ||
11412 | res.Add(new LSL_Integer(mat.AlphaMaskCutoff)); | ||
11413 | } | ||
11414 | return; | ||
11415 | } | ||
11416 | } | ||
11417 | matID = UUID.Zero; | ||
11418 | } | ||
11419 | if(matID == UUID.Zero) | ||
11420 | { | ||
11421 | if(code == (int)ScriptBaseClass.PRIM_NORMAL || code == (int)ScriptBaseClass.PRIM_SPECULAR ) | ||
11422 | { | ||
11423 | res.Add(new LSL_String(UUID.Zero.ToString())); | ||
11424 | res.Add(new LSL_Vector(1.0, 1.0, 0)); | ||
11425 | res.Add(new LSL_Vector(0, 0, 0)); | ||
11426 | res.Add(new LSL_Float(0)); | ||
11427 | |||
11428 | if(code == (int)ScriptBaseClass.PRIM_SPECULAR) | ||
11429 | { | ||
11430 | res.Add(new LSL_Vector(1.0, 1.0, 1.0)); | ||
11431 | res.Add(new LSL_Integer(51)); | ||
11432 | res.Add(new LSL_Integer(0)); | ||
11433 | } | ||
11434 | } | ||
11435 | else if(code == (int)ScriptBaseClass.PRIM_ALPHA_MODE) | ||
11436 | { | ||
11437 | res.Add(new LSL_Integer(1)); | ||
11438 | res.Add(new LSL_Integer(0)); | ||
11439 | } | ||
11440 | } | ||
11441 | } | ||
11313 | 11442 | ||
11314 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) | 11443 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) |
11315 | { | 11444 | { |
@@ -15867,7 +15996,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
15867 | return; | 15996 | return; |
15868 | } | 15997 | } |
15869 | 15998 | ||
15870 | group.RootPart.AttachPoint = group.RootPart.Shape.State; | ||
15871 | group.RootPart.AttachedPos = group.AbsolutePosition; | 15999 | group.RootPart.AttachedPos = group.AbsolutePosition; |
15872 | 16000 | ||
15873 | group.ResetIDs(); | 16001 | group.ResetIDs(); |