mirror of
https://github.com/opensim/opensim.git
synced 2026-08-06 01:06:30 +08:00
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
This commit is contained in:
@@ -245,8 +245,9 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
|
||||
string state = sog.GetStateSnapshot();
|
||||
ad.AttachmentObjectStates.Add(state);
|
||||
sp.InTransitScriptStates.Add(state);
|
||||
// Let's remove the scripts of the original object here
|
||||
sog.RemoveScriptInstances(true);
|
||||
|
||||
// Scripts of the originals will be removed when the Agent is successfully removed.
|
||||
// sog.RemoveScriptInstances(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -483,52 +483,24 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
{
|
||||
if (m_creatorIdForAssetId.ContainsKey(assetId))
|
||||
{
|
||||
string xmlData = Utils.BytesToString(data);
|
||||
List<SceneObjectGroup> sceneObjects = new List<SceneObjectGroup>();
|
||||
data = SceneObjectSerializer.ModifySerializedObject(assetId, data,
|
||||
sog => {
|
||||
bool modified = false;
|
||||
|
||||
foreach (SceneObjectPart sop in sog.Parts)
|
||||
{
|
||||
if (string.IsNullOrEmpty(sop.CreatorData))
|
||||
{
|
||||
sop.CreatorID = m_creatorIdForAssetId[assetId];
|
||||
modified = true;
|
||||
}
|
||||
}
|
||||
|
||||
return modified;
|
||||
});
|
||||
|
||||
CoalescedSceneObjects coa = null;
|
||||
if (CoalescedSceneObjectsSerializer.TryFromXml(xmlData, out coa))
|
||||
{
|
||||
// m_log.DebugFormat(
|
||||
// "[INVENTORY ARCHIVER]: Loaded coalescence {0} has {1} objects", assetId, coa.Count);
|
||||
|
||||
if (coa.Objects.Count == 0)
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[INVENTORY ARCHIVE READ REQUEST]: Aborting load of coalesced object from asset {0} as it has zero loaded components",
|
||||
assetId);
|
||||
return false;
|
||||
}
|
||||
|
||||
sceneObjects.AddRange(coa.Objects);
|
||||
}
|
||||
else
|
||||
{
|
||||
SceneObjectGroup deserializedObject = SceneObjectSerializer.FromOriginalXmlFormat(xmlData);
|
||||
|
||||
if (deserializedObject != null)
|
||||
{
|
||||
sceneObjects.Add(deserializedObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_log.WarnFormat(
|
||||
"[INVENTORY ARCHIVE READ REQUEST]: Aborting load of object from asset {0} as deserialization failed",
|
||||
assetId);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
foreach (SceneObjectGroup sog in sceneObjects)
|
||||
foreach (SceneObjectPart sop in sog.Parts)
|
||||
if (string.IsNullOrEmpty(sop.CreatorData))
|
||||
sop.CreatorID = m_creatorIdForAssetId[assetId];
|
||||
|
||||
if (coa != null)
|
||||
data = Utils.StringToBytes(CoalescedSceneObjectsSerializer.ToXml(coa));
|
||||
else
|
||||
data = Utils.StringToBytes(SceneObjectSerializer.ToOriginalXmlFormat(sceneObjects[0]));
|
||||
if (data == null)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -550,7 +522,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Load control file
|
||||
/// </summary>
|
||||
@@ -656,4 +628,4 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
|
||||
m_assetsLoaded = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,6 +150,8 @@ namespace OpenSim.Region.CoreModules.Framework.Search
|
||||
|
||||
void OnDirFindQuery(IClientAPI remoteClient, UUID queryID, string queryText, uint queryFlags, int queryStart)
|
||||
{
|
||||
queryText = queryText.Trim();
|
||||
|
||||
if (((DirFindFlags)queryFlags & DirFindFlags.People) == DirFindFlags.People)
|
||||
{
|
||||
if (string.IsNullOrEmpty(queryText))
|
||||
@@ -194,4 +196,4 @@ namespace OpenSim.Region.CoreModules.Framework.Search
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,7 +278,8 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
{
|
||||
foreach (UserData data in m_UserCache.Values)
|
||||
{
|
||||
if (users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
|
||||
if (data.Id != UUID.Zero &&
|
||||
users.Find(delegate(UserData d) { return d.Id == data.Id; }) == null &&
|
||||
(data.FirstName.ToLower().StartsWith(query.ToLower()) || data.LastName.ToLower().StartsWith(query.ToLower())))
|
||||
users.Add(data);
|
||||
}
|
||||
@@ -725,4 +726,4 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,8 +189,9 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
m_rotationCenter = options.ContainsKey("rotation-center") ? (Vector3)options["rotation-center"]
|
||||
: new Vector3(scene.RegionInfo.RegionSizeX / 2f, scene.RegionInfo.RegionSizeY / 2f, 0f);
|
||||
|
||||
// Zero can never be a valid user id
|
||||
// Zero can never be a valid user or group id
|
||||
m_validUserUuids[UUID.Zero] = false;
|
||||
m_validGroupUuids[UUID.Zero] = false;
|
||||
|
||||
m_groupsModule = m_rootScene.RequestModuleInterface<IGroupsModule>();
|
||||
m_assetService = m_rootScene.AssetService;
|
||||
@@ -523,58 +524,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
oldTelehubUUID = UUID.Zero;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
ModifySceneObject(scene, sceneObject);
|
||||
|
||||
if (scene.AddRestoredSceneObject(sceneObject, true, false))
|
||||
{
|
||||
@@ -598,6 +548,67 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
scene.RegionInfo.RegionSettings.ClearSpawnPoints();
|
||||
}
|
||||
}
|
||||
|
||||
/// <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) || ResolveGroupUuid(part.OwnerID)))
|
||||
part.OwnerID = scene.RegionInfo.EstateSettings.EstateOwner;
|
||||
|
||||
if (!(ResolveUserUuid(scene, part.LastOwnerID) || ResolveGroupUuid(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) || ResolveGroupUuid(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>
|
||||
/// Load serialized parcels.
|
||||
@@ -695,9 +706,6 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
/// <returns></returns>
|
||||
private bool ResolveGroupUuid(UUID uuid)
|
||||
{
|
||||
if (uuid == UUID.Zero)
|
||||
return true; // this means the object has no group
|
||||
|
||||
lock (m_validGroupUuids)
|
||||
{
|
||||
if (!m_validGroupUuids.ContainsKey(uuid))
|
||||
@@ -754,7 +762,21 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
sbyte assetType = ArchiveConstants.EXTENSION_TO_ASSET_TYPE[extension];
|
||||
|
||||
if (assetType == (sbyte)AssetType.Unknown)
|
||||
{
|
||||
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);
|
||||
|
||||
@@ -977,4 +999,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver
|
||||
return dearchivedScenes;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1342,10 +1342,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
|
||||
{
|
||||
m_regionChangeTimer.Stop();
|
||||
m_regionChangeTimer.Start();
|
||||
}
|
||||
|
||||
protected void RaiseRegionInfoChange(object sender, ElapsedEventArgs e)
|
||||
{
|
||||
ChangeDelegate change = OnRegionInfoChange;
|
||||
|
||||
if (change != null)
|
||||
|
||||
@@ -1340,6 +1340,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
m_scene.ForEachClient(SendParcelOverlay);
|
||||
land.SendLandUpdateToClient(true, remote_client);
|
||||
UpdateLandObject(land.LandData.LocalID, land.LandData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1360,8 +1361,10 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
land.LandData.GroupID = UUID.Zero;
|
||||
land.LandData.IsGroupOwned = false;
|
||||
land.LandData.Flags &= ~(uint) (ParcelFlags.ForSale | ParcelFlags.ForSaleObjects | ParcelFlags.SellParcelObjects | ParcelFlags.ShowDirectory);
|
||||
|
||||
m_scene.ForEachClient(SendParcelOverlay);
|
||||
land.SendLandUpdateToClient(true, remote_client);
|
||||
UpdateLandObject(land.LandData.LocalID, land.LandData);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1388,6 +1391,7 @@ namespace OpenSim.Region.CoreModules.World.Land
|
||||
|
||||
m_scene.ForEachClient(SendParcelOverlay);
|
||||
land.SendLandUpdateToClient(true, remote_client);
|
||||
UpdateLandObject(land.LandData.LocalID, land.LandData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user