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

View File

@ -26,14 +26,7 @@
*/ */
using System; 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.Reflection;
using System.IO;
using System.Web;
using log4net; using log4net;
using Nini.Config; using Nini.Config;
using Mono.Addins; using Mono.Addins;

View File

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