Merge branch 'master' into careminster

Conflicts:
	OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs
	OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
This commit is contained in:
Melanie
2013-01-04 22:39:07 +00:00
29 changed files with 747 additions and 1472 deletions

View File

@@ -722,15 +722,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
if (!silent)
{
// Killing it here will cause the client to deselect it
// It then reappears on the avatar, deselected
// through the full update below
//
if (so.IsSelected)
{
m_scene.SendKillObject(new List<uint> { so.RootPart.LocalId });
}
else if (so.HasPrivateAttachmentPoint)
if (so.HasPrivateAttachmentPoint)
{
// m_log.DebugFormat(
// "[ATTACHMENTS MODULE]: Killing private HUD {0} for avatars other than {1} at attachment point {2}",
@@ -745,7 +737,10 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments
});
}
so.IsSelected = false; // fudge....
// Fudge below is an extremely unhelpful comment. It's probably here so that the scheduled full update
// will succeed, as that will not update if an attachment is selected.
so.IsSelected = false; // fudge....
so.ScheduleGroupForFullUpdate();
}

View File

@@ -124,7 +124,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
SaveAssets = true;
}
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
{
Exception reportedException = null;
bool succeeded = true;
@@ -143,6 +143,12 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
m_saveStream.Close();
}
if (timedOut)
{
succeeded = false;
reportedException = new Exception("Loading assets timed out");
}
m_module.TriggerInventoryArchiveSaved(
m_id, succeeded, m_userInfo, m_invPath, m_saveStream, reportedException);
}
@@ -350,7 +356,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Inventory.Archiver
{
m_log.DebugFormat("[INVENTORY ARCHIVER]: Not saving assets since --noassets was specified");
ReceivedAllAssets(new List<UUID>(), new List<UUID>());
ReceivedAllAssets(new List<UUID>(), new List<UUID>(), false);
}
}
catch (Exception)

View File

@@ -622,13 +622,18 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// <returns></returns>
private bool ResolveUserUuid(Scene scene, UUID uuid)
{
if (!m_validUserUuids.ContainsKey(uuid))
lock (m_validUserUuids)
{
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
m_validUserUuids.Add(uuid, account != null);
}
if (!m_validUserUuids.ContainsKey(uuid))
{
// Note: we call GetUserAccount() inside the lock because this UserID is likely
// to occur many times, and we only want to query the users service once.
UserAccount account = scene.UserAccountService.GetUserAccount(scene.RegionInfo.ScopeID, uuid);
m_validUserUuids.Add(uuid, account != null);
}
return m_validUserUuids[uuid];
return m_validUserUuids[uuid];
}
}
/// <summary>
@@ -641,19 +646,26 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (uuid == UUID.Zero)
return true; // this means the object has no group
if (!m_validGroupUuids.ContainsKey(uuid))
lock (m_validGroupUuids)
{
bool exists;
if (m_groupsModule == null)
exists = false;
else
exists = (m_groupsModule.GetGroupRecord(uuid) != null);
if (!m_validGroupUuids.ContainsKey(uuid))
{
bool exists;
if (m_groupsModule == null)
{
exists = false;
}
else
{
// Note: we call GetGroupRecord() inside the lock because this GroupID is likely
// to occur many times, and we only want to query the groups service once.
exists = (m_groupsModule.GetGroupRecord(uuid) != null);
}
m_validGroupUuids.Add(uuid, exists);
}
m_validGroupUuids.Add(uuid, exists);
return m_validGroupUuids[uuid];
}
return m_validGroupUuids[uuid];
}
/// Load an asset

View File

@@ -587,19 +587,29 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
}
protected void ReceivedAllAssets(
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids)
protected void ReceivedAllAssets(ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut)
{
foreach (UUID uuid in assetsNotFoundUuids)
string errorMessage;
if (timedOut)
{
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
errorMessage = "Loading assets timed out";
}
else
{
foreach (UUID uuid in assetsNotFoundUuids)
{
m_log.DebugFormat("[ARCHIVER]: Could not find asset {0}", uuid);
}
// m_log.InfoFormat(
// "[ARCHIVER]: Received {0} of {1} assets requested",
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
// m_log.InfoFormat(
// "[ARCHIVER]: Received {0} of {1} assets requested",
// assetsFoundUuids.Count, assetsFoundUuids.Count + assetsNotFoundUuids.Count);
CloseArchive(String.Empty);
errorMessage = String.Empty;
}
CloseArchive(errorMessage);
}
/// <summary>
@@ -626,4 +636,4 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_rootScene.EventManager.TriggerOarFileSaved(m_requestId, errorMessage);
}
}
}
}

