Merge branch 'master-core' into mantis5110

This commit is contained in:
Jonathan Freedman
2010-12-05 11:49:15 -08:00
79 changed files with 2421 additions and 1169 deletions

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) Contributors, http://opensimulator.org/
* See CONTRIBUTORS.TXT for a full list of copyright holders.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the OpenSimulator Project nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
using System;
using OpenMetaverse;
namespace OpenSim.Region.Framework.Interfaces
{
public interface IRestartModule
{
TimeSpan TimeUntilRestart { get; }
void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice);
void AbortRestart(string message);
}
}

View File

@@ -9,5 +9,6 @@ namespace OpenSim.Region.Framework.Interfaces
{
string GetUserName(UUID uuid);
void AddUser(UUID uuid, string userData);
void AddUser(UUID uuid, string firstName, string lastName, string profileURL);
}
}

View File

@@ -416,6 +416,10 @@ namespace OpenSim.Region.Framework.Scenes
if ((item != null) && (item.Owner == senderId))
{
IUserManagement uman = RequestModuleInterface<IUserManagement>();
if (uman != null)
uman.AddUser(item.CreatorIdAsUuid, item.CreatorData);
if (!Permissions.BypassPermissions())
{
if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0)

View File

@@ -893,60 +893,6 @@ namespace OpenSim.Region.Framework.Scenes
return new GridRegion(RegionInfo);
}
/// <summary>
/// Given float seconds, this will restart the region.
/// </summary>
/// <param name="seconds">float indicating duration before restart.</param>
public virtual void Restart(float seconds)
{
// notifications are done in 15 second increments
// so .. if the number of seconds is less then 15 seconds, it's not really a restart request
// It's a 'Cancel restart' request.
// RestartNow() does immediate restarting.
if (seconds < 15)
{
m_restartTimer.Stop();
m_dialogModule.SendGeneralAlert("Restart Aborted");
}
else
{
// Now we figure out what to set the timer to that does the notifications and calls, RestartNow()
m_restartTimer.Interval = 15000;
m_incrementsof15seconds = (int)seconds / 15;
m_RestartTimerCounter = 0;
m_restartTimer.AutoReset = true;
m_restartTimer.Elapsed += new ElapsedEventHandler(RestartTimer_Elapsed);
m_log.Info("[REGION]: Restarting Region in " + (seconds / 60) + " minutes");
m_restartTimer.Start();
m_dialogModule.SendNotificationToUsersInRegion(
UUID.Random(), String.Empty, RegionInfo.RegionName + String.Format(": Restarting in {0} Minutes", (int)(seconds / 60.0)));
}
}
// The Restart timer has occured.
// We have to figure out if this is a notification or if the number of seconds specified in Restart
// have elapsed.
// If they have elapsed, call RestartNow()
public void RestartTimer_Elapsed(object sender, ElapsedEventArgs e)
{
m_RestartTimerCounter++;
if (m_RestartTimerCounter <= m_incrementsof15seconds)
{
if (m_RestartTimerCounter == 4 || m_RestartTimerCounter == 6 || m_RestartTimerCounter == 7)
m_dialogModule.SendNotificationToUsersInRegion(
UUID.Random(),
String.Empty,
RegionInfo.RegionName + ": Restarting in " + ((8 - m_RestartTimerCounter) * 15) + " seconds");
}
else
{
m_restartTimer.Stop();
m_restartTimer.AutoReset = false;
RestartNow();
}
}
// This causes the region to restart immediatley.
public void RestartNow()
{
@@ -969,7 +915,8 @@ namespace OpenSim.Region.Framework.Scenes
Close();
m_log.Error("[REGION]: Firing Region Restart Message");
base.Restart(0);
base.Restart();
}
// This is a helper function that notifies root agents in this region that a new sim near them has come up
@@ -2050,7 +1997,7 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="group">Object Id</param>
/// <param name="silent">Suppress broadcasting changes to other clients.</param>
public void DeleteSceneObject(SceneObjectGroup group, bool silent)
{
{
// m_log.DebugFormat("[SCENE]: Deleting scene object {0} {1}", group.Name, group.UUID);
//SceneObjectPart rootPart = group.GetChildPart(group.UUID);
@@ -2091,7 +2038,7 @@ namespace OpenSim.Region.Framework.Scenes
group.DeleteGroupFromScene(silent);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
// m_log.DebugFormat("[SCENE]: Exit DeleteSceneObject() for {0} {1}", group.Name, group.UUID);
}
/// <summary>
@@ -2110,9 +2057,12 @@ namespace OpenSim.Region.Framework.Scenes
// Force a database update so that the scene object group ID is accurate. It's possible that the
// group has recently been delinked from another group but that this change has not been persisted
// to the DB.
ForceSceneObjectBackup(so);
// This is an expensive thing to do so only do it if absolutely necessary.
if (so.HasGroupChangedDueToDelink)
ForceSceneObjectBackup(so);
so.DetachFromBackup();
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
SimulationDataService.RemoveObject(so.UUID, m_regInfo.RegionID);
}
// We need to keep track of this state in case this group is still queued for further backup.
@@ -2377,16 +2327,14 @@ namespace OpenSim.Region.Framework.Scenes
m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName);
return false;
}
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, 2);
newObject.RootPart.ParentGroup.CreateScriptInstances(0, false, DefaultScriptEngine, GetStateSource(newObject));
newObject.ResumeScripts();
// Do this as late as possible so that listeners have full access to the incoming object
EventManager.TriggerOnIncomingSceneObject(newObject);
TriggerChangedTeleport(newObject);
return true;
}
@@ -2494,7 +2442,7 @@ namespace OpenSim.Region.Framework.Scenes
return true;
}
private void TriggerChangedTeleport(SceneObjectGroup sog)
private int GetStateSource(SceneObjectGroup sog)
{
ScenePresence sp = GetScenePresence(sog.OwnerID);
@@ -2505,13 +2453,12 @@ namespace OpenSim.Region.Framework.Scenes
if (aCircuit != null && (aCircuit.teleportFlags != (uint)TeleportFlags.Default))
{
// This will get your attention
//m_log.Error("[XXX] Triggering ");
//m_log.Error("[XXX] Triggering CHANGED_TELEPORT");
// Trigger CHANGED_TELEPORT
sp.Scene.EventManager.TriggerOnScriptChangedEvent(sog.LocalId, (uint)Changed.TELEPORT);
return 5; // StateSource.Teleporting
}
}
return 2; // StateSource.PrimCrossing
}
#endregion
@@ -2616,6 +2563,7 @@ namespace OpenSim.Region.Framework.Scenes
}
else
m_log.DebugFormat("[SCENE]: User Client Verification for {0} {1} in {2} returned true", aCircuit.firstname, aCircuit.lastname, RegionInfo.RegionName);
}
}

