diff options
author | Justin Clark-Casey (justincc) | 2010-07-01 02:06:51 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-07-26 23:34:18 +0100 |
commit | acac47830e3d7d9103c30729ad0cff50b0e8fcdc (patch) | |
tree | ba85833ac3ce4ed85ab628cb0cc4fd0508092882 | |
parent | have a stab at sending the correct number of media entries to shapes (diff) | |
download | opensim-SC-acac47830e3d7d9103c30729ad0cff50b0e8fcdc.zip opensim-SC-acac47830e3d7d9103c30729ad0cff50b0e8fcdc.tar.gz opensim-SC-acac47830e3d7d9103c30729ad0cff50b0e8fcdc.tar.bz2 opensim-SC-acac47830e3d7d9103c30729ad0cff50b0e8fcdc.tar.xz |
start storing incoming MediaEntry on a new Media field on PrimitiveBaseShape
This allows the media texture to persist in memory - logging in and out will redisplay it (after a click) though navigation will be lost
Next need to implement media uri on prim and delegate more incoming llsd parsing to libomv
-rw-r--r-- | OpenSim/Framework/PrimitiveBaseShape.cs | 7 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | 63 |
2 files changed, 67 insertions, 3 deletions
diff --git a/OpenSim/Framework/PrimitiveBaseShape.cs b/OpenSim/Framework/PrimitiveBaseShape.cs index 4d1de22..517dbf6 100644 --- a/OpenSim/Framework/PrimitiveBaseShape.cs +++ b/OpenSim/Framework/PrimitiveBaseShape.cs | |||
@@ -26,12 +26,14 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.Drawing; | 30 | using System.Drawing; |
30 | using System.Drawing.Imaging; | 31 | using System.Drawing.Imaging; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.Xml.Serialization; | 33 | using System.Xml.Serialization; |
33 | using log4net; | 34 | using log4net; |
34 | using OpenMetaverse; | 35 | using OpenMetaverse; |
36 | using OpenMetaverse.StructuredData; | ||
35 | 37 | ||
36 | namespace OpenSim.Framework | 38 | namespace OpenSim.Framework |
37 | { | 39 | { |
@@ -170,6 +172,11 @@ namespace OpenSim.Framework | |||
170 | } | 172 | } |
171 | } | 173 | } |
172 | } | 174 | } |
175 | |||
176 | /// <summary> | ||
177 | /// Entries to store media textures on each face | ||
178 | /// </summary> | ||
179 | public List<MediaEntry> Media { get; set; } | ||
173 | 180 | ||
174 | public PrimitiveBaseShape() | 181 | public PrimitiveBaseShape() |
175 | { | 182 | { |
diff --git a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs index 30507a4..90626f4 100644 --- a/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs +++ b/OpenSim/Region/CoreModules/World/Media/Moap/MoapModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections; | 29 | using System.Collections; |
30 | using System.Collections.Generic; | ||
30 | using System.Collections.Specialized; | 31 | using System.Collections.Specialized; |
31 | using System.Reflection; | 32 | using System.Reflection; |
32 | using System.IO; | 33 | using System.IO; |
@@ -115,6 +116,8 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
115 | 116 | ||
116 | if ("GET" == verb) | 117 | if ("GET" == verb) |
117 | return HandleObjectMediaRequestGet(path, osdParams, httpRequest, httpResponse); | 118 | return HandleObjectMediaRequestGet(path, osdParams, httpRequest, httpResponse); |
119 | if ("UPDATE" == verb) | ||
120 | return HandleObjectMediaRequestUpdate(path, osdParams, httpRequest, httpResponse); | ||
118 | 121 | ||
119 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); | 122 | //NameValueCollection query = HttpUtility.ParseQueryString(httpRequest.Url.Query); |
120 | 123 | ||
@@ -140,6 +143,7 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
140 | return string.Empty; | 143 | return string.Empty; |
141 | } | 144 | } |
142 | 145 | ||
146 | /* | ||
143 | int faces = part.GetNumberOfSides(); | 147 | int faces = part.GetNumberOfSides(); |
144 | m_log.DebugFormat("[MOAP]: Faces [{0}] for [{1}]", faces, primId); | 148 | m_log.DebugFormat("[MOAP]: Faces [{0}] for [{1}]", faces, primId); |
145 | 149 | ||
@@ -154,17 +158,20 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
154 | //me.Width = 240; | 158 | //me.Width = 240; |
155 | media[i] = me; | 159 | media[i] = me; |
156 | } | 160 | } |
161 | */ | ||
162 | |||
163 | if (null == part.Shape.Media) | ||
164 | return string.Empty; | ||
157 | 165 | ||
158 | ObjectMediaResponse resp = new ObjectMediaResponse(); | 166 | ObjectMediaResponse resp = new ObjectMediaResponse(); |
159 | 167 | ||
160 | resp.PrimID = (UUID)osdParams["object_id"]; | 168 | resp.PrimID = primId; |
161 | resp.FaceMedia = media; | 169 | resp.FaceMedia = part.Shape.Media.ToArray(); |
162 | 170 | ||
163 | // I know this has to end with the last avatar to edit and the version code shouldn't always be 16. Just trying | 171 | // I know this has to end with the last avatar to edit and the version code shouldn't always be 16. Just trying |
164 | // to minimally satisfy for now to get something working | 172 | // to minimally satisfy for now to get something working |
165 | resp.Version = "x-mv:0000000016/" + UUID.Random(); | 173 | resp.Version = "x-mv:0000000016/" + UUID.Random(); |
166 | 174 | ||
167 | //string rawResp = resp.Serialize().ToString(); | ||
168 | string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); | 175 | string rawResp = OSDParser.SerializeLLSDXmlString(resp.Serialize()); |
169 | 176 | ||
170 | m_log.DebugFormat("[MOAP]: Got HandleObjectMediaRequestGet raw response is [{0}]", rawResp); | 177 | m_log.DebugFormat("[MOAP]: Got HandleObjectMediaRequestGet raw response is [{0}]", rawResp); |
@@ -172,6 +179,56 @@ namespace OpenSim.Region.CoreModules.Media.Moap | |||
172 | return rawResp; | 179 | return rawResp; |
173 | } | 180 | } |
174 | 181 | ||
182 | protected string HandleObjectMediaRequestUpdate( | ||
183 | string path, Hashtable osdParams, OSHttpRequest httpRequest, OSHttpResponse httpResponse) | ||
184 | { | ||
185 | UUID primId = (UUID)osdParams["object_id"]; | ||
186 | |||
187 | SceneObjectPart part = m_scene.GetSceneObjectPart(primId); | ||
188 | |||
189 | if (null == part) | ||
190 | { | ||
191 | m_log.WarnFormat( | ||
192 | "[MOAP]: Received am UPDATE ObjectMediaRequest for prim {0} but this doesn't exist in the scene", | ||
193 | primId); | ||
194 | return string.Empty; | ||
195 | } | ||
196 | |||
197 | List<MediaEntry> cookedMediaEntries = new List<MediaEntry>(); | ||
198 | |||
199 | ArrayList rawMediaEntries = (ArrayList)osdParams["object_media_data"]; | ||
200 | foreach (Object obj in rawMediaEntries) | ||
201 | { | ||
202 | Hashtable rawMe = (Hashtable)obj; | ||
203 | |||
204 | // TODO: Yeah, I know this is silly. Very soon use existing better code in libomv to do this. | ||
205 | MediaEntry cookedMe = new MediaEntry(); | ||
206 | cookedMe.EnableAlterntiveImage = (bool)rawMe["alt_image_enable"]; | ||
207 | cookedMe.AutoLoop = (bool)rawMe["auto_loop"]; | ||
208 | cookedMe.AutoPlay = (bool)rawMe["auto_play"]; | ||
209 | cookedMe.AutoScale = (bool)rawMe["auto_scale"]; | ||
210 | cookedMe.AutoZoom = (bool)rawMe["auto_zoom"]; | ||
211 | cookedMe.InteractOnFirstClick = (bool)rawMe["first_click_interact"]; | ||
212 | cookedMe.Controls = (MediaControls)rawMe["controls"]; | ||
213 | cookedMe.HomeURL = (string)rawMe["home_url"]; | ||
214 | cookedMe.CurrentURL = (string)rawMe["current_url"]; | ||
215 | cookedMe.Height = (int)rawMe["height_pixels"]; | ||
216 | cookedMe.Width = (int)rawMe["width_pixels"]; | ||
217 | cookedMe.ControlPermissions = (MediaPermission)Enum.Parse(typeof(MediaPermission), rawMe["perms_control"].ToString()); | ||
218 | cookedMe.InteractPermissions = (MediaPermission)Enum.Parse(typeof(MediaPermission), rawMe["perms_interact"].ToString()); | ||
219 | cookedMe.EnableWhiteList = (bool)rawMe["whitelist_enable"]; | ||
220 | //cookedMe.WhiteList = (string[])rawMe["whitelist"]; | ||
221 | |||
222 | cookedMediaEntries.Add(cookedMe); | ||
223 | } | ||
224 | |||
225 | m_log.DebugFormat("[MOAP]: Received {0} media entries for prim {1}", cookedMediaEntries.Count, primId); | ||
226 | |||
227 | part.Shape.Media = cookedMediaEntries; | ||
228 | |||
229 | return string.Empty; | ||
230 | } | ||
231 | |||
175 | /// <summary> | 232 | /// <summary> |
176 | /// Received from the viewer if a user has changed the url of a media texture. | 233 | /// Received from the viewer if a user has changed the url of a media texture. |
177 | /// </summary> | 234 | /// </summary> |