From 6b9cc6c48d7b49cc4bce5dce4e66d7856a093b75 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Thu, 13 Aug 2009 11:30:29 -0700 Subject: Inventory redirects from CachedUserInfo to InventoryService COMPLETE! --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 4695df7..fc8b62e 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -833,11 +833,11 @@ namespace OpenSim.Region.Framework.Scenes m_scene.SwapRootAgentCount(false); - CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); - if (userInfo != null) - userInfo.FetchInventory(); - else - m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); + //CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); + //if (userInfo != null) + // userInfo.FetchInventory(); + //else + // m_log.ErrorFormat("[SCENE]: Could not find user info for {0} when making it a root agent", m_uuid); // On the next prim update, all objects will be sent // -- cgit v1.1 From e02062051d38e56ec22952e25a558039b5e54ab3 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 16 Aug 2009 16:17:19 -0700 Subject: Making attachments work again. Tons of debug more. This needs more testing and a lot of cleaning. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 151 ++++++++++++++--------- 1 file changed, 91 insertions(+), 60 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') 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 RegisterToEvents(); SetDirectionVectors(); - CachedUserInfo userInfo = m_scene.CommsManager.UserProfileCacheService.GetUserDetails(m_uuid); - if (userInfo != null) - userInfo.OnItemReceived += ItemReceived; } public ScenePresence(IClientAPI client, Scene world, RegionInfo reginfo, byte[] visualParams, @@ -1021,7 +1018,9 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// Complete Avatar's movement into the region + /// Complete Avatar's movement into the region. + /// This is called upon a very important packet sent from the client, + /// so it's client-controlled. Never call this method directly. /// public void CompleteMovement() { @@ -1042,22 +1041,19 @@ namespace OpenSim.Region.Framework.Scenes AbsolutePosition = pos; } - if (m_isChildAgent) - { - m_isChildAgent = false; - bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); - MakeRootAgent(AbsolutePosition, m_flying); - - if ((m_callbackURI != null) && !m_callbackURI.Equals("")) - { - m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); - Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); - m_callbackURI = null; - } + m_isChildAgent = false; + bool m_flying = ((m_AgentControlFlags & (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY) != 0); + MakeRootAgent(AbsolutePosition, m_flying); - //m_log.DebugFormat("Completed movement"); + if ((m_callbackURI != null) && !m_callbackURI.Equals("")) + { + m_log.DebugFormat("[SCENE PRESENCE]: Releasing agent in URI {0}", m_callbackURI); + Scene.SendReleaseAgent(m_rootRegionHandle, UUID, m_callbackURI); + m_callbackURI = null; } + //m_log.DebugFormat("Completed movement"); + m_controllingClient.MoveAgentIntoRegion(m_regionInfo, AbsolutePosition, look); SendInitialData(); @@ -3154,6 +3150,20 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("[SCENE PRESENCE]: exception in CopyTo " + e.Message); } + //Attachments + List attPoints = m_appearance.GetAttachedPoints(); + if (attPoints != null) + { + m_log.DebugFormat("[SCENE PRESENCE]: attachments {0}", attPoints.Count); + int i = 0; + AttachmentData[] attachs = new AttachmentData[attPoints.Count]; + foreach (int point in attPoints) + { + attachs[i++] = new AttachmentData(point, m_appearance.GetAttachedItem(point), m_appearance.GetAttachedAsset(point)); + } + cAgent.Attachments = attachs; + } + // Animations try { @@ -3219,6 +3229,19 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("[SCENE PRESENCE]: exception in CopyFrom " + e.Message); } + // Attachments + try + { + if (cAgent.Attachments != null) + { + foreach (AttachmentData att in cAgent.Attachments) + { + m_appearance.SetAttachment(att.AttachPoint, att.ItemID, att.AssetID); + } + } + } + catch { } + // Animations try { @@ -3729,37 +3752,46 @@ namespace OpenSim.Region.Framework.Scenes return flags; } - private void ItemReceived(UUID itemID) + /// + /// RezAttachments. This should only be called upon login on the first region + /// + public void RezAttachments() { - if (IsChildAgent) - return; - if (null == m_appearance) { - m_log.Warn("[ATTACHMENT] Appearance has not been initialized"); + m_log.WarnFormat("[ATTACHMENT] Appearance has not been initialized for agent {0}", UUID); return; } - int attachpoint = m_appearance.GetAttachpoint(itemID); - if (attachpoint == 0) - return; - - UUID asset = m_appearance.GetAttachedAsset(attachpoint); - if (UUID.Zero == asset) // We have just logged in + List attPoints = m_appearance.GetAttachedPoints(); + foreach (int p in attPoints) { + UUID itemID = m_appearance.GetAttachedItem(p); + UUID assetID = m_appearance.GetAttachedAsset(p); + + if (UUID.Zero == assetID) + { + m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); + continue; + } + try { // Rez from inventory - asset = m_scene.RezSingleAttachment(ControllingClient, - itemID, (uint)attachpoint); - // Corner case: We are not yet a Scene Entity - // Setting attachment info in RezSingleAttachment will fail - // Set it here - // - m_appearance.SetAttachment((int)attachpoint, itemID, - asset); - m_log.InfoFormat("[ATTACHMENT] Rezzed attachment {0}, inworld asset {1}", - itemID.ToString(), asset); + UUID asset = m_scene.RezSingleAttachment(ControllingClient, + itemID, (uint)p); + + m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", + p, itemID, assetID, asset); + + //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); + //m_log.DebugFormat("[ATTCHMENT]: Got scene object parent {0} IsAtt {1}", + // ((att.ParentGroup != null) ? "not null" : "null"), att.IsAttachment); + //if (att.ParentGroup != null && !att.IsAttachment) + //{ + // att.FromItemID = itemID; + // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); + //} } catch (Exception e) @@ -3767,31 +3799,30 @@ namespace OpenSim.Region.Framework.Scenes m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); } - return; } - SceneObjectPart att = m_scene.GetSceneObjectPart(asset); + //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); - // If this is null, then the asset has not yet appeared in world - // so we revisit this when it does - // - if (att != null && att.UUID != asset) // Yes. It's really needed - { - m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); - - // This will throw if crossing katty-korner - // So catch it here to avoid the noid - // - try - { - // Attach from world, if not already attached - if (att.ParentGroup != null && !att.IsAttachment) - m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); - } - catch (NullReferenceException) - { - } - } + //// If this is null, then the asset has not yet appeared in world + //// so we revisit this when it does + //// + //if (att != null && att.UUID != asset) // Yes. It's really needed + //{ + // m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); + + // // This will throw if crossing katty-korner + // // So catch it here to avoid the noid + // // + // try + // { + // // Attach from world, if not already attached + // if (att.ParentGroup != null && !att.IsAttachment) + // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); + // } + // catch (NullReferenceException) + // { + // } + //} } } } -- cgit v1.1 From 5d47e08dada2b4de1170b9adb4cca5cd51593cc9 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 16 Aug 2009 17:11:20 -0700 Subject: Removed some debug messages --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 36 ++---------------------- 1 file changed, 3 insertions(+), 33 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b0bb005..3f5d0dc 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3753,7 +3753,8 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// RezAttachments. This should only be called upon login on the first region + /// RezAttachments. This should only be called upon login on the first region. + /// Attachment rezzings on crossings and TPs are done in a different way. /// public void RezAttachments() { @@ -3784,45 +3785,14 @@ namespace OpenSim.Region.Framework.Scenes m_log.InfoFormat("[ATTACHMENT]: Rezzed attachment in point {0} from item {1} and asset {2} ({3})", p, itemID, assetID, asset); - //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); - //m_log.DebugFormat("[ATTCHMENT]: Got scene object parent {0} IsAtt {1}", - // ((att.ParentGroup != null) ? "not null" : "null"), att.IsAttachment); - //if (att.ParentGroup != null && !att.IsAttachment) - //{ - // att.FromItemID = itemID; - // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); - //} - } catch (Exception e) { - m_log.ErrorFormat("[ATTACHMENT] Unable to rez attachment: {0}", e.ToString()); + m_log.ErrorFormat("[ATTACHMENT]: Unable to rez attachment: {0}", e.ToString()); } } - //SceneObjectPart att = m_scene.GetSceneObjectPart(asset); - - //// If this is null, then the asset has not yet appeared in world - //// so we revisit this when it does - //// - //if (att != null && att.UUID != asset) // Yes. It's really needed - //{ - // m_log.DebugFormat("[ATTACHMENT]: Attach from in world: ItemID {0}, Asset ID {1}, Attachment inworld: {2}", itemID.ToString(), asset.ToString(), att.UUID.ToString()); - - // // This will throw if crossing katty-korner - // // So catch it here to avoid the noid - // // - // try - // { - // // Attach from world, if not already attached - // if (att.ParentGroup != null && !att.IsAttachment) - // m_scene.AttachObject(ControllingClient, att.ParentGroup.LocalId, 0, Quaternion.Identity, att.ParentGroup.AbsolutePosition, false); - // } - // catch (NullReferenceException) - // { - // } - //} } } } -- cgit v1.1 From 550d0e434fed79d25c186ca1adab9d8276e09852 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 16 Aug 2009 19:21:19 -0700 Subject: Removing the conditional for assetID=Zero upon rezzing attachments on login. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs') diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 3f5d0dc..ff97183 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3770,11 +3770,13 @@ namespace OpenSim.Region.Framework.Scenes UUID itemID = m_appearance.GetAttachedItem(p); UUID assetID = m_appearance.GetAttachedAsset(p); - if (UUID.Zero == assetID) - { - m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); - continue; - } + // For some reason assetIDs are being written as Zero's in the DB -- need to track tat down + // But they're not used anyway, the item is being looked up for now, so let's proceed. + //if (UUID.Zero == assetID) + //{ + // m_log.DebugFormat("[ATTACHMENT]: Cannot rez attachment in point {0} with itemID {1}", p, itemID); + // continue; + //} try { -- cgit v1.1