From e14f449cc2a59cb84c195b9479bcd43c16cafc48 Mon Sep 17 00:00:00 2001 From: Melanie Date: Wed, 24 Nov 2010 22:14:53 +0000 Subject: Adding the skeleton for the restart module --- .../Region/Framework/Interfaces/IRestartModule.cs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 OpenSim/Region/Framework/Interfaces/IRestartModule.cs (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs new file mode 100644 index 0000000..d8cac7b --- /dev/null +++ b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs @@ -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 seconds, int[] alerts, bool notice); + void AbortRestart(string message); + } +} -- cgit v1.1 From 6734c9f83ae00b762873c3d99293435552b9a0c2 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Nov 2010 01:22:05 +0000 Subject: Implement the restart module --- OpenSim/Region/Framework/Interfaces/IRestartModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs index d8cac7b..c68550f 100644 --- a/OpenSim/Region/Framework/Interfaces/IRestartModule.cs +++ b/OpenSim/Region/Framework/Interfaces/IRestartModule.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.Framework.Interfaces public interface IRestartModule { TimeSpan TimeUntilRestart { get; } - void ScheduleRestart(UUID initiator, string message, int seconds, int[] alerts, bool notice); + void ScheduleRestart(UUID initiator, string message, int[] alerts, bool notice); void AbortRestart(string message); } } -- cgit v1.1 From 57c4def254b85997f5b8a4cd4e7d1db550947290 Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 25 Nov 2010 03:16:52 +0000 Subject: Change all restarting to use the restart module. Remove hardcoded behavior --- OpenSim/Region/Framework/Scenes/Scene.cs | 57 +--------------------------- OpenSim/Region/Framework/Scenes/SceneBase.cs | 20 ++++------ 2 files changed, 10 insertions(+), 67 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4fc2cbc..129b52d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -893,60 +893,6 @@ namespace OpenSim.Region.Framework.Scenes return new GridRegion(RegionInfo); } - /// - /// Given float seconds, this will restart the region. - /// - /// float indicating duration before restart. - 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 diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs index c71aefa..f343bc8 100644 --- a/OpenSim/Region/Framework/Scenes/SceneBase.cs +++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs @@ -218,18 +218,6 @@ namespace OpenSim.Region.Framework.Scenes #region admin stuff - /// - /// Region Restart - Seconds till restart. - /// - /// - 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); } } -- cgit v1.1 From ae4b02e1152b775dc1cdccd1abfbff44ab1a8949 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 25 Nov 2010 11:14:16 -0800 Subject: WARNING: LOTS OF CONFIGURATION CHANGES AFFECTING PRIMARILY HG CONFIGS. Added capability to preserve creator information on HG asset transfers. Added a new HGAssetService that is intended to be the one outside the firewall. It processes and filters the assets that go out of the grid. Also fixed the normal AssetService to do special things for the main instance (console commands, etc). Moved HGInventoryService to OpenSim.Services.HypergridService. Changed the way the login service gets the ServiceURL configs. --- OpenSim/Region/Framework/Interfaces/IUserManagement.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 4 ++++ OpenSim/Region/Framework/Scenes/Scene.cs | 1 + 3 files changed, 6 insertions(+) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs index 1a5cb7e..2904ee8 100644 --- a/OpenSim/Region/Framework/Interfaces/IUserManagement.cs +++ b/OpenSim/Region/Framework/Interfaces/IUserManagement.cs @@ -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); } } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 06f8ac1..2cf0ced 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -416,6 +416,10 @@ namespace OpenSim.Region.Framework.Scenes if ((item != null) && (item.Owner == senderId)) { + IUserManagement uman = RequestModuleInterface(); + if (uman != null) + uman.AddUser(item.CreatorIdAsUuid, item.CreatorData); + if (!Permissions.BypassPermissions()) { if ((item.CurrentPermissions & (uint)PermissionMask.Transfer) == 0) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4fc2cbc..4d90e1b 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2616,6 +2616,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); + } } -- cgit v1.1 From 2827deffe822378b6cb35dac6c90a21c3fbc0de7 Mon Sep 17 00:00:00 2001 From: Marck Date: Fri, 26 Nov 2010 22:46:48 +0100 Subject: Trigger changed event with CHANGED_TELEPORT when teleporting to another region. --- OpenSim/Region/Framework/Scenes/Scene.cs | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 129b52d..b1216c5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2324,16 +2324,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; } @@ -2441,7 +2439,7 @@ namespace OpenSim.Region.Framework.Scenes return true; } - private void TriggerChangedTeleport(SceneObjectGroup sog) + private int GetStateSource(SceneObjectGroup sog) { ScenePresence sp = GetScenePresence(sog.OwnerID); @@ -2452,13 +2450,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 -- cgit v1.1 From 0e311a210444b2c85210cfb7e32f75a7b72004c0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 27 Nov 2010 00:53:35 +0000 Subject: If we fail to gather asset uuids for a particular asset, log the failing asset id and type --- OpenSim/Region/Framework/Scenes/UuidGatherer.cs | 40 +++++++++++++++---------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs index aee2d10..3978a7d 100644 --- a/OpenSim/Region/Framework/Scenes/UuidGatherer.cs +++ b/OpenSim/Region/Framework/Scenes/UuidGatherer.cs @@ -86,23 +86,33 @@ namespace OpenSim.Region.Framework.Scenes /// The assets gathered public void GatherAssetUuids(UUID assetUuid, AssetType assetType, IDictionary assetUuids) { - 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); + 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.Object == assetType) + catch (Exception) { - GetSceneObjectAssetUuids(assetUuid, assetUuids); + m_log.ErrorFormat( + "[UUID GATHERER]: Failed to gather uuids for asset id {0}, type {1}", + assetUuid, assetType); + throw; } } -- cgit v1.1 From 541a7660e06206c9a9eb2426dee0449afb554921 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Tue, 23 Nov 2010 16:08:10 -0800 Subject: Refactor appearance and avatar data sending code. Paritioning the routines into "one-to-many" and "many-to-one" makes it possible to call the right function on presence creation (both child and root) and when a child agent is promoted to root. This brings the total number of appearance sends down to one or two on login. Cleaned up the avatar update calls in the groups code. Cleaned up some commented and debugging code, and a few formating fixes. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 231 ++++++++++++----------- 1 file changed, 117 insertions(+), 114 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index db69093..4a48ac3 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -703,7 +703,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 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes { AbsolutePosition = part.AbsolutePosition; Velocity = Vector3.Zero; - SendFullUpdateToAllClients(); + SendAvatarDataToAllAgents(); //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); } @@ -1688,7 +1690,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 +2156,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 +2381,169 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// 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. /// - /// - public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) + private void SendInitialData() { - // 2 stage check is needed. - if (remoteAvatar == null) - return; - - IClientAPI cl = remoteAvatar.ControllingClient; - if (cl == null) - return; + // Moved this into CompleteMovement to ensure that m_appearance is initialized before + // the inventory arrives + // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); - if (m_appearance.Texture == null) - return; + // 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... + SendAvatarDataToAllAgents(); -// 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; -// } + // 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); + SendAppearanceToAgent(this); - if (IsChildAgent) + // 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(); + } + } + else { - m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID); - return; + m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); } - - remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); - m_scene.StatsReporter.AddAgentUpdates(1); } /// - /// Tell *ALL* agents about this agent + /// 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. /// - public void SendInitialFullUpdateToAllClients() + public void SendAvatarDataToAllAgents() { - m_perfMonMS = Util.EnvironmentTickCount(); - int avUpdates = 0; - m_scene.ForEachScenePresence(delegate(ScenePresence avatar) + // only send update from root agents to other clients; children are only "listening posts" + if (IsChildAgent) { - ++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); - } + m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent"); + return; + } + + m_perfMonMS = Util.EnvironmentTickCount(); - // If the other avatar is a root - if (!avatar.IsChildAgent) - { - avatar.SendFullUpdateToOtherClient(this); - avatar.SendAppearanceToOtherAgent(this); - avatar.Animator.SendAnimPackToClient(ControllingClient); - } - }); + int count = 0; + m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) + { + SendAvatarDataToAgent(scenePresence); + count++; + }); - m_scene.StatsReporter.AddAgentUpdates(avUpdates); + m_scene.StatsReporter.AddAgentUpdates(count); m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); - - //Animator.SendAnimPack(); } - public void SendFullUpdateToAllClients() + /// + /// Send avatar data for all other root agents to this agent, this agent + /// can be either a child or root + /// + public void SendOtherAgentsAvatarDataToMe() { 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.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)); - - Animator.SendAnimPack(); } /// - /// Do everything required once a client completes its movement into a region + /// Send avatar data to an agent. /// - public void SendInitialData() + /// + private void SendAvatarDataToAgent(ScenePresence avatar) { - // Moved this into CompleteMovement to ensure that m_appearance is initialized before - // the inventory arrives - // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); +// m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); - m_controllingClient.SendAvatarDataImmediate(this); - 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()); - } - } - else + avatar.ControllingClient.SendAvatarDataImmediate(this); + Animator.SendAnimPackToClient(avatar.ControllingClient); + } + + /// + /// Send this agent's appearance to all other root and child agents in the scene + /// This agent must be root. + /// + public void SendAppearanceToAllOtherAgents() + { + // only send update from root agents to other clients; children are only "listening posts" + if (IsChildAgent) { - m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); + 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) + return; - SendInitialFullUpdateToAllClients(); + SendAppearanceToAgent(scenePresence); + count++; + }); + + m_scene.StatsReporter.AddAgentUpdates(count); + m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// - /// + /// Send appearance from all other root agents to this agent. this agent + /// can be either root or child /// - public void SendAppearanceToAllOtherAgents() + public void SendOtherAgentsAppearanceToMe() { -// DEBUG ON -// m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid); -// DEBUG OFF m_perfMonMS = Util.EnvironmentTickCount(); + int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { - if (scenePresence.UUID != UUID) - { - SendAppearanceToOtherAgent(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)); } /// - /// Send appearance data to an agent that isn't this one. + /// Send appearance data to an agent. /// /// - public void SendAppearanceToOtherAgent(ScenePresence avatar) + private void SendAppearanceToAgent(ScenePresence avatar) { - if (LocalId == avatar.LocalId) - { - m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID); - return; - } - -// DEBUG ON // 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 +3056,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; -- cgit v1.1 From 6ed63487d912c9d1e0946fb271639c40356483e9 Mon Sep 17 00:00:00 2001 From: Micheil Merlin Date: Sat, 20 Nov 2010 21:49:37 -0600 Subject: llUnsit position fix 4063 (updated 11-20-2010) --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 29 ++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4a48ac3..d4b4e0a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -445,8 +445,33 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor actor = m_physicsActor; if (actor != null) m_pos = actor.Position; - - return m_parentPosition + m_pos; + else // OS Mantis #4063 + { // OS Mantis #4063 + // OpenSim Mantis #4063. 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 avator 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) // OS Mantis #4063 + { + SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); // OS Mantis #4063 + if (part != null) // OS Mantis #4063 + { // OS Mantis #4064 + return m_parentPosition + (m_pos * part.GetWorldRotation()); // OS Mantis #4063 + } + else // OS Mantis #4064 + { // OS Mantis #4063 + return m_parentPosition + m_pos; // OS Mantis #4064 + } // OS Mantis #4063 + } // OS Mantis #4063 + } // OS Mantis #4063 + + return m_pos; // OS Mantis #4063 } set { -- cgit v1.1 From 63e2c3b2d66b5800fa77be76d4a7d47e1bf4a66f Mon Sep 17 00:00:00 2001 From: Melanie Date: Sat, 27 Nov 2010 01:28:02 +0000 Subject: Reformat an overzealous comment. Remove end of line marks and reference to the Mantis solved, as that isn't needed to understand the code. Reformat the comment for 80 col screens. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 45 +++++++++++++----------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index d4b4e0a..82214bf 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -445,33 +445,36 @@ namespace OpenSim.Region.Framework.Scenes PhysicsActor actor = m_physicsActor; if (actor != null) m_pos = actor.Position; - else // OS Mantis #4063 - { // OS Mantis #4063 - // OpenSim Mantis #4063. Obtain the correct position of a seated avatar. In addition - // to providing the correct position while the avatar is seated, this value will also + 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. + // 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 avator in the sim unless the avatar - // is on a sit target. While on a sit target, m_pos will contain the desired offset + // 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) // OS Mantis #4063 + if (m_parentID != 0) { - SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); // OS Mantis #4063 - if (part != null) // OS Mantis #4063 - { // OS Mantis #4064 - return m_parentPosition + (m_pos * part.GetWorldRotation()); // OS Mantis #4063 + SceneObjectPart part = m_scene.GetSceneObjectPart(m_parentID); + if (part != null) + { + return m_parentPosition + (m_pos * part.GetWorldRotation()); } - else // OS Mantis #4064 - { // OS Mantis #4063 - return m_parentPosition + m_pos; // OS Mantis #4064 - } // OS Mantis #4063 - } // OS Mantis #4063 - } // OS Mantis #4063 - - return m_pos; // OS Mantis #4063 + else + { + return m_parentPosition + m_pos; + } + } + } + + return m_pos; } set { -- cgit v1.1 From ca8d0157333823b549c7ae36b40ea3c05045fc25 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 27 Nov 2010 11:40:54 -0800 Subject: Changed the parser for InventoryItem deserialization. Moved some utility functions around. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 122 ++++++--------------- 1 file changed, 31 insertions(+), 91 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index 9cf5a39..da25e80 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -414,7 +414,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization 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) @@ -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) @@ -663,7 +663,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization 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 +690,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 +705,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 +730,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 +745,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 +773,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 +783,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) @@ -922,7 +922,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) @@ -950,7 +950,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization 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) @@ -1459,66 +1459,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(); -- cgit v1.1 From f86c438653fc3c8356a8f0c43a055b1928183f02 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 29 Nov 2010 08:43:33 -0800 Subject: Preservation of creator information now also working in IARs. Cleaned up usage help. Moved Osp around, deleted unnecessary OspInventoryWrapperPlugin, added manipulation of SOP's xml representation in a generic ExternalRepresentationUtils function. --- .../Scenes/Serialization/SceneObjectSerializer.cs | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs index da25e80..6c9826f 100644 --- a/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs +++ b/OpenSim/Region/Framework/Scenes/Serialization/SceneObjectSerializer.cs @@ -409,7 +409,7 @@ 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) @@ -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) @@ -654,11 +654,7 @@ 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(reader, "Flags"); } private static void ProcessCollisionSound(SceneObjectPart obj, 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 @@ -932,20 +928,12 @@ 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(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(reader, "HollowShape"); } private static void ProcessShpSculptTexture(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 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 options, Scene scene) -- cgit v1.1 From 7d24dbca3c85cafe182648139ab132563e3e1cdd Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Wed, 1 Dec 2010 16:01:22 -0800 Subject: Added some comments. Better than listening to the boring speaker... --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index ba592c4..f87056e 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -449,7 +449,10 @@ namespace OpenSim.Region.Framework.Scenes } } - public string CreatorData // = ; + /// + /// Data about the creator in the form profile_url;name + /// + public string CreatorData { get { return m_creatorData; } set { m_creatorData = value; } -- cgit v1.1 From 7e72afcb3e9d5467ad4dd2e6ba5d1e0632d77877 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 3 Dec 2010 00:08:58 +0000 Subject: Only force prim persistence before delete if the prim is the result of an unpersisted delink This considerably improves delete performance for objects with large linksets --- OpenSim/Region/Framework/Scenes/Scene.cs | 11 +++++++---- OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 15 +++++++++++++-- .../Framework/Scenes/Tests/SceneObjectLinkingTests.cs | 8 ++++++-- 3 files changed, 26 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 90223b1..66c6924 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1997,7 +1997,7 @@ namespace OpenSim.Region.Framework.Scenes /// Object Id /// Suppress broadcasting changes to other clients. 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); @@ -2038,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); } /// @@ -2057,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. diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 4ec530e..f17fb28 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -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; } } + + /// + /// 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. + /// + 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; } diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs index f57cf98..b84298f 100644 --- a/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs +++ b/OpenSim/Region/Framework/Scenes/Tests/SceneObjectLinkingTests.cs @@ -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 storedObjects = scene.SimulationDataService.LoadObjects(scene.RegionInfo.RegionID); -- cgit v1.1 From df860516bf4fa4e4196be4d5fc26db71d98334f4 Mon Sep 17 00:00:00 2001 From: Mic Bowman Date: Fri, 3 Dec 2010 16:17:50 -0800 Subject: Various bug fixes for appearance handling: more aggressive reset of textures and vparams when appearance is not cached and when wearables change. Send appearance to the viewer with initial data. Cleaned up (and added) debugging. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 46 +++++++++++++++--------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 82214bf..a1c80e5 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2418,30 +2418,44 @@ namespace OpenSim.Region.Framework.Scenes // the inventory arrives // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); - // 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... - SendAvatarDataToAllAgents(); + 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); - SendAppearanceToAgent(this); - - // 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(); - } + 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); + + // 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(); + } } /// @@ -2501,7 +2515,7 @@ namespace OpenSim.Region.Framework.Scenes /// Send avatar data to an agent. /// /// - private void SendAvatarDataToAgent(ScenePresence avatar) + public void SendAvatarDataToAgent(ScenePresence avatar) { // m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); @@ -2569,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes /// Send appearance data to an agent. /// /// - private void SendAppearanceToAgent(ScenePresence avatar) + public void SendAppearanceToAgent(ScenePresence avatar) { // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); -- cgit v1.1