diff options
author | Melanie | 2010-11-24 18:56:25 +0100 |
---|---|---|
committer | Melanie | 2010-11-24 18:56:25 +0100 |
commit | b3a71c6df1538c61247f7d4711aba4c840508db8 (patch) | |
tree | 2089c5b109ec504b16feea0ea44911f7d77fd849 /OpenSim/Region/Framework/Scenes/ScenePresence.cs | |
parent | Prevent a dump in the llGetLinkKey method when using LINK_ROOT in a single prim (diff) | |
download | opensim-SC-b3a71c6df1538c61247f7d4711aba4c840508db8.zip opensim-SC-b3a71c6df1538c61247f7d4711aba4c840508db8.tar.gz opensim-SC-b3a71c6df1538c61247f7d4711aba4c840508db8.tar.bz2 opensim-SC-b3a71c6df1538c61247f7d4711aba4c840508db8.tar.xz |
Prevent an overlength button label from producing a debug dump and aborting
the script.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 233 |
1 files changed, 118 insertions, 115 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index c35df08..98a3b29 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -767,7 +767,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
767 | // Note: This won't send data *to* other clients in that region (children don't send) | 767 | // Note: This won't send data *to* other clients in that region (children don't send) |
768 | 768 | ||
769 | // MIC: This gets called again in CompleteMovement | 769 | // MIC: This gets called again in CompleteMovement |
770 | SendInitialFullUpdateToAllClients(); | 770 | // SendInitialFullUpdateToAllClients(); |
771 | SendOtherAgentsAvatarDataToMe(); | ||
772 | SendOtherAgentsAppearanceToMe(); | ||
771 | 773 | ||
772 | RegisterToEvents(); | 774 | RegisterToEvents(); |
773 | SetDirectionVectors(); | 775 | SetDirectionVectors(); |
@@ -1757,7 +1759,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1757 | { | 1759 | { |
1758 | AbsolutePosition = part.AbsolutePosition; | 1760 | AbsolutePosition = part.AbsolutePosition; |
1759 | Velocity = Vector3.Zero; | 1761 | Velocity = Vector3.Zero; |
1760 | SendFullUpdateToAllClients(); | 1762 | SendAvatarDataToAllAgents(); |
1761 | 1763 | ||
1762 | HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); //KF ?? | 1764 | HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); //KF ?? |
1763 | } | 1765 | } |
@@ -1867,7 +1869,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1867 | m_parentID = 0; | 1869 | m_parentID = 0; |
1868 | m_linkedPrim = UUID.Zero; | 1870 | m_linkedPrim = UUID.Zero; |
1869 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); | 1871 | m_offsetRotation = new Quaternion(0.0f, 0.0f, 0.0f, 1.0f); |
1870 | SendFullUpdateToAllClients(); | 1872 | SendAvatarDataToAllAgents(); |
1871 | m_requestedSitTargetID = 0; | 1873 | m_requestedSitTargetID = 0; |
1872 | if (m_physicsActor != null && m_appearance != null) | 1874 | if (m_physicsActor != null && m_appearance != null) |
1873 | { | 1875 | { |
@@ -2462,8 +2464,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2462 | Velocity = Vector3.Zero; | 2464 | Velocity = Vector3.Zero; |
2463 | RemoveFromPhysicalScene(); | 2465 | RemoveFromPhysicalScene(); |
2464 | Animator.TrySetMovementAnimation(sitAnimation); | 2466 | Animator.TrySetMovementAnimation(sitAnimation); |
2465 | SendFullUpdateToAllClients(); | 2467 | SendAvatarDataToAllAgents(); |
2466 | SendTerseUpdateToAllClients(); | 2468 | //SendTerseUpdateToAllClients(); |
2467 | } | 2469 | } |
2468 | 2470 | ||
2469 | public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal) | 2471 | public void SitAltitudeCallback(bool hitYN, Vector3 collisionPoint, uint localid, float distance, Vector3 normal) |
@@ -2742,165 +2744,169 @@ namespace OpenSim.Region.Framework.Scenes | |||
2742 | } | 2744 | } |
2743 | 2745 | ||
2744 | /// <summary> | 2746 | /// <summary> |
2745 | /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) | 2747 | /// Do everything required once a client completes its movement into a region and becomes |
2748 | /// a root agent. | ||
2746 | /// </summary> | 2749 | /// </summary> |
2747 | /// <param name="remoteAvatar"></param> | 2750 | private void SendInitialData() |
2748 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | ||
2749 | { | 2751 | { |
2750 | // 2 stage check is needed. | 2752 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before |
2751 | if (remoteAvatar == null) | 2753 | // the inventory arrives |
2752 | return; | 2754 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
2753 | 2755 | ||
2754 | IClientAPI cl = remoteAvatar.ControllingClient; | 2756 | // This agent just became root. We are going to tell everyone about it. The process of |
2755 | if (cl == null) | 2757 | // getting other avatars information was initiated in the constructor... don't do it |
2756 | return; | 2758 | // again here... |
2759 | SendAvatarDataToAllAgents(); | ||
2757 | 2760 | ||
2758 | if (m_appearance.Texture == null) | 2761 | // We have an appearance but we may not have the baked textures. Check the asset cache |
2759 | return; | 2762 | // to see if all the baked textures are already here. |
2760 | 2763 | if (m_scene.AvatarFactory != null) | |
2761 | // MT: This is needed for sit. It's legal to send it to oneself, and the name | 2764 | { |
2762 | // of the method is a misnomer | 2765 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) |
2763 | // | 2766 | { |
2764 | // if (LocalId == remoteAvatar.LocalId) | 2767 | // m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); |
2765 | // { | 2768 | SendAppearanceToAgent(this); |
2766 | // m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); | ||
2767 | // return; | ||
2768 | // } | ||
2769 | 2769 | ||
2770 | if (IsChildAgent) | 2770 | // If the avatars baked textures are all in the cache, then we have a |
2771 | // complete appearance... send it out, if not, then we'll send it when | ||
2772 | // the avatar finishes updating its appearance | ||
2773 | SendAppearanceToAllOtherAgents(); | ||
2774 | } | ||
2775 | } | ||
2776 | else | ||
2771 | { | 2777 | { |
2772 | m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID); | 2778 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); |
2773 | return; | ||
2774 | } | 2779 | } |
2775 | |||
2776 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); | ||
2777 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
2778 | } | 2780 | } |
2779 | 2781 | ||
2780 | /// <summary> | 2782 | /// <summary> |
2781 | /// Tell *ALL* agents about this agent | 2783 | /// Send this agent's avatar data to all other root and child agents in the scene |
2784 | /// This agent must be root. This avatar will receive its own update. | ||
2782 | /// </summary> | 2785 | /// </summary> |
2783 | public void SendInitialFullUpdateToAllClients() | 2786 | public void SendAvatarDataToAllAgents() |
2784 | { | 2787 | { |
2785 | m_perfMonMS = Util.EnvironmentTickCount(); | 2788 | // only send update from root agents to other clients; children are only "listening posts" |
2786 | int avUpdates = 0; | 2789 | if (IsChildAgent) |
2787 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | ||
2788 | { | 2790 | { |
2789 | ++avUpdates; | 2791 | m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent"); |
2790 | 2792 | return; | |
2791 | // Don't update ourselves | 2793 | } |
2792 | if (avatar.LocalId == LocalId) | 2794 | |
2793 | return; | 2795 | m_perfMonMS = Util.EnvironmentTickCount(); |
2794 | |||
2795 | // If this is a root agent, then get info about the avatar | ||
2796 | if (!IsChildAgent) | ||
2797 | { | ||
2798 | SendFullUpdateToOtherClient(avatar); | ||
2799 | } | ||
2800 | 2796 | ||
2801 | // If the other avatar is a root | 2797 | int count = 0; |
2802 | if (!avatar.IsChildAgent) | 2798 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2803 | { | 2799 | { |
2804 | avatar.SendFullUpdateToOtherClient(this); | 2800 | SendAvatarDataToAgent(scenePresence); |
2805 | avatar.SendAppearanceToOtherAgent(this); | 2801 | count++; |
2806 | avatar.Animator.SendAnimPackToClient(ControllingClient); | 2802 | }); |
2807 | } | ||
2808 | }); | ||
2809 | 2803 | ||
2810 | m_scene.StatsReporter.AddAgentUpdates(avUpdates); | 2804 | m_scene.StatsReporter.AddAgentUpdates(count); |
2811 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2805 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2812 | |||
2813 | //Animator.SendAnimPack(); | ||
2814 | } | 2806 | } |
2815 | 2807 | ||
2816 | public void SendFullUpdateToAllClients() | 2808 | /// <summary> |
2809 | /// Send avatar data for all other root agents to this agent, this agent | ||
2810 | /// can be either a child or root | ||
2811 | /// </summary> | ||
2812 | public void SendOtherAgentsAvatarDataToMe() | ||
2817 | { | 2813 | { |
2818 | m_perfMonMS = Util.EnvironmentTickCount(); | 2814 | m_perfMonMS = Util.EnvironmentTickCount(); |
2819 | 2815 | ||
2820 | // only send update from root agents to other clients; children are only "listening posts" | ||
2821 | if (IsChildAgent) | ||
2822 | { | ||
2823 | m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent"); | ||
2824 | return; | ||
2825 | } | ||
2826 | |||
2827 | int count = 0; | 2816 | int count = 0; |
2828 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 2817 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2829 | { | 2818 | { |
2830 | if (sp.IsChildAgent) | 2819 | // only send information about root agents |
2831 | return; | 2820 | if (scenePresence.IsChildAgent) |
2832 | SendFullUpdateToOtherClient(sp); | 2821 | return; |
2833 | ++count; | 2822 | |
2834 | }); | 2823 | // only send information about other root agents |
2824 | if (scenePresence.UUID == UUID) | ||
2825 | return; | ||
2826 | |||
2827 | scenePresence.SendAvatarDataToAgent(this); | ||
2828 | count++; | ||
2829 | }); | ||
2830 | |||
2835 | m_scene.StatsReporter.AddAgentUpdates(count); | 2831 | m_scene.StatsReporter.AddAgentUpdates(count); |
2836 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2832 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2837 | |||
2838 | Animator.SendAnimPack(); | ||
2839 | } | 2833 | } |
2840 | 2834 | ||
2841 | /// <summary> | 2835 | /// <summary> |
2842 | /// Do everything required once a client completes its movement into a region | 2836 | /// Send avatar data to an agent. |
2843 | /// </summary> | 2837 | /// </summary> |
2844 | public void SendInitialData() | 2838 | /// <param name="avatar"></param> |
2839 | private void SendAvatarDataToAgent(ScenePresence avatar) | ||
2845 | { | 2840 | { |
2846 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before | 2841 | // m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); |
2847 | // the inventory arrives | ||
2848 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | ||
2849 | 2842 | ||
2850 | m_controllingClient.SendAvatarDataImmediate(this); | 2843 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
2851 | if (m_scene.AvatarFactory != null) | 2844 | Animator.SendAnimPackToClient(avatar.ControllingClient); |
2852 | { | 2845 | } |
2853 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) | 2846 | |
2854 | { | 2847 | /// <summary> |
2855 | // m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); | 2848 | /// Send this agent's appearance to all other root and child agents in the scene |
2856 | m_controllingClient.SendAppearance( | 2849 | /// This agent must be root. |
2857 | m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); | 2850 | /// </summary> |
2858 | } | 2851 | public void SendAppearanceToAllOtherAgents() |
2859 | } | 2852 | { |
2860 | else | 2853 | // only send update from root agents to other clients; children are only "listening posts" |
2854 | if (IsChildAgent) | ||
2861 | { | 2855 | { |
2862 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); | 2856 | m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent"); |
2857 | return; | ||
2863 | } | 2858 | } |
2859 | |||
2860 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2861 | |||
2862 | int count = 0; | ||
2863 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | ||
2864 | { | ||
2865 | if (scenePresence.UUID == UUID) | ||
2866 | return; | ||
2864 | 2867 | ||
2865 | SendInitialFullUpdateToAllClients(); | 2868 | SendAppearanceToAgent(scenePresence); |
2869 | count++; | ||
2870 | }); | ||
2871 | |||
2872 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
2873 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2866 | } | 2874 | } |
2867 | 2875 | ||
2868 | /// <summary> | 2876 | /// <summary> |
2869 | /// | 2877 | /// Send appearance from all other root agents to this agent. this agent |
2878 | /// can be either root or child | ||
2870 | /// </summary> | 2879 | /// </summary> |
2871 | public void SendAppearanceToAllOtherAgents() | 2880 | public void SendOtherAgentsAppearanceToMe() |
2872 | { | 2881 | { |
2873 | // DEBUG ON | ||
2874 | // m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid); | ||
2875 | // DEBUG OFF | ||
2876 | m_perfMonMS = Util.EnvironmentTickCount(); | 2882 | m_perfMonMS = Util.EnvironmentTickCount(); |
2877 | 2883 | ||
2884 | int count = 0; | ||
2878 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2885 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2879 | { | 2886 | { |
2880 | if (scenePresence.UUID != UUID) | 2887 | // only send information about root agents |
2881 | { | 2888 | if (scenePresence.IsChildAgent) |
2882 | SendAppearanceToOtherAgent(scenePresence); | 2889 | return; |
2883 | } | 2890 | |
2891 | // only send information about other root agents | ||
2892 | if (scenePresence.UUID == UUID) | ||
2893 | return; | ||
2894 | |||
2895 | scenePresence.SendAppearanceToAgent(this); | ||
2896 | count++; | ||
2884 | }); | 2897 | }); |
2885 | 2898 | ||
2899 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
2886 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2900 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2887 | } | 2901 | } |
2888 | 2902 | ||
2889 | /// <summary> | 2903 | /// <summary> |
2890 | /// Send appearance data to an agent that isn't this one. | 2904 | /// Send appearance data to an agent. |
2891 | /// </summary> | 2905 | /// </summary> |
2892 | /// <param name="avatar"></param> | 2906 | /// <param name="avatar"></param> |
2893 | public void SendAppearanceToOtherAgent(ScenePresence avatar) | 2907 | private void SendAppearanceToAgent(ScenePresence avatar) |
2894 | { | 2908 | { |
2895 | if (LocalId == avatar.LocalId) | ||
2896 | { | ||
2897 | m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID); | ||
2898 | return; | ||
2899 | } | ||
2900 | |||
2901 | // DEBUG ON | ||
2902 | // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); | 2909 | // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); |
2903 | // DEBUG OFF | ||
2904 | 2910 | ||
2905 | avatar.ControllingClient.SendAppearance( | 2911 | avatar.ControllingClient.SendAppearance( |
2906 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2912 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
@@ -3413,9 +3419,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3413 | 3419 | ||
3414 | public void CopyFrom(AgentData cAgent) | 3420 | public void CopyFrom(AgentData cAgent) |
3415 | { | 3421 | { |
3416 | // DEBUG ON | ||
3417 | m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM"); | ||
3418 | // DEBUG OFF | ||
3419 | m_originRegionID = cAgent.RegionID; | 3422 | m_originRegionID = cAgent.RegionID; |
3420 | 3423 | ||
3421 | m_callbackURI = cAgent.CallbackURI; | 3424 | m_callbackURI = cAgent.CallbackURI; |