diff options
Diffstat (limited to 'OpenSim/Region')
8 files changed, 120 insertions, 57 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 2dcc9cb..7e51638 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | |||
@@ -4525,7 +4525,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4525 | { | 4525 | { |
4526 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); | 4526 | returnblock[j] = new EstateOwnerMessagePacket.ParamListBlock(); |
4527 | } | 4527 | } |
4528 | j = 0; | 4528 | j = 0; |
4529 | 4529 | ||
4530 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; | 4530 | returnblock[j].Parameter = Utils.StringToBytes(estateID.ToString()); j++; |
4531 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; | 4531 | returnblock[j].Parameter = Utils.StringToBytes(((int)Constants.EstateAccessCodex.EstateBans).ToString()); j++; |
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) |
diff --git a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs index 457444c..79e9f9d 100644 --- a/OpenSim/Region/Framework/Interfaces/IUrlModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IUrlModule.cs | |||
@@ -39,6 +39,8 @@ namespace OpenSim.Region.Framework.Interfaces | |||
39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); | 39 | UUID RequestSecureURL(IScriptModule engine, SceneObjectPart host, UUID itemID); |
40 | void ReleaseURL(string url); | 40 | void ReleaseURL(string url); |
41 | void HttpResponse(UUID request, int status, string body); | 41 | void HttpResponse(UUID request, int status, string body); |
42 | void HttpContentType(UUID request, string type); | ||
43 | |||
42 | string GetHttpHeader(UUID request, string header); | 44 | string GetHttpHeader(UUID request, string header); |
43 | int GetFreeUrls(); | 45 | int GetFreeUrls(); |
44 | 46 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 4335592..d528160 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -10903,31 +10903,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
10903 | public LSL_Float llListStatistics(int operation, LSL_List src) | 10903 | public LSL_Float llListStatistics(int operation, LSL_List src) |
10904 | { | 10904 | { |
10905 | m_host.AddScriptLPS(1); | 10905 | m_host.AddScriptLPS(1); |
10906 | LSL_List nums = LSL_List.ToDoubleList(src); | ||
10907 | switch (operation) | 10906 | switch (operation) |
10908 | { | 10907 | { |
10909 | case ScriptBaseClass.LIST_STAT_RANGE: | 10908 | case ScriptBaseClass.LIST_STAT_RANGE: |
10910 | return nums.Range(); | 10909 | return src.Range(); |
10911 | case ScriptBaseClass.LIST_STAT_MIN: | 10910 | case ScriptBaseClass.LIST_STAT_MIN: |
10912 | return nums.Min(); | 10911 | return src.Min(); |
10913 | case ScriptBaseClass.LIST_STAT_MAX: | 10912 | case ScriptBaseClass.LIST_STAT_MAX: |
10914 | return nums.Max(); | 10913 | return src.Max(); |
10915 | case ScriptBaseClass.LIST_STAT_MEAN: | 10914 | case ScriptBaseClass.LIST_STAT_MEAN: |
10916 | return nums.Mean(); | 10915 | return src.Mean(); |
10917 | case ScriptBaseClass.LIST_STAT_MEDIAN: | 10916 | case ScriptBaseClass.LIST_STAT_MEDIAN: |
10918 | return nums.Median(); | 10917 | return LSL_List.ToDoubleList(src).Median(); |
10919 | case ScriptBaseClass.LIST_STAT_NUM_COUNT: | 10918 | case ScriptBaseClass.LIST_STAT_NUM_COUNT: |
10920 | return nums.NumericLength(); | 10919 | return src.NumericLength(); |
10921 | case ScriptBaseClass.LIST_STAT_STD_DEV: | 10920 | case ScriptBaseClass.LIST_STAT_STD_DEV: |
10922 | return nums.StdDev(); | 10921 | return src.StdDev(); |
10923 | case ScriptBaseClass.LIST_STAT_SUM: | 10922 | case ScriptBaseClass.LIST_STAT_SUM: |
10924 | return nums.Sum(); | 10923 | return src.Sum(); |
10925 | case ScriptBaseClass.LIST_STAT_SUM_SQUARES: | 10924 | case ScriptBaseClass.LIST_STAT_SUM_SQUARES: |
10926 | return nums.SumSqrs(); | 10925 | return src.SumSqrs(); |
10927 | case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN: | 10926 | case ScriptBaseClass.LIST_STAT_GEOMETRIC_MEAN: |
10928 | return nums.GeometricMean(); | 10927 | return src.GeometricMean(); |
10929 | case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN: | 10928 | case ScriptBaseClass.LIST_STAT_HARMONIC_MEAN: |
10930 | return nums.HarmonicMean(); | 10929 | return src.HarmonicMean(); |
10931 | default: | 10930 | default: |
10932 | return 0.0; | 10931 | return 0.0; |
10933 | } | 10932 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index ceff889..7aacfd4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -141,6 +141,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
141 | internal bool m_debuggerSafe = false; | 141 | internal bool m_debuggerSafe = false; |
142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); | 142 | internal Dictionary<string, FunctionPerms > m_FunctionPerms = new Dictionary<string, FunctionPerms >(); |
143 | 143 | ||
144 | protected IUrlModule m_UrlModule = null; | ||
145 | |||
144 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) | 146 | public void Initialize(IScriptEngine ScriptEngine, SceneObjectPart host, TaskInventoryItem item) |
145 | { | 147 | { |
146 | m_ScriptEngine = ScriptEngine; | 148 | m_ScriptEngine = ScriptEngine; |
@@ -148,6 +150,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
148 | m_item = item; | 150 | m_item = item; |
149 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); | 151 | m_debuggerSafe = m_ScriptEngine.Config.GetBoolean("DebuggerSafe", false); |
150 | 152 | ||
153 | m_UrlModule = m_ScriptEngine.World.RequestModuleInterface<IUrlModule>(); | ||
154 | |||
151 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) | 155 | if (m_ScriptEngine.Config.GetBoolean("AllowOSFunctions", false)) |
152 | m_OSFunctionsEnabled = true; | 156 | m_OSFunctionsEnabled = true; |
153 | 157 | ||
@@ -3406,5 +3410,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3406 | 3410 | ||
3407 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); | 3411 | return new LSL_Key(m_host.ParentGroup.FromPartID.ToString()); |
3408 | } | 3412 | } |
3413 | |||
3414 | /// <summary> | ||
3415 | /// Sets the response type for an HTTP request/response | ||
3416 | /// </summary> | ||
3417 | /// <returns></returns> | ||
3418 | public void osSetContentType(LSL_Key id, string type) | ||
3419 | { | ||
3420 | CheckThreatLevel(ThreatLevel.High,"osSetResponseType"); | ||
3421 | if (m_UrlModule != null) | ||
3422 | m_UrlModule.HttpContentType(new UUID(id),type); | ||
3423 | } | ||
3409 | } | 3424 | } |
3410 | } | 3425 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index d0e041c..07149b6 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs | |||
@@ -365,5 +365,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces | |||
365 | /// </summary> | 365 | /// </summary> |
366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> | 366 | /// <returns>Rezzing object key or NULL_KEY if rezzed by agent or otherwise unknown.</returns> |
367 | LSL_Key osGetRezzingObject(); | 367 | LSL_Key osGetRezzingObject(); |
368 | |||
369 | /// <summary> | ||
370 | /// Sets the response type for an HTTP request/response | ||
371 | /// </summary> | ||
372 | /// <returns></returns> | ||
373 | void osSetContentType(LSL_Key id, string type); | ||
368 | } | 374 | } |
369 | } | 375 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index e9131e4..ba1ade2 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | |||
@@ -955,5 +955,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase | |||
955 | { | 955 | { |
956 | return m_OSSL_Functions.osGetRezzingObject(); | 956 | return m_OSSL_Functions.osGetRezzingObject(); |
957 | } | 957 | } |
958 | |||
959 | public void osSetContentType(LSL_Key id, string type) | ||
960 | { | ||
961 | m_OSSL_Functions.osSetContentType(id,type); | ||
962 | } | ||
958 | } | 963 | } |
959 | } | 964 | } |