aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
authorUbitUmarov2014-08-22 20:01:07 +0100
committerUbitUmarov2014-08-22 20:01:07 +0100
commit0295e6822dd6408b6dc6580b4a7a92b0f057d4b8 (patch)
tree15c6b151ecc65459df94dddafc4c2fc7d4994d7a /OpenSim/Region/Framework
parentMerge branch 'master' into ubitworkmaster (diff)
downloadopensim-SC_OLD-0295e6822dd6408b6dc6580b4a7a92b0f057d4b8.zip
opensim-SC_OLD-0295e6822dd6408b6dc6580b4a7a92b0f057d4b8.tar.gz
opensim-SC_OLD-0295e6822dd6408b6dc6580b4a7a92b0f057d4b8.tar.bz2
opensim-SC_OLD-0295e6822dd6408b6dc6580b4a7a92b0f057d4b8.tar.xz
some cleanup ( well or not )
Diffstat (limited to 'OpenSim/Region/Framework')
-rw-r--r--OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs10
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs11
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectPart.cs73
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs203
5 files changed, 234 insertions, 81 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
index 668087f..fdadd32 100644
--- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
+++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs
@@ -576,6 +576,16 @@ namespace OpenSim.Region.Framework.Scenes.Animation
576 m_scenePresence.SendAnimPack(animations, seqs, objectIDs); 576 m_scenePresence.SendAnimPack(animations, seqs, objectIDs);
577 } 577 }
578 578
579 public void GetArrays(out UUID[] animIDs, out int[] sequenceNums, out UUID[] objectIDs)
580 {
581 animIDs = null;
582 sequenceNums = null;
583 objectIDs = null;
584
585 if(m_animations != null)
586 m_animations.GetArrays(out animIDs, out sequenceNums, out objectIDs);
587 }
588
579 public void SendAnimPackToClient(IClientAPI client) 589 public void SendAnimPackToClient(IClientAPI client)
580 { 590 {
581 if (m_scenePresence.IsChildAgent) 591 if (m_scenePresence.IsChildAgent)
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0266faf..aa81000 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -3000,13 +3000,18 @@ namespace OpenSim.Region.Framework.Scenes
3000 if (sp == null) 3000 if (sp == null)
3001 { 3001 {
3002 m_log.DebugFormat( 3002 m_log.DebugFormat(
3003 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}", 3003 "[SCENE]: Adding new child scene presence {0} {1} to scene {2} at pos {3}, tpflags: {4}",
3004 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos); 3004 client.Name, client.AgentId, RegionInfo.RegionName, client.StartPos,
3005 ((TPFlags)aCircuit.teleportFlags).ToString());
3005 3006
3006 m_clientManager.Add(client); 3007 m_clientManager.Add(client);
3007 SubscribeToClientEvents(client); 3008 SubscribeToClientEvents(client);
3008 3009
3009 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type); 3010 sp = m_sceneGraph.CreateAndAddChildScenePresence(client, aCircuit.Appearance, type);
3011
3012 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3013
3014/* done in completMovement
3010 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46); 3015 InventoryFolderBase cof = InventoryService.GetFolderForType(client.AgentId, (AssetType)46);
3011 if (cof == null) 3016 if (cof == null)
3012 sp.COF = UUID.Zero; 3017 sp.COF = UUID.Zero;
@@ -3014,9 +3019,9 @@ namespace OpenSim.Region.Framework.Scenes
3014 sp.COF = cof.ID; 3019 sp.COF = cof.ID;
3015 3020
3016 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF); 3021 m_log.DebugFormat("[SCENE]: COF for {0} is {1}", client.AgentId, sp.COF);
3022 */
3017 m_eventManager.TriggerOnNewPresence(sp); 3023 m_eventManager.TriggerOnNewPresence(sp);
3018 3024
3019 sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags;
3020 } 3025 }
3021 else 3026 else
3022 { 3027 {
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index dd5ee65..d3dd5d7 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2717,15 +2717,15 @@ namespace OpenSim.Region.Framework.Scenes
2717 return; 2717 return;
2718 } 2718 }
2719 } 2719 }
2720 2720
2721 RootPart.SendFullUpdateToAllClients(); 2721 RootPart.SendFullUpdateToAllClientsInternal();
2722 2722
2723 SceneObjectPart[] parts = m_parts.GetArray(); 2723 SceneObjectPart[] parts = m_parts.GetArray();
2724 for (int i = 0; i < parts.Length; i++) 2724 for (int i = 0; i < parts.Length; i++)
2725 { 2725 {
2726 SceneObjectPart part = parts[i]; 2726 SceneObjectPart part = parts[i];
2727 if (part != RootPart) 2727 if (part != RootPart)
2728 part.SendFullUpdateToAllClients(); 2728 part.SendFullUpdateToAllClientsInternal();
2729 } 2729 }
2730 } 2730 }
2731 2731
@@ -2740,16 +2740,6 @@ namespace OpenSim.Region.Framework.Scenes
2740 if (IsDeleted) 2740 if (IsDeleted)
2741 return; 2741 return;
2742 2742
2743 if (IsAttachment)
2744 {
2745 ScenePresence sp = m_scene.GetScenePresence(AttachedAvatar);
2746 if (sp != null)
2747 {
2748 sp.SendAttachmentUpdate(RootPart, UpdateRequired.TERSE);
2749 return;
2750 }
2751 }
2752
2753 RootPart.SendTerseUpdateToAllClients(); 2743 RootPart.SendTerseUpdateToAllClients();
2754 } 2744 }
2755 2745
@@ -2781,7 +2771,7 @@ namespace OpenSim.Region.Framework.Scenes
2781 2771
2782 SceneObjectPart[] parts = m_parts.GetArray(); 2772 SceneObjectPart[] parts = m_parts.GetArray();
2783 for (int i = 0; i < parts.Length; i++) 2773 for (int i = 0; i < parts.Length; i++)
2784 parts[i].SendTerseUpdateToAllClients(); 2774 parts[i].SendTerseUpdateToAllClientsInternal();
2785 } 2775 }
2786 2776
2787 /// <summary> 2777 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
index 98ea880..0930820 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs
@@ -862,7 +862,8 @@ namespace OpenSim.Region.Framework.Scenes
862 { 862 {
863 Vector3 offset = (m_offsetPosition - oldpos); 863 Vector3 offset = (m_offsetPosition - oldpos);
864 av.AbsolutePosition += offset; 864 av.AbsolutePosition += offset;
865 av.SendAvatarDataToAllAgents(); 865// av.SendAvatarDataToAllAgents();
866 av.SendTerseUpdateToAllClients();
866 } 867 }
867 } 868 }
868 } 869 }
@@ -3257,7 +3258,7 @@ namespace OpenSim.Region.Framework.Scenes
3257 /// <summary> 3258 /// <summary>
3258 /// Send a full update for this part to all clients. 3259 /// Send a full update for this part to all clients.
3259 /// </summary> 3260 /// </summary>
3260 public void SendFullUpdateToAllClients() 3261 public void SendFullUpdateToAllClientsInternal()
3261 { 3262 {
3262 if (ParentGroup == null) 3263 if (ParentGroup == null)
3263 return; 3264 return;
@@ -3276,6 +3277,36 @@ namespace OpenSim.Region.Framework.Scenes
3276 }); 3277 });
3277 } 3278 }
3278 3279
3280 public void SendFullUpdateToAllClients()
3281 {
3282 if (ParentGroup == null)
3283 return;
3284
3285 // Update the "last" values
3286 m_lastPosition = OffsetPosition;
3287 m_lastRotation = RotationOffset;
3288 m_lastVelocity = Velocity;
3289 m_lastAcceleration = Acceleration;
3290 m_lastAngularVelocity = AngularVelocity;
3291 m_lastUpdateSentTime = Environment.TickCount;
3292
3293 if (ParentGroup.IsAttachment)
3294 {
3295 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
3296 if (sp != null)
3297 {
3298 sp.SendAttachmentUpdate(this, UpdateRequired.FULL);
3299 }
3300 }
3301 else
3302 {
3303 ParentGroup.Scene.ForEachScenePresence(delegate(ScenePresence avatar)
3304 {
3305 SendFullUpdate(avatar.ControllingClient);
3306 });
3307 }
3308 }
3309
3279 /// <summary> 3310 /// <summary>
3280 /// Sends a full update to the client 3311 /// Sends a full update to the client
3281 /// </summary> 3312 /// </summary>
@@ -3345,24 +3376,24 @@ namespace OpenSim.Region.Framework.Scenes
3345 !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) || 3376 !OffsetPosition.ApproxEquals(m_lastPosition, POSITION_TOLERANCE) ||
3346 Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE) 3377 Environment.TickCount - m_lastUpdateSentTime > TIME_MS_TOLERANCE)
3347 { 3378 {
3348 SendTerseUpdateToAllClients(); 3379 SendTerseUpdateToAllClientsInternal();
3349
3350 } 3380 }
3351 break; 3381 break;
3352 } 3382 }
3353 case UpdateRequired.FULL: 3383 case UpdateRequired.FULL:
3354 { 3384 {
3355 ClearUpdateSchedule(); 3385 ClearUpdateSchedule();
3356 SendFullUpdateToAllClients(); 3386 SendFullUpdateToAllClientsInternal();
3357 break; 3387 break;
3358 } 3388 }
3359 } 3389 }
3360 } 3390 }
3361 3391
3392
3362 /// <summary> 3393 /// <summary>
3363 /// Send a terse update to all clients 3394 /// Send a terse update to all clients
3364 /// </summary> 3395 /// </summary>
3365 public void SendTerseUpdateToAllClients() 3396 public void SendTerseUpdateToAllClientsInternal()
3366 { 3397 {
3367 if (ParentGroup == null || ParentGroup.Scene == null) 3398 if (ParentGroup == null || ParentGroup.Scene == null)
3368 return; 3399 return;
@@ -3381,6 +3412,36 @@ namespace OpenSim.Region.Framework.Scenes
3381 }); 3412 });
3382 } 3413 }
3383 3414
3415 public void SendTerseUpdateToAllClients()
3416 {
3417 if (ParentGroup == null || ParentGroup.Scene == null)
3418 return;
3419
3420 // Update the "last" values
3421 m_lastPosition = OffsetPosition;
3422 m_lastRotation = RotationOffset;
3423 m_lastVelocity = Velocity;
3424 m_lastAcceleration = Acceleration;
3425 m_lastAngularVelocity = AngularVelocity;
3426 m_lastUpdateSentTime = Environment.TickCount;
3427
3428 if (ParentGroup.IsAttachment)
3429 {
3430 ScenePresence sp = ParentGroup.Scene.GetScenePresence(ParentGroup.AttachedAvatar);
3431 if (sp != null)
3432 {
3433 sp.SendAttachmentUpdate(this, UpdateRequired.TERSE);
3434 }
3435 }
3436 else
3437 {
3438 ParentGroup.Scene.ForEachClient(delegate(IClientAPI client)
3439 {
3440 SendTerseUpdateToClient(client);
3441 });
3442 }
3443 }
3444
3384 public void SetAxisRotation(int axis, int rotate) 3445 public void SetAxisRotation(int axis, int rotate)
3385 { 3446 {
3386 ParentGroup.SetAxisRotation(axis, rotate); 3447 ParentGroup.SetAxisRotation(axis, rotate);
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5bfc640..faa07d4 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -1341,6 +1341,11 @@ namespace OpenSim.Region.Framework.Scenes
1341 RemoveFromPhysicalScene(); 1341 RemoveFromPhysicalScene();
1342 ParentID = 0; // Child agents can't be sitting 1342 ParentID = 0; // Child agents can't be sitting
1343 1343
1344// we dont have land information for child
1345 m_previusParcelHide = false;
1346 m_previusParcelUUID = UUID.Zero;
1347 m_currentParcelHide = false;
1348 m_currentParcelUUID = UUID.Zero;
1344 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into 1349 // FIXME: Set RegionHandle to the region handle of the scene this agent is moving into
1345 1350
1346 m_scene.EventManager.TriggerOnMakeChildAgent(this); 1351 m_scene.EventManager.TriggerOnMakeChildAgent(this);
@@ -1753,13 +1758,6 @@ namespace OpenSim.Region.Framework.Scenes
1753 // Tell the client that we're totally ready 1758 // Tell the client that we're totally ready
1754 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look); 1759 ControllingClient.MoveAgentIntoRegion(m_scene.RegionInfo, AbsolutePosition, look);
1755 1760
1756 // Remember in HandleUseCircuitCode, we delayed this to here
1757// this prims etc, moved down
1758// if (m_teleportFlags > 0)
1759// SendInitialDataToMe();
1760
1761 // m_log.DebugFormat("[SCENE PRESENCE] Completed movement");
1762
1763 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1761 m_log.DebugFormat("[CompleteMovement] MoveAgentIntoRegion: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1764 1762
1765 if (!string.IsNullOrEmpty(m_callbackURI)) 1763 if (!string.IsNullOrEmpty(m_callbackURI))
@@ -1805,19 +1803,82 @@ namespace OpenSim.Region.Framework.Scenes
1805 if (!IsChildAgent) 1803 if (!IsChildAgent)
1806 { 1804 {
1807 1805
1808 ValidateAndSendAppearanceAndAgentData(); 1806 // ValidateAndSendAppearanceAndAgentData();
1807
1808 // do it here in line
1809 // so sequence is clear
1810
1811 // verify baked textures and cache
1812
1813 bool cachedbaked = false;
1814
1815 if (m_scene.AvatarFactory != null)
1816 cachedbaked = m_scene.AvatarFactory.ValidateBakedTextureCache(this);
1817
1818 // not sure we need this
1819 if (!cachedbaked)
1820 {
1821 if (m_scene.AvatarFactory != null)
1822 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
1823 }
1824
1825 List<ScenePresence> allpresences = m_scene.GetScenePresences();
1826
1827 // send avatar object to all presences including us, so they cross it into region
1828 // then hide if necessary
1829 SendInitialAvatarDataToAllAgents(allpresences);
1830
1831 // send this look
1832 SendAppearanceToAgent(this);
1833
1834 // send this animations
1835 UUID[] animIDs = null;
1836 int[] animseqs = null;
1837 UUID[] animsobjs = null;
1838
1839 if (Animator != null)
1840 Animator.GetArrays(out animIDs, out animseqs, out animsobjs);
1841
1842 bool haveAnims = (animIDs != null && animseqs != null && animsobjs != null);
1843
1844 if(haveAnims)
1845 SendAnimPackToAgent(this, animIDs, animseqs, animsobjs);
1846
1847 // we should be able to receive updates, etc
1848 // so release them
1849 m_inTransit = false;
1850
1851 // send look and animations to others
1852 // if not cached we send greys
1853 // uncomented if will wait till avatar does baking
1854 //if (cachedbaked)
1855 {
1856 foreach (ScenePresence p in allpresences)
1857 {
1858 if (p == this)
1859 continue;
1860
1861 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
1862 continue;
1863
1864 SendAppearanceToAgentNF(p);
1865 if (haveAnims)
1866 SendAnimPackToAgentNF(p, animIDs, animseqs, animsobjs);
1867 }
1868 } // greys if
1809 1869
1810 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1870 m_log.DebugFormat("[CompleteMovement] ValidateAndSendAppearanceAndAgentData: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1811 1871
1812 // attachments 1872 // attachments
1873
1813 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0) 1874 if (isNPC || (TeleportFlags & TeleportFlags.ViaLogin) != 0)
1814 { 1875 {
1815 if (Scene.AttachmentsModule != null) 1876 if (Scene.AttachmentsModule != null)
1816// Util.FireAndForget( 1877 // Util.FireAndForget(
1817// o => 1878 // o =>
1818// { 1879 // {
1819 Scene.AttachmentsModule.RezAttachments(this); 1880 Scene.AttachmentsModule.RezAttachments(this);
1820 // }); 1881 // });
1821 } 1882 }
1822 else 1883 else
1823 { 1884 {
@@ -1829,23 +1890,23 @@ namespace OpenSim.Region.Framework.Scenes
1829 // Resume scripts this possible should also be moved down after sending the avatar to viewer ? 1890 // Resume scripts this possible should also be moved down after sending the avatar to viewer ?
1830 foreach (SceneObjectGroup sog in m_attachments) 1891 foreach (SceneObjectGroup sog in m_attachments)
1831 { 1892 {
1832 sog.SendFullUpdateToClient(ControllingClient);
1833 SendFullUpdateToClient(ControllingClient); 1893 SendFullUpdateToClient(ControllingClient);
1894 sog.SendFullUpdateToClient(ControllingClient);
1834 1895
1835 if (!sog.HasPrivateAttachmentPoint) 1896 if (!sog.HasPrivateAttachmentPoint)
1836 { 1897 {
1837 // sog.ScheduleGroupForFullUpdate(); 1898 // sog.ScheduleGroupForFullUpdate();
1838 m_scene.ForEachScenePresence(delegate(ScenePresence p) 1899 foreach(ScenePresence p in allpresences)
1839 { 1900 {
1840 if (p == this) 1901 if (p == this)
1841 return; 1902 continue;
1842 1903
1843 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200) 1904 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
1844 return; 1905 continue;
1845 1906
1846 sog.SendFullUpdateToClient(p.ControllingClient);
1847 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path 1907 SendFullUpdateToClient(p.ControllingClient); // resend our data by updates path
1848 }); 1908 sog.SendFullUpdateToClient(p.ControllingClient);
1909 };
1849 } 1910 }
1850 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); 1911 sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource());
1851 sog.ResumeScripts(); 1912 sog.ResumeScripts();
@@ -1872,25 +1933,14 @@ namespace OpenSim.Region.Framework.Scenes
1872 1933
1873 m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1934 m_log.DebugFormat("[CompleteMovement] SendInitialDataToMe: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1874 1935
1875 if (!IsChildAgent) 1936 if (!IsChildAgent && openChildAgents)
1876 { 1937 {
1877// moved from makeroot missing in sendInitialDataToMe
1878// its already there
1879/*
1880 m_scene.ForEachRootScenePresence(delegate(ScenePresence presence)
1881 {
1882 if (presence != this)
1883 presence.Animator.SendAnimPackToClient(ControllingClient);
1884 });
1885*/
1886 if (openChildAgents)
1887 {
1888 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>(); 1938 IFriendsModule friendsModule = m_scene.RequestModuleInterface<IFriendsModule>();
1889 if (friendsModule != null) 1939 if (friendsModule != null)
1890 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient); 1940 friendsModule.SendFriendsOnlineIfNeeded(ControllingClient);
1891 1941
1892 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts)); 1942 m_log.DebugFormat("[CompleteMovement] friendsModule: {0}ms", Util.EnvironmentTickCountSubtract(ts));
1893 } 1943
1894 } 1944 }
1895 } 1945 }
1896 finally 1946 finally
@@ -3481,6 +3531,8 @@ namespace OpenSim.Region.Framework.Scenes
3481 /// Do everything required once a client completes its movement into a region and becomes 3531 /// Do everything required once a client completes its movement into a region and becomes
3482 /// a root agent. 3532 /// a root agent.
3483 /// </summary> 3533 /// </summary>
3534 ///
3535/* only called from on place, do done inline there
3484 private void ValidateAndSendAppearanceAndAgentData() 3536 private void ValidateAndSendAppearanceAndAgentData()
3485 { 3537 {
3486 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID); 3538 //m_log.DebugFormat("[SCENE PRESENCE] SendInitialData: {0} ({1})", Name, UUID);
@@ -3502,11 +3554,13 @@ namespace OpenSim.Region.Framework.Scenes
3502 m_scene.AvatarFactory.QueueAppearanceSave(UUID); 3554 m_scene.AvatarFactory.QueueAppearanceSave(UUID);
3503 } 3555 }
3504 3556
3557 // send avatar object to all viewers so they cross it into region
3505 bool newhide = m_currentParcelHide; 3558 bool newhide = m_currentParcelHide;
3506 m_currentParcelHide = false; 3559 m_currentParcelHide = false;
3507 3560
3508 SendAvatarDataToAllAgents(); 3561 SendAvatarDataToAllAgents();
3509 3562
3563 // now hide
3510 if (newhide) 3564 if (newhide)
3511 { 3565 {
3512 ParcelLoginCheck(m_currentParcelUUID); 3566 ParcelLoginCheck(m_currentParcelUUID);
@@ -3522,7 +3576,7 @@ namespace OpenSim.Region.Framework.Scenes
3522 if(Animator!= null) 3576 if(Animator!= null)
3523 Animator.SendAnimPack(); 3577 Animator.SendAnimPack();
3524 } 3578 }
3525 3579*/
3526 /// <summary> 3580 /// <summary>
3527 /// Send avatar full data appearance and animations for all other root agents to this agent, this agent 3581 /// Send avatar full data appearance and animations for all other root agents to this agent, this agent
3528 /// can be either a child or root 3582 /// can be either a child or root
@@ -3530,15 +3584,18 @@ namespace OpenSim.Region.Framework.Scenes
3530 public void SendOtherAgentsAvatarFullToMe() 3584 public void SendOtherAgentsAvatarFullToMe()
3531 { 3585 {
3532 int count = 0; 3586 int count = 0;
3533 m_scene.ForEachRootScenePresence(delegate(ScenePresence scenePresence) 3587 m_scene.ForEachRootScenePresence(delegate(ScenePresence p)
3534 { 3588 {
3535 // only send information about other root agents 3589 // only send information about other root agents
3536 if (scenePresence.UUID == UUID) 3590 if (p.UUID == UUID)
3537 return; 3591 return;
3538 3592
3539 scenePresence.SendAvatarDataToAgent(this); 3593 if (p.ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && GodLevel < 200)
3540 scenePresence.SendAppearanceToAgent(this); 3594 return;
3541 scenePresence.SendAnimPackToAgent(this); 3595
3596 p.SendAvatarDataToAgentNF(this);
3597 p.SendAppearanceToAgentNF(this);
3598 p.SendAnimPackToAgentNF(this);
3542 // for now attachments are sent with all SOG 3599 // for now attachments are sent with all SOG
3543 count++; 3600 count++;
3544 }); 3601 });
@@ -3559,7 +3616,6 @@ namespace OpenSim.Region.Framework.Scenes
3559 m_log.WarnFormat( 3616 m_log.WarnFormat(
3560 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}", 3617 "[SCENE PRESENCE]: Attempt to send avatar data from a child agent for {0} in {1}",
3561 Name, Scene.RegionInfo.RegionName); 3618 Name, Scene.RegionInfo.RegionName);
3562
3563 return; 3619 return;
3564 } 3620 }
3565 3621
@@ -3575,6 +3631,26 @@ namespace OpenSim.Region.Framework.Scenes
3575 m_scene.StatsReporter.AddAgentUpdates(count); 3631 m_scene.StatsReporter.AddAgentUpdates(count);
3576 } 3632 }
3577 3633
3634 // sends avatar object to all clients so they cross it into region
3635 // then sends kills to hide
3636 public void SendInitialAvatarDataToAllAgents(List<ScenePresence> presences)
3637 {
3638 m_lastSize = Appearance.AvatarSize;
3639 int count = 0;
3640
3641 foreach (ScenePresence p in presences)
3642 {
3643 p.ControllingClient.SendAvatarDataImmediate(this);
3644 if (p != this && ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
3645 // either just kill the object
3646 // p.ControllingClient.SendKillObject(new List<uint> {LocalId});
3647 // or also attachments viewer may still know about
3648 SendKillTo(p);
3649 count++;
3650 }
3651 m_scene.StatsReporter.AddAgentUpdates(count);
3652 }
3653
3578 /// <summary> 3654 /// <summary>
3579 /// Send avatar data to an agent. 3655 /// Send avatar data to an agent.
3580 /// </summary> 3656 /// </summary>
@@ -3589,9 +3665,9 @@ namespace OpenSim.Region.Framework.Scenes
3589 3665
3590 public void SendAvatarDataToAgentNF(ScenePresence avatar) 3666 public void SendAvatarDataToAgentNF(ScenePresence avatar)
3591 { 3667 {
3592 avatar.ControllingClient.SendAvatarDataImmediate(this); 3668 avatar.ControllingClient.SendAvatarDataImmediate(this);
3593 } 3669 }
3594 3670
3595 /// <summary> 3671 /// <summary>
3596 /// Send this agent's appearance to all other root and child agents in the scene 3672 /// Send this agent's appearance to all other root and child agents in the scene
3597 /// This agent must be root. 3673 /// This agent must be root.
@@ -3637,6 +3713,12 @@ namespace OpenSim.Region.Framework.Scenes
3637 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes()); 3713 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
3638 } 3714 }
3639 3715
3716 public void SendAppearanceToAgentNF(ScenePresence avatar)
3717 {
3718 avatar.ControllingClient.SendAppearance(
3719 UUID, Appearance.VisualParams, Appearance.Texture.GetBytes());
3720 }
3721
3640 public void SendAnimPackToAgent(ScenePresence p) 3722 public void SendAnimPackToAgent(ScenePresence p)
3641 { 3723 {
3642 if (IsChildAgent || Animator == null) 3724 if (IsChildAgent || Animator == null)
@@ -3648,6 +3730,29 @@ namespace OpenSim.Region.Framework.Scenes
3648 Animator.SendAnimPackToClient(p.ControllingClient); 3730 Animator.SendAnimPackToClient(p.ControllingClient);
3649 } 3731 }
3650 3732
3733 public void SendAnimPackToAgent(ScenePresence p, UUID[] animations, int[] seqs, UUID[] objectIDs)
3734 {
3735 if (IsChildAgent)
3736 return;
3737
3738 if (ParcelHideThisAvatar && currentParcelUUID != p.currentParcelUUID && p.GodLevel < 200)
3739 return;
3740
3741 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
3742 }
3743
3744 public void SendAnimPackToAgentNF(ScenePresence p)
3745 {
3746 if (IsChildAgent || Animator == null)
3747 return;
3748 Animator.SendAnimPackToClient(p.ControllingClient);
3749 }
3750
3751 public void SendAnimPackToAgentNF(ScenePresence p, UUID[] animations, int[] seqs, UUID[] objectIDs)
3752 {
3753 p.ControllingClient.SendAnimations(animations, seqs, ControllingClient.AgentId, objectIDs);
3754 }
3755
3651 public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs) 3756 public void SendAnimPack(UUID[] animations, int[] seqs, UUID[] objectIDs)
3652 { 3757 {
3653 if (IsChildAgent) 3758 if (IsChildAgent)
@@ -5634,22 +5739,6 @@ namespace OpenSim.Region.Framework.Scenes
5634 } 5739 }
5635 } 5740 }
5636 5741
5637 private void ParcelLoginCheck(UUID currentParcelID)
5638 {
5639 List<ScenePresence> allpresences = m_scene.GetScenePresences();
5640
5641 foreach (ScenePresence p in allpresences)
5642 {
5643 if (p.IsDeleted || p == this || p.ControllingClient == null || !p.ControllingClient.IsActive)
5644 continue;
5645
5646 if (currentParcelID != p.currentParcelUUID && p.GodLevel < 200)
5647 {
5648 SendKillTo(p);
5649 }
5650 }
5651 }
5652
5653 public void parcelRegionCross() 5742 public void parcelRegionCross()
5654 { 5743 {
5655 if (!ParcelHideThisAvatar || GodLevel >= 200) 5744 if (!ParcelHideThisAvatar || GodLevel >= 200)
@@ -5817,8 +5906,6 @@ namespace OpenSim.Region.Framework.Scenes
5817 5906
5818 if (killsToSendme.Count > 0) 5907 if (killsToSendme.Count > 0)
5819 { 5908 {
5820 m_log.Debug("[AVATAR]: killtoMe: " + Lastname + " " + killsToSendme.Count.ToString());
5821
5822 foreach (ScenePresence p in killsToSendme) 5909 foreach (ScenePresence p in killsToSendme)
5823 { 5910 {
5824 m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname); 5911 m_log.Debug("[AVATAR]: killToMe: " + Lastname + " " + p.Lastname);