flag baked texture assets

master
UbitUmarov 2020-04-09 16:08:44 +01:00
parent 05c77f9342
commit 7ecc9408a9
3 changed files with 8 additions and 21 deletions

View File

@ -65,24 +65,19 @@ namespace OpenSim.Capabilities.Handlers
{
try
{
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath;
string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
string capsBase = "/CAPS/" + m_HostCapsObj.CapsObjectPath + Util.RandomClass.Next(5000, 8000).ToString("0000");
BakedTextureUploader uploader =
new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
new BakedTextureUploader(capsBase, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
uploader.OnUpLoad += BakedTextureUploaded;
m_HostCapsObj.HttpListener.AddStreamHandler(
new BinaryStreamHandler(
"POST", capsBase + uploaderPath, uploader.uploaderCaps, "UploadBakedTexture", null));
new BinaryStreamHandler("POST", capsBase, uploader.uploaderCaps, "UploadBakedTexture", null));
string protocol = "http://";
if (m_HostCapsObj.SSLCaps)
protocol = "https://";
string protocol = m_HostCapsObj.SSLCaps ? "https://" : "http://";
string uploaderURL = protocol + m_HostCapsObj.HostName + ":" +
m_HostCapsObj.Port.ToString() + capsBase + uploaderPath;
m_HostCapsObj.Port.ToString() + capsBase;
LLSDAssetUploadResponse uploadResponse = new LLSDAssetUploadResponse();
uploadResponse.uploader = uploaderURL;
@ -112,6 +107,7 @@ namespace OpenSim.Capabilities.Handlers
asset.Data = data;
asset.Temporary = true;
asset.Local = true;
asset.Flags = AssetFlags.AvatarBake;
m_assetService.Store(asset);
}
}
@ -145,13 +141,10 @@ namespace OpenSim.Capabilities.Handlers
/// <returns></returns>
public string uploaderCaps(byte[] data, string path, string param)
{
Action<UUID, byte[]> handlerUpLoad = OnUpLoad;
// Don't do this asynchronously, otherwise it's possible for the client to send set appearance information
// on another thread which might send out avatar updates before the asset has been put into the asset
// service.
if (handlerUpLoad != null)
handlerUpLoad(newAssetID, data);
OnUpLoad?.Invoke(newAssetID, data);
string res = String.Empty;
LLSDAssetUploadComplete uploadComplete = new LLSDAssetUploadComplete();

View File

@ -26,14 +26,7 @@
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Drawing;
using System.Drawing.Imaging;
using System.Reflection;
using System.IO;
using System.Web;
using log4net;
using Nini.Config;
using Mono.Addins;

View File

@ -609,6 +609,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
wearableCache[j].TextureAsset = bakedModuleCache[i].TextureAsset;
bakedModuleCache[i].TextureAsset.Temporary = true;
bakedModuleCache[i].TextureAsset.Local = true;
bakedModuleCache[i].TextureAsset.Flags = AssetFlags.AvatarBake;
cache.Cache(bakedModuleCache[i].TextureAsset);
}
}