View File

@@ -218,18 +218,6 @@ namespace OpenSim.Region.Framework.Scenes
#region admin stuff
/// <summary>
/// Region Restart - Seconds till restart.
/// </summary>
/// <param name="seconds"></param>
public virtual void Restart(int seconds)
{
m_log.Error("[REGION]: passing Restart Message up the namespace");
restart handlerPhysicsCrash = OnRestart;
if (handlerPhysicsCrash != null)
handlerPhysicsCrash(RegionInfo);
}
public virtual bool PresenceChildStatus(UUID avatarID)
{
return false;
@@ -562,6 +550,14 @@ namespace OpenSim.Region.Framework.Scenes
get { return false; }
}
public void Restart()
{
// This has to be here to fire the event
restart handlerPhysicsCrash = OnRestart;
if (handlerPhysicsCrash != null)
handlerPhysicsCrash(RegionInfo);
}
public abstract bool CheckClient(UUID agentID, System.Net.IPEndPoint ep);
}
}

View File

@@ -119,10 +119,19 @@ namespace OpenSim.Region.Framework.Scenes
timeFirstChanged = DateTime.Now.Ticks;
}
m_hasGroupChanged = value;
// m_log.DebugFormat(
// "[SCENE OBJECT GROUP]: HasGroupChanged set to {0} for {1} {2}", m_hasGroupChanged, Name, LocalId);
}
get { return m_hasGroupChanged; }
}
/// <summary>
/// Has the group changed due to an unlink operation? We record this in order to optimize deletion, since
/// an unlinked group currently has to be persisted to the database before we can perform an unlink operation.
/// </summary>
public bool HasGroupChangedDueToDelink { get; private set; }
private bool isTimeToPersist()
{
@@ -1330,6 +1339,7 @@ namespace OpenSim.Region.Framework.Scenes
backup_group.RootPart.AngularVelocity = RootPart.AngularVelocity;
backup_group.RootPart.ParticleSystem = RootPart.ParticleSystem;
HasGroupChanged = false;
HasGroupChangedDueToDelink = false;
m_scene.EventManager.TriggerOnSceneObjectPreSave(backup_group, this);
datastore.StoreObject(backup_group, m_scene.RegionInfo.RegionID);
@@ -2208,8 +2218,9 @@ namespace OpenSim.Region.Framework.Scenes
linkPart.Rezzed = RootPart.Rezzed;
//HasGroupChanged = true;
//ScheduleGroupForFullUpdate();
// When we delete a group, we currently have to force persist to the database if the object id has changed
// (since delete works by deleting all rows which have a given object id)
objectGroup.HasGroupChangedDueToDelink = true;
return objectGroup;
}

