diff options
author | UbitUmarov | 2016-11-16 03:47:48 +0000 |
---|---|---|
committer | UbitUmarov | 2016-11-16 03:47:48 +0000 |
commit | 05ba77fd3b72bb29a1f57245f8cd4ddeb6a19fb8 (patch) | |
tree | 32c7e8cb7c9e3b0ee9848d39e2b8c437221e6bf3 /OpenSim | |
parent | minor change to getdisplaynames cap url (diff) | |
download | opensim-SC-05ba77fd3b72bb29a1f57245f8cd4ddeb6a19fb8.zip opensim-SC-05ba77fd3b72bb29a1f57245f8cd4ddeb6a19fb8.tar.gz opensim-SC-05ba77fd3b72bb29a1f57245f8cd4ddeb6a19fb8.tar.bz2 opensim-SC-05ba77fd3b72bb29a1f57245f8cd4ddeb6a19fb8.tar.xz |
fix parsing of a vector4 and storing on a lsl quaternion needed for lightShare scripts
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | 10 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 25 |
2 files changed, 30 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs index e5e43f8..8cd065b 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LS_Api.cs | |||
@@ -295,7 +295,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
295 | idx++; | 295 | idx++; |
296 | try | 296 | try |
297 | { | 297 | { |
298 | iQ = rules.GetQuaternionItem(idx); | 298 | iQ = rules.GetVector4Item(idx); |
299 | } | 299 | } |
300 | catch (InvalidCastException) | 300 | catch (InvalidCastException) |
301 | { | 301 | { |
@@ -319,7 +319,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
319 | idx++; | 319 | idx++; |
320 | try | 320 | try |
321 | { | 321 | { |
322 | iQ = rules.GetQuaternionItem(idx); | 322 | iQ = rules.GetVector4Item(idx); |
323 | } | 323 | } |
324 | catch (InvalidCastException) | 324 | catch (InvalidCastException) |
325 | { | 325 | { |
@@ -342,7 +342,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
342 | idx++; | 342 | idx++; |
343 | try | 343 | try |
344 | { | 344 | { |
345 | iQ = rules.GetQuaternionItem(idx); | 345 | iQ = rules.GetVector4Item(idx); |
346 | } | 346 | } |
347 | catch (InvalidCastException) | 347 | catch (InvalidCastException) |
348 | { | 348 | { |
@@ -532,7 +532,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
532 | idx++; | 532 | idx++; |
533 | try | 533 | try |
534 | { | 534 | { |
535 | iQ = rules.GetQuaternionItem(idx); | 535 | iQ = rules.GetVector4Item(idx); |
536 | } | 536 | } |
537 | catch (InvalidCastException) | 537 | catch (InvalidCastException) |
538 | { | 538 | { |
@@ -654,7 +654,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
654 | break; | 654 | break; |
655 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: | 655 | case (int)ScriptBaseClass.WL_SUN_MOON_COLOR: |
656 | idx++; | 656 | idx++; |
657 | iQ = rules.GetQuaternionItem(idx); | 657 | iQ = rules.GetVector4Item(idx); |
658 | try | 658 | try |
659 | { | 659 | { |
660 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); | 660 | wl.sunMoonColor = new Vector4((float)iQ.x, (float)iQ.y, (float)iQ.z, (float)iQ.s); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index c36e7c6..738a814 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -700,6 +700,31 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
700 | } | 700 | } |
701 | } | 701 | } |
702 | 702 | ||
703 | // use LSL_Types.Quaternion to parse and store a vector4 for lightShare | ||
704 | public LSL_Types.Quaternion GetVector4Item(int itemIndex) | ||
705 | { | ||
706 | if (Data[itemIndex] is LSL_Types.Quaternion) | ||
707 | { | ||
708 | LSL_Types.Quaternion q = (LSL_Types.Quaternion)Data[itemIndex]; | ||
709 | return q; | ||
710 | } | ||
711 | else if(Data[itemIndex] is OpenMetaverse.Quaternion) | ||
712 | { | ||
713 | LSL_Types.Quaternion q = new LSL_Types.Quaternion( | ||
714 | (OpenMetaverse.Quaternion)Data[itemIndex]); | ||
715 | q.Normalize(); | ||
716 | return q; | ||
717 | } | ||
718 | else | ||
719 | { | ||
720 | throw new InvalidCastException(string.Format( | ||
721 | "{0} expected but {1} given", | ||
722 | typeof(LSL_Types.Quaternion).Name, | ||
723 | Data[itemIndex] != null ? | ||
724 | Data[itemIndex].GetType().Name : "null")); | ||
725 | } | ||
726 | } | ||
727 | |||
703 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) | 728 | public LSL_Types.Quaternion GetQuaternionItem(int itemIndex) |
704 | { | 729 | { |
705 | if (Data[itemIndex] is LSL_Types.Quaternion) | 730 | if (Data[itemIndex] is LSL_Types.Quaternion) |