diff --git a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs index f62512eb5a..6eeef454c9 100644 --- a/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Attachments/AttachmentsModule.cs @@ -168,7 +168,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Attachments return; } -// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0}", sp.Name); +// m_log.DebugFormat("[ATTACHMENTS MODULE]: Rezzing any attachments for {0} from simulator-side", sp.Name); XmlDocument doc = new XmlDocument(); string stateData = String.Empty; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index fd20c60659..38350477a5 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2978,35 +2978,6 @@ namespace OpenSim.Region.Framework.Scenes m_eventManager.TriggerOnNewPresence(sp); sp.TeleportFlags = (TPFlags)aCircuit.teleportFlags; - - // The first agent upon login is a root agent by design. - // For this agent we will have to rez the attachments. - // All other AddNewClient calls find aCircuit.child to be true. - if (aCircuit.child == false) - { - // We have to set SP to be a root agent here so that SP.MakeRootAgent() will later not try to - // start the scripts again (since this is done in RezAttachments()). - // XXX: This is convoluted. - sp.IsChildAgent = false; - sp.IsLoggingIn = true; - - // We leave a 5 second pause before attempting to rez attachments to avoid a clash with - // version 3 viewers that maybe doing their own attachment rezzing related to their current - // outfit folder on startup. If these operations do clash, then the symptoms are invisible - // attachments until one zooms in on the avatar. - // - // We do not pause if we are launching on the same thread anyway in order to avoid pointlessly - // delaying any attachment related regression tests. - if (AttachmentsModule != null) - Util.FireAndForget( - o => - { - if (Util.FireAndForgetMethod != FireAndForgetMethod.None) - Thread.Sleep(5000); - - AttachmentsModule.RezAttachments(sp); - }); - } } else { diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 322afd210f..300ddb35e4 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -941,8 +941,6 @@ namespace OpenSim.Region.Framework.Scenes "[SCENE]: Upgrading child to root agent for {0} in {1}", Name, m_scene.RegionInfo.RegionName); - bool wasChild = IsChildAgent; - if (ParentUUID != UUID.Zero) { m_log.DebugFormat("[SCENE PRESENCE]: Sitting avatar back on prim {0}", ParentUUID); @@ -975,6 +973,9 @@ namespace OpenSim.Region.Framework.Scenes IsLoggingIn = false; } + //m_log.DebugFormat("[SCENE]: known regions in {0}: {1}", Scene.RegionInfo.RegionName, KnownChildRegionHandles.Count); + + IsChildAgent = false; IGroupsModule gm = m_scene.RequestModuleInterface(); if (gm != null) @@ -1095,22 +1096,44 @@ namespace OpenSim.Region.Framework.Scenes // and it has already rezzed the attachments and started their scripts. // We do the following only for non-login agents, because their scripts // haven't started yet. - lock (m_attachments) + if ((TeleportFlags & TeleportFlags.ViaLogin) != 0) { - if (wasChild && HasAttachments()) + // We leave a 5 second pause before attempting to rez attachments to avoid a clash with + // version 3 viewers that maybe doing their own attachment rezzing related to their current + // outfit folder on startup. If these operations do clash, then the symptoms are invisible + // attachments until one zooms in on the avatar. + // + // We do not pause if we are launching on the same thread anyway in order to avoid pointlessly + // delaying any attachment related regression tests. + if (Scene.AttachmentsModule != null) + Util.FireAndForget( + o => + { + if (Util.FireAndForgetMethod != FireAndForgetMethod.None) + System.Threading.Thread.Sleep(5000); + + Scene.AttachmentsModule.RezAttachments(this); + }); + } + else + { + lock (m_attachments) { - m_log.DebugFormat( - "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); + if (HasAttachments()) + { + m_log.DebugFormat( + "[SCENE PRESENCE]: Restarting scripts in attachments for {0} in {1}", Name, Scene.Name); - // Resume scripts - Util.FireAndForget(delegate(object x) { - foreach (SceneObjectGroup sog in m_attachments) - { - sog.ScheduleGroupForFullUpdate(); - sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); - sog.ResumeScripts(); - } - }); + // Resume scripts + Util.FireAndForget(delegate(object x) { + foreach (SceneObjectGroup sog in m_attachments) + { + sog.ScheduleGroupForFullUpdate(); + sog.RootPart.ParentGroup.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, GetStateSource()); + sog.ResumeScripts(); + } + }); + } } }