aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs151
1 files changed, 91 insertions, 60 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index fc8b62e..b0bb005 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -652,9 +652,6 @@ namespace OpenSim.Region.Framework.Scenes
652 RegisterToEvents(); 652 RegisterToEvents();
653 SetDirectionVectors(); 653 SetDirectionVectors();
654 654
655 CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid);
656 if (userInfo != null)
657 userInfo.OnItemReceived += ItemReceived;
658 } 655 }
659 656
660 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, 657 public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams,
@@ -1021,7 +1018,9 @@ namespace OpenSim.Region.Framework.Scenes
1021 } 1018 }
1022 1019
1023 /// <summary> 1020 /// <summary>
1024 /// Complete Avatar's movement into the region 1021 /// Complete Avatar's movement into the region.
1022 /// This is called upon a very important packet sent from the client,
1023 /// so it's client-controlled. Never call this method directly.
1025 /// </summary> 1024 /// </summary>
1026 public void CompleteMovement() 1025 public void CompleteMovement()
1027 { 1026 {
@@ -1042,22 +1041,19 @@ namespace OpenSim.Region.Framework.Scenes
1042 AbsolutePosition = pos; 1041 AbsolutePosition = pos;
1043 } 1042 }
1044 1043
1045 if (m_isChildAgent) 1044 m_isChildAgent = false;
1046 { 1045 bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1047 m_isChildAgent = false; 1046 MakeRootAgent(AbsolutePosition, m_flying);
1048 bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0);
1049 MakeRootAgent(AbsolutePosition, m_flying);
1050
1051 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1052 {
1053 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1054 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1055 m_callbackURI = null;
1056 }
1057 1047
1058 //m_log.DebugFormat("Completed movement"); 1048 if ((m_callbackURI != null) && !m_callbackURI.Equals(""))
1049 {
1050 m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI);
1051 Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI);
1052 m_callbackURI = null;
1059 } 1053 }
1060 1054
1055 //m_log.DebugFormat("Completed movement");
1056
1061 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); 1057 m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look);
1062 SendInitialData(); 1058 SendInitialData();
1063 1059
@@ -3154,6 +3150,20 @@ namespace OpenSim.Region.Framework.Scenes
3154 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); 3150 m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message);
3155 } 3151 }
3156 3152
3153 //Attachments
3154 List<int> attPoints = m_appearance.GetAttachedPoints();
3155 if (attPoints != null)
3156 {
3157 m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count);
3158 int i = 0;
3159 AttachmentData[] attachs = new AttachmentData[attPoints.Count];
3160 foreach (int point in attPoints)
3161 {
3162 attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point));
3163 }
3164 cAgent.Attachments = attachs;
3165 }
3166
3157 // Animations 3167 // Animations
3158 try 3168 try
3159 { 3169 {
@@ -3219,6 +3229,19 @@ namespace OpenSim.Region.Framework.Scenes
3219 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); 3229 m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message);
3220 } 3230 }
3221 3231
3232 // Attachments
3233 try
3234 {
3235 if (cAgent.Attachments != null)
3236 {
3237 foreach (AttachmentData att in cAgent.Attachments)
3238 {
3239 m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID);
3240 }
3241 }
3242 }
3243 catch { }
3244
3222 // Animations 3245 // Animations
3223 try 3246 try
3224 { 3247 {
@@ -3729,37 +3752,46 @@ namespace OpenSim.Region.Framework.Scenes
3729 return flags; 3752 return flags;
3730 } 3753 }
3731 3754
3732 private void ItemReceived(UUID itemID) 3755 /// <summary>
3756 /// RezAttachments. This should only be called upon login on the first region
3757 /// </summary>
3758 public void RezAttachments()
3733 { 3759 {
3734 if (IsChildAgent)
3735 return;
3736
3737 if (null == m_appearance) 3760 if (null == m_appearance)
3738 { 3761 {
3739 m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); 3762 m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID);
3740 return; 3763 return;
3741 } 3764 }
3742 3765
3743 int attachpoint = m_appearance.GetAttachpoint(itemID); 3766 List<int> attPoints = m_appearance.GetAttachedPoints();
3744 if (attachpoint == 0) 3767 foreach (int p in attPoints)
3745 return;
3746
3747 UUID asset = m_appearance.GetAttachedAsset(attachpoint);
3748 if (UUID.Zero == asset) // We have just logged in
3749 { 3768 {
3769 UUID itemID = m_appearance.GetAttachedItem(p);
3770 UUID assetID = m_appearance.GetAttachedAsset(p);
3771
3772 if (UUID.Zero == assetID)
3773 {
3774 m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID);
3775 continue;
3776 }
3777
3750 try 3778 try
3751 { 3779 {
3752 // Rez from inventory 3780 // Rez from inventory
3753 asset = m_scene.RezSingleAttachment(ControllingClient, 3781 UUID asset = m_scene.RezSingleAttachment(ControllingClient,
3754 itemID, (uint)attachpoint); 3782 itemID, (uint)p);
3755 // Corner case: We are not yet a Scene Entity 3783
3756 // Setting attachment info in RezSingleAttachment will fail 3784 m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})",
3757 // Set it here 3785 p, itemID, assetID, asset);
3758 // 3786
3759 m_appearance.SetAttachment((int)attachpoint, itemID, 3787 //SceneObjectPart att = m_scene.GetSceneObjectPart(asset);
3760 asset); 3788 //m_log.DebugFormat("[ATTCHMENT]: Got scene object parent {0} IsAtt {1}",
3761 m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}", 3789 // ((att.ParentGroup != null) ? "not null" : "null"), att.IsAttachment);
3762 itemID.ToString(), asset); 3790 //if (att.ParentGroup != null && !att.IsAttachment)
3791 //{
3792 // att.FromItemID = itemID;
3793 // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false);
3794 //}
3763 3795
3764 } 3796 }
3765 catch (Exception e) 3797 catch (Exception e)
@@ -3767,31 +3799,30 @@ namespace OpenSim.Region.Framework.Scenes
3767 m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); 3799 m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString());
3768 } 3800 }
3769 3801
3770 return;
3771 } 3802 }
3772 3803
3773 SceneObjectPart att = m_scene.GetSceneObjectPart(asset); 3804 //SceneObjectPart att = m_scene.GetSceneObjectPart(asset);
3774 3805
3775 // If this is null, then the asset has not yet appeared in world 3806 //// If this is null, then the asset has not yet appeared in world
3776 // so we revisit this when it does 3807 //// so we revisit this when it does
3777 // 3808 ////
3778 if (att != null && att.UUID != asset) // Yes. It's really needed 3809 //if (att != null && att.UUID != asset) // Yes. It's really needed
3779 { 3810 //{
3780 m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); 3811 // m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString());
3781 3812
3782 // This will throw if crossing katty-korner 3813 // // This will throw if crossing katty-korner
3783 // So catch it here to avoid the noid 3814 // // So catch it here to avoid the noid
3784 // 3815 // //
3785 try 3816 // try
3786 { 3817 // {
3787 // Attach from world, if not already attached 3818 // // Attach from world, if not already attached
3788 if (att.ParentGroup != null && !att.IsAttachment) 3819 // if (att.ParentGroup != null && !att.IsAttachment)
3789 m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); 3820 // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false);
3790 } 3821 // }
3791 catch (NullReferenceException) 3822 // catch (NullReferenceException)
3792 { 3823 // {
3793 } 3824 // }
3794 } 3825 //}
3795 } 3826 }
3796 } 3827 }
3797} 3828}