diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 104 | ||||
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | 25 |
2 files changed, 129 insertions, 0 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 712bd7d..9290fc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -7808,6 +7808,110 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
7808 | return res; | 7808 | return res; |
7809 | } | 7809 | } |
7810 | 7810 | ||
7811 | public LSL_List llGetPrimMediaParams(int face, LSL_List rules) | ||
7812 | { | ||
7813 | m_host.AddScriptLPS(1); | ||
7814 | ScriptSleep(1000); | ||
7815 | |||
7816 | // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid | ||
7817 | // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). | ||
7818 | // Assuming silently fail means give back an empty list. Ideally, need to check this. | ||
7819 | if (face < 0 || face > m_host.Shape.Media.Count - 1) | ||
7820 | return new LSL_List(); | ||
7821 | |||
7822 | return GetLinkPrimMediaParams(face, rules); | ||
7823 | } | ||
7824 | |||
7825 | public LSL_List GetLinkPrimMediaParams(int face, LSL_List rules) | ||
7826 | { | ||
7827 | IMoapModule module = m_ScriptEngine.World.RequestModuleInterface<IMoapModule>(); | ||
7828 | if (null == module) | ||
7829 | throw new Exception("Media on a prim functions not available"); | ||
7830 | |||
7831 | MediaEntry me = module.GetMediaEntry(m_host, face); | ||
7832 | |||
7833 | LSL_List res = new LSL_List(); | ||
7834 | |||
7835 | for (int i = 0; i < rules.Length; i++) | ||
7836 | { | ||
7837 | int code = (int)rules.GetLSLIntegerItem(i); | ||
7838 | |||
7839 | switch (code) | ||
7840 | { | ||
7841 | case ScriptBaseClass.PRIM_MEDIA_ALT_IMAGE_ENABLE: | ||
7842 | // Not implemented | ||
7843 | res.Add(new LSL_Integer(0)); | ||
7844 | break; | ||
7845 | |||
7846 | case ScriptBaseClass.PRIM_MEDIA_CONTROLS: | ||
7847 | if (me.Controls == MediaControls.Standard) | ||
7848 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_STANDARD)); | ||
7849 | else | ||
7850 | res.Add(new LSL_Integer(ScriptBaseClass.PRIM_MEDIA_CONTROLS_MINI)); | ||
7851 | break; | ||
7852 | |||
7853 | case ScriptBaseClass.PRIM_MEDIA_CURRENT_URL: | ||
7854 | res.Add(new LSL_String(me.CurrentURL)); | ||
7855 | break; | ||
7856 | |||
7857 | case ScriptBaseClass.PRIM_MEDIA_HOME_URL: | ||
7858 | res.Add(new LSL_String(me.HomeURL)); | ||
7859 | break; | ||
7860 | |||
7861 | case ScriptBaseClass.PRIM_MEDIA_AUTO_LOOP: | ||
7862 | res.Add(me.AutoLoop ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7863 | break; | ||
7864 | |||
7865 | case ScriptBaseClass.PRIM_MEDIA_AUTO_PLAY: | ||
7866 | res.Add(me.AutoPlay ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7867 | break; | ||
7868 | |||
7869 | case ScriptBaseClass.PRIM_MEDIA_AUTO_SCALE: | ||
7870 | res.Add(me.AutoScale ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7871 | break; | ||
7872 | |||
7873 | case ScriptBaseClass.PRIM_MEDIA_AUTO_ZOOM: | ||
7874 | res.Add(me.AutoZoom ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7875 | break; | ||
7876 | |||
7877 | case ScriptBaseClass.PRIM_MEDIA_FIRST_CLICK_INTERACT: | ||
7878 | res.Add(me.InteractOnFirstClick ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7879 | break; | ||
7880 | |||
7881 | case ScriptBaseClass.PRIM_MEDIA_WIDTH_PIXELS: | ||
7882 | res.Add(new LSL_Integer(me.Width)); | ||
7883 | break; | ||
7884 | |||
7885 | case ScriptBaseClass.PRIM_MEDIA_HEIGHT_PIXELS: | ||
7886 | res.Add(new LSL_Integer(me.Height)); | ||
7887 | break; | ||
7888 | |||
7889 | case ScriptBaseClass.PRIM_MEDIA_WHITELIST_ENABLE: | ||
7890 | res.Add(me.EnableWhiteList ? ScriptBaseClass.TRUE : ScriptBaseClass.FALSE); | ||
7891 | break; | ||
7892 | |||
7893 | case ScriptBaseClass.PRIM_MEDIA_WHITELIST: | ||
7894 | string[] urls = (string[])me.WhiteList.Clone(); | ||
7895 | |||
7896 | for (int j = 0; j < urls.Length; j++) | ||
7897 | urls[j] = Uri.EscapeDataString(urls[j]); | ||
7898 | |||
7899 | res.Add(new LSL_String(string.Join(", ", urls))); | ||
7900 | break; | ||
7901 | |||
7902 | case ScriptBaseClass.PRIM_MEDIA_PERMS_INTERACT: | ||
7903 | res.Add(new LSL_Integer((int)me.InteractPermissions)); | ||
7904 | break; | ||
7905 | |||
7906 | case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: | ||
7907 | res.Add(new LSL_Integer((int)me.ControlPermissions)); | ||
7908 | break; | ||
7909 | } | ||
7910 | } | ||
7911 | |||
7912 | return res; | ||
7913 | } | ||
7914 | |||
7811 | // <remarks> | 7915 | // <remarks> |
7812 | // <para> | 7916 | // <para> |
7813 | // The .NET definition of base 64 is: | 7917 | // The .NET definition of base 64 is: |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs index dba6502..9a64f8c 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Constants.cs | |||
@@ -517,6 +517,31 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
517 | public const int TOUCH_INVALID_FACE = -1; | 517 | public const int TOUCH_INVALID_FACE = -1; |
518 | public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); | 518 | public static readonly vector TOUCH_INVALID_TEXCOORD = new vector(-1.0, -1.0, 0.0); |
519 | public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; | 519 | public static readonly vector TOUCH_INVALID_VECTOR = ZERO_VECTOR; |
520 | |||
521 | // constants for llGetPrimMediaParams | ||
522 | public const int PRIM_MEDIA_ALT_IMAGE_ENABLE = 0; | ||
523 | public const int PRIM_MEDIA_CONTROLS = 1; | ||
524 | public const int PRIM_MEDIA_CURRENT_URL = 2; | ||
525 | public const int PRIM_MEDIA_HOME_URL = 3; | ||
526 | public const int PRIM_MEDIA_AUTO_LOOP = 4; | ||
527 | public const int PRIM_MEDIA_AUTO_PLAY = 5; | ||
528 | public const int PRIM_MEDIA_AUTO_SCALE = 6; | ||
529 | public const int PRIM_MEDIA_AUTO_ZOOM = 7; | ||
530 | public const int PRIM_MEDIA_FIRST_CLICK_INTERACT = 8; | ||
531 | public const int PRIM_MEDIA_WIDTH_PIXELS = 9; | ||
532 | public const int PRIM_MEDIA_HEIGHT_PIXELS = 10; | ||
533 | public const int PRIM_MEDIA_WHITELIST_ENABLE = 11; | ||
534 | public const int PRIM_MEDIA_WHITELIST = 12; | ||
535 | public const int PRIM_MEDIA_PERMS_INTERACT = 13; | ||
536 | public const int PRIM_MEDIA_PERMS_CONTROL = 14; | ||
537 | |||
538 | public const int PRIM_MEDIA_CONTROLS_STANDARD = 0; | ||
539 | public const int PRIM_MEDIA_CONTROLS_MINI = 1; | ||
540 | |||
541 | public const int PRIM_MEDIA_PERM_NONE = 0; | ||
542 | public const int PRIM_MEDIA_PERM_OWNER = 1; | ||
543 | public const int PRIM_MEDIA_PERM_GROUP = 2; | ||
544 | public const int PRIM_MEDIA_PERM_ANYONE = 4; | ||
520 | 545 | ||
521 | // Constants for default textures | 546 | // Constants for default textures |
522 | public const string TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; | 547 | public const string TEXTURE_BLANK = "5748decc-f629-461c-9a36-a35a221fe21f"; |