aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs')
-rw-r--r--OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs26
1 files changed, 8 insertions, 18 deletions
diff --git a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
index 8849a59..48274c1 100644
--- a/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
+++ b/OpenSim/Capabilities/Handlers/UploadBakedTexture/UploadBakedTextureHandler.cs
@@ -26,23 +26,12 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Collections;
30using System.Collections.Specialized;
31using System.Drawing;
32using System.Drawing.Imaging;
33using System.Reflection; 29using System.Reflection;
34using System.IO;
35using System.Web;
36using log4net; 30using log4net;
37using Nini.Config;
38using OpenMetaverse; 31using OpenMetaverse;
39using OpenMetaverse.StructuredData;
40using OpenMetaverse.Imaging;
41using OpenSim.Framework; 32using OpenSim.Framework;
42using OpenSim.Framework.Capabilities; 33using OpenSim.Framework.Capabilities;
43using OpenSim.Framework.Servers;
44using OpenSim.Framework.Servers.HttpServer; 34using OpenSim.Framework.Servers.HttpServer;
45using OpenSim.Region.Framework.Interfaces;
46using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
47using Caps = OpenSim.Framework.Capabilities.Caps; 36using Caps = OpenSim.Framework.Capabilities.Caps;
48 37
@@ -50,17 +39,16 @@ namespace OpenSim.Capabilities.Handlers
50{ 39{
51 public class UploadBakedTextureHandler 40 public class UploadBakedTextureHandler
52 { 41 {
42
53 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 43 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54 44
55 private Caps m_HostCapsObj; 45 private Caps m_HostCapsObj;
56 private IAssetService m_assetService; 46 private IAssetService m_assetService;
57 private bool m_persistBakedTextures;
58 47
59 public UploadBakedTextureHandler(Caps caps, IAssetService assetService, bool persistBakedTextures) 48 public UploadBakedTextureHandler(Caps caps, IAssetService assetService)
60 { 49 {
61 m_HostCapsObj = caps; 50 m_HostCapsObj = caps;
62 m_assetService = assetService; 51 m_assetService = assetService;
63 m_persistBakedTextures = persistBakedTextures;
64 } 52 }
65 53
66 /// <summary> 54 /// <summary>
@@ -81,7 +69,7 @@ namespace OpenSim.Capabilities.Handlers
81 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000"); 69 string uploaderPath = Util.RandomClass.Next(5000, 8000).ToString("0000");
82 70
83 BakedTextureUploader uploader = 71 BakedTextureUploader uploader =
84 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener); 72 new BakedTextureUploader(capsBase + uploaderPath, m_HostCapsObj.HttpListener, m_HostCapsObj.AgentID);
85 uploader.OnUpLoad += BakedTextureUploaded; 73 uploader.OnUpLoad += BakedTextureUploaded;
86 74
87 m_HostCapsObj.HttpListener.AddStreamHandler( 75 m_HostCapsObj.HttpListener.AddStreamHandler(
@@ -117,13 +105,13 @@ namespace OpenSim.Capabilities.Handlers
117 /// <param name="data"></param> 105 /// <param name="data"></param>
118 private void BakedTextureUploaded(UUID assetID, byte[] data) 106 private void BakedTextureUploaded(UUID assetID, byte[] data)
119 { 107 {
120// m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString()); 108 m_log.DebugFormat("[UPLOAD BAKED TEXTURE HANDLER]: Received baked texture {0}", assetID.ToString());
121 109
122 AssetBase asset; 110 AssetBase asset;
123 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString()); 111 asset = new AssetBase(assetID, "Baked Texture", (sbyte)AssetType.Texture, m_HostCapsObj.AgentID.ToString());
124 asset.Data = data; 112 asset.Data = data;
125 asset.Temporary = true; 113 asset.Temporary = true;
126 asset.Local = !m_persistBakedTextures; // Local assets aren't persisted, non-local are 114 asset.Local = true;
127 m_assetService.Store(asset); 115 m_assetService.Store(asset);
128 } 116 }
129 } 117 }
@@ -137,12 +125,14 @@ namespace OpenSim.Capabilities.Handlers
137 private string uploaderPath = String.Empty; 125 private string uploaderPath = String.Empty;
138 private UUID newAssetID; 126 private UUID newAssetID;
139 private IHttpServer httpListener; 127 private IHttpServer httpListener;
128 private UUID AgentId = UUID.Zero;
140 129
141 public BakedTextureUploader(string path, IHttpServer httpServer) 130 public BakedTextureUploader(string path, IHttpServer httpServer, UUID uUID)
142 { 131 {
143 newAssetID = UUID.Random(); 132 newAssetID = UUID.Random();
144 uploaderPath = path; 133 uploaderPath = path;
145 httpListener = httpServer; 134 httpListener = httpServer;
135 AgentId = uUID;
146 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID); 136 // m_log.InfoFormat("[CAPS] baked texture upload starting for {0}",newAssetID);
147 } 137 }
148 138