diff options
author | Justin Clark-Casey (justincc) | 2010-07-12 15:47:56 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:19 +0100 |
commit | 8f403cb4b87fc99c0274929464229b1497395b86 (patch) | |
tree | 00fd0580be37bd9eef194b60a55eddd127edd492 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |
parent | Implement media texture persistence over server restarts for sqlite (diff) | |
download | opensim-SC-8f403cb4b87fc99c0274929464229b1497395b86.zip opensim-SC-8f403cb4b87fc99c0274929464229b1497395b86.tar.gz opensim-SC-8f403cb4b87fc99c0274929464229b1497395b86.tar.bz2 opensim-SC-8f403cb4b87fc99c0274929464229b1497395b86.tar.xz |
Implement llGetPrimMediaParams()
Exposes method to get media entry via IMoapModule
As yet untested.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 104 |
1 files changed, 104 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 417cef4..e18e33e 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: |