View File

@@ -449,7 +449,10 @@ namespace OpenSim.Region.Framework.Scenes
}
}
public string CreatorData // = <profile url>;<name>
/// <summary>
/// Data about the creator in the form profile_url;name
/// </summary>
public string CreatorData
{
get { return m_creatorData; }
set { m_creatorData = value; }

View File

@@ -445,8 +445,36 @@ namespace OpenSim.Region.Framework.Scenes
PhysicsActor actor = m_physicsActor;
if (actor != null)
m_pos = actor.Position;
else
{
// Obtain the correct position of a seated avatar.
// In addition to providing the correct position while
// the avatar is seated, this value will also
// be used as the location to unsit to.
//
// If m_parentID is not 0, assume we are a seated avatar
// and we should return the position based on the sittarget
// offset and rotation of the prim we are seated on.
//
// Generally, m_pos will contain the position of the avatar
// in the sim unless the avatar is on a sit target. While
// on a sit target, m_pos will contain the desired offset
// without the parent rotation applied.
if (m_parentID != 0)
{
SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID);
if (part != null)
{
return m_parentPosition + (m_pos * part.GetWorldRotation());
}
else
{
return m_parentPosition + m_pos;
}
}
}
return m_parentPosition + m_pos;
return m_pos;
}
set
{
@@ -703,7 +731,9 @@ namespace OpenSim.Region.Framework.Scenes
// Note: This won't send data *to* other clients in that region (children don't send)
// MIC: This gets called again in CompleteMovement
SendInitialFullUpdateToAllClients();
// SendInitialFullUpdateToAllClients();
SendOtherAgentsAvatarDataToMe();
SendOtherAgentsAppearanceToMe();
RegisterToEvents();
SetDirectionVectors();
@@ -1613,7 +1643,7 @@ namespace OpenSim.Region.Framework.Scenes
{
AbsolutePosition = part.AbsolutePosition;
Velocity = Vector3.Zero;
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
//HandleAgentSit(ControllingClient, m_requestedSitTargetUUID);
}
@@ -1688,7 +1718,7 @@ namespace OpenSim.Region.Framework.Scenes
m_parentPosition = Vector3.Zero;
m_parentID = 0;
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
m_requestedSitTargetID = 0;
if (m_physicsActor != null && m_appearance != null)
{
@@ -2154,7 +2184,7 @@ namespace OpenSim.Region.Framework.Scenes
RemoveFromPhysicalScene();
Animator.TrySetMovementAnimation(sitAnimation);
SendFullUpdateToAllClients();
SendAvatarDataToAllAgents();
// This may seem stupid, but Our Full updates don't send avatar rotation :P
// So we're also sending a terse update (which has avatar rotation)
// [Update] We do now.
@@ -2379,165 +2409,183 @@ namespace OpenSim.Region.Framework.Scenes
}
/// <summary>
/// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar)
/// Do everything required once a client completes its movement into a region and becomes
/// a root agent.
/// </summary>
/// <param name="remoteAvatar"></param>
public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar)
{
// 2 stage check is needed.
if (remoteAvatar == null)
return;
IClientAPI cl = remoteAvatar.ControllingClient;
if (cl == null)
return;
if (m_appearance.Texture == null)
return;
// MT: This is needed for sit. It's legal to send it to oneself, and the name
// of the method is a misnomer
//
// if (LocalId == remoteAvatar.LocalId)
// {
// m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID);
// return;
// }
if (IsChildAgent)
{
m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID);
return;
}
remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this);
m_scene.StatsReporter.AddAgentUpdates(1);
}
/// <summary>
/// Tell *ALL* agents about this agent
/// </summary>
public void SendInitialFullUpdateToAllClients()
{
m_perfMonMS = Util.EnvironmentTickCount();
int avUpdates = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence avatar)
{
++avUpdates;
// Don't update ourselves
if (avatar.LocalId == LocalId)
return;
// If this is a root agent, then get info about the avatar
if (!IsChildAgent)
{
SendFullUpdateToOtherClient(avatar);
}
// If the other avatar is a root
if (!avatar.IsChildAgent)
{
avatar.SendFullUpdateToOtherClient(this);
avatar.SendAppearanceToOtherAgent(this);
avatar.Animator.SendAnimPackToClient(ControllingClient);
}
});
m_scene.StatsReporter.AddAgentUpdates(avUpdates);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
//Animator.SendAnimPack();
}
public void SendFullUpdateToAllClients()
{
m_perfMonMS = Util.EnvironmentTickCount();
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent");
return;
}
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence sp)
{
if (sp.IsChildAgent)
return;
SendFullUpdateToOtherClient(sp);
++count;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
Animator.SendAnimPack();
}
/// <summary>
/// Do everything required once a client completes its movement into a region
/// </summary>
public void SendInitialData()
private void SendInitialData()
{
// Moved this into CompleteMovement to ensure that m_appearance is initialized before
// the inventory arrives
// m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
m_controllingClient.SendAvatarDataImmediate(this);
bool cachedappearance = false;
// We have an appearance but we may not have the baked textures. Check the asset cache
// to see if all the baked textures are already here.
if (m_scene.AvatarFactory != null)
{
if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient))
{
// m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
m_controllingClient.SendAppearance(
m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes());
}
cachedappearance = m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient);
}
else
{
m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name);
}
// If we aren't using a cached appearance, then clear out the baked textures
if (! cachedappearance)
{
m_appearance.ResetAppearance();
if (m_scene.AvatarFactory != null)
m_scene.AvatarFactory.QueueAppearanceSave(UUID);
}
// This agent just became root. We are going to tell everyone about it. The process of
// getting other avatars information was initiated in the constructor... don't do it
// again here... this comes after the cached appearance check because the avatars
// appearance goes into the avatar update packet
SendAvatarDataToAllAgents();
SendAppearanceToAgent(this);
SendInitialFullUpdateToAllClients();
// If we are using the the cached appearance then send it out to everyone
if (cachedappearance)
{
m_log.InfoFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name);
// If the avatars baked textures are all in the cache, then we have a
// complete appearance... send it out, if not, then we'll send it when
// the avatar finishes updating its appearance
SendAppearanceToAllOtherAgents();
}
}
/// <summary>
///
/// Send this agent's avatar data to all other root and child agents in the scene
/// This agent must be root. This avatar will receive its own update.
/// </summary>
public void SendAppearanceToAllOtherAgents()
public void SendAvatarDataToAllAgents()
{
// DEBUG ON
// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid);
// DEBUG OFF
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
return;
}
m_perfMonMS = Util.EnvironmentTickCount();
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
if (scenePresence.UUID != UUID)
{
SendAppearanceToOtherAgent(scenePresence);
}
SendAvatarDataToAgent(scenePresence);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send appearance data to an agent that isn't this one.
/// Send avatar data for all other root agents to this agent, this agent
/// can be either a child or root
/// </summary>
public void SendOtherAgentsAvatarDataToMe()
{
m_perfMonMS = Util.EnvironmentTickCount();
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
// only send information about root agents
if (scenePresence.IsChildAgent)
return;
// only send information about other root agents
if (scenePresence.UUID == UUID)
return;
scenePresence.SendAvatarDataToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send avatar data to an agent.
/// </summary>
/// <param name="avatar"></param>
public void SendAppearanceToOtherAgent(ScenePresence avatar)
public void SendAvatarDataToAgent(ScenePresence avatar)
{
if (LocalId == avatar.LocalId)
// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
avatar.ControllingClient.SendAvatarDataImmediate(this);
Animator.SendAnimPackToClient(avatar.ControllingClient);
}
/// <summary>
/// Send this agent's appearance to all other root and child agents in the scene
/// This agent must be root.
/// </summary>
public void SendAppearanceToAllOtherAgents()
{
// only send update from root agents to other clients; children are only "listening posts"
if (IsChildAgent)
{
m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID);
m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent");
return;
}
m_perfMonMS = Util.EnvironmentTickCount();
// DEBUG ON
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
if (scenePresence.UUID == UUID)
return;
SendAppearanceToAgent(scenePresence);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send appearance from all other root agents to this agent. this agent
/// can be either root or child
/// </summary>
public void SendOtherAgentsAppearanceToMe()
{
m_perfMonMS = Util.EnvironmentTickCount();
int count = 0;
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
{
// only send information about root agents
if (scenePresence.IsChildAgent)
return;
// only send information about other root agents
if (scenePresence.UUID == UUID)
return;
scenePresence.SendAppearanceToAgent(this);
count++;
});
m_scene.StatsReporter.AddAgentUpdates(count);
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
}
/// <summary>
/// Send appearance data to an agent.
/// </summary>
/// <param name="avatar"></param>
public void SendAppearanceToAgent(ScenePresence avatar)
{
// m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId);
// DEBUG OFF
avatar.ControllingClient.SendAppearance(
m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes());
@@ -3050,9 +3098,6 @@ namespace OpenSim.Region.Framework.Scenes
public void CopyFrom(AgentData cAgent)
{
// DEBUG ON
m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM");
// DEBUG OFF
m_originRegionID = cAgent.RegionID;
m_callbackURI = cAgent.CallbackURI;

View File

@@ -409,12 +409,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region SOPXmlProcessors
private static void ProcessAllowedDrop(SceneObjectPart obj, XmlTextReader reader)
{
obj.AllowedDrop = reader.ReadElementContentAsBoolean("AllowedDrop", String.Empty);
obj.AllowedDrop = Util.ReadBoolean(reader);
}
private static void ProcessCreatorID(SceneObjectPart obj, XmlTextReader reader)
{
obj.CreatorID = ReadUUID(reader, "CreatorID");
obj.CreatorID = Util.ReadUUID(reader, "CreatorID");
}
private static void ProcessCreatorData(SceneObjectPart obj, XmlTextReader reader)
@@ -424,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessFolderID(SceneObjectPart obj, XmlTextReader reader)
{
obj.FolderID = ReadUUID(reader, "FolderID");
obj.FolderID = Util.ReadUUID(reader, "FolderID");
}
private static void ProcessInventorySerial(SceneObjectPart obj, XmlTextReader reader)
@@ -439,7 +439,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessUUID(SceneObjectPart obj, XmlTextReader reader)
{
obj.UUID = ReadUUID(reader, "UUID");
obj.UUID = Util.ReadUUID(reader, "UUID");
}
private static void ProcessLocalId(SceneObjectPart obj, XmlTextReader reader)
@@ -459,7 +459,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessPassTouches(SceneObjectPart obj, XmlTextReader reader)
{
obj.PassTouches = reader.ReadElementContentAsBoolean("PassTouches", String.Empty);
obj.PassTouches = Util.ReadBoolean(reader);
}
private static void ProcessRegionHandle(SceneObjectPart obj, XmlTextReader reader)
@@ -474,32 +474,32 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessGroupPosition(SceneObjectPart obj, XmlTextReader reader)
{
obj.GroupPosition = ReadVector(reader, "GroupPosition");
obj.GroupPosition = Util.ReadVector(reader, "GroupPosition");
}
private static void ProcessOffsetPosition(SceneObjectPart obj, XmlTextReader reader)
{
obj.OffsetPosition = ReadVector(reader, "OffsetPosition"); ;
obj.OffsetPosition = Util.ReadVector(reader, "OffsetPosition"); ;
}
private static void ProcessRotationOffset(SceneObjectPart obj, XmlTextReader reader)
{
obj.RotationOffset = ReadQuaternion(reader, "RotationOffset");
obj.RotationOffset = Util.ReadQuaternion(reader, "RotationOffset");
}
private static void ProcessVelocity(SceneObjectPart obj, XmlTextReader reader)
{
obj.Velocity = ReadVector(reader, "Velocity");
obj.Velocity = Util.ReadVector(reader, "Velocity");
}
private static void ProcessAngularVelocity(SceneObjectPart obj, XmlTextReader reader)
{
obj.AngularVelocity = ReadVector(reader, "AngularVelocity");
obj.AngularVelocity = Util.ReadVector(reader, "AngularVelocity");
}
private static void ProcessAcceleration(SceneObjectPart obj, XmlTextReader reader)
{
obj.Acceleration = ReadVector(reader, "Acceleration");
obj.Acceleration = Util.ReadVector(reader, "Acceleration");
}
private static void ProcessDescription(SceneObjectPart obj, XmlTextReader reader)
@@ -553,7 +553,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessScale(SceneObjectPart obj, XmlTextReader reader)
{
obj.Scale = ReadVector(reader, "Scale");
obj.Scale = Util.ReadVector(reader, "Scale");
}
private static void ProcessUpdateFlag(SceneObjectPart obj, XmlTextReader reader)
@@ -563,22 +563,22 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessSitTargetOrientation(SceneObjectPart obj, XmlTextReader reader)
{
obj.SitTargetOrientation = ReadQuaternion(reader, "SitTargetOrientation");
obj.SitTargetOrientation = Util.ReadQuaternion(reader, "SitTargetOrientation");
}
private static void ProcessSitTargetPosition(SceneObjectPart obj, XmlTextReader reader)
{
obj.SitTargetPosition = ReadVector(reader, "SitTargetPosition");
obj.SitTargetPosition = Util.ReadVector(reader, "SitTargetPosition");
}
private static void ProcessSitTargetPositionLL(SceneObjectPart obj, XmlTextReader reader)
{
obj.SitTargetPositionLL = ReadVector(reader, "SitTargetPositionLL");
obj.SitTargetPositionLL = Util.ReadVector(reader, "SitTargetPositionLL");
}
private static void ProcessSitTargetOrientationLL(SceneObjectPart obj, XmlTextReader reader)
{
obj.SitTargetOrientationLL = ReadQuaternion(reader, "SitTargetOrientationLL");
obj.SitTargetOrientationLL = Util.ReadQuaternion(reader, "SitTargetOrientationLL");
}
private static void ProcessParentID(SceneObjectPart obj, XmlTextReader reader)
@@ -614,17 +614,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessGroupID(SceneObjectPart obj, XmlTextReader reader)
{
obj.GroupID = ReadUUID(reader, "GroupID");
obj.GroupID = Util.ReadUUID(reader, "GroupID");
}
private static void ProcessOwnerID(SceneObjectPart obj, XmlTextReader reader)
{
obj.OwnerID = ReadUUID(reader, "OwnerID");
obj.OwnerID = Util.ReadUUID(reader, "OwnerID");
}
private static void ProcessLastOwnerID(SceneObjectPart obj, XmlTextReader reader)
{
obj.LastOwnerID = ReadUUID(reader, "LastOwnerID");
obj.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
}
private static void ProcessBaseMask(SceneObjectPart obj, XmlTextReader reader)
@@ -654,16 +654,12 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessFlags(SceneObjectPart obj, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("Flags", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
obj.Flags = (PrimFlags)Enum.Parse(typeof(PrimFlags), value);
obj.Flags = Util.ReadEnum<PrimFlags>(reader, "Flags");
}
private static void ProcessCollisionSound(SceneObjectPart obj, XmlTextReader reader)
{
obj.CollisionSound = ReadUUID(reader, "CollisionSound");
obj.CollisionSound = Util.ReadUUID(reader, "CollisionSound");
}
private static void ProcessCollisionSoundVolume(SceneObjectPart obj, XmlTextReader reader)
@@ -690,7 +686,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
#region TaskInventoryXmlProcessors
private static void ProcessTIAssetID(TaskInventoryItem item, XmlTextReader reader)
{
item.AssetID = ReadUUID(reader, "AssetID");
item.AssetID = Util.ReadUUID(reader, "AssetID");
}
private static void ProcessTIBasePermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -705,7 +701,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTICreatorID(TaskInventoryItem item, XmlTextReader reader)
{
item.CreatorID = ReadUUID(reader, "CreatorID");
item.CreatorID = Util.ReadUUID(reader, "CreatorID");
}
private static void ProcessTICreatorData(TaskInventoryItem item, XmlTextReader reader)
@@ -730,7 +726,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIGroupID(TaskInventoryItem item, XmlTextReader reader)
{
item.GroupID = ReadUUID(reader, "GroupID");
item.GroupID = Util.ReadUUID(reader, "GroupID");
}
private static void ProcessTIGroupPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -745,20 +741,20 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIItemID(TaskInventoryItem item, XmlTextReader reader)
{
item.ItemID = ReadUUID(reader, "ItemID");
item.ItemID = Util.ReadUUID(reader, "ItemID");
}
private static void ProcessTIOldItemID(TaskInventoryItem item, XmlTextReader reader)
{
ReadUUID(reader, "OldItemID");
Util.ReadUUID(reader, "OldItemID");
// On deserialization, the old item id MUST BE UUID.Zero!!!!!
// Setting this to the saved value will BREAK script persistence!
// item.OldItemID = ReadUUID(reader, "OldItemID");
// item.OldItemID = Util.ReadUUID(reader, "OldItemID");
}
private static void ProcessTILastOwnerID(TaskInventoryItem item, XmlTextReader reader)
{
item.LastOwnerID = ReadUUID(reader, "LastOwnerID");
item.LastOwnerID = Util.ReadUUID(reader, "LastOwnerID");
}
private static void ProcessTIName(TaskInventoryItem item, XmlTextReader reader)
@@ -773,7 +769,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIOwnerID(TaskInventoryItem item, XmlTextReader reader)
{
item.OwnerID = ReadUUID(reader, "OwnerID");
item.OwnerID = Util.ReadUUID(reader, "OwnerID");
}
private static void ProcessTICurrentPermissions(TaskInventoryItem item, XmlTextReader reader)
@@ -783,17 +779,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIParentID(TaskInventoryItem item, XmlTextReader reader)
{
item.ParentID = ReadUUID(reader, "ParentID");
item.ParentID = Util.ReadUUID(reader, "ParentID");
}
private static void ProcessTIParentPartID(TaskInventoryItem item, XmlTextReader reader)
{
item.ParentPartID = ReadUUID(reader, "ParentPartID");
item.ParentPartID = Util.ReadUUID(reader, "ParentPartID");
}
private static void ProcessTIPermsGranter(TaskInventoryItem item, XmlTextReader reader)
{
item.PermsGranter = ReadUUID(reader, "PermsGranter");
item.PermsGranter = Util.ReadUUID(reader, "PermsGranter");
}
private static void ProcessTIPermsMask(TaskInventoryItem item, XmlTextReader reader)
@@ -808,7 +804,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessTIOwnerChanged(TaskInventoryItem item, XmlTextReader reader)
{
item.OwnerChanged = reader.ReadElementContentAsBoolean("OwnerChanged", String.Empty);
item.OwnerChanged = Util.ReadBoolean(reader);
}
#endregion
@@ -922,7 +918,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessShpScale(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.Scale = ReadVector(reader, "Scale");
shp.Scale = Util.ReadVector(reader, "Scale");
}
private static void ProcessShpState(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -932,25 +928,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessShpProfileShape(PrimitiveBaseShape shp, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("ProfileShape", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
shp.ProfileShape = (ProfileShape)Enum.Parse(typeof(ProfileShape), value);
shp.ProfileShape = Util.ReadEnum<ProfileShape>(reader, "ProfileShape");
}
private static void ProcessShpHollowShape(PrimitiveBaseShape shp, XmlTextReader reader)
{
string value = reader.ReadElementContentAsString("HollowShape", String.Empty);
// !!!!! to deal with flags without commas
if (value.Contains(" ") && !value.Contains(","))
value = value.Replace(" ", ", ");
shp.HollowShape = (HollowShape)Enum.Parse(typeof(HollowShape), value);
shp.HollowShape = Util.ReadEnum<HollowShape>(reader, "HollowShape");
}
private static void ProcessShpSculptTexture(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.SculptTexture = ReadUUID(reader, "SculptTexture");
shp.SculptTexture = Util.ReadUUID(reader, "SculptTexture");
}
private static void ProcessShpSculptType(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1045,17 +1033,17 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
private static void ProcessShpFlexiEntry(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.FlexiEntry = reader.ReadElementContentAsBoolean("FlexiEntry", String.Empty);
shp.FlexiEntry = Util.ReadBoolean(reader);
}
private static void ProcessShpLightEntry(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.LightEntry = reader.ReadElementContentAsBoolean("LightEntry", String.Empty);
shp.LightEntry = Util.ReadBoolean(reader);
}
private static void ProcessShpSculptEntry(PrimitiveBaseShape shp, XmlTextReader reader)
{
shp.SculptEntry = reader.ReadElementContentAsBoolean("SculptEntry", String.Empty);
shp.SculptEntry = Util.ReadBoolean(reader);
}
private static void ProcessShpMedia(PrimitiveBaseShape shp, XmlTextReader reader)
@@ -1220,16 +1208,8 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
static void WriteFlags(XmlTextWriter writer, string name, string flagsStr, Dictionary<string, object> options)
{
// Older versions of serialization can't cope with commas
if (options.ContainsKey("version"))
{
float version = 0.5F;
float.TryParse(options["version"].ToString(), out version);
if (version < 0.5)
flagsStr = flagsStr.Replace(",", "");
}
writer.WriteElementString(name, flagsStr);
// Older versions of serialization can't cope with commas, so we eliminate the commas
writer.WriteElementString(name, flagsStr.Replace(",", ""));
}
static void WriteTaskInventory(XmlTextWriter writer, TaskInventoryDictionary tinv, Dictionary<string, object> options, Scene scene)
@@ -1459,66 +1439,6 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
return obj;
}
static UUID ReadUUID(XmlTextReader reader, string name)
{
UUID id;
string idStr;
reader.ReadStartElement(name);
if (reader.Name == "Guid")
idStr = reader.ReadElementString("Guid");
else // UUID
idStr = reader.ReadElementString("UUID");
UUID.TryParse(idStr, out id);
reader.ReadEndElement();
return id;
}
static Vector3 ReadVector(XmlTextReader reader, string name)
{
Vector3 vec;
reader.ReadStartElement(name);
vec.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // X or x
vec.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Y or y
vec.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty); // Z or z
reader.ReadEndElement();
return vec;
}
static Quaternion ReadQuaternion(XmlTextReader reader, string name)
{
Quaternion quat = new Quaternion();
reader.ReadStartElement(name);
while (reader.NodeType != XmlNodeType.EndElement)
{
switch (reader.Name.ToLower())
{
case "x":
quat.X = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
break;
case "y":
quat.Y = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
break;
case "z":
quat.Z = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
break;
case "w":
quat.W = reader.ReadElementContentAsFloat(reader.Name, String.Empty);
break;
}
}
reader.ReadEndElement();
return quat;
}
static TaskInventoryDictionary ReadTaskInventory(XmlTextReader reader, string name)
{
TaskInventoryDictionary tinv = new TaskInventoryDictionary();

View File

@@ -121,13 +121,14 @@ namespace OpenSim.Region.Framework.Scenes.Tests
"Not exactly sure what this is asserting...");
// Delink part 2
grp1.DelinkFromGroup(part2.LocalId);
SceneObjectGroup grp3 = grp1.DelinkFromGroup(part2.LocalId);
if (debugtest)
m_log.Debug("Group2: Prim2: OffsetPosition:" + part2.AbsolutePosition + ", OffsetRotation:" + part2.RotationOffset);
Assert.That(grp1.Parts.Length, Is.EqualTo(1), "Group 1 still contained part2 after delink.");
Assert.That(part2.AbsolutePosition == Vector3.Zero, "The absolute position should be zero");
Assert.That(grp3.HasGroupChangedDueToDelink, Is.True);
}
[Test]
@@ -325,7 +326,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
SceneObjectGroup sog = new SceneObjectGroup(rootPart);
sog.AddPart(linkPart);
scene.AddNewSceneObject(sog, true);
scene.AddNewSceneObject(sog, true);
// In a test, we have to crank the backup handle manually. Normally this would be done by the timer invoked
// scene backup thread.
@@ -333,7 +334,10 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// These changes should occur immediately without waiting for a backup pass
SceneObjectGroup groupToDelete = sog.DelinkFromGroup(linkPart, false);
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.True);
scene.DeleteSceneObject(groupToDelete, false);
Assert.That(groupToDelete.HasGroupChangedDueToDelink, Is.False);
List<SceneObjectGroup> storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID);

View File

@@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes
/// <param name="assetUuids">The assets gathered</param>
public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary<UUID, AssetType> assetUuids)
{
assetUuids[assetUuid] = assetType;
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{
GetWearableAssetUuids(assetUuid, assetUuids);
try
{
assetUuids[assetUuid] = assetType;
if (AssetType.Bodypart == assetType || AssetType.Clothing == assetType)
{
GetWearableAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Gesture == assetType)
{
GetGestureAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.LSLText == assetType)
{
GetScriptAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Object == assetType)
{
GetSceneObjectAssetUuids(assetUuid, assetUuids);
}
}
else if (AssetType.Gesture == assetType)
catch (Exception)
{
GetGestureAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.LSLText == assetType)
{
GetScriptAssetUuids(assetUuid, assetUuids);
}
else if (AssetType.Object == assetType)
{
GetSceneObjectAssetUuids(assetUuid, assetUuids);
m_log.ErrorFormat(
"[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}",
assetUuid, assetType);
throw;
}
}