diff options
author | Oren Hurvitz | 2013-11-18 12:53:11 +0200 |
---|---|---|
committer | Oren Hurvitz | 2014-03-24 18:17:59 +0100 |
commit | 35078e03e5a0c0fe6f691eddb3a4cc843d7b3243 (patch) | |
tree | 73754228d158540c13757f36a817fdc87e2ac543 /OpenSim/Region | |
parent | Refactored Load IAR: created a generic mechanism to modify the SOG's as they ... (diff) | |
download | opensim-SC-35078e03e5a0c0fe6f691eddb3a4cc843d7b3243.zip opensim-SC-35078e03e5a0c0fe6f691eddb3a4cc843d7b3243.tar.gz opensim-SC-35078e03e5a0c0fe6f691eddb3a4cc843d7b3243.tar.bz2 opensim-SC-35078e03e5a0c0fe6f691eddb3a4cc843d7b3243.tar.xz |
During Load OAR, fix the User and Group ID's in objects that are embedded in assets (previously only rezzed objects were fixed)
Resolves http://opensimulator.org/mantis/view.php?id=6942
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | 130 |
1 files changed, 77 insertions, 53 deletions
diff --git a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs index 2e638d4..0c7be6f 100644 --- a/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs +++ b/OpenSim/Region/CoreModules/World/Archiver/ArchiveReadRequest.cs | |||
@@ -523,58 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
523 | oldTelehubUUID = UUID.Zero; | 523 | oldTelehubUUID = UUID.Zero; |
524 | } | 524 | } |
525 | 525 | ||
526 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | 526 | ModifySceneObject(scene, sceneObject); |
527 | // or creator data is present. Otherwise, use the estate owner instead. | ||
528 | foreach (SceneObjectPart part in sceneObject.Parts) | ||
529 | { | ||
530 | if (string.IsNullOrEmpty(part.CreatorData)) | ||
531 | { | ||
532 | if (!ResolveUserUuid(scene, part.CreatorID)) | ||
533 | part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
534 | } | ||
535 | if (UserManager != null) | ||
536 | UserManager.AddUser(part.CreatorID, part.CreatorData); | ||
537 | |||
538 | if (!ResolveUserUuid(scene, part.OwnerID)) | ||
539 | part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
540 | |||
541 | if (!ResolveUserUuid(scene, part.LastOwnerID)) | ||
542 | part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
543 | |||
544 | if (!ResolveGroupUuid(part.GroupID)) | ||
545 | part.GroupID = UUID.Zero; | ||
546 | |||
547 | // And zap any troublesome sit target information | ||
548 | // part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
549 | // part.SitTargetPosition = new Vector3(0, 0, 0); | ||
550 | |||
551 | // Fix ownership/creator of inventory items | ||
552 | // Not doing so results in inventory items | ||
553 | // being no copy/no mod for everyone | ||
554 | lock (part.TaskInventory) | ||
555 | { | ||
556 | TaskInventoryDictionary inv = part.TaskInventory; | ||
557 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
558 | { | ||
559 | if (!ResolveUserUuid(scene, kvp.Value.OwnerID)) | ||
560 | { | ||
561 | kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
562 | } | ||
563 | |||
564 | if (string.IsNullOrEmpty(kvp.Value.CreatorData)) | ||
565 | { | ||
566 | if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) | ||
567 | kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
568 | } | ||
569 | |||
570 | if (UserManager != null) | ||
571 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | ||
572 | |||
573 | if (!ResolveGroupUuid(kvp.Value.GroupID)) | ||
574 | kvp.Value.GroupID = UUID.Zero; | ||
575 | } | ||
576 | } | ||
577 | } | ||
578 | 527 | ||
579 | if (scene.AddRestoredSceneObject(sceneObject, true, false)) | 528 | if (scene.AddRestoredSceneObject(sceneObject, true, false)) |
580 | { | 529 | { |
@@ -598,6 +547,67 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
598 | scene.RegionInfo.RegionSettings.ClearSpawnPoints(); | 547 | scene.RegionInfo.RegionSettings.ClearSpawnPoints(); |
599 | } | 548 | } |
600 | } | 549 | } |
550 | |||
551 | /// <summary> | ||
552 | /// Optionally modify a loaded SceneObjectGroup. Currently this just ensures that the | ||
553 | /// User IDs and Group IDs are valid, but other manipulations could be done as well. | ||
554 | /// </summary> | ||
555 | private void ModifySceneObject(Scene scene, SceneObjectGroup sceneObject) | ||
556 | { | ||
557 | // Try to retain the original creator/owner/lastowner if their uuid is present on this grid | ||
558 | // or creator data is present. Otherwise, use the estate owner instead. | ||
559 | foreach (SceneObjectPart part in sceneObject.Parts) | ||
560 | { | ||
561 | if (string.IsNullOrEmpty(part.CreatorData)) | ||
562 | { | ||
563 | if (!ResolveUserUuid(scene, part.CreatorID)) | ||
564 | part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
565 | } | ||
566 | if (UserManager != null) | ||
567 | UserManager.AddUser(part.CreatorID, part.CreatorData); | ||
568 | |||
569 | if (!ResolveUserUuid(scene, part.OwnerID)) | ||
570 | part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
571 | |||
572 | if (!ResolveUserUuid(scene, part.LastOwnerID)) | ||
573 | part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
574 | |||
575 | if (!ResolveGroupUuid(part.GroupID)) | ||
576 | part.GroupID = UUID.Zero; | ||
577 | |||
578 | // And zap any troublesome sit target information | ||
579 | // part.SitTargetOrientation = new Quaternion(0, 0, 0, 1); | ||
580 | // part.SitTargetPosition = new Vector3(0, 0, 0); | ||
581 | |||
582 | // Fix ownership/creator of inventory items | ||
583 | // Not doing so results in inventory items | ||
584 | // being no copy/no mod for everyone | ||
585 | lock (part.TaskInventory) | ||
586 | { | ||
587 | TaskInventoryDictionary inv = part.TaskInventory; | ||
588 | foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv) | ||
589 | { | ||
590 | if (!ResolveUserUuid(scene, kvp.Value.OwnerID)) | ||
591 | { | ||
592 | kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
593 | } | ||
594 | |||
595 | if (string.IsNullOrEmpty(kvp.Value.CreatorData)) | ||
596 | { | ||
597 | if (!ResolveUserUuid(scene, kvp.Value.CreatorID)) | ||
598 | kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner; | ||
599 | } | ||
600 | |||
601 | if (UserManager != null) | ||
602 | UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData); | ||
603 | |||
604 | if (!ResolveGroupUuid(kvp.Value.GroupID)) | ||
605 | kvp.Value.GroupID = UUID.Zero; | ||
606 | } | ||
607 | } | ||
608 | } | ||
609 | } | ||
610 | |||
601 | 611 | ||
602 | /// <summary> | 612 | /// <summary> |
603 | /// Load serialized parcels. | 613 | /// Load serialized parcels. |
@@ -754,7 +764,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
754 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; | 764 | sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension]; |
755 | 765 | ||
756 | if (assetType == (sbyte)AssetType.Unknown) | 766 | if (assetType == (sbyte)AssetType.Unknown) |
767 | { | ||
757 | m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); | 768 | m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid); |
769 | } | ||
770 | else if (assetType == (sbyte)AssetType.Object) | ||
771 | { | ||
772 | data = SceneObjectSerializer.ModifySerializedObject(UUID.Parse(uuid), data, | ||
773 | sog => | ||
774 | { | ||
775 | ModifySceneObject(m_rootScene, sog); | ||
776 | return true; | ||
777 | }); | ||
778 | |||
779 | if (data == null) | ||
780 | return false; | ||
781 | } | ||
758 | 782 | ||
759 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); | 783 | //m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType); |
760 | 784 | ||
@@ -977,4 +1001,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver | |||
977 | return dearchivedScenes; | 1001 | return dearchivedScenes; |
978 | } | 1002 | } |
979 | } | 1003 | } |
980 | } \ No newline at end of file | 1004 | } |