mirror of
https://github.com/opensim/opensim.git
synced 2026-05-14 02:39:52 +08:00
make dynamic textures only use asset cache explicitly
This commit is contained in:
@@ -470,12 +470,16 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
|
||||
/// <returns>The asset UUID given to the incoming data.</returns>
|
||||
public UUID DataReceived(byte[] data, Scene scene)
|
||||
{
|
||||
// this are local assets and will not work without cache
|
||||
IAssetCache iac = scene.RequestModuleInterface<IAssetCache>();
|
||||
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<IJ2KDecoder>();
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user