View File

@@ -150,12 +150,5 @@ namespace OpenSim.Region.CoreModules.World.Archiver
m_log.InfoFormat("[ARCHIVER]: Added {0} assets to archive", m_assetsWritten);
}
/// <summary>
/// Only call this if you need to force a close on the underlying writer.
/// </summary>
public void ForceClose()
{
m_archiveWriter.Close();
}
}
}

View File

@@ -50,7 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
/// Method called when all the necessary assets for an archive request have been received.
/// </summary>
public delegate void AssetsRequestCallback(
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids);
ICollection<UUID> assetsFoundUuids, ICollection<UUID> assetsNotFoundUuids, bool timedOut);
enum RequestState
{
@@ -148,7 +148,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
if (m_repliesRequired == 0)
{
m_requestState = RequestState.Completed;
PerformAssetsRequestCallback(null);
PerformAssetsRequestCallback(false);
return;
}
@@ -164,7 +164,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
protected void OnRequestCallbackTimeout(object source, ElapsedEventArgs args)
{
bool close = true;
bool timedOut = true;
try
{
@@ -174,7 +174,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// the final request came in (assuming that such a thing is possible)
if (m_requestState == RequestState.Completed)
{
close = false;
timedOut = false;
return;
}
@@ -223,8 +223,8 @@ namespace OpenSim.Region.CoreModules.World.Archiver
}
finally
{
if (close)
m_assetsArchiver.ForceClose();
if (timedOut)
Util.FireAndForget(PerformAssetsRequestCallback, true);
}
}
@@ -290,7 +290,7 @@ namespace OpenSim.Region.CoreModules.World.Archiver
// We want to stop using the asset cache thread asap
// as we now need to do the work of producing the rest of the archive
Util.FireAndForget(PerformAssetsRequestCallback);
Util.FireAndForget(PerformAssetsRequestCallback, false);
}
else
{
@@ -311,9 +311,11 @@ namespace OpenSim.Region.CoreModules.World.Archiver
{
Culture.SetCurrentCulture();
Boolean timedOut = (Boolean)o;
try
{
m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids);
m_assetsRequestCallback(m_foundAssetUuids, m_notFoundAssetUuids, timedOut);
}
catch (Exception e)
{

View File

@@ -128,7 +128,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
uint sun = 0;
if (!Scene.RegionInfo.EstateSettings.UseGlobalTime)
if (Scene.RegionInfo.EstateSettings.FixedSun)
sun = (uint)(Scene.RegionInfo.EstateSettings.SunPosition * 1024.0) + 0x1800;
UUID estateOwner;
estateOwner = Scene.RegionInfo.EstateSettings.EstateOwner;
@@ -1128,6 +1128,7 @@ namespace OpenSim.Region.CoreModules.World.Estate
{
Scene.RegionInfo.EstateSettings.UseGlobalTime = false;
Scene.RegionInfo.EstateSettings.SunPosition = (parms2 - 0x1800)/1024.0;
// Warning: FixedSun should be set to True, otherwise this sun position won't be used.
}
if ((parms1 & 0x00000010) != 0)

View File

@@ -141,6 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Land
m_scene.EventManager.OnValidateLandBuy += EventManagerOnValidateLandBuy;
m_scene.EventManager.OnLandBuy += EventManagerOnLandBuy;
m_scene.EventManager.OnNewClient += EventManagerOnNewClient;
m_scene.EventManager.OnMakeChildAgent += EventMakeChildAgent;
m_scene.EventManager.OnSignificantClientMovement += EventManagerOnSignificantClientMovement;
m_scene.EventManager.OnNoticeNoLandDataFromStorage += EventManagerOnNoLandDataFromStorage;
m_scene.EventManager.OnIncomingLandDataFromStorage += EventManagerOnIncomingLandDataFromStorage;
@@ -221,6 +222,11 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
public void EventMakeChildAgent(ScenePresence avatar)
{
avatar.currentParcelUUID = UUID.Zero;
}
void ClientOnPreAgentUpdate(IClientAPI remoteClient, AgentUpdateArgs agentData)
{
}
@@ -249,17 +255,15 @@ namespace OpenSim.Region.CoreModules.World.Land
newData.LocalID = local_id;
ILandObject landobj = null;
ILandObject land;
lock (m_landList)
{
if (m_landList.ContainsKey(local_id))
{
m_landList[local_id].LandData = newData;
landobj = m_landList[local_id];
// m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, m_landList[local_id]);
}
if (m_landList.TryGetValue(local_id, out land))
land.LandData = newData;
}
if(landobj != null)
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, landobj);
if (land != null)
m_scene.EventManager.TriggerLandObjectUpdated((uint)local_id, land);
}
public bool AllowedForcefulBans
@@ -584,7 +588,7 @@ namespace OpenSim.Region.CoreModules.World.Land
// Only now can we add the prim counts to the land object - we rely on the global ID which is generated
// as a random UUID inside LandData initialization
if (m_primCountModule != null)
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID);
lock (m_landList)
{
@@ -621,6 +625,7 @@ namespace OpenSim.Region.CoreModules.World.Land
/// <param name="local_id">Land.localID of the peice of land to remove.</param>
public void removeLandObject(int local_id)
{
ILandObject land;
lock (m_landList)
{
for (int x = 0; x < 64; x++)
@@ -637,9 +642,11 @@ namespace OpenSim.Region.CoreModules.World.Land
}
}
m_scene.EventManager.TriggerLandObjectRemoved(m_landList[local_id].LandData.GlobalID);
land = m_landList[local_id];
m_landList.Remove(local_id);
}
m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
}
/// <summary>
@@ -1399,25 +1406,72 @@ namespace OpenSim.Region.CoreModules.World.Land
public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
{
ILandObject selectedParcel = null;
lock (m_landList)
if (localID != -1)
{
m_landList.TryGetValue(localID, out selectedParcel);
ILandObject selectedParcel = null;
lock (m_landList)
{
m_landList.TryGetValue(localID, out selectedParcel);
}
if (selectedParcel == null)
return;
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
}
else
{
if (returnType != 1)
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown return type {0}", returnType);
return;
}
if (selectedParcel == null) return;
// We get here when the user returns objects from the list of Top Colliders or Top Scripts.
// In that case we receive specific object UUID's, but no parcel ID.
selectedParcel.ReturnLandObjects(returnType, agentIDs, taskIDs, remoteClient);
Dictionary<UUID, HashSet<SceneObjectGroup>> returns = new Dictionary<UUID, HashSet<SceneObjectGroup>>();
foreach (UUID groupID in taskIDs)
{
SceneObjectGroup obj = m_scene.GetSceneObjectGroup(groupID);
if (obj != null)
{
if (!returns.ContainsKey(obj.OwnerID))
returns[obj.OwnerID] = new HashSet<SceneObjectGroup>();
returns[obj.OwnerID].Add(obj);
}
else
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: unknown object {0}", groupID);
}
}
int num = 0;
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
num += objs.Count;
m_log.DebugFormat("[LAND MANAGEMENT MODULE]: Returning {0} specific object(s)", num);
foreach (HashSet<SceneObjectGroup> objs in returns.Values)
{
List<SceneObjectGroup> objs2 = new List<SceneObjectGroup>(objs);
if (m_scene.Permissions.CanReturnObjects(null, remoteClient.AgentId, objs2))
{
m_scene.returnObjects(objs2.ToArray(), remoteClient.AgentId);
}
else
{
m_log.WarnFormat("[LAND MANAGEMENT MODULE]: ReturnObjectsInParcel: not permitted to return {0} object(s) belonging to user {1}",
objs2.Count, objs2[0].OwnerID);
}
}
}
}
public void EventManagerOnNoLandDataFromStorage()
{
// called methods already have locks
// lock (m_landList)
{
ResetSimLandObjects();
CreateDefaultParcel();
}
ResetSimLandObjects();
CreateDefaultParcel();
}
#endregion

