diff options
author | Mic Bowman | 2010-11-23 16:08:10 -0800 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2010-11-27 01:14:36 +0000 |
commit | 541a7660e06206c9a9eb2426dee0449afb554921 (patch) | |
tree | 16a99d09acd76e0c53b37300de069e0a4c6a8163 | |
parent | Another attempt at fixing failing test for creator info. (diff) | |
download | opensim-SC-541a7660e06206c9a9eb2426dee0449afb554921.zip opensim-SC-541a7660e06206c9a9eb2426dee0449afb554921.tar.gz opensim-SC-541a7660e06206c9a9eb2426dee0449afb554921.tar.bz2 opensim-SC-541a7660e06206c9a9eb2426dee0449afb554921.tar.xz |
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.
Diffstat (limited to '')
6 files changed, 149 insertions, 170 deletions
diff --git a/OpenSim/Framework/AgentCircuitData.cs b/OpenSim/Framework/AgentCircuitData.cs index cc9fcea..1600bdc 100644 --- a/OpenSim/Framework/AgentCircuitData.cs +++ b/OpenSim/Framework/AgentCircuitData.cs | |||
@@ -302,31 +302,26 @@ namespace OpenSim.Framework | |||
302 | if (args["start_pos"] != null) | 302 | if (args["start_pos"] != null) |
303 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); | 303 | Vector3.TryParse(args["start_pos"].AsString(), out startpos); |
304 | 304 | ||
305 | // DEBUG ON | 305 | m_log.InfoFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); |
306 | m_log.WarnFormat("[AGENTCIRCUITDATA] agentid={0}, child={1}, startpos={2}",AgentID,child,startpos.ToString()); | ||
307 | // DEBUG OFF | ||
308 | 306 | ||
309 | try { | 307 | try { |
310 | // Unpack various appearance elements | 308 | // Unpack various appearance elements |
311 | Appearance = new AvatarAppearance(AgentID); | 309 | Appearance = new AvatarAppearance(AgentID); |
312 | 310 | ||
313 | // Eventually this code should be deprecated, use full appearance | 311 | // Eventually this code should be deprecated, use full appearance |
314 | // packing in packed_appearance | 312 | // packing in packed_appearance |
315 | if (args["appearance_serial"] != null) | 313 | if (args["appearance_serial"] != null) |
316 | Appearance.Serial = args["appearance_serial"].AsInteger(); | 314 | Appearance.Serial = args["appearance_serial"].AsInteger(); |
317 | 315 | ||
318 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) | 316 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"].Type == OSDType.Map)) |
319 | { | 317 | { |
320 | Appearance.Unpack((OSDMap)args["packed_appearance"]); | 318 | Appearance.Unpack((OSDMap)args["packed_appearance"]); |
321 | // DEBUG ON | 319 | m_log.InfoFormat("[AGENTCIRCUITDATA] unpacked appearance"); |
322 | m_log.WarnFormat("[AGENTCIRCUITDATA] unpacked appearance"); | 320 | } |
323 | // DEBUG OFF | 321 | else |
322 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
324 | } | 323 | } |
325 | // DEBUG ON | 324 | catch (Exception e) |
326 | else | ||
327 | m_log.Warn("[AGENTCIRCUITDATA] failed to find a valid packed_appearance"); | ||
328 | // DEBUG OFF | ||
329 | } catch (Exception e) | ||
330 | { | 325 | { |
331 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); | 326 | m_log.ErrorFormat("[AGENTCIRCUITDATA] failed to unpack appearance; {0}",e.Message); |
332 | } | 327 | } |
diff --git a/OpenSim/Framework/ChildAgentDataUpdate.cs b/OpenSim/Framework/ChildAgentDataUpdate.cs index a227338..ce0b2fb 100644 --- a/OpenSim/Framework/ChildAgentDataUpdate.cs +++ b/OpenSim/Framework/ChildAgentDataUpdate.cs | |||
@@ -331,9 +331,7 @@ namespace OpenSim.Framework | |||
331 | 331 | ||
332 | public virtual OSDMap Pack() | 332 | public virtual OSDMap Pack() |
333 | { | 333 | { |
334 | // DEBUG ON | 334 | m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Pack data"); |
335 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Pack data"); | ||
336 | // DEBUG OFF | ||
337 | 335 | ||
338 | OSDMap args = new OSDMap(); | 336 | OSDMap args = new OSDMap(); |
339 | args["message_type"] = OSD.FromString("AgentData"); | 337 | args["message_type"] = OSD.FromString("AgentData"); |
@@ -454,9 +452,7 @@ namespace OpenSim.Framework | |||
454 | /// <param name="hash"></param> | 452 | /// <param name="hash"></param> |
455 | public virtual void Unpack(OSDMap args) | 453 | public virtual void Unpack(OSDMap args) |
456 | { | 454 | { |
457 | // DEBUG ON | 455 | m_log.InfoFormat("[CHILDAGENTDATAUPDATE] Unpack data"); |
458 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] Unpack data"); | ||
459 | // DEBUG OFF | ||
460 | 456 | ||
461 | if (args.ContainsKey("region_id")) | 457 | if (args.ContainsKey("region_id")) |
462 | UUID.TryParse(args["region_id"].AsString(), out RegionID); | 458 | UUID.TryParse(args["region_id"].AsString(), out RegionID); |
@@ -613,10 +609,8 @@ namespace OpenSim.Framework | |||
613 | 609 | ||
614 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) | 610 | if (args.ContainsKey("packed_appearance") && (args["packed_appearance"]).Type == OSDType.Map) |
615 | Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); | 611 | Appearance = new AvatarAppearance(AgentID,(OSDMap)args["packed_appearance"]); |
616 | // DEBUG ON | ||
617 | else | 612 | else |
618 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); | 613 | m_log.WarnFormat("[CHILDAGENTDATAUPDATE] No packed appearance"); |
619 | // DEBUG OFF | ||
620 | 614 | ||
621 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) | 615 | if ((args["controllers"] != null) && (args["controllers"]).Type == OSDType.Array) |
622 | { | 616 | { |
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index 0df4585..ab1c206 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs | |||
@@ -183,7 +183,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
183 | }); | 183 | }); |
184 | } | 184 | } |
185 | 185 | ||
186 | // m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); | 186 | m_log.WarnFormat("[AVFACTORY]: Complete texture check for {0}",client.AgentId); |
187 | } | 187 | } |
188 | 188 | ||
189 | // Process the visual params, this may change height as well | 189 | // Process the visual params, this may change height as well |
@@ -196,12 +196,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
196 | sp.SetHeight(sp.Appearance.AvatarHeight); | 196 | sp.SetHeight(sp.Appearance.AvatarHeight); |
197 | } | 197 | } |
198 | } | 198 | } |
199 | |||
200 | // Send the appearance back to the avatar, not clear that this is needed | ||
201 | sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
202 | // AvatarAppearance avp = sp.Appearance; | ||
203 | // sp.ControllingClient.SendAppearance(avp.Owner,avp.VisualParams,avp.Texture.GetBytes()); | ||
204 | |||
205 | } | 199 | } |
206 | 200 | ||
207 | 201 | ||
@@ -274,21 +268,6 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
274 | 268 | ||
275 | // Send the appearance to everyone in the scene | 269 | // Send the appearance to everyone in the scene |
276 | sp.SendAppearanceToAllOtherAgents(); | 270 | sp.SendAppearanceToAllOtherAgents(); |
277 | // sp.ControllingClient.SendAvatarDataImmediate(sp); | ||
278 | |||
279 | // Send the appearance back to the avatar | ||
280 | // AvatarAppearance avp = sp.Appearance; | ||
281 | // sp.ControllingClient.SendAppearance(avp.Owner, avp.VisualParams, avp.Texture.GetBytes()); | ||
282 | |||
283 | /* | ||
284 | // this needs to be fixed, the flag should be on scene presence not the region module | ||
285 | // Start the animations if necessary | ||
286 | if (!m_startAnimationSet) | ||
287 | { | ||
288 | sp.Animator.UpdateMovementAnimations(); | ||
289 | m_startAnimationSet = true; | ||
290 | } | ||
291 | */ | ||
292 | } | 271 | } |
293 | 272 | ||
294 | private void HandleAppearanceSave(UUID agentid) | 273 | private void HandleAppearanceSave(UUID agentid) |
@@ -374,6 +353,7 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
374 | 353 | ||
375 | // m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId); | 354 | // m_log.WarnFormat("[AVFACTORY]: AvatarIsWearing called for {0}", client.AgentId); |
376 | 355 | ||
356 | // operate on a copy of the appearance so we don't have to lock anything | ||
377 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); | 357 | AvatarAppearance avatAppearance = new AvatarAppearance(sp.Appearance, false); |
378 | 358 | ||
379 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) | 359 | foreach (AvatarWearingArgs.Wearable wear in e.NowWearing) |
@@ -388,9 +368,11 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory | |||
388 | SetAppearanceAssets(sp.UUID, ref avatAppearance); | 368 | SetAppearanceAssets(sp.UUID, ref avatAppearance); |
389 | 369 | ||
390 | // could get fancier with the locks here, but in the spirit of "last write wins" | 370 | // could get fancier with the locks here, but in the spirit of "last write wins" |
391 | // this should work correctly | 371 | // this should work correctly, also, we don't need to send the appearance here |
372 | // since the "iswearing" will trigger a new set of visual param and baked texture changes | ||
373 | // when those complete, the new appearance will be sent | ||
392 | sp.Appearance = avatAppearance; | 374 | sp.Appearance = avatAppearance; |
393 | m_scene.AvatarService.SetAppearance(client.AgentId, sp.Appearance); | 375 | QueueAppearanceSave(client.AgentId); |
394 | } | 376 | } |
395 | 377 | ||
396 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) | 378 | private void SetAppearanceAssets(UUID userID, ref AvatarAppearance appearance) |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index f02a922..b57dc88 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -903,8 +903,10 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
903 | } | 903 | } |
904 | 904 | ||
905 | agent.MakeChildAgent(); | 905 | agent.MakeChildAgent(); |
906 | |||
906 | // now we have a child agent in this region. Request all interesting data about other (root) agents | 907 | // now we have a child agent in this region. Request all interesting data about other (root) agents |
907 | agent.SendInitialFullUpdateToAllClients(); | 908 | agent.SendOtherAgentsAvatarDataToMe(); |
909 | agent.SendOtherAgentsAppearanceToMe(); | ||
908 | 910 | ||
909 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); | 911 | CrossAttachmentsIntoNewRegion(neighbourRegion, agent, true); |
910 | 912 | ||
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 | |||
703 | // Note: This won't send data *to* other clients in that region (children don't send) | 703 | // Note: This won't send data *to* other clients in that region (children don't send) |
704 | 704 | ||
705 | // MIC: This gets called again in CompleteMovement | 705 | // MIC: This gets called again in CompleteMovement |
706 | SendInitialFullUpdateToAllClients(); | 706 | // SendInitialFullUpdateToAllClients(); |
707 | SendOtherAgentsAvatarDataToMe(); | ||
708 | SendOtherAgentsAppearanceToMe(); | ||
707 | 709 | ||
708 | RegisterToEvents(); | 710 | RegisterToEvents(); |
709 | SetDirectionVectors(); | 711 | SetDirectionVectors(); |
@@ -1613,7 +1615,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1613 | { | 1615 | { |
1614 | AbsolutePosition = part.AbsolutePosition; | 1616 | AbsolutePosition = part.AbsolutePosition; |
1615 | Velocity = Vector3.Zero; | 1617 | Velocity = Vector3.Zero; |
1616 | SendFullUpdateToAllClients(); | 1618 | SendAvatarDataToAllAgents(); |
1617 | 1619 | ||
1618 | //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); | 1620 | //HandleAgentSit(ControllingClient, m_requestedSitTargetUUID); |
1619 | } | 1621 | } |
@@ -1688,7 +1690,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1688 | m_parentPosition = Vector3.Zero; | 1690 | m_parentPosition = Vector3.Zero; |
1689 | 1691 | ||
1690 | m_parentID = 0; | 1692 | m_parentID = 0; |
1691 | SendFullUpdateToAllClients(); | 1693 | SendAvatarDataToAllAgents(); |
1692 | m_requestedSitTargetID = 0; | 1694 | m_requestedSitTargetID = 0; |
1693 | if (m_physicsActor != null && m_appearance != null) | 1695 | if (m_physicsActor != null && m_appearance != null) |
1694 | { | 1696 | { |
@@ -2154,7 +2156,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2154 | RemoveFromPhysicalScene(); | 2156 | RemoveFromPhysicalScene(); |
2155 | 2157 | ||
2156 | Animator.TrySetMovementAnimation(sitAnimation); | 2158 | Animator.TrySetMovementAnimation(sitAnimation); |
2157 | SendFullUpdateToAllClients(); | 2159 | SendAvatarDataToAllAgents(); |
2158 | // This may seem stupid, but Our Full updates don't send avatar rotation :P | 2160 | // This may seem stupid, but Our Full updates don't send avatar rotation :P |
2159 | // So we're also sending a terse update (which has avatar rotation) | 2161 | // So we're also sending a terse update (which has avatar rotation) |
2160 | // [Update] We do now. | 2162 | // [Update] We do now. |
@@ -2379,165 +2381,169 @@ namespace OpenSim.Region.Framework.Scenes | |||
2379 | } | 2381 | } |
2380 | 2382 | ||
2381 | /// <summary> | 2383 | /// <summary> |
2382 | /// Tell other client about this avatar (The client previously didn't know or had outdated details about this avatar) | 2384 | /// Do everything required once a client completes its movement into a region and becomes |
2385 | /// a root agent. | ||
2383 | /// </summary> | 2386 | /// </summary> |
2384 | /// <param name="remoteAvatar"></param> | 2387 | private void SendInitialData() |
2385 | public void SendFullUpdateToOtherClient(ScenePresence remoteAvatar) | ||
2386 | { | 2388 | { |
2387 | // 2 stage check is needed. | 2389 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before |
2388 | if (remoteAvatar == null) | 2390 | // the inventory arrives |
2389 | return; | 2391 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); |
2390 | |||
2391 | IClientAPI cl = remoteAvatar.ControllingClient; | ||
2392 | if (cl == null) | ||
2393 | return; | ||
2394 | 2392 | ||
2395 | if (m_appearance.Texture == null) | 2393 | // This agent just became root. We are going to tell everyone about it. The process of |
2396 | return; | 2394 | // getting other avatars information was initiated in the constructor... don't do it |
2395 | // again here... | ||
2396 | SendAvatarDataToAllAgents(); | ||
2397 | 2397 | ||
2398 | // MT: This is needed for sit. It's legal to send it to oneself, and the name | 2398 | // We have an appearance but we may not have the baked textures. Check the asset cache |
2399 | // of the method is a misnomer | 2399 | // to see if all the baked textures are already here. |
2400 | // | 2400 | if (m_scene.AvatarFactory != null) |
2401 | // if (LocalId == remoteAvatar.LocalId) | 2401 | { |
2402 | // { | 2402 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) |
2403 | // m_log.WarnFormat("[SCENEPRESENCE]: An agent is attempting to send avatar data to itself; {0}", UUID); | 2403 | { |
2404 | // return; | 2404 | // m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); |
2405 | // } | 2405 | SendAppearanceToAgent(this); |
2406 | 2406 | ||
2407 | if (IsChildAgent) | 2407 | // If the avatars baked textures are all in the cache, then we have a |
2408 | // complete appearance... send it out, if not, then we'll send it when | ||
2409 | // the avatar finishes updating its appearance | ||
2410 | SendAppearanceToAllOtherAgents(); | ||
2411 | } | ||
2412 | } | ||
2413 | else | ||
2408 | { | 2414 | { |
2409 | m_log.WarnFormat("[SCENEPRESENCE]: A child agent is attempting to send out avatar data; {0}", UUID); | 2415 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); |
2410 | return; | ||
2411 | } | 2416 | } |
2412 | |||
2413 | remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); | ||
2414 | m_scene.StatsReporter.AddAgentUpdates(1); | ||
2415 | } | 2417 | } |
2416 | 2418 | ||
2417 | /// <summary> | 2419 | /// <summary> |
2418 | /// Tell *ALL* agents about this agent | 2420 | /// Send this agent's avatar data to all other root and child agents in the scene |
2421 | /// This agent must be root. This avatar will receive its own update. | ||
2419 | /// </summary> | 2422 | /// </summary> |
2420 | public void SendInitialFullUpdateToAllClients() | 2423 | public void SendAvatarDataToAllAgents() |
2421 | { | 2424 | { |
2422 | m_perfMonMS = Util.EnvironmentTickCount(); | 2425 | // only send update from root agents to other clients; children are only "listening posts" |
2423 | int avUpdates = 0; | 2426 | if (IsChildAgent) |
2424 | m_scene.ForEachScenePresence(delegate(ScenePresence avatar) | ||
2425 | { | 2427 | { |
2426 | ++avUpdates; | 2428 | m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent"); |
2427 | 2429 | return; | |
2428 | // Don't update ourselves | 2430 | } |
2429 | if (avatar.LocalId == LocalId) | 2431 | |
2430 | return; | 2432 | m_perfMonMS = Util.EnvironmentTickCount(); |
2431 | |||
2432 | // If this is a root agent, then get info about the avatar | ||
2433 | if (!IsChildAgent) | ||
2434 | { | ||
2435 | SendFullUpdateToOtherClient(avatar); | ||
2436 | } | ||
2437 | 2433 | ||
2438 | // If the other avatar is a root | 2434 | int count = 0; |
2439 | if (!avatar.IsChildAgent) | 2435 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2440 | { | 2436 | { |
2441 | avatar.SendFullUpdateToOtherClient(this); | 2437 | SendAvatarDataToAgent(scenePresence); |
2442 | avatar.SendAppearanceToOtherAgent(this); | 2438 | count++; |
2443 | avatar.Animator.SendAnimPackToClient(ControllingClient); | 2439 | }); |
2444 | } | ||
2445 | }); | ||
2446 | 2440 | ||
2447 | m_scene.StatsReporter.AddAgentUpdates(avUpdates); | 2441 | m_scene.StatsReporter.AddAgentUpdates(count); |
2448 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2442 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2449 | |||
2450 | //Animator.SendAnimPack(); | ||
2451 | } | 2443 | } |
2452 | 2444 | ||
2453 | public void SendFullUpdateToAllClients() | 2445 | /// <summary> |
2446 | /// Send avatar data for all other root agents to this agent, this agent | ||
2447 | /// can be either a child or root | ||
2448 | /// </summary> | ||
2449 | public void SendOtherAgentsAvatarDataToMe() | ||
2454 | { | 2450 | { |
2455 | m_perfMonMS = Util.EnvironmentTickCount(); | 2451 | m_perfMonMS = Util.EnvironmentTickCount(); |
2456 | 2452 | ||
2457 | // only send update from root agents to other clients; children are only "listening posts" | ||
2458 | if (IsChildAgent) | ||
2459 | { | ||
2460 | m_log.Warn("[SCENEPRESENCE] attempt to send update from a childagent"); | ||
2461 | return; | ||
2462 | } | ||
2463 | |||
2464 | int count = 0; | 2453 | int count = 0; |
2465 | m_scene.ForEachScenePresence(delegate(ScenePresence sp) | 2454 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2466 | { | 2455 | { |
2467 | if (sp.IsChildAgent) | 2456 | // only send information about root agents |
2468 | return; | 2457 | if (scenePresence.IsChildAgent) |
2469 | SendFullUpdateToOtherClient(sp); | 2458 | return; |
2470 | ++count; | 2459 | |
2471 | }); | 2460 | // only send information about other root agents |
2461 | if (scenePresence.UUID == UUID) | ||
2462 | return; | ||
2463 | |||
2464 | scenePresence.SendAvatarDataToAgent(this); | ||
2465 | count++; | ||
2466 | }); | ||
2467 | |||
2472 | m_scene.StatsReporter.AddAgentUpdates(count); | 2468 | m_scene.StatsReporter.AddAgentUpdates(count); |
2473 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2469 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2474 | |||
2475 | Animator.SendAnimPack(); | ||
2476 | } | 2470 | } |
2477 | 2471 | ||
2478 | /// <summary> | 2472 | /// <summary> |
2479 | /// Do everything required once a client completes its movement into a region | 2473 | /// Send avatar data to an agent. |
2480 | /// </summary> | 2474 | /// </summary> |
2481 | public void SendInitialData() | 2475 | /// <param name="avatar"></param> |
2476 | private void SendAvatarDataToAgent(ScenePresence avatar) | ||
2482 | { | 2477 | { |
2483 | // Moved this into CompleteMovement to ensure that m_appearance is initialized before | 2478 | // m_log.WarnFormat("[SP] Send avatar data from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); |
2484 | // the inventory arrives | ||
2485 | // m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); | ||
2486 | 2479 | ||
2487 | m_controllingClient.SendAvatarDataImmediate(this); | 2480 | avatar.ControllingClient.SendAvatarDataImmediate(this); |
2488 | if (m_scene.AvatarFactory != null) | 2481 | Animator.SendAnimPackToClient(avatar.ControllingClient); |
2489 | { | 2482 | } |
2490 | if (m_scene.AvatarFactory.ValidateBakedTextureCache(m_controllingClient)) | 2483 | |
2491 | { | 2484 | /// <summary> |
2492 | // m_log.WarnFormat("[SCENEPRESENCE]: baked textures are in the cache for {0}", Name); | 2485 | /// Send this agent's appearance to all other root and child agents in the scene |
2493 | m_controllingClient.SendAppearance( | 2486 | /// This agent must be root. |
2494 | m_appearance.Owner,m_appearance.VisualParams,m_appearance.Texture.GetBytes()); | 2487 | /// </summary> |
2495 | } | 2488 | public void SendAppearanceToAllOtherAgents() |
2496 | } | 2489 | { |
2497 | else | 2490 | // only send update from root agents to other clients; children are only "listening posts" |
2491 | if (IsChildAgent) | ||
2498 | { | 2492 | { |
2499 | m_log.WarnFormat("[SCENEPRESENCE]: AvatarFactory not set for {0}", Name); | 2493 | m_log.Warn("[SCENEPRESENCE] attempt to send avatar data from a child agent"); |
2494 | return; | ||
2500 | } | 2495 | } |
2496 | |||
2497 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2498 | |||
2499 | int count = 0; | ||
2500 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | ||
2501 | { | ||
2502 | if (scenePresence.UUID == UUID) | ||
2503 | return; | ||
2501 | 2504 | ||
2502 | SendInitialFullUpdateToAllClients(); | 2505 | SendAppearanceToAgent(scenePresence); |
2506 | count++; | ||
2507 | }); | ||
2508 | |||
2509 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
2510 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2503 | } | 2511 | } |
2504 | 2512 | ||
2505 | /// <summary> | 2513 | /// <summary> |
2506 | /// | 2514 | /// Send appearance from all other root agents to this agent. this agent |
2515 | /// can be either root or child | ||
2507 | /// </summary> | 2516 | /// </summary> |
2508 | public void SendAppearanceToAllOtherAgents() | 2517 | public void SendOtherAgentsAppearanceToMe() |
2509 | { | 2518 | { |
2510 | // DEBUG ON | ||
2511 | // m_log.WarnFormat("[SCENEPRESENCE]: Send appearance from {0} to all other agents", m_uuid); | ||
2512 | // DEBUG OFF | ||
2513 | m_perfMonMS = Util.EnvironmentTickCount(); | 2519 | m_perfMonMS = Util.EnvironmentTickCount(); |
2514 | 2520 | ||
2521 | int count = 0; | ||
2515 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2522 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2516 | { | 2523 | { |
2517 | if (scenePresence.UUID != UUID) | 2524 | // only send information about root agents |
2518 | { | 2525 | if (scenePresence.IsChildAgent) |
2519 | SendAppearanceToOtherAgent(scenePresence); | 2526 | return; |
2520 | } | 2527 | |
2528 | // only send information about other root agents | ||
2529 | if (scenePresence.UUID == UUID) | ||
2530 | return; | ||
2531 | |||
2532 | scenePresence.SendAppearanceToAgent(this); | ||
2533 | count++; | ||
2521 | }); | 2534 | }); |
2522 | 2535 | ||
2536 | m_scene.StatsReporter.AddAgentUpdates(count); | ||
2523 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 2537 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2524 | } | 2538 | } |
2525 | 2539 | ||
2526 | /// <summary> | 2540 | /// <summary> |
2527 | /// Send appearance data to an agent that isn't this one. | 2541 | /// Send appearance data to an agent. |
2528 | /// </summary> | 2542 | /// </summary> |
2529 | /// <param name="avatar"></param> | 2543 | /// <param name="avatar"></param> |
2530 | public void SendAppearanceToOtherAgent(ScenePresence avatar) | 2544 | private void SendAppearanceToAgent(ScenePresence avatar) |
2531 | { | 2545 | { |
2532 | if (LocalId == avatar.LocalId) | ||
2533 | { | ||
2534 | m_log.WarnFormat("[SCENE PRESENCE]: An agent is attempting to send appearance data to itself; {0}", UUID); | ||
2535 | return; | ||
2536 | } | ||
2537 | |||
2538 | // DEBUG ON | ||
2539 | // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); | 2546 | // m_log.WarnFormat("[SP] Send appearance from {0} to {1}",m_uuid,avatar.ControllingClient.AgentId); |
2540 | // DEBUG OFF | ||
2541 | 2547 | ||
2542 | avatar.ControllingClient.SendAppearance( | 2548 | avatar.ControllingClient.SendAppearance( |
2543 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); | 2549 | m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); |
@@ -3050,9 +3056,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3050 | 3056 | ||
3051 | public void CopyFrom(AgentData cAgent) | 3057 | public void CopyFrom(AgentData cAgent) |
3052 | { | 3058 | { |
3053 | // DEBUG ON | ||
3054 | m_log.ErrorFormat("[SCENEPRESENCE] CALLING COPYFROM"); | ||
3055 | // DEBUG OFF | ||
3056 | m_originRegionID = cAgent.RegionID; | 3059 | m_originRegionID = cAgent.RegionID; |
3057 | 3060 | ||
3058 | m_callbackURI = cAgent.CallbackURI; | 3061 | m_callbackURI = cAgent.CallbackURI; |
diff --git a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs index 0c8113e..ccf5289 100644 --- a/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs +++ b/OpenSim/Region/OptionalModules/Avatar/XmlRpcGroups/GroupsModule.cs | |||
@@ -1173,10 +1173,13 @@ namespace OpenSim.Region.OptionalModules.Avatar.XmlRpcGroups | |||
1173 | presence = scene.GetScenePresence(AgentID); | 1173 | presence = scene.GetScenePresence(AgentID); |
1174 | if (presence != null) | 1174 | if (presence != null) |
1175 | { | 1175 | { |
1176 | presence.Grouptitle = Title; | 1176 | if (presence.Grouptitle != Title) |
1177 | { | ||
1178 | presence.Grouptitle = Title; | ||
1177 | 1179 | ||
1178 | // FixMe: Ter suggests a "Schedule" method that I can't find. | 1180 | if (! presence.IsChildAgent) |
1179 | presence.SendFullUpdateToAllClients(); | 1181 | presence.SendAvatarDataToAllAgents(); |
1182 | } | ||
1180 | } | 1183 | } |
1181 | } | 1184 | } |
1182 | } | 1185 | } |