diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index 15595006d6..438812f2a3 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -428,6 +428,7 @@ namespace OpenSim.Framework public static Primitive.TextureEntry GetDefaultTexture() { Primitive.TextureEntry textu = new Primitive.TextureEntry(new UUID("C228D1CF-4B5D-4BA8-84F4-899A0796AA97")); + /* recommended by MB textu.CreateFace(0).TextureID = new UUID("00000000-0000-1111-9999-000000000012"); textu.CreateFace(1).TextureID = Util.BLANK_TEXTURE_UUID; textu.CreateFace(2).TextureID = Util.BLANK_TEXTURE_UUID; @@ -435,6 +436,7 @@ namespace OpenSim.Framework textu.CreateFace(4).TextureID = new UUID("7CA39B4C-BD19-4699-AFF7-F93FD03D3E7B"); textu.CreateFace(5).TextureID = new UUID("00000000-0000-1111-9999-000000000010"); textu.CreateFace(6).TextureID = new UUID("00000000-0000-1111-9999-000000000011"); + */ return textu; } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 7dacd939df..e1cbe03654 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -5630,10 +5630,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // What would happen if we ignore any SetAppearance packet that does not include textures? if (te == null) { - //m_log.WarnFormat("[LLCLIENTVIEW] Received SetAppearance from {0} ( )", Name); + m_log.WarnFormat("[LLCLIENTVIEW] Received SetAppearance from {0} ( )", Name); return true; } - //m_log.WarnFormat("[LLCLIENTVIEW] Received SetAppearance from {0} (TE)", Name); + m_log.WarnFormat("[LLCLIENTVIEW] Received SetAppearance from {0} (TE)", Name); if (handlerSetAppearanceRaw != null) handlerSetAppearanceRaw(this, AgentId, visualparams, te); if (handlerSetAppearance != null) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index c44aaf8d9b..bae63e82b5 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1199,6 +1199,8 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer protected List RequestNeighbours(Scene pScene, uint pRegionLocX, uint pRegionLocY) { + m_log.DebugFormat("[ENTITY TRANSFER MODULE] Request neighbors for {0} at {1}/{2}", + pScene.RegionInfo.RegionName, pRegionLocX, pRegionLocY); RegionInfo m_regionInfo = pScene.RegionInfo; Border[] northBorders = pScene.NorthBorders.ToArray(); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs index 77b35896a6..ad4d17e7fa 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClient.cs @@ -350,6 +350,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule return; } + m_log.DebugFormat("{0} Handle NewAvater for \"{1} {2}\"", LogHeader, first, last); if (m_remoteAvatars.ContainsKey(agentID)) { RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Attempted to add duplicate avatar \"{0} {1}\" ({2})", first, last, agentID.ToString())); @@ -720,7 +721,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule Send(new RegionSyncMessage(RegionSyncMessage.MsgType.GetAvatars)); // Register for events which will be forwarded to authoritative scene - m_scene.EventManager.OnNewClient += EventManager_OnNewClient; + // m_scene.EventManager.OnNewClient += EventManager_OnNewClient; + m_scene.EventManager.OnMakeRootAgent += EventManager_OnMakeRootAgent; + m_scene.EventManager.OnMakeChildAgent += EventManager_OnMakeChildAgent; m_scene.EventManager.OnClientClosed += new EventManager.ClientClosed(RemoveLocalClient); } @@ -730,8 +733,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } #region MESSAGES SENT FROM CLIENT MANAGER TO SIM - public void EventManager_OnNewClient(IClientAPI client) + // public void EventManager_OnNewClient(IClientAPI client) + public void EventManager_OnMakeRootAgent(ScenePresence scenep) { + IClientAPI client = scenep.ControllingClient; // If this client was added in response to NewAvatar message from a synced server, // don't subscribe to events or send back to server if (RemoteAvatars.ContainsKey(client.AgentId)) @@ -747,7 +752,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule newlocals.Add(client.AgentId, client); m_localAvatars = newlocals; } - m_log.WarnFormat("{0} New local client \"{1}\" ({2}) being added to remote scene.", LogHeader, client.Name, client.AgentId.ToString()); + + m_log.WarnFormat("{0} New local client \"{1}\" ({2}) being added to remote scene.", + LogHeader, client.Name, client.AgentId.ToString()); // Let the auth sim know that a new agent has connected OSDMap data = new OSDMap(4); data["agentID"] = OSD.FromUUID(client.AgentId); @@ -763,6 +770,17 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule client.OnChatFromClientRaw += HandleChatFromClientRaw; } + public void EventManager_OnMakeChildAgent(ScenePresence scenep) + { + // if demoting from root, tell the server not to track our child + m_log.DebugFormat("{0} Demotion to child. Sending remove for {1}/{2}", + LogHeader, scenep.ControllingClient.Name, scenep.ControllingClient.AgentId); + OSDMap data = new OSDMap(1); + data["agentID"] = OSD.FromUUID(scenep.ControllingClient.AgentId); + Send(new RegionSyncMessage(RegionSyncMessage.MsgType.AgentRemove, OSDParser.SerializeJsonString(data))); + return; + } + private void RemoveLocalClient(UUID clientID, Scene scene) { // If the client closed due to load balancing, the presence will stick around diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs index 2b963836f1..e207d2ae7c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientModule.cs @@ -69,8 +69,10 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_active = true; m_scene.RegionSyncEnabled = true; m_scene.RegionSyncMode = "client"; - m_serveraddr = syncConfig.GetString("ServerIPAddress", "127.0.0.1"); - m_serverport = syncConfig.GetInt("ServerPort", 13000); + string serverAddrDefault = syncConfig.GetString("ServerIPAddress", "127.0.0.1"); + m_serveraddr = syncConfig.GetString(scene.RegionInfo.RegionName+"_ServerIPAddress", serverAddrDefault); + int serverPortDefault = syncConfig.GetInt("ServerPort", 13000); + m_serverport = syncConfig.GetInt(scene.RegionInfo.RegionName+"_ServerPort", serverPortDefault); m_scene.RegisterModuleInterface(this); // Setup the command line interface diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs index a22a9844bd..721cbec96b 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncClientView.cs @@ -462,7 +462,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule case RegionSyncMessage.MsgType.AvatarAppearance: { int msgID = msgCount; - //m_log.WarnFormat("{0} START of AvatarAppearance handler <{1}>", LogHeader, msgID); + m_log.DebugFormat("{0} START of AvatarAppearance handler <{1}>", LogHeader, msgID); // Get the data from message and error check OSDMap data = DeserializeMessage(msg); if (data == null) @@ -507,7 +507,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule } } - //m_log.WarnFormat("{0} {1} Calling presence.SetAppearance {2} <{3}>", LogHeader, name, (missingBakes ? "MISSING BAKES" : "GOT BAKES"), msgID); + m_log.DebugFormat("{0} {1} Calling presence.SetAppearance {2} <{3}>", LogHeader, name, (missingBakes ? "MISSING BAKES" : "GOT BAKES"), msgID); try { presence.SetAppearance(te, vp); @@ -520,7 +520,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule RegionSyncMessage.HandleSuccess(LogHeader, msg, String.Format("Set appearance for {0} <{1}>", name, msgID)); else RegionSyncMessage.HandleWarning(LogHeader, msg, String.Format("Set appearance for {0} but has missing bakes. <{1}>", name, msgID)); - //m_log.WarnFormat("{0} Calling RegionsSyncServerModule.SendAppearance for {1} {2} <{3}>", LogHeader, name, (missingBakes ? "MISSING BAKES" : "GOT BAKES"), msgID); + m_log.DebugFormat("{0} Calling RegionsSyncServerModule.SendAppearance for {1} {2} <{3}>", LogHeader, name, (missingBakes ? "MISSING BAKES" : "GOT BAKES"), msgID); m_scene.RegionSyncServerModule.SendAppearance(presence.UUID, presence.Appearance.VisualParams, presence.Appearance.Texture); lock (m_appearanceTimers) m_appearanceTimers.Remove(agentID); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServer.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServer.cs index 07ca8af9a8..32e9e11642 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServer.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServer.cs @@ -118,7 +118,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule while (true) { // *** Move/Add TRY/CATCH to here, but we don't want to spin loop on the same error - m_log.WarnFormat("[REGION SYNC SERVER] Listening for new connections on port {0}...", m_port.ToString()); + m_log.WarnFormat("[REGION SYNC SERVER] Listening for new connections on {0}:{1}...", m_addr.ToString(), m_port.ToString()); TcpClient tcpclient = m_listener.AcceptTcpClient(); IPAddress addr = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Address; int port = ((IPEndPoint)tcpclient.Client.RemoteEndPoint).Port; diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs index c1a5889836..8a39dd0106 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/RegionSyncServerModule.cs @@ -323,7 +323,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_log.WarnFormat("[REGION SYNC SERVER MODULE] <{0}> {1} SendAppearance could not locate presence!", " ", agentID); return; } - //m_log.WarnFormat("[REGION SYNC SERVER MODULE] <{0}> {1} ScenePresence called SendAppearance ({2})", sp.Name, agentID, te == null ? " " : "te"); + m_log.DebugFormat("[REGION SYNC SERVER MODULE] <{0}> {1} ScenePresence called SendAppearance ({2})", sp.Name, agentID, te == null ? " " : "te"); if(te == null) return; int delay = 1000; @@ -334,7 +334,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule data["te"] = te.GetOSD(); Timer appearanceSetter = new Timer(delegate(object obj) { - //m_log.WarnFormat("[REGION SYNC SERVER MODULE] <{0}> {1} Broadcasting appearance to all client managers", sp.Name, agentID); + m_log.DebugFormat("[REGION SYNC SERVER MODULE] <{0}> {1} Broadcasting appearance to all client managers", sp.Name, agentID); m_server.Broadcast(new RegionSyncMessage(RegionSyncMessage.MsgType.AvatarAppearance, OSDParser.SerializeJsonString(data))); lock (m_appearanceTimers) m_appearanceTimers.Remove(agentID); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8ee8bfc88f..087a0a4417 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1597,6 +1597,18 @@ namespace OpenSim.Region.Framework.Scenes ForEachScenePresence(delegate(ScenePresence sp) { sp.SendPrimUpdates(); }); if(m_frame % 20 == 0) RegionSyncClientModule.SendCoarseLocations(); + // make border crossing work in the CMs + m_sceneGraph.ForEachScenePresence(delegate(ScenePresence sp) + { + if (!sp.IsChildAgent) + { + // Check that we have a physics actor or we're sitting on something + if (sp.ParentID == 0 && sp.PhysicsActor != null || sp.ParentID != 0) + { + sp.CheckForBorderCrossing(); + } + } + }); } else { @@ -2979,6 +2991,7 @@ namespace OpenSim.Region.Framework.Scenes m_LastLogin = Util.EnvironmentTickCount(); EventManager.TriggerOnNewClient(client); + // m_log.Debug("[Scene] New agent " + client.Name + " vialogin=" + vialogin.ToString()); if (vialogin) EventManager.TriggerOnClientLogin(client); } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0739801a32..932365d79d 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1122,7 +1122,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void CompleteMovement(IClientAPI client) { - //m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); + m_log.Debug("[SCENE PRESENCE]: CompleteMovement"); Vector3 look = Velocity; if ((look.X == 0) && (look.Y == 0) && (look.Z == 0)) @@ -1158,8 +1158,10 @@ namespace OpenSim.Region.Framework.Scenes SendInitialData(); // Create child agents in neighbouring regions - if (!m_isChildAgent) + if (!m_isChildAgent && !m_scene.IsAuthoritativeScene()) { + m_log.DebugFormat("[SCENE PRESENCE]: Requesting neighbouring children. cagent={0}, auth={1}", + m_isChildAgent.ToString(), m_scene.IsAuthoritativeScene()); IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) m_agentTransfer.EnableChildAgents(this); @@ -2472,6 +2474,9 @@ namespace OpenSim.Region.Framework.Scenes pos.Z += m_appearance.HipOffset; remoteAvatar.m_controllingClient.SendAvatarDataImmediate(this); + // Next line added on recommondation of MB + m_controllingClient.SendAppearance(m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); + m_scene.StatsReporter.AddAgentUpdates(1); } @@ -2492,6 +2497,7 @@ namespace OpenSim.Region.Framework.Scenes // only send if this is the root (children are only "listening posts" in a foreign region) if (!IsChildAgent) { + m_log.DebugFormat("[SCENE PRESENCE]: SendInitialFullUpdateToAllClients.SendFullUpdateToOtherClient"); SendFullUpdateToOtherClient(avatar); } @@ -2548,8 +2554,11 @@ namespace OpenSim.Region.Framework.Scenes pos.Z += m_appearance.HipOffset; m_controllingClient.SendAvatarDataImmediate(this); - SendInitialFullUpdateToAllClients(); + // Next two lines added on recommondation of MB + if (m_appearance != null && m_appearance.VisualParams != null && m_appearance.Texture != null) + m_controllingClient.SendAppearance(m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); + SendAppearanceToAllOtherAgents(); } @@ -2584,7 +2593,7 @@ namespace OpenSim.Region.Framework.Scenes { if(client.AgentId != ControllingClient.AgentId) { - //m_log.WarnFormat("[SCENE PRESENCE] Sending {0} appearance to {1} (SendAppearanceToAllOtherAgents)", Name, client.Name); + m_log.DebugFormat("[SCENE PRESENCE] Sending {0} appearance to {1} (SendAppearanceToAllOtherAgents)", Name, client.Name); client.SendAppearance(m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); } }); @@ -2611,9 +2620,11 @@ namespace OpenSim.Region.Framework.Scenes public void SendAppearanceToOtherAgent(ScenePresence avatar) { if (Appearance.Texture == null) + { return; + } //m_log.WarnFormat("{0} sending appearance to {1}, owner={2}", UUID, avatar.UUID, m_appearance.Owner); - //m_log.WarnFormat("[SCENE PRESENCE] Sending {0} appearance to {1} (SendAppearanceToOtherAgent)", Name, avatar.Name); + m_log.DebugFormat("[SCENE PRESENCE] Sending {0} appearance to {1} (SendAppearanceToOtherAgent)", Name, avatar.Name); m_appearance.Owner = UUID; avatar.ControllingClient.SendAppearance( m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); @@ -2668,25 +2679,34 @@ namespace OpenSim.Region.Framework.Scenes #endregion Bake Cache Check - m_appearance.SetAppearance(textureEntry, visualParams); - if (m_appearance.AvatarHeight > 0) - SetHeight(m_appearance.AvatarHeight); - - // This is not needed, because only the transient data changed - //AvatarData adata = new AvatarData(m_appearance); - //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); - - SendAppearanceToAllOtherAgents(); - if (!m_startAnimationSet) + try { - Animator.UpdateMovementAnimations(); - m_startAnimationSet = true; + m_appearance.SetAppearance(textureEntry, visualParams); + if (m_appearance.AvatarHeight > 0) + SetHeight(m_appearance.AvatarHeight); + + // This is not needed, because only the transient data changed + //AvatarData adata = new AvatarData(m_appearance); + //m_scene.AvatarService.SetAvatar(m_controllingClient.AgentId, adata); + + SendAppearanceToAllOtherAgents(); + if (!m_startAnimationSet) + { + Animator.UpdateMovementAnimations(); + m_startAnimationSet = true; + } + + Vector3 pos = m_pos; + pos.Z += m_appearance.HipOffset; + + m_controllingClient.SendAvatarDataImmediate(this); + // Next line added on recommondation of MB + m_controllingClient.SendAppearance(m_appearance.Owner, m_appearance.VisualParams, m_appearance.Texture.GetBytes()); + } + catch (Exception e) + { + m_log.DebugFormat("[SCENE PRESENCE] EXCEPTION setting appearance: {0}", e); } - - Vector3 pos = m_pos; - pos.Z += m_appearance.HipOffset; - - m_controllingClient.SendAvatarDataImmediate(this); } public void SetWearable(int wearableId, AvatarWearable wearable) @@ -2774,7 +2794,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Checks to see if the avatar is in range of a border and calls CrossToNewRegion /// - protected void CheckForBorderCrossing() + public void CheckForBorderCrossing() { if (IsChildAgent) return;