aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs24
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs22
-rw-r--r--OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs72
-rw-r--r--OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs22
-rw-r--r--OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs86
-rw-r--r--OpenSim/Region/DataSnapshot/DataRequestHandler.cs2
-rw-r--r--OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs25
-rw-r--r--OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs9
-rw-r--r--OpenSim/Region/Framework/Scenes/EventManager.cs24
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs14
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs8
-rw-r--r--OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs145
-rw-r--r--OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs185
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs45
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs5
-rw-r--r--OpenSim/Server/Handlers/Asset/AssetServerConnector.cs129
-rw-r--r--OpenSim/Services/AssetService/AssetService.cs124
-rw-r--r--OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs45
-rw-r--r--OpenSim/Tools/pCampBot/pCampBot.cs8
21 files changed, 730 insertions, 267 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
index cb9692a..185a909 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs
@@ -102,7 +102,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
102 { 102 {
103 m_currentPacket = 2; 103 m_currentPacket = 2;
104 } 104 }
105 105
106 while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket) 106 while (sendMore && packetsSent < packetsToSend && m_currentPacket <= m_stopPacket)
107 { 107 {
108 sendMore = SendPacket(client); 108 sendMore = SendPacket(client);
@@ -114,17 +114,19 @@ namespace OpenSim.Region.ClientStack.LindenUDP
114 return (m_currentPacket > m_stopPacket); 114 return (m_currentPacket > m_stopPacket);
115 } 115 }
116 116
117 /// <summary>
118 /// This is where we decide what we need to update
119 /// and assign the real discardLevel and packetNumber
120 /// assuming of course that the connected client might be bonkers
121 /// </summary>
117 public void RunUpdate() 122 public void RunUpdate()
118 { 123 {
119 //This is where we decide what we need to update
120 //and assign the real discardLevel and packetNumber
121 //assuming of course that the connected client might be bonkers
122
123 if (!HasAsset) 124 if (!HasAsset)
124 { 125 {
125 if (!m_assetRequested) 126 if (!m_assetRequested)
126 { 127 {
127 m_assetRequested = true; 128 m_assetRequested = true;
129// m_log.DebugFormat("[J2KIMAGE]: Requesting asset {0}", TextureID);
128 AssetService.Get(TextureID.ToString(), this, AssetReceived); 130 AssetService.Get(TextureID.ToString(), this, AssetReceived);
129 } 131 }
130 } 132 }
@@ -137,6 +139,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
137 { 139 {
138 //Request decode 140 //Request decode
139 m_decodeRequested = true; 141 m_decodeRequested = true;
142
143// m_log.DebugFormat("[J2KIMAGE]: Requesting decode of asset {0}", TextureID);
144
140 // Do we have a jpeg decoder? 145 // Do we have a jpeg decoder?
141 if (J2KDecoder != null) 146 if (J2KDecoder != null)
142 { 147 {
@@ -149,7 +154,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
149 // Send it off to the jpeg decoder 154 // Send it off to the jpeg decoder
150 J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback); 155 J2KDecoder.BeginDecode(TextureID, m_asset, J2KDecodedCallback);
151 } 156 }
152
153 } 157 }
154 else 158 else
155 { 159 {
@@ -328,14 +332,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
328 { 332 {
329 if (m_currentPacket == 0) 333 if (m_currentPacket == 0)
330 return 0; 334 return 0;
335
331 if (m_currentPacket == 1) 336 if (m_currentPacket == 1)
332 return FIRST_PACKET_SIZE; 337 return FIRST_PACKET_SIZE;
333 338
334 int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE; 339 int result = FIRST_PACKET_SIZE + ((int)m_currentPacket - 2) * IMAGE_PACKET_SIZE;
340
335 if (result < 0) 341 if (result < 0)
336 {
337 result = FIRST_PACKET_SIZE; 342 result = FIRST_PACKET_SIZE;
338 } 343
339 return result; 344 return result;
340 } 345 }
341 346
@@ -374,7 +379,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
374 { 379 {
375 UUID assetID = UUID.Zero; 380 UUID assetID = UUID.Zero;
376 if (asset != null) 381 if (asset != null)
382 {
377 assetID = asset.FullID; 383 assetID = asset.FullID;
384 }
378 else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule)) 385 else if ((InventoryAccessModule != null) && (sender != InventoryAccessModule))
379 { 386 {
380 // Unfortunately we need this here, there's no other way. 387 // Unfortunately we need this here, there's no other way.
@@ -395,7 +402,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
395 } 402 }
396 403
397 AssetDataCallback(assetID, asset); 404 AssetDataCallback(assetID, asset);
398
399 } 405 }
400 } 406 }
401} 407}
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
index b37fd54..eb1a50e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs
@@ -348,7 +348,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
348 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>(); 348 protected Dictionary<PacketType, PacketProcessor> m_packetHandlers = new Dictionary<PacketType, PacketProcessor>();
349 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers 349 protected Dictionary<string, GenericMessage> m_genericPacketHandlers = new Dictionary<string, GenericMessage>(); //PauPaw:Local Generic Message handlers
350 protected Scene m_scene; 350 protected Scene m_scene;
351 protected LLImageManager m_imageManager; 351 private LLImageManager m_imageManager;
352 protected string m_firstName; 352 protected string m_firstName;
353 protected string m_lastName; 353 protected string m_lastName;
354 protected Thread m_clientThread; 354 protected Thread m_clientThread;
@@ -499,8 +499,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
499 IsActive = false; 499 IsActive = false;
500 500
501 // Shutdown the image manager 501 // Shutdown the image manager
502 if (m_imageManager != null) 502 m_imageManager.Close();
503 m_imageManager.Close();
504 503
505 // Fire the callback for this connection closing 504 // Fire the callback for this connection closing
506 if (OnConnectionClosed != null) 505 if (OnConnectionClosed != null)
@@ -578,7 +577,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
578 /// Add a handler for the given packet type. 577 /// Add a handler for the given packet type.
579 /// </summary> 578 /// </summary>
580 /// <remarks> 579 /// <remarks>
581 /// The packet is handled on its own thread. If packets must be handled in the order in which thye 580 /// The packet is handled on its own thread. If packets must be handled in the order in which they
582 /// are received then please use the synchronous version of this method. 581 /// are received then please use the synchronous version of this method.
583 /// </remarks> 582 /// </remarks>
584 /// <param name="packetType"></param> 583 /// <param name="packetType"></param>
@@ -3940,14 +3939,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
3940 } 3939 }
3941 3940
3942 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0) 3941 if ((categories & ThrottleOutPacketTypeFlags.Texture) != 0)
3943 {
3944 ProcessTextureRequests();
3945 }
3946 }
3947
3948 void ProcessTextureRequests()
3949 {
3950 if (m_imageManager != null)
3951 m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit); 3942 m_imageManager.ProcessImageQueue(m_udpServer.TextureSendLimit);
3952 } 3943 }
3953 3944
@@ -7479,12 +7470,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
7479 if ((ImageType)block.Type == ImageType.Baked) 7470 if ((ImageType)block.Type == ImageType.Baked)
7480 args.Priority *= 2.0f; 7471 args.Priority *= 2.0f;
7481 7472
7482 // in the end, we null this, so we have to check if it's null 7473 m_imageManager.EnqueueReq(args);
7483 if (m_imageManager != null)
7484 {
7485 m_imageManager.EnqueueReq(args);
7486 }
7487 } 7474 }
7475
7488 return true; 7476 return true;
7489 } 7477 }
7490 7478
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
index e3a881f..3e31b7d 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/LLImageManager.cs
@@ -84,7 +84,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
84 /// <param name="newRequest"></param> 84 /// <param name="newRequest"></param>
85 public void EnqueueReq(TextureRequestArgs newRequest) 85 public void EnqueueReq(TextureRequestArgs newRequest)
86 { 86 {
87 //Make sure we're not shutting down..
88 if (!m_shuttingdown) 87 if (!m_shuttingdown)
89 { 88 {
90 J2KImage imgrequest; 89 J2KImage imgrequest;
@@ -99,19 +98,23 @@ namespace OpenSim.Region.ClientStack.LindenUDP
99 { 98 {
100 //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID); 99 //m_log.Debug("[TEX]: (CAN) ID=" + newRequest.RequestedAssetID);
101 100
102 try 101 try
103 { 102 {
104 lock (m_syncRoot) 103 lock (m_syncRoot)
105 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle); 104 m_priorityQueue.Delete(imgrequest.PriorityQueueHandle);
106 } 105 }
107 catch (Exception) { } 106 catch (Exception) { }
108 } 107 }
109 else 108 else
110 { 109 {
110// m_log.DebugFormat(
111// "[LL IMAGE MANAGER]: Received duplicate of existing request for {0}, start packet {1} from {2}",
112// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
113
111 //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}", 114 //m_log.DebugFormat("[TEX]: (UPD) ID={0}: D={1}, S={2}, P={3}",
112 // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); 115 // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
113 116
114 //Check the packet sequence to make sure this isn't older than 117 //Check the packet sequence to make sure this isn't older than
115 //one we've already received 118 //one we've already received
116 if (newRequest.requestSequence > imgrequest.LastSequence) 119 if (newRequest.requestSequence > imgrequest.LastSequence)
117 { 120 {
@@ -126,11 +129,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
126 129
127 //Update the requested priority 130 //Update the requested priority
128 imgrequest.Priority = newRequest.Priority; 131 imgrequest.Priority = newRequest.Priority;
132
129 UpdateImageInQueue(imgrequest); 133 UpdateImageInQueue(imgrequest);
130 134
131 //Run an update
132 imgrequest.RunUpdate(); 135 imgrequest.RunUpdate();
136
137// J2KImage imgrequest2 = new J2KImage(this);
138// imgrequest2.J2KDecoder = m_j2kDecodeModule;
139// imgrequest2.AssetService = m_assetCache;
140// imgrequest2.AgentID = m_client.AgentId;
141// imgrequest2.InventoryAccessModule = m_client.Scene.RequestModuleInterface<IInventoryAccessModule>();
142// imgrequest2.DiscardLevel = newRequest.DiscardLevel;
143// imgrequest2.StartPacket = Math.Max(1, newRequest.PacketNumber);
144// imgrequest2.Priority = newRequest.Priority;
145// imgrequest2.TextureID = newRequest.RequestedAssetID;
146// imgrequest2.Priority = newRequest.Priority;
147//
148// //Add this download to the priority queue
149// AddImageToQueue(imgrequest2);
150//
151// imgrequest2.RunUpdate();
152
133 } 153 }
154// else
155// {
156// m_log.DebugFormat(
157// "[LL IMAGE MANAGER]: Ignoring duplicate of existing request for {0} (sequence {1}) from {2} as its request sequence {3} is not greater",
158// newRequest.RequestedAssetID, imgrequest.LastSequence, m_client.Name, newRequest.requestSequence);
159// }
134 } 160 }
135 } 161 }
136 else 162 else
@@ -142,6 +168,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
142 } 168 }
143 else 169 else
144 { 170 {
171// m_log.DebugFormat(
172// "[LL IMAGE MANAGER]: Received request for {0}, start packet {1} from {2}",
173// newRequest.RequestedAssetID, newRequest.PacketNumber, m_client.Name);
174
145 //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}", 175 //m_log.DebugFormat("[TEX]: (NEW) ID={0}: D={1}, S={2}, P={3}",
146 // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority); 176 // newRequest.RequestedAssetID, newRequest.DiscardLevel, newRequest.PacketNumber, newRequest.Priority);
147 177
@@ -159,7 +189,6 @@ namespace OpenSim.Region.ClientStack.LindenUDP
159 //Add this download to the priority queue 189 //Add this download to the priority queue
160 AddImageToQueue(imgrequest); 190 AddImageToQueue(imgrequest);
161 191
162 //Run an update
163 imgrequest.RunUpdate(); 192 imgrequest.RunUpdate();
164 } 193 }
165 } 194 }
@@ -176,7 +205,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
176 205
177 // If null was returned, the texture priority queue is currently empty 206 // If null was returned, the texture priority queue is currently empty
178 if (image == null) 207 if (image == null)
179 return false; 208 break;
180 209
181 if (image.IsDecoded) 210 if (image.IsDecoded)
182 { 211 {
@@ -194,10 +223,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
194 // written. Undecoded textures should not be going into the priority 223 // written. Undecoded textures should not be going into the priority
195 // queue, because a high priority undecoded texture will clog up the 224 // queue, because a high priority undecoded texture will clog up the
196 // pipeline for a client 225 // pipeline for a client
197 return true; 226// m_log.DebugFormat(
227// "[LL IMAGE MANAGER]: Exiting image queue processing early on encountering undecoded image {0}",
228// image.TextureID);
229
230 break;
198 } 231 }
199 } 232 }
200 233
234// if (packetsSent != 0)
235// m_log.DebugFormat("[LL IMAGE MANAGER]: Processed {0} packets from image queue", packetsSent);
236
201 return m_priorityQueue.Count > 0; 237 return m_priorityQueue.Count > 0;
202 } 238 }
203 239
@@ -219,7 +255,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
219 { 255 {
220 if (m_priorityQueue.Count > 0) 256 if (m_priorityQueue.Count > 0)
221 { 257 {
222 try { image = m_priorityQueue.FindMax(); } 258 try
259 {
260 image = m_priorityQueue.FindMax();
261 }
223 catch (Exception) { } 262 catch (Exception) { }
224 } 263 }
225 } 264 }
@@ -232,7 +271,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
232 271
233 lock (m_syncRoot) 272 lock (m_syncRoot)
234 { 273 {
235 try { m_priorityQueue.Add(ref image.PriorityQueueHandle, image); } 274 try
275 {
276 m_priorityQueue.Add(ref image.PriorityQueueHandle, image);
277 }
236 catch (Exception) { } 278 catch (Exception) { }
237 } 279 }
238 } 280 }
@@ -241,7 +283,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
241 { 283 {
242 lock (m_syncRoot) 284 lock (m_syncRoot)
243 { 285 {
244 try { m_priorityQueue.Delete(image.PriorityQueueHandle); } 286 try
287 {
288 m_priorityQueue.Delete(image.PriorityQueueHandle);
289 }
245 catch (Exception) { } 290 catch (Exception) { }
246 } 291 }
247 } 292 }
@@ -250,7 +295,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
250 { 295 {
251 lock (m_syncRoot) 296 lock (m_syncRoot)
252 { 297 {
253 try { m_priorityQueue.Replace(image.PriorityQueueHandle, image); } 298 try
299 {
300 m_priorityQueue.Replace(image.PriorityQueueHandle, image);
301 }
254 catch (Exception) 302 catch (Exception)
255 { 303 {
256 image.PriorityQueueHandle = null; 304 image.PriorityQueueHandle = null;
diff --git a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
index 7dd9087..349d3ac 100644
--- a/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
+++ b/OpenSim/Region/CoreModules/Agent/TextureSender/J2KDecoderModule.cs
@@ -103,6 +103,10 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
103 // If it's cached, return the cached results 103 // If it's cached, return the cached results
104 if (m_decodedCache.TryGetValue(assetID, out result)) 104 if (m_decodedCache.TryGetValue(assetID, out result))
105 { 105 {
106// m_log.DebugFormat(
107// "[J2KDecoderModule]: Returning existing cached {0} layers j2k decode for {1}",
108// result.Length, assetID);
109
106 callback(assetID, result); 110 callback(assetID, result);
107 } 111 }
108 else 112 else
@@ -133,14 +137,9 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
133 } 137 }
134 } 138 }
135 139
136 /// <summary> 140 public bool Decode(UUID assetID, byte[] j2kData)
137 /// Provides a synchronous decode so that caller can be assured that this executes before the next line
138 /// </summary>
139 /// <param name="assetID"></param>
140 /// <param name="j2kData"></param>
141 public void Decode(UUID assetID, byte[] j2kData)
142 { 141 {
143 DoJ2KDecode(assetID, j2kData); 142 return DoJ2KDecode(assetID, j2kData);
144 } 143 }
145 144
146 #endregion IJ2KDecoder 145 #endregion IJ2KDecoder
@@ -150,11 +149,13 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
150 /// </summary> 149 /// </summary>
151 /// <param name="assetID">UUID of Asset</param> 150 /// <param name="assetID">UUID of Asset</param>
152 /// <param name="j2kData">JPEG2000 data</param> 151 /// <param name="j2kData">JPEG2000 data</param>
153 private void DoJ2KDecode(UUID assetID, byte[] j2kData) 152 private bool DoJ2KDecode(UUID assetID, byte[] j2kData)
154 { 153 {
155// m_log.DebugFormat( 154// m_log.DebugFormat(
156// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID); 155// "[J2KDecoderModule]: Doing J2K decoding of {0} bytes for asset {1}", j2kData.Length, assetID);
157 156
157 bool decodedSuccessfully = true;
158
158 //int DecodeTime = 0; 159 //int DecodeTime = 0;
159 //DecodeTime = Environment.TickCount; 160 //DecodeTime = Environment.TickCount;
160 OpenJPEG.J2KLayerInfo[] layers; 161 OpenJPEG.J2KLayerInfo[] layers;
@@ -192,6 +193,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
192 catch (Exception ex) 193 catch (Exception ex)
193 { 194 {
194 m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message); 195 m_log.Warn("[J2KDecoderModule]: CSJ2K threw an exception decoding texture " + assetID + ": " + ex.Message);
196 decodedSuccessfully = false;
195 } 197 }
196 } 198 }
197 else 199 else
@@ -200,6 +202,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
200 if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components)) 202 if (!OpenJPEG.DecodeLayerBoundaries(j2kData, out layers, out components))
201 { 203 {
202 m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID); 204 m_log.Warn("[J2KDecoderModule]: OpenJPEG failed to decode texture " + assetID);
205 decodedSuccessfully = false;
203 } 206 }
204 } 207 }
205 208
@@ -208,6 +211,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
208 m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults"); 211 m_log.Warn("[J2KDecoderModule]: Failed to decode layer data for texture " + assetID + ", guessing sane defaults");
209 // Layer decoding completely failed. Guess at sane defaults for the layer boundaries 212 // Layer decoding completely failed. Guess at sane defaults for the layer boundaries
210 layers = CreateDefaultLayers(j2kData.Length); 213 layers = CreateDefaultLayers(j2kData.Length);
214 decodedSuccessfully = false;
211 } 215 }
212 216
213 // Cache Decoded layers 217 // Cache Decoded layers
@@ -227,6 +231,8 @@ namespace OpenSim.Region.CoreModules.Agent.TextureSender
227 m_notifyList.Remove(assetID); 231 m_notifyList.Remove(assetID);
228 } 232 }
229 } 233 }
234
235 return decodedSuccessfully;
230 } 236 }
231 237
232 private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength) 238 private OpenJPEG.J2KLayerInfo[] CreateDefaultLayers(int j2kLength)
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index e8aee3e..d68d28c 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -156,7 +156,8 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
156 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed; 156 changed = sp.Appearance.SetTextureEntries(textureEntry) || changed;
157 157
158// WriteBakedTexturesReport(sp, m_log.DebugFormat); 158// WriteBakedTexturesReport(sp, m_log.DebugFormat);
159 ValidateBakedTextureCache(sp, false); 159 if (!ValidateBakedTextureCache(sp))
160 RequestRebake(sp, true);
160 161
161 // This appears to be set only in the final stage of the appearance 162 // This appears to be set only in the final stage of the appearance
162 // update transaction. In theory, we should be able to do an immediate 163 // update transaction. In theory, we should be able to do an immediate
@@ -251,15 +252,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
251 } 252 }
252 253
253 /// <summary> 254 /// <summary>
254 /// Check for the existence of the baked texture assets.
255 /// </summary>
256 /// <param name="sp"></param>
257 public bool ValidateBakedTextureCache(IScenePresence sp)
258 {
259 return ValidateBakedTextureCache(sp, true);
260 }
261
262 /// <summary>
263 /// Queue up a request to send appearance. 255 /// Queue up a request to send appearance.
264 /// </summary> 256 /// </summary>
265 /// <remarks> 257 /// <remarks>
@@ -292,17 +284,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
292 } 284 }
293 } 285 }
294 286
295 #endregion 287 public bool ValidateBakedTextureCache(IScenePresence sp)
296
297 #region AvatarFactoryModule private methods
298
299 /// <summary>
300 /// Check for the existence of the baked texture assets. Request a rebake
301 /// unless checkonly is true.
302 /// </summary>
303 /// <param name="client"></param>
304 /// <param name="checkonly"></param>
305 private bool ValidateBakedTextureCache(IScenePresence sp, bool checkonly)
306 { 288 {
307 bool defonly = true; // are we only using default textures 289 bool defonly = true; // are we only using default textures
308 290
@@ -330,16 +312,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
330 defonly = false; // found a non-default texture reference 312 defonly = false; // found a non-default texture reference
331 313
332 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null) 314 if (m_scene.AssetService.Get(face.TextureID.ToString()) == null)
333 { 315 return false;
334 if (checkonly)
335 return false;
336
337 m_log.DebugFormat(
338 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
339 face.TextureID, idx, sp.Name);
340
341 sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
342 }
343 } 316 }
344 317
345 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID); 318 m_log.DebugFormat("[AVFACTORY]: Completed texture check for {0}", sp.UUID);
@@ -348,6 +321,57 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
348 return (defonly ? false : true); 321 return (defonly ? false : true);
349 } 322 }
350 323
324 public int RequestRebake(IScenePresence sp, bool missingTexturesOnly)
325 {
326 int texturesRebaked = 0;
327
328 for (int i = 0; i < AvatarAppearance.BAKE_INDICES.Length; i++)
329 {
330 int idx = AvatarAppearance.BAKE_INDICES[i];
331 Primitive.TextureEntryFace face = sp.Appearance.Texture.FaceTextures[idx];
332
333 // if there is no texture entry, skip it
334 if (face == null)
335 continue;
336
337// m_log.DebugFormat(
338// "[AVFACTORY]: Looking for texture {0}, id {1} for {2} {3}",
339// face.TextureID, idx, client.Name, client.AgentId);
340
341 // if the texture is one of the "defaults" then skip it
342 // this should probably be more intelligent (skirt texture doesnt matter
343 // if the avatar isnt wearing a skirt) but if any of the main baked
344 // textures is default then the rest should be as well
345 if (face.TextureID == UUID.Zero || face.TextureID == AppearanceManager.DEFAULT_AVATAR_TEXTURE)
346 continue;
347
348 if (missingTexturesOnly)
349 {
350 if (m_scene.AssetService.Get(face.TextureID.ToString()) != null)
351 continue;
352 else
353 m_log.DebugFormat(
354 "[AVFACTORY]: Missing baked texture {0} ({1}) for {2}, requesting rebake.",
355 face.TextureID, idx, sp.Name);
356 }
357 else
358 {
359 m_log.DebugFormat(
360 "[AVFACTORY]: Requesting rebake of {0} ({1}) for {2}.",
361 face.TextureID, idx, sp.Name);
362 }
363
364 texturesRebaked++;
365 sp.ControllingClient.SendRebakeAvatarTextures(face.TextureID);
366 }
367
368 return texturesRebaked;
369 }
370
371 #endregion
372
373 #region AvatarFactoryModule private methods
374
351 private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp) 375 private Dictionary<BakeType, Primitive.TextureEntryFace> GetBakedTextureFaces(ScenePresence sp)
352 { 376 {
353 if (sp.IsChildAgent) 377 if (sp.IsChildAgent)
diff --git a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
index b760454..93648d6 100644
--- a/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
+++ b/OpenSim/Region/DataSnapshot/DataRequestHandler.cs
@@ -67,7 +67,7 @@ namespace OpenSim.Region.DataSnapshot
67 67
68 public void OnRegisterCaps(UUID agentID, Caps caps) 68 public void OnRegisterCaps(UUID agentID, Caps caps)
69 { 69 {
70 m_log.Info("[DATASNAPSHOT]: Registering service discovery capability for " + agentID); 70// m_log.InfoFormat("[DATASNAPSHOT]: Registering service discovery capability for {0}", agentID);
71 string capsBase = "/CAPS/" + caps.CapsObjectPath; 71 string capsBase = "/CAPS/" + caps.CapsObjectPath;
72 caps.RegisterHandler("PublicSnapshotDataInfo", 72 caps.RegisterHandler("PublicSnapshotDataInfo",
73 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt)); 73 new RestStreamHandler("POST", capsBase + m_discoveryPath, OnDiscoveryAttempt));
diff --git a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
index 8670229..39a760c 100644
--- a/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IAvatarFactoryModule.cs
@@ -61,7 +61,32 @@ namespace OpenSim.Region.Framework.Interfaces
61 /// <returns>true if a valid agent was found, false otherwise</returns> 61 /// <returns>true if a valid agent was found, false otherwise</returns>
62 bool SaveBakedTextures(UUID agentId); 62 bool SaveBakedTextures(UUID agentId);
63 63
64 /// <summary>
65 /// Validate that OpenSim can find the baked textures need to display a given avatar
66 /// </summary>
67 /// <param name="client"></param>
68 /// <param name="checkonly"></param>
69 /// <returns>
70 /// true if all the baked textures referenced by the texture IDs exist or the appearance is only using default textures. false otherwise.
71 /// </returns>
64 bool ValidateBakedTextureCache(IScenePresence sp); 72 bool ValidateBakedTextureCache(IScenePresence sp);
73
74 /// <summary>
75 /// Request a rebake of textures for an avatar.
76 /// </summary>
77 /// <remarks>
78 /// This will send the request to the viewer, since it's there that the rebake is done.
79 /// </remarks>
80 /// <param name="sp">Avatar to rebake.</param>
81 /// <param name="missingTexturesOnly">
82 /// If true, only request a rebake for the textures that are missing.
83 /// If false then we request a rebake of all textures for which we already have references.
84 /// </param>
85 /// <returns>
86 /// Number of rebake requests made. This will depend upon whether we've previously received texture IDs.
87 /// </returns>
88 int RequestRebake(IScenePresence sp, bool missingTexturesOnly);
89
65 void QueueAppearanceSend(UUID agentid); 90 void QueueAppearanceSend(UUID agentid);
66 void QueueAppearanceSave(UUID agentid); 91 void QueueAppearanceSave(UUID agentid);
67 92
diff --git a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
index 856eb11..0964276 100644
--- a/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
+++ b/OpenSim/Region/Framework/Interfaces/IJ2KDecoder.cs
@@ -35,6 +35,13 @@ namespace OpenSim.Region.Framework.Interfaces
35 public interface IJ2KDecoder 35 public interface IJ2KDecoder
36 { 36 {
37 void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback); 37 void BeginDecode(UUID assetID, byte[] j2kData, DecodedCallback callback);
38 void Decode(UUID assetID, byte[] j2kData); 38
39 /// <summary>
40 /// Provides a synchronous decode so that caller can be assured that this executes before the next line
41 /// </summary>
42 /// <param name="assetID"></param>
43 /// <param name="j2kData"></param>
44 /// <returns>true if decode was successful. false otherwise.</returns>
45 bool Decode(UUID assetID, byte[] j2kData);
39 } 46 }
40} 47}
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 4f71915..fd35c62 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -401,6 +401,9 @@ namespace OpenSim.Region.Framework.Scenes
401 public delegate void RegionUp(GridRegion region); 401 public delegate void RegionUp(GridRegion region);
402 public event RegionUp OnRegionUp; 402 public event RegionUp OnRegionUp;
403 403
404 public delegate void RegionStarted(Scene scene);
405 public event RegionStarted OnRegionStarted;
406
404 public delegate void LoginsEnabled(string regionName); 407 public delegate void LoginsEnabled(string regionName);
405 public event LoginsEnabled OnLoginsEnabled; 408 public event LoginsEnabled OnLoginsEnabled;
406 409
@@ -2243,6 +2246,27 @@ namespace OpenSim.Region.Framework.Scenes
2243 } 2246 }
2244 } 2247 }
2245 2248
2249 public void TriggerOnRegionStarted(Scene scene)
2250 {
2251 RegionStarted handler = OnRegionStarted;
2252
2253 if (handler != null)
2254 {
2255 foreach (RegionStarted d in handler.GetInvocationList())
2256 {
2257 try
2258 {
2259 d(scene);
2260 }
2261 catch (Exception e)
2262 {
2263 m_log.ErrorFormat("[EVENT MANAGER]: Delegate for RegionStarted failed - continuing {0} - {1}",
2264 e.Message, e.StackTrace);
2265 }
2266 }
2267 }
2268 }
2269
2246 public void TriggerLoginsEnabled (string regionName) 2270 public void TriggerLoginsEnabled (string regionName)
2247 { 2271 {
2248 LoginsEnabled handler = OnLoginsEnabled; 2272 LoginsEnabled handler = OnLoginsEnabled;
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0f84da9..027ec96 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1194,6 +1194,7 @@ namespace OpenSim.Region.Framework.Scenes
1194 1194
1195 try 1195 try
1196 { 1196 {
1197 m_eventManager.TriggerOnRegionStarted(this);
1197 while (!shuttingdown) 1198 while (!shuttingdown)
1198 Update(); 1199 Update();
1199 1200
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index aea47e6..51d3586 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -1960,19 +1960,13 @@ namespace OpenSim.Region.Framework.Scenes
1960 public Vector3 GetWorldPosition() 1960 public Vector3 GetWorldPosition()
1961 { 1961 {
1962 Quaternion parentRot = ParentGroup.RootPart.RotationOffset; 1962 Quaternion parentRot = ParentGroup.RootPart.RotationOffset;
1963
1964 Vector3 axPos = OffsetPosition; 1963 Vector3 axPos = OffsetPosition;
1965
1966 axPos *= parentRot; 1964 axPos *= parentRot;
1967 Vector3 translationOffsetPosition = axPos; 1965 Vector3 translationOffsetPosition = axPos;
1968 1966 if(_parentID == 0)
1969// m_log.DebugFormat("[SCENE OBJECT PART]: Found group pos {0} for part {1}", GroupPosition, Name); 1967 return GroupPosition;
1970 1968 else
1971 Vector3 worldPos = GroupPosition + translationOffsetPosition; 1969 return ParentGroup.AbsolutePosition + translationOffsetPosition;
1972
1973// m_log.DebugFormat("[SCENE OBJECT PART]: Found world pos {0} for part {1}", worldPos, Name);
1974
1975 return worldPos;
1976 } 1970 }
1977 1971
1978 /// <summary> 1972 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3d1c1b5..42cd4be 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2844,7 +2844,7 @@ namespace OpenSim.Region.Framework.Scenes
2844 Velocity = Vector3.Zero; 2844 Velocity = Vector3.Zero;
2845 AbsolutePosition = pos; 2845 AbsolutePosition = pos;
2846 2846
2847 m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition); 2847// m_log.DebugFormat("[SCENE PRESENCE]: Prevented flyoff for {0} at {1}", Name, AbsolutePosition);
2848 2848
2849 AddToPhysicalScene(isFlying); 2849 AddToPhysicalScene(isFlying);
2850 } 2850 }
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
index 60cc788..bca49f7 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs
@@ -1263,7 +1263,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1263 writer.WriteElementString(name, flagsStr.Replace(",", "")); 1263 writer.WriteElementString(name, flagsStr.Replace(",", ""));
1264 } 1264 }
1265 1265
1266 static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene) 1266 public static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
1267 { 1267 {
1268 if (tinv.Count > 0) // otherwise skip this 1268 if (tinv.Count > 0) // otherwise skip this
1269 { 1269 {
@@ -1317,7 +1317,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1317 } 1317 }
1318 } 1318 }
1319 1319
1320 static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary<string, object> options) 1320 public static void WriteShape(XmlTextWriter writer, PrimitiveBaseShape shp, Dictionary<string, object> options)
1321 { 1321 {
1322 if (shp != null) 1322 if (shp != null)
1323 { 1323 {
@@ -1492,7 +1492,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1492 return obj; 1492 return obj;
1493 } 1493 }
1494 1494
1495 static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name) 1495 public static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
1496 { 1496 {
1497 TaskInventoryDictionary tinv = new TaskInventoryDictionary(); 1497 TaskInventoryDictionary tinv = new TaskInventoryDictionary();
1498 1498
@@ -1538,7 +1538,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
1538 /// <param name="name">The name of the xml element containing the shape</param> 1538 /// <param name="name">The name of the xml element containing the shape</param>
1539 /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param> 1539 /// <param name="errors">true if any errors were encountered during parsing, false otherwise</param>
1540 /// <returns>The shape parsed</returns> 1540 /// <returns>The shape parsed</returns>
1541 static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors) 1541 public static PrimitiveBaseShape ReadShape(XmlTextReader reader, string name, out bool errors)
1542 { 1542 {
1543 errors = false; 1543 errors = false;
1544 1544
diff --git a/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
new file mode 100644
index 0000000..b224132
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Agent/TextureSender/J2KDecoderCommandModule.cs
@@ -0,0 +1,145 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Text;
33using log4net;
34using Mono.Addins;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Region.OptionalModules.Agent.TextureSender
43{
44 /// <summary>
45 /// Commands for the J2KDecoder module. For debugging purposes.
46 /// </summary>
47 /// <remarks>
48 /// Placed here so that they can be removed if not required and to keep the J2KDecoder module itself simple.
49 /// </remarks>
50 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "J2KDecoderCommandModule")]
51 public class J2KDecoderCommandModule : ISharedRegionModule
52 {
53// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
54
55 private Scene m_scene;
56
57 public string Name { get { return "Asset Information Module"; } }
58
59 public Type ReplaceableInterface { get { return null; } }
60
61 public void Initialise(IConfigSource source)
62 {
63// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: INITIALIZED MODULE");
64 }
65
66 public void PostInitialise()
67 {
68// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: POST INITIALIZED MODULE");
69 }
70
71 public void Close()
72 {
73// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: CLOSED MODULE");
74 }
75
76 public void AddRegion(Scene scene)
77 {
78// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
79 }
80
81 public void RemoveRegion(Scene scene)
82 {
83// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
84 }
85
86 public void RegionLoaded(Scene scene)
87 {
88// m_log.DebugFormat("[J2K DECODER COMMAND MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
89
90 if (m_scene == null)
91 m_scene = scene;
92
93 MainConsole.Instance.Commands.AddCommand(
94 "j2k",
95 false,
96 "j2k decode",
97 "j2k decode <ID>",
98 "Do JPEG2000 decoding of an asset.",
99 "This is for debugging purposes. The asset id given must contain JPEG2000 data.",
100 HandleDecode);
101 }
102
103 void HandleDecode(string module, string[] args)
104 {
105 if (args.Length < 3)
106 {
107 MainConsole.Instance.Output("Usage is j2k decode <ID>");
108 return;
109 }
110
111 UUID assetId;
112 string rawAssetId = args[2];
113
114 if (!UUID.TryParse(rawAssetId, out assetId))
115 {
116 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
117 return;
118 }
119
120 AssetBase asset = m_scene.AssetService.Get(assetId.ToString());
121 if (asset == null)
122 {
123 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
124 return;
125 }
126
127 if (asset.Type != (sbyte)AssetType.Texture)
128 {
129 MainConsole.Instance.OutputFormat("ERROR: Asset {0} is not a texture type", assetId);
130 return;
131 }
132
133 IJ2KDecoder decoder = m_scene.RequestModuleInterface<IJ2KDecoder>();
134 if (decoder == null)
135 {
136 MainConsole.Instance.OutputFormat("ERROR: No IJ2KDecoder module available");
137 return;
138 }
139
140 if (decoder.Decode(assetId, asset.Data))
141 MainConsole.Instance.OutputFormat("Successfully decoded asset {0}", assetId);
142 else
143 MainConsole.Instance.OutputFormat("Decode of asset {0} failed", assetId); }
144 }
145} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
new file mode 100644
index 0000000..a5207eb
--- /dev/null
+++ b/OpenSim/Region/OptionalModules/Asset/AssetInfoModule.cs
@@ -0,0 +1,185 @@
1/*
2 * Copyright (c) Contributors, http://opensimulator.org/
3 * See CONTRIBUTORS.TXT for a full list of copyright holders.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 * * Neither the name of the OpenSimulator Project nor the
13 * names of its contributors may be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
17 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19 * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28using System;
29using System.Collections.Generic;
30using System.IO;
31using System.Reflection;
32using System.Text;
33using log4net;
34using Mono.Addins;
35using Nini.Config;
36using OpenMetaverse;
37using OpenSim.Framework;
38using OpenSim.Framework.Console;
39using OpenSim.Region.Framework.Interfaces;
40using OpenSim.Region.Framework.Scenes;
41
42namespace OpenSim.Region.OptionalModules.Asset
43{
44 /// <summary>
45 /// A module that just holds commands for inspecting assets.
46 /// </summary>
47 [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "AssetInfoModule")]
48 public class AssetInfoModule : ISharedRegionModule
49 {
50// private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51
52 private Scene m_scene;
53
54 public string Name { get { return "Asset Information Module"; } }
55
56 public Type ReplaceableInterface { get { return null; } }
57
58 public void Initialise(IConfigSource source)
59 {
60// m_log.DebugFormat("[ASSET INFO MODULE]: INITIALIZED MODULE");
61 }
62
63 public void PostInitialise()
64 {
65// m_log.DebugFormat("[ASSET INFO MODULE]: POST INITIALIZED MODULE");
66 }
67
68 public void Close()
69 {
70// m_log.DebugFormat("[ASSET INFO MODULE]: CLOSED MODULE");
71 }
72
73 public void AddRegion(Scene scene)
74 {
75// m_log.DebugFormat("[ASSET INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
76 }
77
78 public void RemoveRegion(Scene scene)
79 {
80// m_log.DebugFormat("[ASSET INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
81 }
82
83 public void RegionLoaded(Scene scene)
84 {
85// m_log.DebugFormat("[ASSET INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
86
87 if (m_scene == null)
88 m_scene = scene;
89
90 MainConsole.Instance.Commands.AddCommand(
91 "asset",
92 false,
93 "show asset",
94 "show asset <ID>",
95 "Show asset information",
96 HandleShowAsset);
97
98 MainConsole.Instance.Commands.AddCommand(
99 "asset", false, "dump asset",
100 "dump asset <id>",
101 "Dump an asset",
102 HandleDumpAsset);
103 }
104
105 void HandleDumpAsset(string module, string[] args)
106 {
107 if (args.Length < 3)
108 {
109 MainConsole.Instance.Output("Usage is dump asset <ID>");
110 return;
111 }
112
113 UUID assetId;
114 string rawAssetId = args[2];
115
116 if (!UUID.TryParse(rawAssetId, out assetId))
117 {
118 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
119 return;
120 }
121
122 AssetBase asset = m_scene.AssetService.Get(assetId.ToString());
123 if (asset == null)
124 {
125 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
126 return;
127 }
128
129 string fileName = rawAssetId;
130
131 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
132 {
133 using (BinaryWriter bw = new BinaryWriter(fs))
134 {
135 bw.Write(asset.Data);
136 }
137 }
138
139 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
140 }
141
142 void HandleShowAsset(string module, string[] args)
143 {
144 if (args.Length < 3)
145 {
146 MainConsole.Instance.Output("Syntax: show asset <ID>");
147 return;
148 }
149
150 AssetBase asset = m_scene.AssetService.Get(args[2]);
151
152 if (asset == null || asset.Data.Length == 0)
153 {
154 MainConsole.Instance.Output("Asset not found");
155 return;
156 }
157
158 int i;
159
160 MainConsole.Instance.OutputFormat("Name: {0}", asset.Name);
161 MainConsole.Instance.OutputFormat("Description: {0}", asset.Description);
162 MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type);
163 MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType);
164 MainConsole.Instance.OutputFormat("Size: {0} bytes", asset.Data.Length);
165 MainConsole.Instance.OutputFormat("Temporary: {0}", asset.Temporary ? "yes" : "no");
166 MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags);
167
168 for (i = 0 ; i < 5 ; i++)
169 {
170 int off = i * 16;
171 if (asset.Data.Length <= off)
172 break;
173 int len = 16;
174 if (asset.Data.Length < off + len)
175 len = asset.Data.Length - off;
176
177 byte[] line = new byte[len];
178 Array.Copy(asset.Data, off, line, 0, len);
179
180 string text = BitConverter.ToString(line);
181 MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
182 }
183 }
184 }
185} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
index 1ce24f1..39cd4c9 100644
--- a/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
+++ b/OpenSim/Region/OptionalModules/Avatar/Appearance/AppearanceInfoModule.cs
@@ -114,6 +114,16 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
114 "Send appearance data for each avatar in the simulator to other viewers.", 114 "Send appearance data for each avatar in the simulator to other viewers.",
115 "Optionally, you can specify that only a particular avatar's appearance data is sent.", 115 "Optionally, you can specify that only a particular avatar's appearance data is sent.",
116 HandleSendAppearanceCommand); 116 HandleSendAppearanceCommand);
117
118 scene.AddCommand(
119 this, "appearance rebake",
120 "appearance rebake <first-name> <last-name>",
121 "Send a request to the user's viewer for it to rebake and reupload its appearance textures.",
122 "This is currently done for all baked texture references previously received, whether the simulator can find the asset or not."
123 + "\nThis will only work for texture ids that the viewer has already uploaded."
124 + "\nIf the viewer has not yet sent the server any texture ids then nothing will happen"
125 + "\nsince requests can only be made for ids that the client has already sent us",
126 HandleRebakeAppearanceCommand);
117 } 127 }
118 128
119 private void HandleSendAppearanceCommand(string module, string[] cmd) 129 private void HandleSendAppearanceCommand(string module, string[] cmd)
@@ -210,6 +220,39 @@ namespace OpenSim.Region.OptionalModules.Avatar.Appearance
210 } 220 }
211 } 221 }
212 } 222 }
213 } 223 }
224
225 private void HandleRebakeAppearanceCommand(string module, string[] cmd)
226 {
227 if (cmd.Length != 4)
228 {
229 MainConsole.Instance.OutputFormat("Usage: appearance rebake <first-name> <last-name>");
230 return;
231 }
232
233 string firstname = cmd[2];
234 string lastname = cmd[3];
235
236 lock (m_scenes)
237 {
238 foreach (Scene scene in m_scenes.Values)
239 {
240 ScenePresence sp = scene.GetScenePresence(firstname, lastname);
241 if (sp != null && !sp.IsChildAgent)
242 {
243 int rebakesRequested = scene.AvatarFactory.RequestRebake(sp, false);
244
245 if (rebakesRequested > 0)
246 MainConsole.Instance.OutputFormat(
247 "Requesting rebake of {0} uploaded textures for {1} in {2}",
248 rebakesRequested, sp.Name, scene.RegionInfo.RegionName);
249 else
250 MainConsole.Instance.OutputFormat(
251 "No texture IDs available for rebake request for {0} in {1}",
252 sp.Name, scene.RegionInfo.RegionName);
253 }
254 }
255 }
256 }
214 } 257 }
215} \ No newline at end of file 258} \ No newline at end of file
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
index 16cd7e4..a8e545c 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IInventoryItem.cs
@@ -30,8 +30,7 @@ using OpenMetaverse;
30using OpenMetaverse.Assets; 30using OpenMetaverse.Assets;
31 31
32namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 32namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
33{ 33{
34
35 /// <summary> 34 /// <summary>
36 /// This implements the methods needed to operate on individual inventory items. 35 /// This implements the methods needed to operate on individual inventory items.
37 /// </summary> 36 /// </summary>
@@ -39,6 +38,6 @@ namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
39 { 38 {
40 int Type { get; } 39 int Type { get; }
41 UUID AssetID { get; } 40 UUID AssetID { get; }
42 T RetrieveAsset<T>() where T : Asset, new(); 41 T RetrieveAsset<T>() where T : OpenMetaverse.Assets.Asset, new();
43 } 42 }
44} 43}
diff --git a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
index df571fa..9b80245 100644
--- a/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
+++ b/OpenSim/Server/Handlers/Asset/AssetServerConnector.cs
@@ -26,7 +26,11 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.IO;
29using Nini.Config; 30using Nini.Config;
31using OpenMetaverse;
32using OpenSim.Framework;
33using OpenSim.Framework.Console;
30using OpenSim.Server.Base; 34using OpenSim.Server.Base;
31using OpenSim.Services.Interfaces; 35using OpenSim.Services.Interfaces;
32using OpenSim.Framework.Servers.HttpServer; 36using OpenSim.Framework.Servers.HttpServer;
@@ -67,6 +71,129 @@ namespace OpenSim.Server.Handlers.Asset
67 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService)); 71 server.AddStreamHandler(new AssetServerGetHandler(m_AssetService));
68 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService)); 72 server.AddStreamHandler(new AssetServerPostHandler(m_AssetService));
69 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete)); 73 server.AddStreamHandler(new AssetServerDeleteHandler(m_AssetService, allowDelete));
74
75 MainConsole.Instance.Commands.AddCommand("kfs", false,
76 "show asset",
77 "show asset <ID>",
78 "Show asset information",
79 HandleShowAsset);
80
81 MainConsole.Instance.Commands.AddCommand("kfs", false,
82 "delete asset",
83 "delete asset <ID>",
84 "Delete asset from database",
85 HandleDeleteAsset);
86
87 MainConsole.Instance.Commands.AddCommand("kfs", false,
88 "dump asset",
89 "dump asset <ID>",
90 "Dump asset to a file",
91 "The filename is the same as the ID given.",
92 HandleDumpAsset);
93 }
94
95 void HandleDeleteAsset(string module, string[] args)
96 {
97 if (args.Length < 3)
98 {
99 MainConsole.Instance.Output("Syntax: delete asset <ID>");
100 return;
101 }
102
103 AssetBase asset = m_AssetService.Get(args[2]);
104
105 if (asset == null || asset.Data.Length == 0)
106 {
107 MainConsole.Instance.Output("Asset not found");
108 return;
109 }
110
111 m_AssetService.Delete(args[2]);
112
113 //MainConsole.Instance.Output("Asset deleted");
114 // TODO: Implement this
115
116 MainConsole.Instance.Output("Asset deletion not supported by database");
117 }
118
119 void HandleDumpAsset(string module, string[] args)
120 {
121 if (args.Length < 3)
122 {
123 MainConsole.Instance.Output("Usage is dump asset <ID>");
124 return;
125 }
126
127 UUID assetId;
128 string rawAssetId = args[2];
129
130 if (!UUID.TryParse(rawAssetId, out assetId))
131 {
132 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
133 return;
134 }
135
136 AssetBase asset = m_AssetService.Get(assetId.ToString());
137 if (asset == null)
138 {
139 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
140 return;
141 }
142
143 string fileName = rawAssetId;
144
145 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
146 {
147 using (BinaryWriter bw = new BinaryWriter(fs))
148 {
149 bw.Write(asset.Data);
150 }
151 }
152
153 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
154 }
155
156 void HandleShowAsset(string module, string[] args)
157 {
158 if (args.Length < 3)
159 {
160 MainConsole.Instance.Output("Syntax: show asset <ID>");
161 return;
162 }
163
164 AssetBase asset = m_AssetService.Get(args[2]);
165
166 if (asset == null || asset.Data.Length == 0)
167 {
168 MainConsole.Instance.Output("Asset not found");
169 return;
170 }
171
172 int i;
173
174 MainConsole.Instance.OutputFormat("Name: {0}", asset.Name);
175 MainConsole.Instance.OutputFormat("Description: {0}", asset.Description);
176 MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type);
177 MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType);
178 MainConsole.Instance.OutputFormat("Size: {0} bytes", asset.Data.Length);
179 MainConsole.Instance.OutputFormat("Temporary: {0}", asset.Temporary ? "yes" : "no");
180 MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags);
181
182 for (i = 0 ; i < 5 ; i++)
183 {
184 int off = i * 16;
185 if (asset.Data.Length <= off)
186 break;
187 int len = 16;
188 if (asset.Data.Length < off + len)
189 len = asset.Data.Length - off;
190
191 byte[] line = new byte[len];
192 Array.Copy(asset.Data, off, line, 0, len);
193
194 string text = BitConverter.ToString(line);
195 MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
196 }
70 } 197 }
71 } 198 }
72} 199} \ No newline at end of file
diff --git a/OpenSim/Services/AssetService/AssetService.cs b/OpenSim/Services/AssetService/AssetService.cs
index b3af8e3..4f4cbf6 100644
--- a/OpenSim/Services/AssetService/AssetService.cs
+++ b/OpenSim/Services/AssetService/AssetService.cs
@@ -32,7 +32,6 @@ using System.Reflection;
32using Nini.Config; 32using Nini.Config;
33using log4net; 33using log4net;
34using OpenSim.Framework; 34using OpenSim.Framework;
35using OpenSim.Framework.Console;
36using OpenSim.Data; 35using OpenSim.Data;
37using OpenSim.Services.Interfaces; 36using OpenSim.Services.Interfaces;
38using OpenMetaverse; 37using OpenMetaverse;
@@ -53,23 +52,6 @@ namespace OpenSim.Services.AssetService
53 { 52 {
54 m_RootInstance = this; 53 m_RootInstance = this;
55 54
56 MainConsole.Instance.Commands.AddCommand("kfs", false,
57 "show digest",
58 "show digest <ID>",
59 "Show asset digest", HandleShowDigest);
60
61 MainConsole.Instance.Commands.AddCommand("kfs", false,
62 "delete asset",
63 "delete asset <ID>",
64 "Delete asset from database", HandleDeleteAsset);
65
66 MainConsole.Instance.Commands.AddCommand("kfs", false,
67 "dump asset",
68 "dump asset <ID>",
69 "Dump asset to a file",
70 "The filename is the same as the ID given.",
71 HandleDumpAsset);
72
73 if (m_AssetLoader != null) 55 if (m_AssetLoader != null)
74 { 56 {
75 IConfig assetConfig = config.Configs["AssetService"]; 57 IConfig assetConfig = config.Configs["AssetService"];
@@ -218,111 +200,11 @@ namespace OpenSim.Services.AssetService
218 return m_Database.Delete(id); 200 return m_Database.Delete(id);
219 } 201 }
220 else 202 else
221 m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
222
223 return false;
224 }
225
226 void HandleDumpAsset(string module, string[] args)
227 {
228 if (args.Length < 3)
229 {
230 MainConsole.Instance.Output("Usage is dump asset <ID>");
231 return;
232 }
233
234 string rawAssetId = args[2];
235 UUID assetId;
236
237 if (!UUID.TryParse(rawAssetId, out assetId))
238 {
239 MainConsole.Instance.OutputFormat("ERROR: {0} is not a valid ID format", rawAssetId);
240 return;
241 }
242
243 AssetBase asset = m_Database.GetAsset(assetId);
244 if (asset == null)
245 {
246 MainConsole.Instance.OutputFormat("ERROR: No asset found with ID {0}", assetId);
247 return;
248 }
249
250 string fileName = rawAssetId;
251
252 using (FileStream fs = new FileStream(fileName, FileMode.CreateNew))
253 {
254 using (BinaryWriter bw = new BinaryWriter(fs))
255 {
256 bw.Write(asset.Data);
257 }
258 }
259
260 MainConsole.Instance.OutputFormat("Asset dumped to file {0}", fileName);
261 }
262
263 void HandleShowDigest(string module, string[] args)
264 {
265 if (args.Length < 3)
266 {
267 MainConsole.Instance.Output("Syntax: show digest <ID>");
268 return;
269 }
270
271 AssetBase asset = Get(args[2]);
272
273 if (asset == null || asset.Data.Length == 0)
274 {
275 MainConsole.Instance.Output("Asset not found");
276 return;
277 }
278
279 int i;
280
281 MainConsole.Instance.OutputFormat("Name: {0}", asset.Name);
282 MainConsole.Instance.OutputFormat("Description: {0}", asset.Description);
283 MainConsole.Instance.OutputFormat("Type: {0} (type number = {1})", (AssetType)asset.Type, asset.Type);
284 MainConsole.Instance.OutputFormat("Content-type: {0}", asset.Metadata.ContentType);
285 MainConsole.Instance.OutputFormat("Flags: {0}", asset.Metadata.Flags);
286
287 for (i = 0 ; i < 5 ; i++)
288 { 203 {
289 int off = i * 16; 204 m_log.DebugFormat("[ASSET SERVICE]: Request to delete asset {0}, but flags are not Maptile", id);
290 if (asset.Data.Length <= off)
291 break;
292 int len = 16;
293 if (asset.Data.Length < off + len)
294 len = asset.Data.Length - off;
295
296 byte[] line = new byte[len];
297 Array.Copy(asset.Data, off, line, 0, len);
298
299 string text = BitConverter.ToString(line);
300 MainConsole.Instance.Output(String.Format("{0:x4}: {1}", off, text));
301 }
302 }
303
304 void HandleDeleteAsset(string module, string[] args)
305 {
306 if (args.Length < 3)
307 {
308 MainConsole.Instance.Output("Syntax: delete asset <ID>");
309 return;
310 }
311
312 AssetBase asset = Get(args[2]);
313
314 if (asset == null || asset.Data.Length == 0)
315 {
316 MainConsole.Instance.Output("Asset not found");
317 return;
318 } 205 }
319 206
320 Delete(args[2]); 207 return false;
321
322 //MainConsole.Instance.Output("Asset deleted");
323 // TODO: Implement this
324
325 MainConsole.Instance.Output("Asset deletion not supported by database");
326 } 208 }
327 } 209 }
328} 210} \ No newline at end of file
diff --git a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
index d7b2ff8..e4c3eaf 100644
--- a/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
+++ b/OpenSim/Services/Connectors/Asset/AssetServiceConnector.cs
@@ -86,11 +86,8 @@ namespace OpenSim.Services.Connectors
86 m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService"); 86 m_log.Error("[ASSET CONNECTOR]: No Server URI named in section AssetService");
87 throw new Exception("Asset connector init error"); 87 throw new Exception("Asset connector init error");
88 } 88 }
89 m_ServerURI = serviceURI;
90 89
91 MainConsole.Instance.Commands.AddCommand("asset", false, "dump asset", 90 m_ServerURI = serviceURI;
92 "dump asset <id> <file>",
93 "dump one cached asset", HandleDumpAsset);
94 } 91 }
95 92
96 protected void SetCache(IImprovedAssetCache cache) 93 protected void SetCache(IImprovedAssetCache cache)
@@ -328,43 +325,5 @@ namespace OpenSim.Services.Connectors
328 } 325 }
329 return false; 326 return false;
330 } 327 }
331
332 private void HandleDumpAsset(string module, string[] args)
333 {
334 if (args.Length != 4)
335 {
336 MainConsole.Instance.Output("Syntax: dump asset <id> <file>");
337 return;
338 }
339
340 UUID assetID;
341
342 if (!UUID.TryParse(args[2], out assetID))
343 {
344 MainConsole.Instance.Output("Invalid asset ID");
345 return;
346 }
347
348 if (m_Cache == null)
349 {
350 MainConsole.Instance.Output("Instance uses no cache");
351 return;
352 }
353
354 AssetBase asset = m_Cache.Get(assetID.ToString());
355
356 if (asset == null)
357 {
358 MainConsole.Instance.Output("Asset not found in cache");
359 return;
360 }
361
362 string fileName = args[3];
363
364 FileStream fs = File.Create(fileName);
365 fs.Write(asset.Data, 0, asset.Data.Length);
366
367 fs.Close();
368 }
369 } 328 }
370} 329} \ No newline at end of file
diff --git a/OpenSim/Tools/pCampBot/pCampBot.cs b/OpenSim/Tools/pCampBot/pCampBot.cs
index 6249fae..a73fcbe 100644
--- a/OpenSim/Tools/pCampBot/pCampBot.cs
+++ b/OpenSim/Tools/pCampBot/pCampBot.cs
@@ -112,10 +112,10 @@ namespace pCampBot
112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" + 112 " -lastname lastname for the bots. Each lastname will have _<bot-number> appended, e.g. Ima Bot_0\n" +
113 " -password password for the bots\n" + 113 " -password password for the bots\n" +
114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" + 114 " -b, behaviours behaviours for bots. Comma separated, e.g. p,g. Default is p\n" +
115 " current options are:" + 115 " current options are:\n" +
116 " p (physics)" + 116 " p (physics)\n" +
117 " g (grab)" + 117 " g (grab)\n" +
118 " t (teleport)" + 118 " t (teleport)\n" +
119// " c (cross)" + 119// " c (cross)" +
120 " -wear set appearance folder to load from (default: no)\n" + 120 " -wear set appearance folder to load from (default: no)\n" +
121 " -h, -help show this message"); 121 " -h, -help show this message");