aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs81
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs4
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs27
4 files changed, 37 insertions, 82 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 12fd813..dc08b49 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -498,12 +498,6 @@ namespace OpenSim.Region.Framework.Scenes
498 get { return m_sceneGraph.Entities; } 498 get { return m_sceneGraph.Entities; }
499 } 499 }
500 500
501 public Dictionary<UUID, ScenePresence> m_restorePresences
502 {
503 get { return m_sceneGraph.RestorePresences; }
504 set { m_sceneGraph.RestorePresences = value; }
505 }
506
507 #endregion Properties 501 #endregion Properties
508 502
509 #region Constructors 503 #region Constructors
@@ -2483,56 +2477,26 @@ namespace OpenSim.Region.Framework.Scenes
2483 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0; 2477 (aCircuit.teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0;
2484 2478
2485 CheckHeartbeat(); 2479 CheckHeartbeat();
2486 ScenePresence presence;
2487 2480
2488 if (m_restorePresences.ContainsKey(client.AgentId)) 2481 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2489 { 2482 {
2490 m_log.DebugFormat("[SCENE]: Restoring agent {0} {1} in {2}", client.Name, client.AgentId, RegionInfo.RegionName); 2483 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2491 2484
2492 m_clientManager.Add(client); 2485 m_clientManager.Add(client);
2493 SubscribeToClientEvents(client); 2486 SubscribeToClientEvents(client);
2494 2487
2495 presence = m_restorePresences[client.AgentId]; 2488 ScenePresence sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance);
2496 m_restorePresences.Remove(client.AgentId); 2489 m_eventManager.TriggerOnNewPresence(sp);
2497
2498 // This is one of two paths to create avatars that are
2499 // used. This tends to get called more in standalone
2500 // than grid, not really sure why, but as such needs
2501 // an explicity appearance lookup here.
2502 AvatarAppearance appearance = null;
2503 GetAvatarAppearance(client, out appearance);
2504 presence.Appearance = appearance;
2505 2490
2506 presence.initializeScenePresence(client, RegionInfo, this); 2491 sp.TeleportFlags = (TeleportFlags)aCircuit.teleportFlags;
2507 2492
2508 m_sceneGraph.AddScenePresence(presence); 2493 // HERE!!! Do the initial attachments right here
2509 2494 // first agent upon login is a root agent by design.
2510 lock (m_restorePresences) 2495 // All other AddNewClient calls find aCircuit.child to be true
2496 if (aCircuit.child == false)
2511 { 2497 {
2512 Monitor.PulseAll(m_restorePresences); 2498 sp.IsChildAgent = false;
2513 } 2499 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2514 }
2515 else
2516 {
2517 if (GetScenePresence(client.AgentId) == null) // ensure there is no SP here
2518 {
2519 m_log.Debug("[SCENE]: Adding new agent " + client.Name + " to scene " + RegionInfo.RegionName);
2520
2521 m_clientManager.Add(client);
2522 SubscribeToClientEvents(client);
2523
2524 ScenePresence sp = CreateAndAddScenePresence(client);
2525 if (aCircuit != null)
2526 sp.Appearance = aCircuit.Appearance;
2527
2528 // HERE!!! Do the initial attachments right here
2529 // first agent upon login is a root agent by design.
2530 // All other AddNewClient calls find aCircuit.child to be true
2531 if (aCircuit == null || (aCircuit != null && aCircuit.child == false))
2532 {
2533 sp.IsChildAgent = false;
2534 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2535 }
2536 } 2500 }
2537 } 2501 }
2538 2502
@@ -2997,25 +2961,6 @@ namespace OpenSim.Region.Framework.Scenes
2997 } 2961 }
2998 2962
2999 /// <summary> 2963 /// <summary>
3000 /// Create a child agent scene presence and add it to this scene.
3001 /// </summary>
3002 /// <param name="client"></param>
3003 /// <returns></returns>
3004 protected virtual ScenePresence CreateAndAddScenePresence(IClientAPI client)
3005 {
3006 CheckHeartbeat();
3007 AvatarAppearance appearance = null;
3008 GetAvatarAppearance(client, out appearance);
3009
3010 ScenePresence avatar = m_sceneGraph.CreateAndAddChildScenePresence(client, appearance);
3011 //avatar.KnownRegions = GetChildrenSeeds(avatar.UUID);
3012
3013 m_eventManager.TriggerOnNewPresence(avatar);
3014
3015 return avatar;
3016 }
3017
3018 /// <summary>
3019 /// Get the avatar apperance for the given client. 2964 /// Get the avatar apperance for the given client.
3020 /// </summary> 2965 /// </summary>
3021 /// <param name="client"></param> 2966 /// <param name="client"></param>
@@ -3324,6 +3269,10 @@ namespace OpenSim.Region.Framework.Scenes
3324 } 3269 }
3325 else 3270 else
3326 { 3271 {
3272 // Let the SP know how we got here. This has a lot of interesting
3273 // uses down the line.
3274 sp.TeleportFlags = (TeleportFlags)teleportFlags;
3275
3327 if (sp.IsChildAgent) 3276 if (sp.IsChildAgent)
3328 { 3277 {
3329 m_log.DebugFormat( 3278 m_log.DebugFormat(
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index a2ed54f..969ff13 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -73,7 +73,6 @@ namespace OpenSim.Region.Framework.Scenes
73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>(); 73 protected List<ScenePresence> m_scenePresenceArray = new List<ScenePresence>();
74 74
75 protected internal EntityManager Entities = new EntityManager(); 75 protected internal EntityManager Entities = new EntityManager();
76 protected internal Dictionary<UUID, ScenePresence> RestorePresences = new Dictionary<UUID, ScenePresence>();
77 76
78 protected RegionInfo m_regInfo; 77 protected RegionInfo m_regInfo;
79 protected Scene m_parentScene; 78 protected Scene m_parentScene;
@@ -564,8 +563,8 @@ namespace OpenSim.Region.Framework.Scenes
564 { 563 {
565 ScenePresence newAvatar = null; 564 ScenePresence newAvatar = null;
566 565
566 // ScenePresence always defaults to child agent
567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance); 567 newAvatar = new ScenePresence(client, m_parentScene, m_regInfo, appearance);
568 newAvatar.IsChildAgent = true;
569 568
570 AddScenePresence(newAvatar); 569 AddScenePresence(newAvatar);
571 570
@@ -578,6 +577,7 @@ namespace OpenSim.Region.Framework.Scenes
578 /// <param name="presence"></param> 577 /// <param name="presence"></param>
579 protected internal void AddScenePresence(ScenePresence presence) 578 protected internal void AddScenePresence(ScenePresence presence)
580 { 579 {
580 // Always a child when added to the scene
581 bool child = presence.IsChildAgent; 581 bool child = presence.IsChildAgent;
582 582
583 if (child) 583 if (child)
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
index 91bb3a5..67e59c6 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPartInventory.cs
@@ -178,6 +178,8 @@ namespace OpenSim.Region.Framework.Scenes
178 { 178 {
179 item.LastOwnerID = item.OwnerID; 179 item.LastOwnerID = item.OwnerID;
180 item.OwnerID = ownerId; 180 item.OwnerID = ownerId;
181 item.PermsMask = 0;
182 item.PermsGranter = UUID.Zero;
181 } 183 }
182 } 184 }
183 } 185 }
@@ -695,7 +697,6 @@ namespace OpenSim.Region.Framework.Scenes
695 { 697 {
696 item.ParentID = m_part.UUID; 698 item.ParentID = m_part.UUID;
697 item.ParentPartID = m_part.UUID; 699 item.ParentPartID = m_part.UUID;
698 item.Flags = m_items[item.ItemID].Flags;
699 700
700 // If group permissions have been set on, check that the groupID is up to date in case it has 701 // If group permissions have been set on, check that the groupID is up to date in case it has
701 // changed since permissions were last set. 702 // changed since permissions were last set.
@@ -850,7 +851,7 @@ namespace OpenSim.Region.Framework.Scenes
850 /// <param name="xferManager"></param> 851 /// <param name="xferManager"></param>
851 public void RequestInventoryFile(IClientAPI client, IXfer xferManager) 852 public void RequestInventoryFile(IClientAPI client, IXfer xferManager)
852 { 853 {
853 bool changed = CreateInventoryFile(); 854 CreateInventoryFile();
854 855
855 if (m_inventorySerial == 0) // No inventory 856 if (m_inventorySerial == 0) // No inventory
856 { 857 {
@@ -1013,6 +1014,8 @@ namespace OpenSim.Region.Framework.Scenes
1013 item.BasePermissions &= item.NextPermissions; 1014 item.BasePermissions &= item.NextPermissions;
1014 item.EveryonePermissions &= item.NextPermissions; 1015 item.EveryonePermissions &= item.NextPermissions;
1015 item.OwnerChanged = true; 1016 item.OwnerChanged = true;
1017 item.PermsMask = 0;
1018 item.PermsGranter = UUID.Zero;
1016 } 1019 }
1017 } 1020 }
1018 } 1021 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 3a40196..1c276fa 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -130,6 +130,13 @@ namespace OpenSim.Region.Framework.Scenes
130 private bool m_updateflag; 130 private bool m_updateflag;
131 private byte m_movementflag; 131 private byte m_movementflag;
132 private Vector3? m_forceToApply; 132 private Vector3? m_forceToApply;
133 private TeleportFlags m_teleportFlags;
134 public TeleportFlags TeleportFlags
135 {
136 get { return m_teleportFlags; }
137 set { m_teleportFlags = value; }
138 }
139
133 private uint m_requestedSitTargetID; 140 private uint m_requestedSitTargetID;
134 private UUID m_requestedSitTargetUUID; 141 private UUID m_requestedSitTargetUUID;
135 public bool SitGround = false; 142 public bool SitGround = false;
@@ -928,10 +935,6 @@ namespace OpenSim.Region.Framework.Scenes
928 //else 935 //else
929 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); 936 // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid);
930 937
931 // On the next prim update, all objects will be sent
932 //
933 m_sceneViewer.Reset();
934
935 m_isChildAgent = false; 938 m_isChildAgent = false;
936 939
937 // send the animations of the other presences to me 940 // send the animations of the other presences to me
@@ -953,6 +956,10 @@ namespace OpenSim.Region.Framework.Scenes
953 /// </summary> 956 /// </summary>
954 public void MakeChildAgent() 957 public void MakeChildAgent()
955 { 958 {
959 // Reset these so that teleporting in and walking out isn't seen
960 // as teleporting back
961 m_teleportFlags = TeleportFlags.Default;
962
956 // It looks like m_animator is set to null somewhere, and MakeChild 963 // It looks like m_animator is set to null somewhere, and MakeChild
957 // is called after that. Probably in aborted teleports. 964 // is called after that. Probably in aborted teleports.
958 if (m_animator == null) 965 if (m_animator == null)
@@ -1108,7 +1115,7 @@ namespace OpenSim.Region.Framework.Scenes
1108 /// </summary> 1115 /// </summary>
1109 public void CompleteMovement(IClientAPI client) 1116 public void CompleteMovement(IClientAPI client)
1110 { 1117 {
1111 DateTime startTime = DateTime.Now; 1118// DateTime startTime = DateTime.Now;
1112 1119
1113 m_log.DebugFormat( 1120 m_log.DebugFormat(
1114 "[SCENE PRESENCE]: Completing movement of {0} into region {1}", 1121 "[SCENE PRESENCE]: Completing movement of {0} into region {1}",
@@ -1161,9 +1168,9 @@ namespace OpenSim.Region.Framework.Scenes
1161 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1168 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1162 } 1169 }
1163 1170
1164 m_log.DebugFormat( 1171// m_log.DebugFormat(
1165 "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms", 1172// "[SCENE PRESENCE]: Completing movement of {0} into region {1} took {2}ms",
1166 client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds); 1173// client.Name, Scene.RegionInfo.RegionName, (DateTime.Now - startTime).Milliseconds);
1167 } 1174 }
1168 1175
1169 /// <summary> 1176 /// <summary>
@@ -2952,10 +2959,6 @@ namespace OpenSim.Region.Framework.Scenes
2952 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0) 2959 if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
2953 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles); 2960 ControllingClient.SetChildAgentThrottle(cAgentData.Throttles);
2954 2961
2955 // Sends out the objects in the user's draw distance if m_sendTasksToChild is true.
2956 if (m_scene.m_seeIntoRegionFromNeighbor)
2957 m_sceneViewer.Reset();
2958
2959 //cAgentData.AVHeight; 2962 //cAgentData.AVHeight;
2960 m_rootRegionHandle = cAgentData.RegionHandle; 2963 m_rootRegionHandle = cAgentData.RegionHandle;
2961 //m_velocity = cAgentData.Velocity; 2964 //m_velocity = cAgentData.Velocity;