View File

@@ -490,11 +490,14 @@ namespace OpenSim.Region.CoreModules.World.Land
m_Scene.ForEachSOG(AddObject);
List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
foreach (UUID k in primcountKeys)
lock (m_PrimCounts)
{
if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k);
List<UUID> primcountKeys = new List<UUID>(m_PrimCounts.Keys);
foreach (UUID k in primcountKeys)
{
if (!m_OwnerMap.ContainsKey(k))
m_PrimCounts.Remove(k);
}
}
m_Tainted = false;

View File

@@ -252,12 +252,11 @@ namespace OpenSim.Region.CoreModules
}
// TODO: Decouple this, so we can get rid of Linden Hour info
// Update Region infor with new Sun Position and Hour
// Update Region with new Sun Vector
// set estate settings for region access to sun position
if (receivedEstateToolsSunUpdate)
{
m_scene.RegionInfo.RegionSettings.SunVector = Position;
m_scene.RegionInfo.RegionSettings.SunPosition = GetCurrentTimeAsLindenSunHour();
}
}
@@ -395,7 +394,7 @@ namespace OpenSim.Region.CoreModules
ready = false;
// Remove our hooks
m_scene.EventManager.OnFrame -= SunUpdate;
m_scene.EventManager.OnFrame -= SunUpdate;
m_scene.EventManager.OnAvatarEnteringNewParcel -= AvatarEnteringParcel;
m_scene.EventManager.OnEstateToolsSunUpdate -= EstateToolsSunUpdate;
m_scene.EventManager.OnGetCurrentTimeAsLindenSunHour -= GetCurrentTimeAsLindenSunHour;
@@ -459,26 +458,33 @@ namespace OpenSim.Region.CoreModules
SunToClient(avatar.ControllingClient);
}
/// <summary>
///
/// </summary>
/// <param name="regionHandle"></param>
/// <param name="FixedTime">Is the sun's position fixed?</param>
/// <param name="useEstateTime">Use the Region or Estate Sun hour?</param>
/// <param name="FixedSunHour">What hour of the day is the Sun Fixed at?</param>
public void EstateToolsSunUpdate(ulong regionHandle, bool FixedSun, bool useEstateTime, float FixedSunHour)
public void EstateToolsSunUpdate(ulong regionHandle)
{
if (m_scene.RegionInfo.RegionHandle == regionHandle)
{
float sunFixedHour;
bool fixedSun;
if (m_scene.RegionInfo.RegionSettings.UseEstateSun)
{
sunFixedHour = (float)m_scene.RegionInfo.EstateSettings.SunPosition;
fixedSun = m_scene.RegionInfo.EstateSettings.FixedSun;
}
else
{
sunFixedHour = (float)m_scene.RegionInfo.RegionSettings.SunPosition - 6.0f;
fixedSun = m_scene.RegionInfo.RegionSettings.FixedSun;
}
// Must limit the Sun Hour to 0 ... 24
while (FixedSunHour > 24.0f)
FixedSunHour -= 24;
while (sunFixedHour > 24.0f)
sunFixedHour -= 24;
while (FixedSunHour < 0)
FixedSunHour += 24;
m_SunFixedHour = FixedSunHour;
m_SunFixed = FixedSun;
while (sunFixedHour < 0)
sunFixedHour += 24;
m_SunFixedHour = sunFixedHour;
m_SunFixed = fixedSun;
// m_log.DebugFormat("[SUN]: Sun Settings Update: Fixed Sun? : {0}", m_SunFixed.ToString());
// m_log.DebugFormat("[SUN]: Sun Settings Update: Sun Hour : {0}", m_SunFixedHour.ToString());
@@ -501,7 +507,7 @@ namespace OpenSim.Region.CoreModules
{
m_scene.ForEachRootClient(delegate(IClientAPI client)
{
SunToClient(client);
SunToClient(client);
});
}

View File

@@ -480,7 +480,7 @@ namespace OpenSim.Region.CoreModules.World.Terrain
else
{
m_plugineffects[pluginName] = effect;
m_log.Warn("E ... " + pluginName + " (Replaced)");
m_log.Info("E ... " + pluginName + " (Replaced)");
}
}
}