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=69420.8.0.3
parent
5fd9411143
commit
35078e03e5
|
@ -523,58 +523,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
oldTelehubUUID = UUID.Zero;
|
oldTelehubUUID = UUID.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
|
ModifySceneObject(scene, sceneObject);
|
||||||
// or creator data is present. Otherwise, use the estate owner instead.
|
|
||||||
foreach (SceneObjectPart part in sceneObject.Parts)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(part.CreatorData))
|
|
||||||
{
|
|
||||||
if (!ResolveUserUuid(scene, part.CreatorID))
|
|
||||||
part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
|
||||||
}
|
|
||||||
if (UserManager != null)
|
|
||||||
UserManager.AddUser(part.CreatorID, part.CreatorData);
|
|
||||||
|
|
||||||
if (!ResolveUserUuid(scene, part.OwnerID))
|
|
||||||
part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
|
||||||
|
|
||||||
if (!ResolveUserUuid(scene, part.LastOwnerID))
|
|
||||||
part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
|
||||||
|
|
||||||
if (!ResolveGroupUuid(part.GroupID))
|
|
||||||
part.GroupID = UUID.Zero;
|
|
||||||
|
|
||||||
// And zap any troublesome sit target information
|
|
||||||
// part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
|
|
||||||
// part.SitTargetPosition = new Vector3(0, 0, 0);
|
|
||||||
|
|
||||||
// Fix ownership/creator of inventory items
|
|
||||||
// Not doing so results in inventory items
|
|
||||||
// being no copy/no mod for everyone
|
|
||||||
lock (part.TaskInventory)
|
|
||||||
{
|
|
||||||
TaskInventoryDictionary inv = part.TaskInventory;
|
|
||||||
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
|
||||||
{
|
|
||||||
if (!ResolveUserUuid(scene, kvp.Value.OwnerID))
|
|
||||||
{
|
|
||||||
kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(kvp.Value.CreatorData))
|
|
||||||
{
|
|
||||||
if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
|
|
||||||
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (UserManager != null)
|
|
||||||
UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
|
|
||||||
|
|
||||||
if (!ResolveGroupUuid(kvp.Value.GroupID))
|
|
||||||
kvp.Value.GroupID = UUID.Zero;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scene.AddRestoredSceneObject(sceneObject, true, false))
|
if (scene.AddRestoredSceneObject(sceneObject, true, false))
|
||||||
{
|
{
|
||||||
|
@ -599,6 +548,67 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Optionally modify a loaded SceneObjectGroup. Currently this just ensures that the
|
||||||
|
/// User IDs and Group IDs are valid, but other manipulations could be done as well.
|
||||||
|
/// </summary>
|
||||||
|
private void ModifySceneObject(Scene scene, SceneObjectGroup sceneObject)
|
||||||
|
{
|
||||||
|
// Try to retain the original creator/owner/lastowner if their uuid is present on this grid
|
||||||
|
// or creator data is present. Otherwise, use the estate owner instead.
|
||||||
|
foreach (SceneObjectPart part in sceneObject.Parts)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrEmpty(part.CreatorData))
|
||||||
|
{
|
||||||
|
if (!ResolveUserUuid(scene, part.CreatorID))
|
||||||
|
part.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
}
|
||||||
|
if (UserManager != null)
|
||||||
|
UserManager.AddUser(part.CreatorID, part.CreatorData);
|
||||||
|
|
||||||
|
if (!ResolveUserUuid(scene, part.OwnerID))
|
||||||
|
part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
|
||||||
|
if (!ResolveUserUuid(scene, part.LastOwnerID))
|
||||||
|
part.LastOwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
|
||||||
|
if (!ResolveGroupUuid(part.GroupID))
|
||||||
|
part.GroupID = UUID.Zero;
|
||||||
|
|
||||||
|
// And zap any troublesome sit target information
|
||||||
|
// part.SitTargetOrientation = new Quaternion(0, 0, 0, 1);
|
||||||
|
// part.SitTargetPosition = new Vector3(0, 0, 0);
|
||||||
|
|
||||||
|
// Fix ownership/creator of inventory items
|
||||||
|
// Not doing so results in inventory items
|
||||||
|
// being no copy/no mod for everyone
|
||||||
|
lock (part.TaskInventory)
|
||||||
|
{
|
||||||
|
TaskInventoryDictionary inv = part.TaskInventory;
|
||||||
|
foreach (KeyValuePair<UUID, TaskInventoryItem> kvp in inv)
|
||||||
|
{
|
||||||
|
if (!ResolveUserUuid(scene, kvp.Value.OwnerID))
|
||||||
|
{
|
||||||
|
kvp.Value.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (string.IsNullOrEmpty(kvp.Value.CreatorData))
|
||||||
|
{
|
||||||
|
if (!ResolveUserUuid(scene, kvp.Value.CreatorID))
|
||||||
|
kvp.Value.CreatorID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (UserManager != null)
|
||||||
|
UserManager.AddUser(kvp.Value.CreatorID, kvp.Value.CreatorData);
|
||||||
|
|
||||||
|
if (!ResolveGroupUuid(kvp.Value.GroupID))
|
||||||
|
kvp.Value.GroupID = UUID.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load serialized parcels.
|
/// Load serialized parcels.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -754,7 +764,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||||
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
|
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
|
||||||
|
|
||||||
if (assetType == (sbyte)AssetType.Unknown)
|
if (assetType == (sbyte)AssetType.Unknown)
|
||||||
|
{
|
||||||
m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
|
m_log.WarnFormat("[ARCHIVER]: Importing {0} byte asset {1} with unknown type", data.Length, uuid);
|
||||||
|
}
|
||||||
|
else if (assetType == (sbyte)AssetType.Object)
|
||||||
|
{
|
||||||
|
data = SceneObjectSerializer.ModifySerializedObject(UUID.Parse(uuid), data,
|
||||||
|
sog =>
|
||||||
|
{
|
||||||
|
ModifySceneObject(m_rootScene, sog);
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (data == null)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
|
//m_log.DebugFormat("[ARCHIVER]: Importing asset {0}, type {1}", uuid, assetType);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue