diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs index 2d9e503549..6393102d6a 100644 --- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs +++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs @@ -470,12 +470,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture /// The asset UUID given to the incoming data. public UUID DataReceived(byte[] data, Scene scene) { + // this are local assets and will not work without cache + IAssetCache iac = scene.RequestModuleInterface(); + if (iac == null) + return UUID.Zero; + SceneObjectPart part = scene.GetSceneObjectPart(PrimID); if (part == null || data == null || data.Length <= 1) { - string msg = - String.Format("DynamicTextureModule: Error preparing image using URL {0}", Url); + string msg = string.Format("DynamicTextureModule: Error preparing image using URL {0}", Url); scene.SimChat(Utils.StringToBytes(msg), ChatTypeEnum.Say, 0, part.ParentGroup.RootPart.AbsolutePosition, part.Name, part.UUID, false); @@ -520,26 +524,17 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture } // Create a new asset for user - AssetBase asset - = new AssetBase( + AssetBase asset = new AssetBase( UUID.Random(), "DynamicImage" + Util.RandomClass.Next(1, 10000), (sbyte)AssetType.Texture, - scene.RegionInfo.RegionID.ToString()); + part.OwnerID.ToString()); asset.Data = assetData; - asset.Description = String.Format("URL image : {0}", Url); + asset.Description = string.Format("URL image : {0}", Url); if (asset.Description.Length > 128) asset.Description = asset.Description.Substring(0, 128); asset.Local = true; // dynamic images aren't saved in the assets server asset.Temporary = ((Disp & DISP_TEMP) != 0); - scene.AssetService.Store(asset); // this will only save the asset in the local asset cache - IJ2KDecoder cacheLayerDecode = scene.RequestModuleInterface(); - if (cacheLayerDecode != null) - { - if (!cacheLayerDecode.Decode(asset.FullID, asset.Data)) - m_log.WarnFormat( - "[DYNAMIC TEXTURE MODULE]: Decoding of dynamically generated asset {0} for {1} in {2} failed", - asset.ID, part.Name, part.ParentGroup.Scene.Name); - } + iac.Cache(asset); UUID oldID = UpdatePart(part, asset.FullID); @@ -551,9 +546,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture if (oldAsset != null) { if (oldAsset.Temporary) - { - scene.AssetService.Delete(oldID.ToString()); - } + iac.Expire(oldID.ToString()); } }