diff options
author | Oren Hurvitz | 2013-11-18 12:48:23 +0200 |
---|---|---|
committer | Oren Hurvitz | 2014-03-24 18:17:35 +0100 |
commit | 5fd94111434c2faa742d4eb7357d7a6b02253988 (patch) | |
tree | ee9272cc38a1d2a2afcd6c0b85c38dccc6449315 /OpenSim/Region/CoreModules | |
parent | HGAssetService searches for the "HomeURI" setting in several sections: Startu... (diff) | |
download | opensim-SC_OLD-5fd94111434c2faa742d4eb7357d7a6b02253988.zip opensim-SC_OLD-5fd94111434c2faa742d4eb7357d7a6b02253988.tar.gz opensim-SC_OLD-5fd94111434c2faa742d4eb7357d7a6b02253988.tar.bz2 opensim-SC_OLD-5fd94111434c2faa742d4eb7357d7a6b02253988.tar.xz |
Refactored Load IAR: created a generic mechanism to modify the SOG's as they are being loaded
Resolves http://opensimulator.org/mantis/view.php?id=6942
Diffstat (limited to 'OpenSim/Region/CoreModules')
-rw-r--r-- | OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | 66 |
1 files changed, 19 insertions, 47 deletions
diff --git a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs index f7057fe..9963521 100644 --- a/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/Avatar/Inventory/Archiver/InventoryArchiveReadRequest.cs | |||
@@ -483,52 +483,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
483 | { | 483 | { |
484 | if (m_creatorIdForAssetId.ContainsKey(assetId)) | 484 | if (m_creatorIdForAssetId.ContainsKey(assetId)) |
485 | { | 485 | { |
486 | string xmlData = Utils.BytesToString(data); | 486 | data = SceneObjectSerializer.ModifySerializedObject(assetId, data, |
487 | List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>(); | 487 | sog => { |
488 | bool modified = false; | ||
489 | |||
490 | foreach (SceneObjectPart sop in sog.Parts) | ||
491 | { | ||
492 | if (string.IsNullOrEmpty(sop.CreatorData)) | ||
493 | { | ||
494 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
495 | modified = true; | ||
496 | } | ||
497 | } | ||
498 | |||
499 | return modified; | ||
500 | }); | ||
488 | 501 | ||
489 | CoalescedSceneObjects coa = null; | 502 | if (data == null) |
490 | if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa)) | 503 | return false; |
491 | { | ||
492 | // m_log.DebugFormat( | ||
493 | // "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count); | ||
494 | |||
495 | if (coa.Objects.Count == 0) | ||
496 | { | ||
497 | m_log.WarnFormat( | ||
498 | "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of coalesced object from asset {0} as it has zero loaded components", | ||
499 | assetId); | ||
500 | return false; | ||
501 | } | ||
502 | |||
503 | sceneObjects.AddRange(coa.Objects); | ||
504 | } | ||
505 | else | ||
506 | { | ||
507 | SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData); | ||
508 | |||
509 | if (deserializedObject != null) | ||
510 | { | ||
511 | sceneObjects.Add(deserializedObject); | ||
512 | } | ||
513 | else | ||
514 | { | ||
515 | m_log.WarnFormat( | ||
516 | "[INVENTORY ARCHIVE READ REQUEST]: Aborting load of object from asset {0} as deserialization failed", | ||
517 | assetId); | ||
518 | |||
519 | return false; | ||
520 | } | ||
521 | } | ||
522 | |||
523 | foreach (SceneObjectGroup sog in sceneObjects) | ||
524 | foreach (SceneObjectPart sop in sog.Parts) | ||
525 | if (string.IsNullOrEmpty(sop.CreatorData)) | ||
526 | sop.CreatorID = m_creatorIdForAssetId[assetId]; | ||
527 | |||
528 | if (coa != null) | ||
529 | data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa)); | ||
530 | else | ||
531 | data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0])); | ||
532 | } | 504 | } |
533 | } | 505 | } |
534 | 506 | ||
@@ -550,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
550 | return false; | 522 | return false; |
551 | } | 523 | } |
552 | } | 524 | } |
553 | 525 | ||
554 | /// <summary> | 526 | /// <summary> |
555 | /// Load control file | 527 | /// Load control file |
556 | /// </summary> | 528 | /// </summary> |
@@ -656,4 +628,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver | |||
656 | m_assetsLoaded = true; | 628 | m_assetsLoaded = true; |
657 | } | 629 | } |
658 | } | 630 | } |
659 | } \ No newline at end of file | 631 | } |