aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs75
1 files changed, 45 insertions, 30 deletions
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index 2d9143a..a547df5 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -46,6 +46,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
46 46
47 private const int ALL_SIDES = -1; 47 private const int ALL_SIDES = -1;
48 48
49 public const int DISP_EXPIRE = 1;
50 public const int DISP_TEMP = 2;
51
49 private Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>(); 52 private Dictionary<UUID, Scene> RegisteredScenes = new Dictionary<UUID, Scene>();
50 53
51 private Dictionary<string, IDynamicTextureRender> RenderPlugins = 54 private Dictionary<string, IDynamicTextureRender> RenderPlugins =
@@ -110,15 +113,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
110 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 113 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
111 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 114 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
112 { 115 {
113 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, SetBlending, AlphaValue, ALL_SIDES); 116 return AddDynamicTextureURL(simID, primID, contentType, url,
117 extraParams, updateTimer, SetBlending,
118 (int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
114 } 119 }
115 120
116 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 121 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
117 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue, int face) 122 string extraParams, int updateTimer, bool SetBlending,
123 int disp, byte AlphaValue, int face)
118 { 124 {
119 if (RenderPlugins.ContainsKey(contentType)) 125 if (RenderPlugins.ContainsKey(contentType))
120 { 126 {
121 //m_log.Debug("dynamic texture being created: " + url + " of type " + contentType);
122 127
123 DynamicTextureUpdater updater = new DynamicTextureUpdater(); 128 DynamicTextureUpdater updater = new DynamicTextureUpdater();
124 updater.SimUUID = simID; 129 updater.SimUUID = simID;
@@ -131,6 +136,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
131 updater.BlendWithOldTexture = SetBlending; 136 updater.BlendWithOldTexture = SetBlending;
132 updater.FrontAlpha = AlphaValue; 137 updater.FrontAlpha = AlphaValue;
133 updater.Face = face; 138 updater.Face = face;
139 updater.Disp = disp;
134 140
135 lock (Updaters) 141 lock (Updaters)
136 { 142 {
@@ -155,11 +161,12 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
155 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 161 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
156 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 162 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue)
157 { 163 {
158 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending, AlphaValue, ALL_SIDES); 164 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending,
165 (int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
159 } 166 }
160 167
161 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 168 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
162 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue, int face) 169 string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face)
163 { 170 {
164 if (RenderPlugins.ContainsKey(contentType)) 171 if (RenderPlugins.ContainsKey(contentType))
165 { 172 {
@@ -175,6 +182,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
175 updater.FrontAlpha = AlphaValue; 182 updater.FrontAlpha = AlphaValue;
176 updater.Face = face; 183 updater.Face = face;
177 updater.Url = "Local image"; 184 updater.Url = "Local image";
185 updater.Disp = disp;
178 186
179 lock (Updaters) 187 lock (Updaters)
180 { 188 {
@@ -252,6 +260,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
252 public UUID UpdaterID; 260 public UUID UpdaterID;
253 public int UpdateTimer; 261 public int UpdateTimer;
254 public int Face; 262 public int Face;
263 public int Disp;
255 public string Url; 264 public string Url;
256 265
257 public DynamicTextureUpdater() 266 public DynamicTextureUpdater()
@@ -269,7 +278,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
269 278
270 SceneObjectPart part = scene.GetSceneObjectPart(PrimID); 279 SceneObjectPart part = scene.GetSceneObjectPart(PrimID);
271 280
272 if (data == null || data.Length <= 1) 281 if (part == null || data == null || data.Length <= 1)
273 { 282 {
274 string msg = 283 string msg =
275 String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url); 284 String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url);
@@ -309,8 +318,9 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
309 asset.Type = 0; 318 asset.Type = 0;
310 asset.Description = String.Format("URL image : {0}", Url); 319 asset.Description = String.Format("URL image : {0}", Url);
311 asset.Local = false; 320 asset.Local = false;
312 asset.Temporary = true; 321 asset.Temporary = ((Disp & DISP_TEMP) != 0);
313 scene.AssetService.Store(asset); 322 scene.AssetService.Store(asset);
323// scene.CommsManager.AssetCache.AddAsset(asset);
314 324
315 IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>(); 325 IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface<IJ2KDecoder>();
316 if (cacheLayerDecode != null) 326 if (cacheLayerDecode != null)
@@ -320,37 +330,42 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
320 LastAssetID = asset.FullID; 330 LastAssetID = asset.FullID;
321 } 331 }
322 332
323 // mostly keep the values from before 333 UUID oldID = UUID.Zero;
324 Primitive.TextureEntry tmptex = part.Shape.Textures;
325 334
326 // remove the old asset from the cache later 335 lock(part)
327 UUID oldID = tmptex.DefaultTexture.TextureID;
328
329 if (Face == ALL_SIDES)
330 {
331 tmptex.DefaultTexture.TextureID = asset.FullID;
332 }
333 else
334 { 336 {
335 try 337 // mostly keep the values from before
338 Primitive.TextureEntry tmptex = part.Shape.Textures;
339
340 // remove the old asset from the cache
341 oldID = tmptex.DefaultTexture.TextureID;
342
343 if(Face == ALL_SIDES)
336 { 344 {
337 Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face); 345 tmptex.DefaultTexture.TextureID = asset.FullID;
338 texface.TextureID = asset.FullID;
339 tmptex.FaceTextures[Face] = texface;
340 } 346 }
341 catch(Exception) 347 else
342 { 348 {
343 tmptex.DefaultTexture.TextureID = asset.FullID; 349 try
350 {
351 Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
352 texface.TextureID = asset.FullID;
353 tmptex.FaceTextures[Face] = texface;
354 }
355 catch(Exception e)
356 {
357 tmptex.DefaultTexture.TextureID = asset.FullID;
358 }
344 } 359 }
345 }
346 360
347 // I'm pretty sure we always want to force this to true 361 // I'm pretty sure we always want to force this to true
348 // I'm pretty sure noone whats to set fullbright true if it wasn't true before. 362 // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
349 // tmptex.DefaultTexture.Fullbright = true; 363 // tmptex.DefaultTexture.Fullbright = true;
350 364
351 part.UpdateTexture(tmptex); 365 part.UpdateTexture(tmptex);
352 366 }
353 if (Face == ALL_SIDES) 367
368 if (oldID != UUID.Zero && ((Disp & DISP_EXPIRE) != 0))
354 { 369 {
355 // scene.CommsManager.AssetCache.ExpireAsset(oldID); 370 // scene.CommsManager.AssetCache.ExpireAsset(oldID);
356 scene.AssetService.Delete(oldID.ToString()); 371 scene.AssetService.Delete(oldID.ToString());