aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules/Scripting
diff options
context:
space:
mode:
authorMelanie2012-08-31 01:32:18 +0100
committerMelanie2012-08-31 01:32:18 +0100
commit1b15144208d925bf1fe6c545616b533faf8945ea (patch)
treea7720bb8c2ddcdc1470cf991e26c62b2b1a46be9 /OpenSim/Region/CoreModules/Scripting
parentMerge branch 'avination' into careminster (diff)
parentReplace SendBannedUserList with Avination's version. Untested in core. Not ev... (diff)
downloadopensim-SC_OLD-1b15144208d925bf1fe6c545616b533faf8945ea.zip
opensim-SC_OLD-1b15144208d925bf1fe6c545616b533faf8945ea.tar.gz
opensim-SC_OLD-1b15144208d925bf1fe6c545616b533faf8945ea.tar.bz2
opensim-SC_OLD-1b15144208d925bf1fe6c545616b533faf8945ea.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Data/MySQL/MySQLSimulationData.cs OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs
Diffstat (limited to 'OpenSim/Region/CoreModules/Scripting')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs107
-rw-r--r--OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs17
2 files changed, 80 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 13b7498..3eedf49 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -186,63 +186,79 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
186 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 186 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
187 string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) 187 string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
188 { 188 {
189 if (RenderPlugins.ContainsKey(contentType)) 189 if (!RenderPlugins.ContainsKey(contentType))
190 { 190 return UUID.Zero;
191 // If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
192 // them.
193 if (ReuseTextures)
194 disp = disp & ~DISP_EXPIRE;
195 191
196 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 192 Scene scene;
197 updater.SimUUID = simID; 193 RegisteredScenes.TryGetValue(simID, out scene);
198 updater.PrimID = primID;
199 updater.ContentType = contentType;
200 updater.BodyData = data;
201 updater.UpdateTimer = updateTimer;
202 updater.UpdaterID = UUID.Random();
203 updater.Params = extraParams;
204 updater.BlendWithOldTexture = SetBlending;
205 updater.FrontAlpha = AlphaValue;
206 updater.Face = face;
207 updater.Url = "Local image";
208 updater.Disp = disp;
209 194
210 object reusableTextureUUID = null; 195 if (scene == null)
196 return UUID.Zero;
211 197
212 if (ReuseTextures) 198 SceneObjectPart part = scene.GetSceneObjectPart(primID);
213 reusableTextureUUID 199
214 = m_reuseableDynamicTextures.Get(GenerateReusableTextureKey(data, extraParams)); 200 if (part == null)
201 return UUID.Zero;
202
203 // If we want to reuse dynamic textures then we have to ignore any request from the caller to expire
204 // them.
205 if (ReuseTextures)
206 disp = disp & ~DISP_EXPIRE;
207
208 DynamicTextureUpdater updater = new DynamicTextureUpdater();
209 updater.SimUUID = simID;
210 updater.PrimID = primID;
211 updater.ContentType = contentType;
212 updater.BodyData = data;
213 updater.UpdateTimer = updateTimer;
214 updater.UpdaterID = UUID.Random();
215 updater.Params = extraParams;
216 updater.BlendWithOldTexture = SetBlending;
217 updater.FrontAlpha = AlphaValue;
218 updater.Face = face;
219 updater.Url = "Local image";
220 updater.Disp = disp;
221
222 object objReusableTextureUUID = null;
223
224 if (ReuseTextures && !updater.BlendWithOldTexture)
225 {
226 string reuseableTextureKey = GenerateReusableTextureKey(data, extraParams);
227 objReusableTextureUUID = m_reuseableDynamicTextures.Get(reuseableTextureKey);
215 228
216 // We cannot reuse a dynamic texture if the data is going to be blended with something already there. 229 if (objReusableTextureUUID != null)
217 if (reusableTextureUUID == null || updater.BlendWithOldTexture)
218 { 230 {
219 lock (Updaters) 231 // If something else has removed this temporary asset from the cache, detect and invalidate
232 // our cached uuid.
233 if (scene.AssetService.GetMetadata(objReusableTextureUUID.ToString()) == null)
220 { 234 {
221 if (!Updaters.ContainsKey(updater.UpdaterID)) 235 m_reuseableDynamicTextures.Invalidate(reuseableTextureKey);
222 { 236 objReusableTextureUUID = null;
223 Updaters.Add(updater.UpdaterID, updater);
224 }
225 } 237 }
226
227 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
228 } 238 }
229 else 239 }
240
241 // We cannot reuse a dynamic texture if the data is going to be blended with something already there.
242 if (objReusableTextureUUID == null)
243 {
244 lock (Updaters)
230 { 245 {
231 // No need to add to updaters as the texture is always the same. Not that this functionality 246 if (!Updaters.ContainsKey(updater.UpdaterID))
232 // apppears to be implemented anyway.
233 if (RegisteredScenes.ContainsKey(updater.SimUUID))
234 { 247 {
235 SceneObjectPart part = RegisteredScenes[updater.SimUUID].GetSceneObjectPart(updater.PrimID); 248 Updaters.Add(updater.UpdaterID, updater);
236
237 if (part != null)
238 updater.UpdatePart(part, (UUID)reusableTextureUUID);
239 } 249 }
240 } 250 }
241 251
242 return updater.UpdaterID; 252 RenderPlugins[contentType].AsyncConvertData(updater.UpdaterID, data, extraParams);
243 } 253 }
244 254 else
245 return UUID.Zero; 255 {
256 // No need to add to updaters as the texture is always the same. Not that this functionality
257 // apppears to be implemented anyway.
258 updater.UpdatePart(part, (UUID)objReusableTextureUUID);
259 }
260
261 return updater.UpdaterID;
246 } 262 }
247 263
248 private string GenerateReusableTextureKey(string data, string extraParams) 264 private string GenerateReusableTextureKey(string data, string extraParams)
@@ -267,6 +283,10 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
267 283
268 public void Initialise(Scene scene, IConfigSource config) 284 public void Initialise(Scene scene, IConfigSource config)
269 { 285 {
286 IConfig texturesConfig = config.Configs["Textures"];
287 if (texturesConfig != null)
288 ReuseTextures = texturesConfig.GetBoolean("ReuseDynamicTextures", false);
289
270 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID)) 290 if (!RegisteredScenes.ContainsKey(scene.RegionInfo.RegionID))
271 { 291 {
272 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene); 292 RegisteredScenes.Add(scene.RegionInfo.RegionID, scene);
@@ -276,7 +296,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
276 296
277 public void PostInitialise() 297 public void PostInitialise()
278 { 298 {
279// ReuseTextures = true;
280 if (ReuseTextures) 299 if (ReuseTextures)
281 { 300 {
282 m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative); 301 m_reuseableDynamicTextures = new Cache(CacheMedium.Memory, CacheStrategy.Conservative);
diff --git a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
index e0e358a..32a4c88 100644
--- a/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/LSLHttp/UrlModule.cs
@@ -58,6 +58,7 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
58 public string body; 58 public string body;
59 public int responseCode; 59 public int responseCode;
60 public string responseBody; 60 public string responseBody;
61 public string responseType = "text/plain";
61 //public ManualResetEvent ev; 62 //public ManualResetEvent ev;
62 public bool requestDone; 63 public bool requestDone;
63 public int startTime; 64 public int startTime;
@@ -270,6 +271,22 @@ namespace OpenSim.Region.CoreModules.Scripting.LSLHttp
270 } 271 }
271 } 272 }
272 273
274 public void HttpContentType(UUID request, string type)
275 {
276 lock (m_UrlMap)
277 {
278 if (m_RequestMap.ContainsKey(request))
279 {
280 UrlData urlData = m_RequestMap[request];
281 urlData.requests[request].responseType = type;
282 }
283 else
284 {
285 m_log.Info("[HttpRequestHandler] There is no http-in request with id " + request.ToString());
286 }
287 }
288 }
289
273 public void HttpResponse(UUID request, int status, string body) 290 public void HttpResponse(UUID request, int status, string body)
274 { 291 {
275 lock (m_RequestMap) 292 lock (m_RequestMap)