aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/CoreModules
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs48
-rw-r--r--OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs6
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs13
-rw-r--r--OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs80
-rw-r--r--OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs4
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs48
-rw-r--r--OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs74
-rw-r--r--OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs58
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs223
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandChannel.cs8
12 files changed, 273 insertions, 293 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
index f002ad7..ad46107 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveWriteRequest.cs
@@ -218,10 +218,39 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
218 218
219 // Count inventory items (different to asset count) 219 // Count inventory items (different to asset count)
220 CountItems++; 220 CountItems++;
221 221
222 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset 222 // Don't chase down link asset items as they actually point to their target item IDs rather than an asset
223 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder) 223 if (SaveAssets && itemAssetType != AssetType.Link && itemAssetType != AssetType.LinkFolder)
224 {
225 int curErrorCntr = m_assetGatherer.ErrorCount;
226 int possible = m_assetGatherer.possibleNotAssetCount;
224 m_assetGatherer.AddForInspection(inventoryItem.AssetID); 227 m_assetGatherer.AddForInspection(inventoryItem.AssetID);
228 m_assetGatherer.GatherAll();
229 curErrorCntr = m_assetGatherer.ErrorCount - curErrorCntr;
230 possible = m_assetGatherer.possibleNotAssetCount - possible;
231
232 if(curErrorCntr > 0 || possible > 0)
233 {
234 string spath;
235 int indx = path.IndexOf("__");
236 if(indx > 0)
237 spath = path.Substring(0,indx);
238 else
239 spath = path;
240
241 if(curErrorCntr > 0)
242 {
243 m_log.ErrorFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references to missing or damaged assets",
244 inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, curErrorCntr);
245 if(possible > 0)
246 m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item also contains {0} references that may be to missing or damaged assets or not a problem", possible);
247 }
248 else if(possible > 0)
249 {
250 m_log.WarnFormat("[INVENTORY ARCHIVER Warning]: item {0} '{1}', type {2}, in '{3}', contains {4} references that may be to missing or damaged assets or not a problem", inventoryItem.ID, inventoryItem.Name, itemAssetType.ToString(), spath, possible);
251 }
252 }
253 }
225 } 254 }
226 255
227 /// <summary> 256 /// <summary>
@@ -381,6 +410,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
381 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath); 410 string errorMessage = string.Format("Aborted save. Could not find inventory path {0}", m_invPath);
382 Exception e = new InventoryArchiverException(errorMessage); 411 Exception e = new InventoryArchiverException(errorMessage);
383 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0); 412 m_module.TriggerInventoryArchiveSaved(m_id, false, m_userInfo, m_invPath, m_saveStream, e, 0, 0);
413 if(m_saveStream != null && m_saveStream.CanWrite)
414 m_saveStream.Close();
384 throw e; 415 throw e;
385 } 416 }
386 417
@@ -420,17 +451,20 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
420 { 451 {
421 m_assetGatherer.GatherAll(); 452 m_assetGatherer.GatherAll();
422 453
454 int errors = m_assetGatherer.FailedUUIDs.Count;
455
423 m_log.DebugFormat( 456 m_log.DebugFormat(
424 "[INVENTORY ARCHIVER]: Saving {0} assets for items", m_assetGatherer.GatheredUuids.Count); 457 "[INVENTORY ARCHIVER]: The items to save reference {0} possible assets", m_assetGatherer.GatheredUuids.Count + errors);
458 if(errors > 0)
459 m_log.DebugFormat("[INVENTORY ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors);
425 460
426 AssetsRequest ar 461 AssetsRequest ar = new AssetsRequest(
427 = new AssetsRequest(
428 new AssetsArchiver(m_archiveWriter), 462 new AssetsArchiver(m_archiveWriter),
429 m_assetGatherer.GatheredUuids, m_scene.AssetService, 463 m_assetGatherer.GatheredUuids, m_assetGatherer.FailedUUIDs.Count,
464 m_scene.AssetService,
430 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID, 465 m_scene.UserAccountService, m_scene.RegionInfo.ScopeID,
431 options, ReceivedAllAssets); 466 options, ReceivedAllAssets);
432 467 ar.Execute();
433 WorkManager.RunInThread(o => ar.Execute(), null, string.Format("AssetsRequest ({0})", m_scene.Name));
434 } 468 }
435 else 469 else
436 { 470 {
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
index be59eb5..06aec7b 100644
--- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiverModule.cs
@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
218// { 218// {
219 try 219 try
220 { 220 {
221 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream).Execute(options, UserAccountService); 221 InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, saveStream);
222 iarReq.Execute(options, UserAccountService);
222 } 223 }
223 catch (EntryPointNotFoundException e) 224 catch (EntryPointNotFoundException e)
224 { 225 {
@@ -261,7 +262,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
261// { 262// {
262 try 263 try
263 { 264 {
264 new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath).Execute(options, UserAccountService); 265 InventoryArchiveWriteRequest iarReq = new InventoryArchiveWriteRequest(id, this, m_aScene, userInfo, invPath, savePath);
266 iarReq.Execute(options, UserAccountService);
265 } 267 }
266 catch (EntryPointNotFoundException e) 268 catch (EntryPointNotFoundException e)
267 { 269 {
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
index 3f3245c..f1409bb 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/InventoryAccessModule.cs
@@ -412,7 +412,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
412 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>(); 412 Dictionary<UUID, Vector3> originalPositions = new Dictionary<UUID, Vector3>();
413 Dictionary<UUID, Quaternion> originalRotations = new Dictionary<UUID, Quaternion>(); 413 Dictionary<UUID, Quaternion> originalRotations = new Dictionary<UUID, Quaternion>();
414 // this possible is not needed if keyframes are saved 414 // this possible is not needed if keyframes are saved
415 Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>(); 415// Dictionary<UUID, KeyframeMotion> originalKeyframes = new Dictionary<UUID, KeyframeMotion>();
416 416
417 foreach (SceneObjectGroup objectGroup in objlist) 417 foreach (SceneObjectGroup objectGroup in objlist)
418 { 418 {
@@ -423,8 +423,8 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
423 objectGroup.RootPart.SetForce(Vector3.Zero); 423 objectGroup.RootPart.SetForce(Vector3.Zero);
424 objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false); 424 objectGroup.RootPart.SetAngularImpulse(Vector3.Zero, false);
425 425
426 originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion; 426// originalKeyframes[objectGroup.UUID] = objectGroup.RootPart.KeyframeMotion;
427 objectGroup.RootPart.KeyframeMotion = null; 427// objectGroup.RootPart.KeyframeMotion = null;
428 428
429 Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition; 429 Vector3 inventoryStoredPosition = objectGroup.AbsolutePosition;
430 originalPositions[objectGroup.UUID] = inventoryStoredPosition; 430 originalPositions[objectGroup.UUID] = inventoryStoredPosition;
@@ -476,7 +476,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
476 { 476 {
477 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID]; 477 objectGroup.AbsolutePosition = originalPositions[objectGroup.UUID];
478 objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID]; 478 objectGroup.RootPart.RotationOffset = originalRotations[objectGroup.UUID];
479 objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID]; 479// objectGroup.RootPart.KeyframeMotion = originalKeyframes[objectGroup.UUID];
480 if (objectGroup.RootPart.KeyframeMotion != null) 480 if (objectGroup.RootPart.KeyframeMotion != null)
481 objectGroup.RootPart.KeyframeMotion.Resume(); 481 objectGroup.RootPart.KeyframeMotion.Resume();
482 } 482 }
@@ -989,11 +989,11 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
989 // one full update during the attachment 989 // one full update during the attachment
990 // process causes some clients to fail to display the 990 // process causes some clients to fail to display the
991 // attachment properly. 991 // attachment properly.
992 m_Scene.AddNewSceneObject(group, true, false);
993 992
994 if (!attachment) 993 if (!attachment)
995 { 994 {
996 group.AbsolutePosition = pos + veclist[i]; 995 group.AbsolutePosition = pos + veclist[i];
996 m_Scene.AddNewSceneObject(group, true, false);
997 997
998 // Fire on_rez 998 // Fire on_rez
999 group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1); 999 group.CreateScriptInstances(0, true, m_Scene.DefaultScriptEngine, 1);
@@ -1001,6 +1001,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess
1001 1001
1002 group.ScheduleGroupForFullUpdate(); 1002 group.ScheduleGroupForFullUpdate();
1003 } 1003 }
1004 else
1005 m_Scene.AddNewSceneObject(group, true, false);
1006
1004 1007
1005// m_log.DebugFormat( 1008// m_log.DebugFormat(
1006// "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}", 1009// "[INVENTORY ACCESS MODULE]: Rezzed {0} {1} {2} ownermask={3:X} nextownermask={4:X} groupmask={5:X} everyonemask={6:X} for {7}",
diff --git a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
index c369d87..090cb7d 100644
--- a/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/DynamicTexture/DynamicTextureModule.cs
@@ -135,17 +135,13 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
135 m_reuseableDynamicTextures.Store( 135 m_reuseableDynamicTextures.Store(
136 GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID); 136 GenerateReusableTextureKey(texture.InputCommands, texture.InputParams), newTextureID);
137 } 137 }
138 updater.newTextureID = newTextureID;
138 } 139 }
139 }
140 140
141 if (updater.UpdateTimer == 0)
142 {
143 lock (Updaters) 141 lock (Updaters)
144 { 142 {
145 if (!Updaters.ContainsKey(updater.UpdaterID)) 143 if (Updaters.ContainsKey(updater.UpdaterID))
146 {
147 Updaters.Remove(updater.UpdaterID); 144 Updaters.Remove(updater.UpdaterID);
148 }
149 } 145 }
150 } 146 }
151 } 147 }
@@ -172,21 +168,20 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
172 } 168 }
173 169
174 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 170 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
175 string extraParams, int updateTimer) 171 string extraParams)
176 { 172 {
177 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, updateTimer, false, 255); 173 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, false, 255);
178 } 174 }
179 175
180 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 176 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
181 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 177 string extraParams, bool SetBlending, byte AlphaValue)
182 { 178 {
183 return AddDynamicTextureURL(simID, primID, contentType, url, 179 return AddDynamicTextureURL(simID, primID, contentType, url, extraParams, SetBlending,
184 extraParams, updateTimer, SetBlending, 180 (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
185 (int)(DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
186 } 181 }
187 182
188 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url, 183 public UUID AddDynamicTextureURL(UUID simID, UUID primID, string contentType, string url,
189 string extraParams, int updateTimer, bool SetBlending, 184 string extraParams, bool SetBlending,
190 int disp, byte AlphaValue, int face) 185 int disp, byte AlphaValue, int face)
191 { 186 {
192 if (RenderPlugins.ContainsKey(contentType)) 187 if (RenderPlugins.ContainsKey(contentType))
@@ -196,7 +191,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
196 updater.PrimID = primID; 191 updater.PrimID = primID;
197 updater.ContentType = contentType; 192 updater.ContentType = contentType;
198 updater.Url = url; 193 updater.Url = url;
199 updater.UpdateTimer = updateTimer;
200 updater.UpdaterID = UUID.Random(); 194 updater.UpdaterID = UUID.Random();
201 updater.Params = extraParams; 195 updater.Params = extraParams;
202 updater.BlendWithOldTexture = SetBlending; 196 updater.BlendWithOldTexture = SetBlending;
@@ -213,26 +207,27 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
213 } 207 }
214 208
215 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams); 209 RenderPlugins[contentType].AsyncConvertUrl(updater.UpdaterID, url, extraParams);
216 return updater.UpdaterID; 210 return updater.newTextureID;
217 } 211 }
218 return UUID.Zero; 212 return UUID.Zero;
219 } 213 }
220 214
221 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 215 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
222 string extraParams, int updateTimer) 216 string extraParams)
223 { 217 {
224 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, false, 255); 218 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, false,
219 (DISP_TEMP|DISP_EXPIRE), 255, ALL_SIDES);
225 } 220 }
226 221
227 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 222 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
228 string extraParams, int updateTimer, bool SetBlending, byte AlphaValue) 223 string extraParams, bool SetBlending, byte AlphaValue)
229 { 224 {
230 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, updateTimer, SetBlending, 225 return AddDynamicTextureData(simID, primID, contentType, data, extraParams, SetBlending,
231 (int) (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES); 226 (DISP_TEMP|DISP_EXPIRE), AlphaValue, ALL_SIDES);
232 } 227 }
233 228
234 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data, 229 public UUID AddDynamicTextureData(UUID simID, UUID primID, string contentType, string data,
235 string extraParams, int updateTimer, bool SetBlending, int disp, byte AlphaValue, int face) 230 string extraParams, bool SetBlending, int disp, byte AlphaValue, int face)
236 { 231 {
237 if (!RenderPlugins.ContainsKey(contentType)) 232 if (!RenderPlugins.ContainsKey(contentType))
238 return UUID.Zero; 233 return UUID.Zero;
@@ -258,7 +253,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
258 updater.PrimID = primID; 253 updater.PrimID = primID;
259 updater.ContentType = contentType; 254 updater.ContentType = contentType;
260 updater.BodyData = data; 255 updater.BodyData = data;
261 updater.UpdateTimer = updateTimer;
262 updater.UpdaterID = UUID.Random(); 256 updater.UpdaterID = UUID.Random();
263 updater.Params = extraParams; 257 updater.Params = extraParams;
264 updater.BlendWithOldTexture = SetBlending; 258 updater.BlendWithOldTexture = SetBlending;
@@ -314,7 +308,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
314 updater.UpdatePart(part, (UUID)objReusableTextureUUID); 308 updater.UpdatePart(part, (UUID)objReusableTextureUUID);
315 } 309 }
316 310
317 return updater.UpdaterID; 311 return updater.newTextureID;
318 } 312 }
319 313
320 private string GenerateReusableTextureKey(string data, string extraParams) 314 private string GenerateReusableTextureKey(string data, string extraParams)
@@ -404,17 +398,15 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
404 public byte FrontAlpha = 255; 398 public byte FrontAlpha = 255;
405 public string Params; 399 public string Params;
406 public UUID PrimID; 400 public UUID PrimID;
407 public bool SetNewFrontAlpha = false;
408 public UUID SimUUID; 401 public UUID SimUUID;
409 public UUID UpdaterID; 402 public UUID UpdaterID;
410 public int UpdateTimer;
411 public int Face; 403 public int Face;
412 public int Disp; 404 public int Disp;
413 public string Url; 405 public string Url;
406 public UUID newTextureID;
414 407
415 public DynamicTextureUpdater() 408 public DynamicTextureUpdater()
416 { 409 {
417 UpdateTimer = 0;
418 BodyData = null; 410 BodyData = null;
419 } 411 }
420 412
@@ -436,16 +428,23 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
436 // FIXME: Need to return the appropriate ID if only a single face is replaced. 428 // FIXME: Need to return the appropriate ID if only a single face is replaced.
437 oldID = tmptex.DefaultTexture.TextureID; 429 oldID = tmptex.DefaultTexture.TextureID;
438 430
431 // not using parts number of faces because that fails on old meshs
439 if (Face == ALL_SIDES) 432 if (Face == ALL_SIDES)
440 { 433 {
441 oldID = tmptex.DefaultTexture.TextureID; 434 oldID = tmptex.DefaultTexture.TextureID;
442 tmptex.DefaultTexture.TextureID = textureID; 435 tmptex.DefaultTexture.TextureID = textureID;
436 for(int i = 0; i < tmptex.FaceTextures.Length; i++)
437 {
438 if(tmptex.FaceTextures[i] != null)
439 tmptex.FaceTextures[i].TextureID = textureID;
440 }
443 } 441 }
444 else 442 else
445 { 443 {
446 try 444 try
447 { 445 {
448 Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face); 446 Primitive.TextureEntryFace texface = tmptex.CreateFace((uint)Face);
447 oldID = texface.TextureID;
449 texface.TextureID = textureID; 448 texface.TextureID = textureID;
450 tmptex.FaceTextures[Face] = texface; 449 tmptex.FaceTextures[Face] = texface;
451 } 450 }
@@ -455,10 +454,6 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
455 } 454 }
456 } 455 }
457 456
458 // I'm pretty sure we always want to force this to true
459 // I'm pretty sure noone whats to set fullbright true if it wasn't true before.
460 // tmptex.DefaultTexture.Fullbright = true;
461
462 part.UpdateTextureEntry(tmptex.GetBytes()); 457 part.UpdateTextureEntry(tmptex.GetBytes());
463 } 458 }
464 459
@@ -491,13 +486,26 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
491 486
492 if (BlendWithOldTexture) 487 if (BlendWithOldTexture)
493 { 488 {
494 Primitive.TextureEntryFace defaultFace = part.Shape.Textures.DefaultTexture; 489 Primitive.TextureEntryFace curFace;
495 if (defaultFace != null) 490 if(Face == ALL_SIDES)
491 curFace = part.Shape.Textures.DefaultTexture;
492 else
493 {
494 try
495 {
496 curFace = part.Shape.Textures.GetFace((uint)Face);
497 }
498 catch
499 {
500 curFace = null;
501 }
502 }
503 if (curFace != null)
496 { 504 {
497 oldAsset = scene.AssetService.Get(defaultFace.TextureID.ToString()); 505 oldAsset = scene.AssetService.Get(curFace.TextureID.ToString());
498 506
499 if (oldAsset != null) 507 if (oldAsset != null)
500 assetData = BlendTextures(data, oldAsset.Data, SetNewFrontAlpha, FrontAlpha); 508 assetData = BlendTextures(data, oldAsset.Data, FrontAlpha);
501 } 509 }
502 } 510 }
503 511
@@ -548,7 +556,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
548 return asset.FullID; 556 return asset.FullID;
549 } 557 }
550 558
551 private byte[] BlendTextures(byte[] frontImage, byte[] backImage, bool setNewAlpha, byte newAlpha) 559 private byte[] BlendTextures(byte[] frontImage, byte[] backImage, byte newAlpha)
552 { 560 {
553 ManagedImage managedImage; 561 ManagedImage managedImage;
554 Image image; 562 Image image;
@@ -568,7 +576,7 @@ namespace OpenSim.Region.CoreModules.Scripting.DynamicTexture
568 Bitmap image2 = new Bitmap(image); 576 Bitmap image2 = new Bitmap(image);
569 image.Dispose(); 577 image.Dispose();
570 578
571 if (setNewAlpha) 579 if (newAlpha < 255)
572 SetAlpha(ref image1, newAlpha); 580 SetAlpha(ref image1, newAlpha);
573 581
574 using(Bitmap joint = MergeBitMaps(image1, image2)) 582 using(Bitmap joint = MergeBitMaps(image1, image2))
diff --git a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
index b499b19..d342163 100644
--- a/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/HttpRequest/ScriptsHttpRequests.cs
@@ -379,9 +379,9 @@ namespace OpenSim.Region.CoreModules.Scripting.HttpRequest
379 if (ThreadPool == null) 379 if (ThreadPool == null)
380 { 380 {
381 STPStartInfo startInfo = new STPStartInfo(); 381 STPStartInfo startInfo = new STPStartInfo();
382 startInfo.IdleTimeout = 20000; 382 startInfo.IdleTimeout = 2000;
383 startInfo.MaxWorkerThreads = maxThreads; 383 startInfo.MaxWorkerThreads = maxThreads;
384 startInfo.MinWorkerThreads = 1; 384 startInfo.MinWorkerThreads = 0;
385 startInfo.ThreadPriority = ThreadPriority.BelowNormal; 385 startInfo.ThreadPriority = ThreadPriority.BelowNormal;
386 startInfo.StartSuspended = true; 386 startInfo.StartSuspended = true;
387 startInfo.ThreadPoolName = "ScriptsHttpReq"; 387 startInfo.ThreadPoolName = "ScriptsHttpReq";
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
index ed255bf..325f7f9 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/Tests/VectorRenderModuleTests.cs
@@ -77,8 +77,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
77 so.UUID, 77 so.UUID,
78 m_vrm.GetContentType(), 78 m_vrm.GetContentType(),
79 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", 79 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
80 "", 80 "");
81 0);
82 81
83 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 82 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
84 } 83 }
@@ -98,8 +97,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
98 so.UUID, 97 so.UUID,
99 m_vrm.GetContentType(), 98 m_vrm.GetContentType(),
100 dtText, 99 dtText,
101 "", 100 "");
102 0);
103 101
104 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 102 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
105 103
@@ -108,8 +106,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
108 so.UUID, 106 so.UUID,
109 m_vrm.GetContentType(), 107 m_vrm.GetContentType(),
110 dtText, 108 dtText,
111 "", 109 "");
112 0);
113 110
114 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 111 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
115 } 112 }
@@ -129,8 +126,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
129 so.UUID, 126 so.UUID,
130 m_vrm.GetContentType(), 127 m_vrm.GetContentType(),
131 dtText, 128 dtText,
132 "", 129 "");
133 0);
134 130
135 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 131 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
136 132
@@ -139,8 +135,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
139 so.UUID, 135 so.UUID,
140 m_vrm.GetContentType(), 136 m_vrm.GetContentType(),
141 dtText, 137 dtText,
142 "alpha:250", 138 "alpha:250");
143 0);
144 139
145 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 140 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
146 } 141 }
@@ -161,8 +156,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
161 so.UUID, 156 so.UUID,
162 m_vrm.GetContentType(), 157 m_vrm.GetContentType(),
163 dtText, 158 dtText,
164 "", 159 "");
165 0);
166 160
167 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 161 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
168 162
@@ -171,8 +165,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
171 so.UUID, 165 so.UUID,
172 m_vrm.GetContentType(), 166 m_vrm.GetContentType(),
173 dtText, 167 dtText,
174 "", 168 "");
175 0);
176 169
177 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 170 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
178 } 171 }
@@ -191,8 +184,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
191 so.UUID, 184 so.UUID,
192 m_vrm.GetContentType(), 185 m_vrm.GetContentType(),
193 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;", 186 "PenColour BLACK; MoveTo 40,220; FontSize 32; Text Hello World;",
194 "", 187 "");
195 0);
196 188
197 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 189 Assert.That(originalTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
198 } 190 }
@@ -213,8 +205,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
213 so.UUID, 205 so.UUID,
214 m_vrm.GetContentType(), 206 m_vrm.GetContentType(),
215 dtText, 207 dtText,
216 "", 208 "");
217 0);
218 209
219 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 210 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
220 211
@@ -223,8 +214,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
223 so.UUID, 214 so.UUID,
224 m_vrm.GetContentType(), 215 m_vrm.GetContentType(),
225 dtText, 216 dtText,
226 "", 217 "");
227 0);
228 218
229 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 219 Assert.That(firstDynamicTextureID, Is.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
230 } 220 }
@@ -253,8 +243,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
253 so.UUID, 243 so.UUID,
254 m_vrm.GetContentType(), 244 m_vrm.GetContentType(),
255 dtText, 245 dtText,
256 "1024", 246 "1024");
257 0);
258 247
259 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 248 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
260 249
@@ -263,8 +252,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
263 so.UUID, 252 so.UUID,
264 m_vrm.GetContentType(), 253 m_vrm.GetContentType(),
265 dtText, 254 dtText,
266 "1024", 255 "1024");
267 0);
268 256
269 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 257 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
270 } 258 }
@@ -284,8 +272,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
284 so.UUID, 272 so.UUID,
285 m_vrm.GetContentType(), 273 m_vrm.GetContentType(),
286 dtText, 274 dtText,
287 "", 275 "");
288 0);
289 276
290 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 277 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
291 278
@@ -294,8 +281,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
294 so.UUID, 281 so.UUID,
295 m_vrm.GetContentType(), 282 m_vrm.GetContentType(),
296 dtText, 283 dtText,
297 "alpha:250", 284 "alpha:250");
298 0);
299 285
300 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 286 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
301 } 287 }
@@ -316,8 +302,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
316 so.UUID, 302 so.UUID,
317 m_vrm.GetContentType(), 303 m_vrm.GetContentType(),
318 dtText, 304 dtText,
319 "", 305 "");
320 0);
321 306
322 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID; 307 UUID firstDynamicTextureID = so.RootPart.Shape.Textures.GetFace(0).TextureID;
323 308
@@ -326,8 +311,7 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender.Tests
326 so.UUID, 311 so.UUID,
327 m_vrm.GetContentType(), 312 m_vrm.GetContentType(),
328 dtText, 313 dtText,
329 "", 314 "");
330 0);
331 315
332 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID)); 316 Assert.That(firstDynamicTextureID, Is.Not.EqualTo(so.RootPart.Shape.Textures.GetFace(0).TextureID));
333 } 317 }
diff --git a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
index f12286d..8a26ab7 100644
--- a/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/VectorRender/VectorRenderModule.cs
@@ -355,30 +355,22 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
355 lock (this) 355 lock (this)
356 { 356 {
357 if (alpha == 256) 357 if (alpha == 256)
358 bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
359 else
360 bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
361
362 graph = Graphics.FromImage(bitmap);
363
364 // this is really just to save people filling the
365 // background color in their scripts, only do when fully opaque
366 if (alpha >= 255)
367 { 358 {
359 bitmap = new Bitmap(width, height, PixelFormat.Format32bppRgb);
360 graph = Graphics.FromImage(bitmap);
368 using (SolidBrush bgFillBrush = new SolidBrush(bgColor)) 361 using (SolidBrush bgFillBrush = new SolidBrush(bgColor))
369 { 362 {
370 graph.FillRectangle(bgFillBrush, 0, 0, width, height); 363 graph.FillRectangle(bgFillBrush, 0, 0, width, height);
371 } 364 }
372 } 365 }
373 366 else
374 for (int w = 0; w < bitmap.Width; w++)
375 { 367 {
376 if (alpha <= 255) 368 bitmap = new Bitmap(width, height, PixelFormat.Format32bppArgb);
369 graph = Graphics.FromImage(bitmap);
370 Color newbg = Color.FromArgb(alpha,bgColor);
371 using (SolidBrush bgFillBrush = new SolidBrush(newbg))
377 { 372 {
378 for (int h = 0; h < bitmap.Height; h++) 373 graph.FillRectangle(bgFillBrush, 0, 0, width, height);
379 {
380 bitmap.SetPixel(w, h, Color.FromArgb(alpha, bitmap.GetPixel(w, h)));
381 }
382 } 374 }
383 } 375 }
384 376
@@ -519,8 +511,32 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
519 511
520// m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine); 512// m_log.DebugFormat("[VECTOR RENDER MODULE]: Processing line '{0}'", nextLine);
521 513
514 if (nextLine.StartsWith("ResetTransf"))
515 {
516 graph.ResetTransform();
517 }
518 else if (nextLine.StartsWith("TransTransf"))
519 {
520 float x = 0;
521 float y = 0;
522 GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
523 graph.TranslateTransform(x, y);
524 }
525 else if (nextLine.StartsWith("ScaleTransf"))
526 {
527 float x = 0;
528 float y = 0;
529 GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
530 graph.ScaleTransform(x, y);
531 }
532 else if (nextLine.StartsWith("RotTransf"))
533 {
534 float x = 0;
535 GetParams(partsDelimiter, ref nextLine, 9, ref x);
536 graph.RotateTransform(x);
537 }
522 //replace with switch, or even better, do some proper parsing 538 //replace with switch, or even better, do some proper parsing
523 if (nextLine.StartsWith("MoveTo")) 539 else if (nextLine.StartsWith("MoveTo"))
524 { 540 {
525 float x = 0; 541 float x = 0;
526 float y = 0; 542 float y = 0;
@@ -625,6 +641,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
625 startPoint.X += endPoint.X; 641 startPoint.X += endPoint.X;
626 startPoint.Y += endPoint.Y; 642 startPoint.Y += endPoint.Y;
627 } 643 }
644 else if (nextLine.StartsWith("FillEllipse"))
645 {
646 float x = 0;
647 float y = 0;
648 GetParams(partsDelimiter, ref nextLine, 11, ref x, ref y);
649 endPoint.X = (int)x;
650 endPoint.Y = (int)y;
651 graph.FillEllipse(myBrush, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);
652 startPoint.X += endPoint.X;
653 startPoint.Y += endPoint.Y;
654 }
628 else if (nextLine.StartsWith("FontSize")) 655 else if (nextLine.StartsWith("FontSize"))
629 { 656 {
630 nextLine = nextLine.Remove(0, 8); 657 nextLine = nextLine.Remove(0, 8);
@@ -790,6 +817,17 @@ namespace OpenSim.Region.CoreModules.Scripting.VectorRender
790 } 817 }
791 } 818 }
792 819
820 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x)
821 {
822 line = line.Remove(0, startLength);
823 string[] parts = line.Split(partsDelimiter);
824 if (parts.Length > 0)
825 {
826 string xVal = parts[0].Trim();
827 x = Convert.ToSingle(xVal, CultureInfo.InvariantCulture);
828 }
829 }
830
793 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y) 831 private static void GetParams(char[] partsDelimiter, ref string line, int startLength, ref float x, ref float y)
794 { 832 {
795 line = line.Remove(0, startLength); 833 line = line.Remove(0, startLength);
diff --git a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
index f68c5f8..6028eef 100644
--- a/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
+++ b/OpenSim/Region/CoreModules/Scripting/XMLRPC/XMLRPCModule.cs
@@ -658,7 +658,7 @@ namespace OpenSim.Region.CoreModules.Scripting.XMLRPC
658 public void Process() 658 public void Process()
659 { 659 {
660 _finished = false; 660 _finished = false;
661 httpThread = WorkManager.StartThread(SendRequest, "HttpRequestThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue); 661 httpThread = WorkManager.StartThread(SendRequest, "XMLRPCreqThread", ThreadPriority.BelowNormal, true, false, null, int.MaxValue);
662 } 662 }
663 663
664 /* 664 /*
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
index 8dabcee..11c53d7 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveWriteRequest.cs
@@ -181,11 +181,13 @@ namespace OpenSim.Region.CoreModules.World.Archiver
181 // Archive the regions 181 // Archive the regions
182 182
183 Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>(); 183 Dictionary<UUID, sbyte> assetUuids = new Dictionary<UUID, sbyte>();
184 HashSet<UUID> failedIDs = new HashSet<UUID>();
185 HashSet<UUID> uncertainAssetsUUIDs = new HashSet<UUID>();
184 186
185 scenesGroup.ForEachScene(delegate(Scene scene) 187 scenesGroup.ForEachScene(delegate(Scene scene)
186 { 188 {
187 string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : ""; 189 string regionDir = MultiRegionFormat ? scenesGroup.GetRegionDir(scene.RegionInfo.RegionID) : "";
188 ArchiveOneRegion(scene, regionDir, assetUuids); 190 ArchiveOneRegion(scene, regionDir, assetUuids, failedIDs, uncertainAssetsUUIDs);
189 }); 191 });
190 192
191 // Archive the assets 193 // Archive the assets
@@ -193,23 +195,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
193 if (SaveAssets) 195 if (SaveAssets)
194 { 196 {
195 m_log.DebugFormat("[ARCHIVER]: Saving {0} assets", assetUuids.Count); 197 m_log.DebugFormat("[ARCHIVER]: Saving {0} assets", assetUuids.Count);
196 198
197 // Asynchronously request all the assets required to perform this archive operation 199 AssetsRequest ar = new AssetsRequest(
198 AssetsRequest ar
199 = new AssetsRequest(
200 new AssetsArchiver(m_archiveWriter), assetUuids, 200 new AssetsArchiver(m_archiveWriter), assetUuids,
201 failedIDs.Count,
201 m_rootScene.AssetService, m_rootScene.UserAccountService, 202 m_rootScene.AssetService, m_rootScene.UserAccountService,
202 m_rootScene.RegionInfo.ScopeID, options, ReceivedAllAssets); 203 m_rootScene.RegionInfo.ScopeID, options, null);
203 204 ar.Execute();
204 WorkManager.RunInThread(o => ar.Execute(), null, "Archive Assets Request"); 205 assetUuids = null;
205
206 // CloseArchive() will be called from ReceivedAllAssets()
207 } 206 }
208 else 207 else
209 { 208 {
210 m_log.DebugFormat("[ARCHIVER]: Not saving assets since --noassets was specified"); 209 m_log.DebugFormat("[ARCHIVER]: Not saving assets since --noassets was specified");
211 CloseArchive(string.Empty); 210// CloseArchive(string.Empty);
212 } 211 }
212 CloseArchive(string.Empty);
213 } 213 }
214 catch (Exception e) 214 catch (Exception e)
215 { 215 {
@@ -218,7 +218,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
218 } 218 }
219 } 219 }
220 220
221 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids) 221 private void ArchiveOneRegion(Scene scene, string regionDir, Dictionary<UUID, sbyte> assetUuids,
222 HashSet<UUID> failedIDs, HashSet<UUID> uncertainAssetsUUIDs)
222 { 223 {
223 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name); 224 m_log.InfoFormat("[ARCHIVER]: Writing region {0}", scene.Name);
224 225
@@ -237,7 +238,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
237 { 238 {
238 SceneObjectGroup sceneObject = (SceneObjectGroup)entity; 239 SceneObjectGroup sceneObject = (SceneObjectGroup)entity;
239 240
240 if (!sceneObject.IsDeleted && !sceneObject.IsAttachment) 241 if (!sceneObject.IsDeleted && !sceneObject.IsAttachment && !sceneObject.IsTemporary && !sceneObject.inTransit)
241 { 242 {
242 if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule)) 243 if (!CanUserArchiveObject(scene.RegionInfo.EstateSettings.EstateOwner, sceneObject, FilterContent, permissionsModule))
243 { 244 {
@@ -254,17 +255,39 @@ namespace OpenSim.Region.CoreModules.World.Archiver
254 255
255 if (SaveAssets) 256 if (SaveAssets)
256 { 257 {
257 UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids); 258 UuidGatherer assetGatherer = new UuidGatherer(scene.AssetService, assetUuids, failedIDs, uncertainAssetsUUIDs);
258 int prevAssets = assetUuids.Count; 259 int prevAssets = assetUuids.Count;
259 260
260 foreach (SceneObjectGroup sceneObject in sceneObjects) 261 foreach (SceneObjectGroup sceneObject in sceneObjects)
262 {
263 int curErrorCntr = assetGatherer.ErrorCount;
264 int possible = assetGatherer.possibleNotAssetCount;
261 assetGatherer.AddForInspection(sceneObject); 265 assetGatherer.AddForInspection(sceneObject);
266 assetGatherer.GatherAll();
267 curErrorCntr = assetGatherer.ErrorCount - curErrorCntr;
268 possible = assetGatherer.possibleNotAssetCount - possible;
269 if(curErrorCntr > 0)
270 {
271 m_log.ErrorFormat("[ARCHIVER]: object {0} '{1}', at {2}, contains {3} references to missing or damaged assets",
272 sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), curErrorCntr);
273 if(possible > 0)
274 m_log.WarnFormat("[ARCHIVER Warning]: object also contains {0} references that may be to missing or damaged assets or not a problem", possible);
275 }
276 else if(possible > 0)
277 {
278 m_log.WarnFormat("[ARCHIVER Warning]: object {0} '{1}', at {2}, contains {3} references that may be to missing or damaged assets or not a problem",
279 sceneObject.UUID, sceneObject.Name ,sceneObject.AbsolutePosition.ToString(), possible);
280 }
281 }
262 282
263 assetGatherer.GatherAll(); 283 assetGatherer.GatherAll();
264 284
285 int errors = assetGatherer.FailedUUIDs.Count;
265 m_log.DebugFormat( 286 m_log.DebugFormat(
266 "[ARCHIVER]: {0} scene objects to serialize requiring save of {1} assets", 287 "[ARCHIVER]: {0} region scene objects to save reference {1} possible assets",
267 sceneObjects.Count, assetUuids.Count - prevAssets); 288 sceneObjects.Count, assetUuids.Count - prevAssets + errors);
289 if(errors > 0)
290 m_log.DebugFormat("[ARCHIVER]: {0} of these have problems or are not assets and will be ignored", errors);
268 } 291 }
269 292
270 if (numObjectsSkippedPermissions > 0) 293 if (numObjectsSkippedPermissions > 0)
@@ -572,7 +595,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
572 foreach (SceneObjectGroup sceneObject in sceneObjects) 595 foreach (SceneObjectGroup sceneObject in sceneObjects)
573 { 596 {
574 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType()); 597 //m_log.DebugFormat("[ARCHIVER]: Saving {0} {1}, {2}", entity.Name, entity.UUID, entity.GetType());
575 598 if(sceneObject.IsDeleted || sceneObject.inTransit)
599 continue;
576 string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options); 600 string serializedObject = serializer.SerializeGroupToXml2(sceneObject, m_options);
577 string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject)); 601 string objectPath = string.Format("{0}{1}", regionDir, ArchiveHelpers.CreateObjectPath(sceneObject));
578 m_archiveWriter.WriteFile(objectPath, serializedObject); 602 m_archiveWriter.WriteFile(objectPath, serializedObject);
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
index efacae3..3092fe0 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsArchiver.cs
@@ -46,7 +46,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
46 /// <value> 46 /// <value>
47 /// Post a message to the log every x assets as a progress bar 47 /// Post a message to the log every x assets as a progress bar
48 /// </value> 48 /// </value>
49 protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 50; 49 protected static int LOG_ASSET_LOAD_NOTIFICATION_INTERVAL = 100;
50 50
51 /// <value> 51 /// <value>
52 /// Keep a count of the number of assets written so that we can provide status updates 52 /// Keep a count of the number of assets written so that we can provide status updates
diff --git a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
index d380da8..91f4dc3 100644
--- a/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
+++ b/OpenSim/Region/CoreModules/World/Archiver/AssetsRequest.cs
@@ -62,27 +62,10 @@ namespace OpenSim.Region.CoreModules.World.Archiver
62 }; 62 };
63 63
64 /// <value> 64 /// <value>
65 /// Timeout threshold if we still need assets or missing asset notifications but have stopped receiving them
66 /// from the asset service
67 /// </value>
68 protected const int TIMEOUT = 60 * 1000;
69
70 /// <value>
71 /// If a timeout does occur, limit the amount of UUID information put to the console.
72 /// </value>
73 protected const int MAX_UUID_DISPLAY_ON_TIMEOUT = 3;
74
75 protected System.Timers.Timer m_requestCallbackTimer;
76
77 /// <value>
78 /// State of this request
79 /// </value>
80 private RequestState m_requestState = RequestState.Initial;
81
82 /// <value>
83 /// uuids to request 65 /// uuids to request
84 /// </value> 66 /// </value>
85 protected IDictionary<UUID, sbyte> m_uuids; 67 protected IDictionary<UUID, sbyte> m_uuids;
68 private int m_previousErrorsCount;
86 69
87 /// <value> 70 /// <value>
88 /// Callback used when all the assets requested have been received. 71 /// Callback used when all the assets requested have been received.
@@ -104,6 +87,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
104 /// </value> 87 /// </value>
105 private int m_repliesRequired; 88 private int m_repliesRequired;
106 89
90 private System.Timers.Timer m_timeOutTimer;
91 private bool m_timeout;
92
107 /// <value> 93 /// <value>
108 /// Asset service used to request the assets 94 /// Asset service used to request the assets
109 /// </value> 95 /// </value>
@@ -117,205 +103,98 @@ namespace OpenSim.Region.CoreModules.World.Archiver
117 103
118 protected internal AssetsRequest( 104 protected internal AssetsRequest(
119 AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids, 105 AssetsArchiver assetsArchiver, IDictionary<UUID, sbyte> uuids,
106 int previousErrorsCount,
120 IAssetService assetService, IUserAccountService userService, 107 IAssetService assetService, IUserAccountService userService,
121 UUID scope, Dictionary<string, object> options, 108 UUID scope, Dictionary<string, object> options,
122 AssetsRequestCallback assetsRequestCallback) 109 AssetsRequestCallback assetsRequestCallback)
123 { 110 {
124 m_assetsArchiver = assetsArchiver; 111 m_assetsArchiver = assetsArchiver;
125 m_uuids = uuids; 112 m_uuids = uuids;
113 m_previousErrorsCount = previousErrorsCount;
126 m_assetsRequestCallback = assetsRequestCallback; 114 m_assetsRequestCallback = assetsRequestCallback;
127 m_assetService = assetService; 115 m_assetService = assetService;
128 m_userAccountService = userService; 116 m_userAccountService = userService;
129 m_scopeID = scope; 117 m_scopeID = scope;
130 m_options = options; 118 m_options = options;
131 m_repliesRequired = uuids.Count; 119 m_repliesRequired = uuids.Count;
132
133 // FIXME: This is a really poor way of handling the timeout since it will always leave the original requesting thread
134 // hanging. Need to restructure so an original request thread waits for a ManualResetEvent on asset received
135 // so we can properly abort that thread. Or request all assets synchronously, though that would be a more
136 // radical change
137 m_requestCallbackTimer = new System.Timers.Timer(TIMEOUT);
138 m_requestCallbackTimer.AutoReset = false;
139 m_requestCallbackTimer.Elapsed += new ElapsedEventHandler(OnRequestCallbackTimeout);
140 } 120 }
141 121
142 protected internal void Execute() 122 protected internal void Execute()
143 { 123 {
144 m_requestState = RequestState.Running; 124 Culture.SetCurrentCulture();
145
146 m_log.DebugFormat("[ARCHIVER]: AssetsRequest executed looking for {0} possible assets", m_repliesRequired);
147
148 // We can stop here if there are no assets to fetch 125 // We can stop here if there are no assets to fetch
149 if (m_repliesRequired == 0) 126 if (m_repliesRequired == 0)
150 { 127 {
151 m_requestState = RequestState.Completed;
152 PerformAssetsRequestCallback(false); 128 PerformAssetsRequestCallback(false);
153 return; 129 return;
154 } 130 }
155 131
156 m_requestCallbackTimer.Enabled = true; 132 m_timeOutTimer = new System.Timers.Timer(60000);
133 m_timeOutTimer .AutoReset = false;
134 m_timeOutTimer.Elapsed += OnTimeout;
135 m_timeout = false;
157 136
158 foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids) 137 foreach (KeyValuePair<UUID, sbyte> kvp in m_uuids)
159 { 138 {
160// m_log.DebugFormat("[ARCHIVER]: Requesting asset {0}", kvp.Key); 139 string thiskey = kvp.Key.ToString();
161 140 try
162// m_assetService.Get(kvp.Key.ToString(), kvp.Value, PreAssetRequestCallback);
163 AssetBase asset = m_assetService.Get(kvp.Key.ToString());
164 PreAssetRequestCallback(kvp.Key.ToString(), kvp.Value, asset);
165 }
166 }
167
168 protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
169 {
170 bool timedOut = true;
171
172 try
173 {
174 lock (this)
175 { 141 {
176 // Take care of the possibilty that this thread started but was paused just outside the lock before 142 m_timeOutTimer.Enabled = true;
177 // the final request came in (assuming that such a thing is possible) 143 AssetBase asset = m_assetService.Get(thiskey);
178 if (m_requestState == RequestState.Completed) 144 if(m_timeout)
145 break;
146
147 m_timeOutTimer.Enabled = false;
148
149 if(asset == null)
179 { 150 {
180 timedOut = false; 151 m_notFoundAssetUuids.Add(new UUID(thiskey));
181 return; 152 continue;
182 } 153 }
183 154
184 m_requestState = RequestState.Aborted; 155 sbyte assetType = kvp.Value;
185 } 156 if (asset != null && assetType == (sbyte)AssetType.Unknown)
186 157 {
187 // Calculate which uuids were not found. This is an expensive way of doing it, but this is a failure 158 m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", thiskey, SLUtil.AssetTypeFromCode(assetType));
188 // case anyway. 159 asset.Type = assetType;
189 List<UUID> uuids = new List<UUID>(); 160 }
190 foreach (UUID uuid in m_uuids.Keys)
191 {
192 uuids.Add(uuid);
193 }
194
195 foreach (UUID uuid in m_foundAssetUuids)
196 {
197 uuids.Remove(uuid);
198 }
199 161
200 foreach (UUID uuid in m_notFoundAssetUuids) 162 m_foundAssetUuids.Add(asset.FullID);
201 { 163 m_assetsArchiver.WriteAsset(PostProcess(asset));
202 uuids.Remove(uuid);
203 } 164 }
204 165
205 m_log.ErrorFormat( 166 catch (Exception e)
206 "[ARCHIVER]: Asset service failed to return information about {0} requested assets", uuids.Count);
207
208 int i = 0;
209 foreach (UUID uuid in uuids)
210 { 167 {
211 m_log.ErrorFormat("[ARCHIVER]: No information about asset {0} received", uuid); 168 m_log.ErrorFormat("[ARCHIVER]: Execute failed with {0}", e);
212
213 if (++i >= MAX_UUID_DISPLAY_ON_TIMEOUT)
214 break;
215 } 169 }
216
217 if (uuids.Count > MAX_UUID_DISPLAY_ON_TIMEOUT)
218 m_log.ErrorFormat(
219 "[ARCHIVER]: (... {0} more not shown)", uuids.Count - MAX_UUID_DISPLAY_ON_TIMEOUT);
220
221 m_log.Error("[ARCHIVER]: Archive save aborted. PLEASE DO NOT USE THIS ARCHIVE, IT WILL BE INCOMPLETE.");
222 } 170 }
223 catch (Exception e)
224 {
225 m_log.ErrorFormat("[ARCHIVER]: Timeout handler exception {0}{1}", e.Message, e.StackTrace);
226 }
227 finally
228 {
229 if (timedOut)
230 WorkManager.RunInThread(PerformAssetsRequestCallback, true, "Archive Assets Request Callback");
231 }
232 }
233 171
234 protected void PreAssetRequestCallback(string fetchedAssetID, object assetType, AssetBase fetchedAsset) 172 m_timeOutTimer.Dispose();
235 { 173 int totalerrors = m_notFoundAssetUuids.Count + m_previousErrorsCount;
236 // Check for broken asset types and fix them with the AssetType gleaned by UuidGatherer
237 if (fetchedAsset != null && fetchedAsset.Type == (sbyte)AssetType.Unknown)
238 {
239 m_log.InfoFormat("[ARCHIVER]: Rewriting broken asset type for {0} to {1}", fetchedAsset.ID, SLUtil.AssetTypeFromCode((sbyte)assetType));
240 fetchedAsset.Type = (sbyte)assetType;
241 }
242 174
243 AssetRequestCallback(fetchedAssetID, this, fetchedAsset); 175 if(m_timeout)
244 } 176 m_log.DebugFormat("[ARCHIVER]: Aborted because AssetService request timeout. Successfully added {0} assets", m_foundAssetUuids.Count);
177 else if(totalerrors == 0)
178 m_log.DebugFormat("[ARCHIVER]: Successfully added all {0} assets", m_foundAssetUuids.Count);
179 else
180 m_log.DebugFormat("[ARCHIVER]: Successfully added {0} assets ({1} of total possible assets requested were not found, were damaged or were not assets)",
181 m_foundAssetUuids.Count, totalerrors);
245 182
246 /// <summary> 183 PerformAssetsRequestCallback(m_timeout);
247 /// Called back by the asset cache when it has the asset 184 }
248 /// </summary> 185
249 /// <param name="assetID"></param> 186 private void OnTimeout(object source, ElapsedEventArgs args)
250 /// <param name="asset"></param>
251 public void AssetRequestCallback(string id, object sender, AssetBase asset)
252 { 187 {
253 Culture.SetCurrentCulture(); 188 m_timeout = true;
254
255 try
256 {
257 lock (this)
258 {
259 //m_log.DebugFormat("[ARCHIVER]: Received callback for asset {0}", id);
260
261 m_requestCallbackTimer.Stop();
262
263 if ((m_requestState == RequestState.Aborted) || (m_requestState == RequestState.Completed))
264 {
265 m_log.WarnFormat(
266 "[ARCHIVER]: Received information about asset {0} while in state {1}. Ignoring.",
267 id, m_requestState);
268
269 return;
270 }
271
272 if (asset != null)
273 {
274// m_log.DebugFormat("[ARCHIVER]: Writing asset {0}", id);
275 m_foundAssetUuids.Add(asset.FullID);
276
277 m_assetsArchiver.WriteAsset(PostProcess(asset));
278 }
279 else
280 {
281// m_log.DebugFormat("[ARCHIVER]: Recording asset {0} as not found", id);
282 m_notFoundAssetUuids.Add(new UUID(id));
283 }
284
285 if (m_foundAssetUuids.Count + m_notFoundAssetUuids.Count >= m_repliesRequired)
286 {
287 m_requestState = RequestState.Completed;
288 if(m_notFoundAssetUuids.Count == 0)
289 m_log.DebugFormat(
290 "[ARCHIVER]: Successfully added {0} assets",
291 m_foundAssetUuids.Count);
292 else
293 m_log.DebugFormat(
294 "[ARCHIVER]: Successfully added {0} assets ({1} assets not found but these may be expected invalid references)",
295 m_foundAssetUuids.Count, m_notFoundAssetUuids.Count);
296
297
298 // We want to stop using the asset cache thread asap
299 // as we now need to do the work of producing the rest of the archive
300 WorkManager.RunInThread(PerformAssetsRequestCallback, false, "Archive Assets Request Callback");
301 }
302 else
303 {
304 m_requestCallbackTimer.Start();
305 }
306 }
307 }
308 catch (Exception e)
309 {
310 m_log.ErrorFormat("[ARCHIVER]: AssetRequestCallback failed with {0}", e);
311 }
312 } 189 }
313 190
314 /// <summary> 191 /// <summary>
315 /// Perform the callback on the original requester of the assets 192 /// Perform the callback on the original requester of the assets
316 /// </summary> 193 /// </summary>
317 protected void PerformAssetsRequestCallback(object o) 194 private void PerformAssetsRequestCallback(object o)
318 { 195 {
196 if(m_assetsRequestCallback == null)
197 return;
319 Culture.SetCurrentCulture(); 198 Culture.SetCurrentCulture();
320 199
321 Boolean timedOut = (Boolean)o; 200 Boolean timedOut = (Boolean)o;
@@ -331,7 +210,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
331 } 210 }
332 } 211 }
333 212
334 protected AssetBase PostProcess(AssetBase asset) 213 private AssetBase PostProcess(AssetBase asset)
335 { 214 {
336 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home")) 215 if (asset.Type == (sbyte)AssetType.Object && asset.Data != null && m_options.ContainsKey("home"))
337 { 216 {
diff --git a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
index b59e2af..5ff063b 100644
--- a/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
+++ b/OpenSim/Region/CoreModules/World/Land/LandChannel.cs
@@ -176,6 +176,14 @@ namespace OpenSim.Region.CoreModules.World.Land
176 } 176 }
177 } 177 }
178 178
179 public void SendParcelsOverlay(IClientAPI client)
180 {
181 if (m_landManagementModule != null)
182 {
183 m_landManagementModule.SendParcelOverlay(client);
184 }
185 }
186
179 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id) 187 public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
180 { 188 {
181 if (m_landManagementModule != null) 189 if (m_landManagementModule != null)