aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorMelanie2011-12-08 18:29:19 +0000
committerMelanie2011-12-08 18:29:19 +0000
commit96539ffc79c1654feddc17592170f0e4b57f5b8d (patch)
treed500df1c7a7b37cae6e74d52b67f51aa7bfad46d /OpenSim/Region/Framework
parentMerge branch 'master' into bigmerge (diff)
parentWhen a client connects to a scene, send other avatar appearance data asynchro... (diff)
downloadopensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.zip
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.gz
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.bz2
opensim-SC-96539ffc79c1654feddc17592170f0e4b57f5b8d.tar.xz
Merge branch 'master' into bigmerge
Conflicts: OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Interfaces/IScenePresence.cs22
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs69
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneBase.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs39
4 files changed, 62 insertions, 70 deletions
diff --git a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
index ff39283..5e43843 100644
--- a/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScenePresence.cs
@@ -38,28 +38,8 @@ namespace OpenSim.Region.Framework.Interfaces
38 /// <remarks> 38 /// <remarks>
39 /// Interface is a work in progress. Please feel free to add other required properties and methods. 39 /// Interface is a work in progress. Please feel free to add other required properties and methods.
40 /// </remarks> 40 /// </remarks>
41 public interface IScenePresence : ISceneEntity 41 public interface IScenePresence : ISceneAgent
42 { 42 {
43 /// <value>
44 /// The client controlling this presence
45 /// </value>
46 IClientAPI ControllingClient { get; }
47
48 /// <summary>
49 /// What type of presence is this? User, NPC, etc.
50 /// </summary>
51 PresenceType PresenceType { get; }
52
53 /// <summary>
54 /// Avatar appearance data.
55 /// </summary>
56 /// <remarks>
57 // Because appearance setting is in a module, we actually need
58 // to give it access to our appearance directly, otherwise we
59 // get a synchronization issue.
60 /// </remarks>
61 AvatarAppearance Appearance { get; set; }
62
63 /// <summary> 43 /// <summary>
64 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments. 44 /// The AttachmentsModule synchronizes on this to avoid race conditions between commands to add and remove attachments.
65 /// </summary> 45 /// </summary>
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index f9ae39c..a51fca2 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -2610,17 +2610,17 @@ namespace OpenSim.Region.Framework.Scenes
2610 #region Add/Remove Avatar Methods 2610 #region Add/Remove Avatar Methods
2611 2611
2612 /// <summary> 2612 /// <summary>
2613 /// Add a new client and create a child agent for it. 2613 /// Add a new client and create a child scene presence for it.
2614 /// </summary> 2614 /// </summary>
2615 /// <param name="client"></param> 2615 /// <param name="client"></param>
2616 /// <param name="type">The type of agent to add.</param> 2616 /// <param name="type">The type of agent to add.</param>
2617 public override void AddNewClient(IClientAPI client, PresenceType type) 2617 public override ISceneAgent AddNewClient(IClientAPI client, PresenceType type)
2618 { 2618 {
2619 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode); 2619 AgentCircuitData aCircuit = m_authenticateHandler.GetAgentCircuitData(client.CircuitCode);
2620 bool vialogin = false; 2620 bool vialogin = false;
2621 2621
2622 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully 2622 if (aCircuit == null) // no good, didn't pass NewUserConnection successfully
2623 return; 2623 return null;
2624 2624
2625 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 || 2625 vialogin = (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0 ||
2626 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2626 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
@@ -2628,60 +2628,61 @@ namespace OpenSim.Region.Framework.Scenes
2628 CheckHeartbeat(); 2628 CheckHeartbeat();
2629 ScenePresence presence; 2629 ScenePresence presence;
2630 2630
2631 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here 2631 ScenePresence sp = GetScenePresence(client.AgentId);
2632
2633 // XXX: Not sure how good it is to add a new client if a scene presence already exists. Possibly this
2634 // could occur if a viewer crashes and relogs before the old client is kicked out. But this could cause
2635 // other problems, and possible the code calling AddNewClient() should ensure that no client is already
2636 // connected.
2637 if (sp == null)
2632 { 2638 {
2633 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName); 2639 m_log.Debug("[SCENE]: Adding new child scene presence " + client.Name + " to scene " + RegionInfo.RegionName);
2634 2640
2635 m_clientManager.Add(client); 2641 m_clientManager.Add(client);
2636 SubscribeToClientEvents(client); 2642 SubscribeToClientEvents(client);
2637 2643
2638 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 2644 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
2639 m_eventManager.TriggerOnNewPresence(sp); 2645 m_eventManager.TriggerOnNewPresence(sp);
2640 2646
2641 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags; 2647 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
2642 2648
2643 // HERE!!! Do the initial attachments right here 2649 // The first agent upon login is a root agent by design.
2644 // first agent upon login is a root agent by design. 2650 // For this agent we will have to rez the attachments.
2645 // All other AddNewClient calls find aCircuit.child to be true 2651 // All other AddNewClient calls find aCircuit.child to be true.
2646 if (aCircuit.child == false) 2652 if (aCircuit.child == false)
2647 { 2653 {
2654 // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to
2655 // start the scripts again (since this is done in RezAttachments()).
2656 // XXX: This is convoluted.
2648 sp.IsChildAgent = false; 2657 sp.IsChildAgent = false;
2649 2658
2650 if (AttachmentsModule != null) 2659 if (AttachmentsModule != null)
2651 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); }); 2660 Util.FireAndForget(delegate(object o) { AttachmentsModule.RezAttachments(sp); });
2652 } 2661 }
2653 } 2662 }
2654 2663 else
2655 ScenePresence createdSp = GetScenePresence(client.AgentId);
2656 if (createdSp != null)
2657 { 2664 {
2658 m_LastLogin = Util.EnvironmentTickCount(); 2665 m_log.WarnFormat(
2666 "[SCENE]: Already found {0} scene presence for {1} in {2} when asked to add new scene presence",
2667 sp.IsChildAgent ? "child" : "root", sp.Name, RegionInfo.RegionName);
2668 }
2659 2669
2660 // Cache the user's name 2670 m_LastLogin = Util.EnvironmentTickCount();
2661 CacheUserName(createdSp, aCircuit);
2662 2671
2663 EventManager.TriggerOnNewClient(client); 2672 // Cache the user's name
2664 if (vialogin) 2673 CacheUserName(sp, aCircuit);
2665 {
2666 EventManager.TriggerOnClientLogin(client);
2667 2674
2668 // Send initial parcel data 2675 EventManager.TriggerOnNewClient(client);
2669 Vector3 pos = createdSp.AbsolutePosition; 2676 if (vialogin)
2670 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y); 2677 {
2671 land.SendLandUpdateToClient(client); 2678 EventManager.TriggerOnClientLogin(client);
2672 } 2679 // Send initial parcel data
2680 Vector3 pos = sp.AbsolutePosition;
2681 ILandObject land = LandChannel.GetLandObject(pos.X, pos.Y);
2682 land.SendLandUpdateToClient(client);
2673 } 2683 }
2674 2684
2675 // Send all scene object to the new client 2685 return sp;
2676 Util.FireAndForget(delegate
2677 {
2678 EntityBase[] entities = Entities.GetEntities();
2679 foreach(EntityBase e in entities)
2680 {
2681 if (e != null && e is SceneObjectGroup)
2682 ((SceneObjectGroup)e).SendFullUpdateToClient(client);
2683 }
2684 });
2685 } 2686 }
2686 2687
2687 /// <summary> 2688 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 29ab071..84da700 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -177,7 +177,7 @@ namespace OpenSim.Region.Framework.Scenes
177 177
178 #region Add/Remove Agent/Avatar 178 #region Add/Remove Agent/Avatar
179 179
180 public abstract void AddNewClient(IClientAPI client, PresenceType type); 180 public abstract ISceneAgent AddNewClient(IClientAPI client, PresenceType type);
181 public abstract void RemoveClient(UUID agentID, bool closeChildAgents); 181 public abstract void RemoveClient(UUID agentID, bool closeChildAgents);
182 182
183 public bool TryGetScenePresence(UUID agentID, out object scenePresence) 183 public bool TryGetScenePresence(UUID agentID, out object scenePresence)
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3c97852..2748a75 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -794,15 +794,6 @@ namespace OpenSim.Region.Framework.Scenes
794 794
795 AdjustKnownSeeds(); 795 AdjustKnownSeeds();
796 796
797 // we created a new ScenePresence (a new child agent) in a fresh region.
798 // Request info about all the (root) agents in this region
799 // Note: This won't send data *to* other clients in that region (children don't send)
800
801// MIC: This gets called again in CompleteMovement
802 // SendInitialFullUpdateToAllClients();
803 SendOtherAgentsAvatarDataToMe();
804 SendOtherAgentsAppearanceToMe();
805
806 RegisterToEvents(); 797 RegisterToEvents();
807 SetDirectionVectors(); 798 SetDirectionVectors();
808 799
@@ -1207,9 +1198,9 @@ namespace OpenSim.Region.Framework.Scenes
1207 { 1198 {
1208// DateTime startTime = DateTime.Now; 1199// DateTime startTime = DateTime.Now;
1209 1200
1210 m_log.DebugFormat( 1201// m_log.DebugFormat(
1211 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1202// "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
1212 client.Name, Scene.RegionInfo.RegionName); 1203// client.Name, Scene.RegionInfo.RegionName);
1213 1204
1214 Vector3 look = Velocity; 1205 Vector3 look = Velocity;
1215 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) 1206 if ((look.X == 0) && (look.Y == 0) && (look.Z == 0))
@@ -1241,7 +1232,7 @@ namespace OpenSim.Region.Framework.Scenes
1241 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement"); 1232 //m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1242 1233
1243 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1234 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1244 SendInitialData(); 1235 ValidateAndSendAppearanceAndAgentData();
1245 1236
1246 // Create child agents in neighbouring regions 1237 // Create child agents in neighbouring regions
1247 if (openChildAgents && !IsChildAgent) 1238 if (openChildAgents && !IsChildAgent)
@@ -2531,11 +2522,31 @@ namespace OpenSim.Region.Framework.Scenes
2531 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); 2522 ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
2532 } 2523 }
2533 2524
2525 public void SendInitialDataToMe()
2526 {
2527 // Send all scene object to the new client
2528 Util.FireAndForget(delegate
2529 {
2530 // we created a new ScenePresence (a new child agent) in a fresh region.
2531 // Request info about all the (root) agents in this region
2532 // Note: This won't send data *to* other clients in that region (children don't send)
2533 SendOtherAgentsAvatarDataToMe();
2534 SendOtherAgentsAppearanceToMe();
2535
2536 EntityBase[] entities = Scene.Entities.GetEntities();
2537 foreach(EntityBase e in entities)
2538 {
2539 if (e != null && e is SceneObjectGroup)
2540 ((SceneObjectGroup)e).SendFullUpdateToClient(ControllingClient);
2541 }
2542 });
2543 }
2544
2534 /// <summary> 2545 /// <summary>
2535 /// Do everything required once a client completes its movement into a region and becomes 2546 /// Do everything required once a client completes its movement into a region and becomes
2536 /// a root agent. 2547 /// a root agent.
2537 /// </summary> 2548 /// </summary>
2538 private void SendInitialData() 2549 private void ValidateAndSendAppearanceAndAgentData()
2539 { 2550 {
2540 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); 2551 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
2541 // Moved this into CompleteMovement to ensure that Appearance is initialized before 2552 // Moved this into CompleteMovement to ensure that Appearance is initialized before