diff --git a/OpenSim/Data/IGridUserData.cs b/OpenSim/Data/IGridUserData.cs index e15a1f88a5..9afa477f30 100644 --- a/OpenSim/Data/IGridUserData.cs +++ b/OpenSim/Data/IGridUserData.cs @@ -50,6 +50,7 @@ namespace OpenSim.Data public interface IGridUserData { GridUserData Get(string userID); + GridUserData[] GetAll(string query); bool Store(GridUserData data); } } \ No newline at end of file diff --git a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs index 1870273616..fd52122cb0 100644 --- a/OpenSim/Data/MSSQL/MSSQLGridUserData.cs +++ b/OpenSim/Data/MSSQL/MSSQLGridUserData.cs @@ -50,7 +50,7 @@ namespace OpenSim.Data.MSSQL { } - public GridUserData Get(string userID) + public new GridUserData Get(string userID) { GridUserData[] ret = Get("UserID", userID); @@ -60,5 +60,10 @@ namespace OpenSim.Data.MSSQL return ret[0]; } + public GridUserData[] GetAll(string userID) + { + return base.Get(String.Format("UserID LIKE '{0}%'", userID)); + } + } } diff --git a/OpenSim/Data/MySQL/MySQLGridUserData.cs b/OpenSim/Data/MySQL/MySQLGridUserData.cs index a9ce94d33c..00560c11db 100644 --- a/OpenSim/Data/MySQL/MySQLGridUserData.cs +++ b/OpenSim/Data/MySQL/MySQLGridUserData.cs @@ -46,7 +46,7 @@ namespace OpenSim.Data.MySQL public MySQLGridUserData(string connectionString, string realm) : base(connectionString, realm, "GridUserStore") {} - public GridUserData Get(string userID) + public new GridUserData Get(string userID) { GridUserData[] ret = Get("UserID", userID); @@ -56,6 +56,9 @@ namespace OpenSim.Data.MySQL return ret[0]; } - + public GridUserData[] GetAll(string userID) + { + return base.Get(String.Format("UserID LIKE '{0}%'", userID)); + } } } \ No newline at end of file diff --git a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations index 55d82eca73..5faf95625f 100644 --- a/OpenSim/Data/MySQL/Resources/FriendsStore.migrations +++ b/OpenSim/Data/MySQL/Resources/FriendsStore.migrations @@ -9,7 +9,7 @@ CREATE TABLE `Friends` ( `Offered` VARCHAR(32) NOT NULL DEFAULT 0, PRIMARY KEY(`PrincipalID`, `Friend`), KEY(`PrincipalID`) -); +) ENGINE=InnoDB; COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteGridUserData.cs b/OpenSim/Data/SQLite/SQLiteGridUserData.cs index 1bb5ed87d6..d8c52f8880 100644 --- a/OpenSim/Data/SQLite/SQLiteGridUserData.cs +++ b/OpenSim/Data/SQLite/SQLiteGridUserData.cs @@ -56,6 +56,10 @@ namespace OpenSim.Data.SQLite return ret[0]; } + public GridUserData[] GetAll(string userID) + { + return base.Get(String.Format("UserID LIKE '{0}%'", userID)); + } } } \ No newline at end of file diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 6c22414b94..87c279252b 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs @@ -226,18 +226,6 @@ namespace OpenSim "Force the update of all objects on clients", HandleForceUpdate); - m_console.Commands.AddCommand("Debug", false, "debug packet", - "debug packet [ ]", - "Turn on packet debugging", - "If level > 255 then all incoming and outgoing packets are logged.\n" - + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" - + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" - + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" - + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" - + "If level <= 0 then no packets are logged.\n" - + "If an avatar name is given then only packets from that avatar are logged", - Debug); - m_console.Commands.AddCommand("General", false, "change region", "change region ", "Change current console region", ChangeSelectedRegion); @@ -701,45 +689,6 @@ namespace OpenSim RefreshPrompt(); } - /// - /// Turn on some debugging values for OpenSim. - /// - /// - protected void Debug(string module, string[] args) - { - if (args.Length == 1) - return; - - switch (args[1]) - { - case "packet": - string name = null; - if (args.Length == 5) - name = string.Format("{0} {1}", args[3], args[4]); - - if (args.Length > 2) - { - int newDebug; - if (int.TryParse(args[2], out newDebug)) - { - SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); - // We provide user information elsewhere if any clients had their debug level set. -// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); - } - else - { - MainConsole.Instance.Output("Usage: debug packet 0..255"); - } - } - - break; - - default: - MainConsole.Instance.Output("Unknown debug command"); - break; - } - } - // see BaseOpenSimServer /// /// Many commands list objects for debugging. Some of the types are listed here diff --git a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs index dfc4419def..15d6f7f253 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/J2KImage.cs @@ -424,7 +424,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // foreign user is visiting, we need to try again after the first fail to the local // asset service. string assetServerURL = string.Empty; - if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL)) + if (InventoryAccessModule.IsForeignUser(AgentID, out assetServerURL) && !string.IsNullOrEmpty(assetServerURL)) { if (!assetServerURL.EndsWith("/") && !assetServerURL.EndsWith("=")) assetServerURL = assetServerURL + "/"; diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index d008702008..7f14371ce5 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -34,6 +34,7 @@ using System.Net.Sockets; using System.Reflection; using System.Threading; using log4net; +using NDesk.Options; using Nini.Config; using OpenMetaverse.Packets; using OpenSim.Framework; @@ -102,10 +103,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// public class LLUDPServer : OpenSimUDPBase { + private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// Maximum transmission unit, or UDP packet size, for the LLUDP protocol public const int MTU = 1400; - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); + /// + /// Default packet debug level given to new clients + /// + public int DefaultClientPacketDebugLevel { get; set; } /// The measured resolution of Environment.TickCount public readonly float TickCountResolution; @@ -515,6 +521,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP if (UsePools) EnablePoolStats(); + MainConsole.Instance.Commands.AddCommand( + "Debug", false, "debug lludp packet", + "debug lludp packet [--default] [ ]", + "Turn on packet debugging", + "If level > 255 then all incoming and outgoing packets are logged.\n" + + "If level <= 255 then incoming AgentUpdate and outgoing SimStats and SimulatorViewerTimeMessage packets are not logged.\n" + + "If level <= 200 then incoming RequestImage and outgoing ImagePacket, ImageData, LayerData and CoarseLocationUpdate packets are not logged.\n" + + "If level <= 100 then incoming ViewerEffect and AgentAnimation and outgoing ViewerEffect and AvatarAnimation packets are not logged.\n" + + "If level <= 50 then outgoing ImprovedTerseObjectUpdate packets are not logged.\n" + + "If level <= 0 then no packets are logged.\n" + + "If --default is specified then the level becomes the default logging level for all subsequent agents.\n" + + "In this case, you cannot also specify an avatar name.\n" + + "If an avatar name is given then only packets from that avatar are logged.", + HandlePacketCommand); + MainConsole.Instance.Commands.AddCommand( "Debug", false, @@ -556,8 +577,68 @@ namespace OpenSim.Region.ClientStack.LindenUDP HandleStatusCommand); } + private void HandlePacketCommand(string module, string[] args) + { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + + bool setAsDefaultLevel = false; + OptionSet optionSet = new OptionSet().Add("default", o => setAsDefaultLevel = o != null); + List filteredArgs = optionSet.Parse(args); + + string name = null; + + if (filteredArgs.Count == 6) + { + if (!setAsDefaultLevel) + { + name = string.Format("{0} {1}", filteredArgs[4], filteredArgs[5]); + } + else + { + MainConsole.Instance.OutputFormat("ERROR: Cannot specify a user name when setting default logging level"); + return; + } + } + + if (filteredArgs.Count > 3) + { + int newDebug; + if (int.TryParse(filteredArgs[3], out newDebug)) + { + if (setAsDefaultLevel) + { + DefaultClientPacketDebugLevel = newDebug; + MainConsole.Instance.OutputFormat( + "Debug packet debug for new clients set to {0}", DefaultClientPacketDebugLevel); + } + else + { + m_scene.ForEachScenePresence(sp => + { + if (name == null || sp.Name == name) + { + MainConsole.Instance.OutputFormat( + "Packet debug for {0} ({1}) set to {2} in {3}", + sp.Name, sp.IsChildAgent ? "child" : "root", newDebug, m_scene.Name); + + sp.ControllingClient.DebugPacketLevel = newDebug; + } + }); + } + } + else + { + MainConsole.Instance.Output("Usage: debug lludp packet [--default] 0..255 [ ]"); + } + } + } + private void HandleStartCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp start "); @@ -575,6 +656,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleStopCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp stop "); @@ -592,6 +676,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandlePoolCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + if (args.Length != 4) { MainConsole.Instance.Output("Usage: debug lludp pool "); @@ -624,6 +711,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP private void HandleStatusCommand(string module, string[] args) { + if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) + return; + MainConsole.Instance.OutputFormat( "IN LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningInbound ? "enabled" : "disabled"); @@ -631,6 +721,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP "OUT LLUDP packet processing for {0} is {1}", m_scene.Name, IsRunningOutbound ? "enabled" : "disabled"); MainConsole.Instance.OutputFormat("LLUDP pools in {0} are {1}", m_scene.Name, UsePools ? "on" : "off"); + + MainConsole.Instance.OutputFormat( + "Packet debug level for new clients is {0}", DefaultClientPacketDebugLevel); } public bool HandlesRegion(Location x) @@ -1544,6 +1637,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP client = new LLClientView(m_scene, this, udpClient, sessionInfo, agentID, sessionID, circuitCode); client.OnLogout += LogoutHandler; + client.DebugPacketLevel = DefaultClientPacketDebugLevel; ((LLClientView)client).DisableFacelights = m_disableFacelights; diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs index 41ea2a270b..6d4c65d77b 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/FriendsModule.cs @@ -498,6 +498,8 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected virtual void StatusNotify(List friendList, UUID userID, bool online) { + m_log.DebugFormat("[FRIENDS]: Entering StatusNotify for {0}", userID); + List friendStringIds = friendList.ConvertAll(friend => friend.Friend); List remoteFriendStringIds = new List(); foreach (string friendStringId in friendStringIds) @@ -523,12 +525,17 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends foreach (PresenceInfo friendSession in friendSessions) { // let's guard against sessions-gone-bad - if (friendSession.RegionID != UUID.Zero) + if (friendSession != null && friendSession.RegionID != UUID.Zero) { + m_log.DebugFormat("[FRIENDS]: Get region {0}", friendSession.RegionID); GridRegion region = GridService.GetRegionByUUID(m_Scenes[0].RegionInfo.ScopeID, friendSession.RegionID); - //m_log.DebugFormat("[FRIENDS]: Remote Notify to region {0}", region.RegionName); - m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); + if (region != null) + { + m_FriendsSimConnector.StatusNotify(region, userID, friendSession.UserID, online); + } } + else + m_log.DebugFormat("[FRIENDS]: friend session is null or the region is UUID.Zero"); } } diff --git a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs index ae45b992fb..a456009ca1 100644 --- a/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/Friends/HGFriendsModule.cs @@ -252,7 +252,7 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends protected override void StatusNotify(List friendList, UUID userID, bool online) { -// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); + m_log.DebugFormat("[HGFRIENDS MODULE]: Entering StatusNotify for {0}", userID); // First, let's divide the friends on a per-domain basis Dictionary> friendsPerDomain = new Dictionary>(); @@ -348,31 +348,30 @@ namespace OpenSim.Region.CoreModules.Avatar.Friends return null; } -// public override FriendInfo[] GetFriendsFromService(IClientAPI client) -// { -//// m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); -// Boolean agentIsLocal = true; -// if (UserManagementModule != null) -// agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); + public override FriendInfo[] GetFriendsFromService(IClientAPI client) + { + // m_log.DebugFormat("[HGFRIENDS MODULE]: Entering GetFriendsFromService for {0}", client.Name); + Boolean agentIsLocal = true; + if (UserManagementModule != null) + agentIsLocal = UserManagementModule.IsLocalGridUser(client.AgentId); -// if (agentIsLocal) -// return base.GetFriendsFromService(client); + if (agentIsLocal) + return base.GetFriendsFromService(client); -// FriendInfo[] finfos = new FriendInfo[0]; -// // Foreigner -// AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); -// if (agentClientCircuit != null) -// { -// //[XXX] string agentUUI = Util.ProduceUserUniversalIdentifier(agentClientCircuit); + FriendInfo[] finfos = new FriendInfo[0]; + // Foreigner + AgentCircuitData agentClientCircuit = ((Scene)(client.Scene)).AuthenticateHandler.GetAgentCircuitData(client.CircuitCode); + if (agentClientCircuit != null) + { + // Note that this is calling a different interface than base; this one calls with a string param! + finfos = FriendsService.GetFriends(client.AgentId.ToString()); + m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); + } -// finfos = FriendsService.GetFriends(client.AgentId.ToString()); -// m_log.DebugFormat("[HGFRIENDS MODULE]: Fetched {0} local friends for visitor {1}", finfos.Length, client.AgentId.ToString()); -// } + // m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); -//// m_log.DebugFormat("[HGFRIENDS MODULE]: Exiting GetFriendsFromService for {0}", client.Name); - -// return finfos; -// } + return finfos; + } protected override bool StoreRights(UUID agentID, UUID friendID, int rights) { diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs index 7871eda5b6..144895ccfc 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGAssetMapper.cs @@ -73,6 +73,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess private AssetMetadata FetchMetadata(string url, UUID assetID) { + if (string.IsNullOrEmpty(url)) + return null; + if (!url.EndsWith("/") && !url.EndsWith("=")) url = url + "/"; @@ -92,6 +95,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess AssetBase asset = m_scene.AssetService.Get(assetID.ToString()); if (asset == null) { + if (string.IsNullOrEmpty(url)) + return null; + if (!url.EndsWith("/") && !url.EndsWith("=")) url = url + "/"; @@ -109,6 +115,9 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess public bool PostAsset(string url, AssetBase asset) { + if (string.IsNullOrEmpty(url)) + return false; + if (asset != null) { if (!url.EndsWith("/") && !url.EndsWith("=")) diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs index b2b628d548..1eae0ac4a1 100644 --- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs +++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/HGInventoryAccessModule.cs @@ -244,7 +244,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess UUID RayTargetID, byte BypassRayCast, bool RayEndIsIntersection, bool RezSelected, bool RemoveItem, UUID fromTaskID, bool attachment) { - m_log.DebugFormat("[HGScene] RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); + m_log.DebugFormat("[HGScene]: RezObject itemID={0} fromTaskID={1}", itemID, fromTaskID); //if (fromTaskID.Equals(UUID.Zero)) //{ @@ -297,7 +297,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess if (m_Scene.TryGetScenePresence(userID, out sp)) { AgentCircuitData aCircuit = m_Scene.AuthenticateHandler.GetAgentCircuitData(sp.ControllingClient.CircuitCode); - if (aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) + if (aCircuit != null && aCircuit.ServiceURLs != null && aCircuit.ServiceURLs.ContainsKey("AssetServerURI")) { assetServerURL = aCircuit.ServiceURLs["AssetServerURI"].ToString(); assetServerURL = assetServerURL.Trim(new char[] { '/' }); diff --git a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs index 194b591460..a7cbc8fe3c 100644 --- a/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs +++ b/OpenSim/Region/CoreModules/Framework/UserManagement/UserManagementModule.cs @@ -135,7 +135,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement s.ForEachSOG(delegate(SceneObjectGroup sog) { CacheCreators(sog); }); } - void EventManager_OnNewClient(IClientAPI client) { client.OnConnectionClosed += new Action(HandleConnectionClosed); @@ -151,6 +150,10 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement void HandleUUIDNameRequest(UUID uuid, IClientAPI remote_client) { +// m_log.DebugFormat( +// "[USER MANAGEMENT MODULE]: Handling request for name binding of UUID {0} from {1}", +// uuid, remote_client.Name); + if (m_Scenes[0].LibraryService != null && (m_Scenes[0].LibraryService.LibraryRootFolder.Owner == uuid)) { remote_client.SendNameReply(uuid, "Mr", "OpenSim"); @@ -319,8 +322,34 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } else { + // Let's try the GridUser service + GridUserInfo uInfo = m_Scenes[0].GridUserService.GetGridUserInfo(uuid.ToString()); + if (uInfo != null) + { + string url, first, last, tmp; + UUID u; + if (Util.ParseUniversalUserIdentifier(uInfo.UserID, out u, out url, out first, out last, out tmp)) + { + AddUser(uuid, first, last, url); + + if (m_UserCache.ContainsKey(uuid)) + { + names[0] = m_UserCache[uuid].FirstName; + names[1] = m_UserCache[uuid].LastName; + + return true; + } + } + else + m_log.DebugFormat("[USER MANAGEMENT MODULE]: Unable to parse UUI {0}", uInfo.UserID); + } + else + { + m_log.DebugFormat("[USER MANAGEMENT MODULE]: No grid user found for {0}", uuid); + } + names[0] = "Unknown"; - names[1] = "UserUMMTGUN3"; + names[1] = "UserUMMTGUN7"; return false; } @@ -474,7 +503,6 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement //m_log.DebugFormat("[USER MANAGEMENT MODULE]: Adding user with id {0}, creatorData {1}", id, creatorData); UserData oldUser; - //lock the whole block - prevent concurrent update lock (m_UserCache) m_UserCache.TryGetValue(id, out oldUser); @@ -512,7 +540,7 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement UserData user = new UserData(); user.Id = id; - if (creatorData != null && creatorData != string.Empty) + if (!string.IsNullOrEmpty(creatorData)) { //creatorData = ; @@ -536,8 +564,12 @@ namespace OpenSim.Region.CoreModules.Framework.UserManagement } else { + // Temporarily add unknown user entries of this type into the cache so that we can distinguish + // this source from other recent (hopefully resolved) bugs that fail to retrieve a user name binding + // TODO: Can be removed when GUN* unknown users have definitely dropped significantly or + // disappeared. user.FirstName = "Unknown"; - user.LastName = "UserUMMAU"; + user.LastName = "UserUMMAU3"; } AddUserInternal(user); diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index e434b2eb69..0e79733cc0 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -546,7 +546,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands { ConsoleDisplayList cdl = new ConsoleDisplayList(); cdl.AddRow("Name", so.Name); - cdl.AddRow("Descrition", so.Description); + cdl.AddRow("Description", so.Description); cdl.AddRow("Local ID", so.LocalId); cdl.AddRow("UUID", so.UUID); cdl.AddRow("Location", string.Format("{0} @ {1}", so.AbsolutePosition, so.Scene.Name)); diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 436a544858..c743190b09 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -5091,6 +5091,7 @@ namespace OpenSim.Region.Framework.Scenes public void RegionHandleRequest(IClientAPI client, UUID regionID) { + m_log.DebugFormat("[SCENE]: RegionHandleRequest {0}", regionID); ulong handle = 0; if (regionID == RegionInfo.RegionID) handle = RegionInfo.RegionHandle; diff --git a/OpenSim/Region/Framework/Scenes/SceneManager.cs b/OpenSim/Region/Framework/Scenes/SceneManager.cs index c70342fc02..c5c083a25c 100644 --- a/OpenSim/Region/Framework/Scenes/SceneManager.cs +++ b/OpenSim/Region/Framework/Scenes/SceneManager.cs @@ -420,29 +420,6 @@ namespace OpenSim.Region.Framework.Scenes return false; } - /// - /// Set the debug packet level on each current scene. This level governs which packets are printed out to the - /// console. - /// - /// - /// Name of avatar to debug - public void SetDebugPacketLevelOnCurrentScene(int newDebug, string name) - { - ForEachSelectedScene(scene => - scene.ForEachScenePresence(sp => - { - if (name == null || sp.Name == name) - { - m_log.DebugFormat( - "Packet debug for {0} ({1}) set to {2}", - sp.Name, sp.IsChildAgent ? "child" : "root", newDebug); - - sp.ControllingClient.DebugPacketLevel = newDebug; - } - }) - ); - } - public List GetCurrentSceneAvatars() { List avatars = new List(); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs index 75ff24ed0b..bdf4bc0b01 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSActorMoveToTarget.cs @@ -50,7 +50,8 @@ public class BSActorMoveToTarget : BSActor // BSActor.isActive public override bool isActive { - get { return Enabled; } + // MoveToTarget only works on physical prims + get { return Enabled && m_controllingPrim.IsPhysicallyActive; } } // Release any connections and resources used by the actor. @@ -102,16 +103,28 @@ public class BSActorMoveToTarget : BSActor // We're taking over after this. m_controllingPrim.ZeroMotion(true); - m_targetMotor = new BSVMotor("BSActorMoveToTargget.Activate", - m_controllingPrim.MoveToTargetTau, // timeScale - BSMotor.Infinite, // decay time scale - 1f // efficiency + /* Someday use the PID controller + m_targetMotor = new BSPIDVMotor("BSActorMoveToTarget-" + m_controllingPrim.LocalID.ToString()); + m_targetMotor.TimeScale = m_controllingPrim.MoveToTargetTau; + m_targetMotor.Efficiency = 1f; + */ + m_targetMotor = new BSVMotor("BSActorMoveToTarget-" + m_controllingPrim.LocalID.ToString(), + m_controllingPrim.MoveToTargetTau, // timeScale + BSMotor.Infinite, // decay time scale + 1f // efficiency ); m_targetMotor.PhysicsScene = m_physicsScene; // DEBUG DEBUG so motor will output detail log messages. m_targetMotor.SetTarget(m_controllingPrim.MoveToTargetTarget); m_targetMotor.SetCurrent(m_controllingPrim.RawPosition); - m_physicsScene.BeforeStep += Mover; + // m_physicsScene.BeforeStep += Mover; + m_physicsScene.BeforeStep += Mover2; + } + else + { + // If already allocated, make sure the target and other paramters are current + m_targetMotor.SetTarget(m_controllingPrim.MoveToTargetTarget); + m_targetMotor.SetCurrent(m_controllingPrim.RawPosition); } } @@ -119,12 +132,16 @@ public class BSActorMoveToTarget : BSActor { if (m_targetMotor != null) { - m_physicsScene.BeforeStep -= Mover; + // m_physicsScene.BeforeStep -= Mover; + m_physicsScene.BeforeStep -= Mover2; m_targetMotor = null; } } - // Called just before the simulation step. Update the vertical position for hoverness. + // Origional mover that set the objects position to move to the target. + // The problem was that gravity would keep trying to push the object down so + // the overall downward velocity would increase to infinity. + // Called just before the simulation step. private void Mover(float timeStep) { // Don't do hovering while the object is selected. @@ -142,6 +159,7 @@ public class BSActorMoveToTarget : BSActor m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover,zeroMovement,movePos={1},pos={2},mass={3}", m_controllingPrim.LocalID, movePosition, m_controllingPrim.RawPosition, m_controllingPrim.Mass); m_controllingPrim.ForcePosition = m_targetMotor.TargetValue; + m_controllingPrim.ForceVelocity = OMV.Vector3.Zero; // Setting the position does not cause the physics engine to generate a property update. Force it. m_physicsScene.PE.PushUpdate(m_controllingPrim.PhysBody); } @@ -151,7 +169,51 @@ public class BSActorMoveToTarget : BSActor // Setting the position does not cause the physics engine to generate a property update. Force it. m_physicsScene.PE.PushUpdate(m_controllingPrim.PhysBody); } - m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover,move,fromPos={1},movePos={2}", m_controllingPrim.LocalID, origPosition, movePosition); + m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover,move,fromPos={1},movePos={2}", + m_controllingPrim.LocalID, origPosition, movePosition); + } + + // Version of mover that applies forces to move the physical object to the target. + // Also overcomes gravity so the object doesn't just drop to the ground. + // Called just before the simulation step. + private void Mover2(float timeStep) + { + // Don't do hovering while the object is selected. + if (!isActive) + return; + + OMV.Vector3 origPosition = m_controllingPrim.RawPosition; // DEBUG DEBUG (for printout below) + OMV.Vector3 addedForce = OMV.Vector3.Zero; + + // CorrectionVector is the movement vector required this step + OMV.Vector3 correctionVector = m_targetMotor.Step(timeStep, m_controllingPrim.RawPosition); + + // If we are very close to our target, turn off the movement motor. + if (m_targetMotor.ErrorIsZero()) + { + m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover3,zeroMovement,pos={1},mass={2}", + m_controllingPrim.LocalID, m_controllingPrim.RawPosition, m_controllingPrim.Mass); + m_controllingPrim.ForcePosition = m_targetMotor.TargetValue; + m_controllingPrim.ForceVelocity = OMV.Vector3.Zero; + // Setting the position does not cause the physics engine to generate a property update. Force it. + m_physicsScene.PE.PushUpdate(m_controllingPrim.PhysBody); + } + else + { + // First force to move us there -- the motor return a timestep scaled value. + addedForce = correctionVector / timeStep; + // Remove the existing velocity (only the moveToTarget force counts) + addedForce -= m_controllingPrim.RawVelocity; + // Overcome gravity. + addedForce -= m_controllingPrim.Gravity; + + // Add enough force to overcome the mass of the object + addedForce *= m_controllingPrim.Mass; + + m_controllingPrim.AddForce(addedForce, false /* pushForce */, true /* inTaintTime */); + } + m_physicsScene.DetailLog("{0},BSActorMoveToTarget.Mover3,move,fromPos={1},addedForce={2}", + m_controllingPrim.LocalID, origPosition, addedForce); } } } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs index 48f842e91e..5ef69925f8 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSCharacter.cs @@ -626,7 +626,7 @@ public sealed class BSCharacter : BSPhysObject OMV.Vector3 addForce = force / PhysScene.LastTimeStep; AddForce(addForce, pushforce, false); } - private void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { + public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { if (force.IsFinite()) { OMV.Vector3 addForce = Util.ClampV(force, BSParam.MaxAddForceMagnitude); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs index 07e87d13eb..aa247dd01d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSDynamics.cs @@ -1276,7 +1276,7 @@ namespace OpenSim.Region.Physics.BulletSPlugin VehicleAddForce(appliedGravity); - VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={3}", + VDetailLog("{0}, MoveLinear,applyGravity,vehGrav={1},collid={2},fudge={3},mass={4},appliedForce={5}", ControllingPrim.LocalID, m_VehicleGravity, ControllingPrim.IsColliding, BSParam.VehicleGroundGravityFudge, m_vehicleMass, appliedGravity); } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs index 76c2187eed..ad8e10f2f5 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinkset.cs @@ -33,14 +33,6 @@ using OMV = OpenMetaverse; namespace OpenSim.Region.Physics.BulletSPlugin { -// A BSPrim can get individual information about its linkedness attached -// to it through an instance of a subclass of LinksetInfo. -// Each type of linkset will define the information needed for its type. -public abstract class BSLinksetInfo -{ - public virtual void Clear() { } -} - public abstract class BSLinkset { // private static string LogHeader = "[BULLETSIM LINKSET]"; @@ -56,15 +48,15 @@ public abstract class BSLinkset { BSLinkset ret = null; - switch ((int)BSParam.LinksetImplementation) + switch (parent.LinksetType) { - case (int)LinksetImplementation.Constraint: + case LinksetImplementation.Constraint: ret = new BSLinksetConstraints(physScene, parent); break; - case (int)LinksetImplementation.Compound: + case LinksetImplementation.Compound: ret = new BSLinksetCompound(physScene, parent); break; - case (int)LinksetImplementation.Manual: + case LinksetImplementation.Manual: // ret = new BSLinksetManual(physScene, parent); break; default: diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs index 350a5d1761..308cf13b13 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSLinksetCompound.cs @@ -238,7 +238,6 @@ public sealed class BSLinksetCompound : BSLinkset // there will already be a rebuild scheduled. DetailLog("{0},BSLinksetCompound.UpdateProperties,couldNotUpdateChild.schedulingRebuild,whichUpdated={1}", updated.LocalID, whichUpdated); - updated.LinksetInfo = null; // setting to 'null' causes relative position to be recomputed. ScheduleRebuild(updated); } } @@ -294,7 +293,6 @@ public sealed class BSLinksetCompound : BSLinkset child.LocalID, child.PhysBody.AddrString); // Cause the child's body to be rebuilt and thus restored to normal operation - child.LinksetInfo = null; child.ForceBodyShapeRebuild(false); if (!HasAnyChildren) diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs index ef662b5919..121470364b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSMotors.cs @@ -144,7 +144,6 @@ public class BSVMotor : BSMotor Vector3 correction = Vector3.Zero; Vector3 error = TargetValue - CurrentValue; - LastError = error; if (!ErrorIsZero(error)) { correction = StepError(timeStep, error); @@ -179,6 +178,7 @@ public class BSVMotor : BSMotor MDetailLog("{0}, BSVMotor.Step,zero,{1},origTgt={2},origCurr={3},currTgt={4},currCurr={5}", BSScene.DetailLogZero, UseName, origCurrVal, origTarget, TargetValue, CurrentValue); } + LastError = error; return correction; } @@ -293,7 +293,6 @@ public class BSFMotor : BSMotor float correction = 0f; float error = TargetValue - CurrentValue; - LastError = error; if (!ErrorIsZero(error)) { correction = StepError(timeStep, error); @@ -328,6 +327,7 @@ public class BSFMotor : BSMotor MDetailLog("{0}, BSFMotor.Step,zero,{1},origTgt={2},origCurr={3},ret={4}", BSScene.DetailLogZero, UseName, origCurrVal, origTarget, CurrentValue); } + LastError = error; return CurrentValue; } @@ -363,7 +363,7 @@ public class BSFMotor : BSMotor // ============================================================================ // ============================================================================ -// Proportional, Integral, Derivitive Motor +// Proportional, Integral, Derivitive ("PID") Motor // Good description at http://www.answers.com/topic/pid-controller . Includes processes for choosing p, i and d factors. public class BSPIDVMotor : BSVMotor { @@ -434,15 +434,14 @@ public class BSPIDVMotor : BSVMotor // A simple derivitive is the rate of change from the last error. Vector3 derivitive = (error - LastError) * timeStep; - LastError = error; // Correction = (proportionOfPresentError + accumulationOfPastError + rateOfChangeOfError) - Vector3 ret = error * timeStep * proportionFactor * FactorMix.X - + RunningIntegration * integralFactor * FactorMix.Y - + derivitive * derivFactor * FactorMix.Z + Vector3 ret = error / TimeScale * timeStep * proportionFactor * FactorMix.X + + RunningIntegration / TimeScale * integralFactor * FactorMix.Y + + derivitive / TimeScale * derivFactor * FactorMix.Z ; - MDetailLog("{0},BSPIDVMotor.step,ts={1},err={2},runnInt={3},deriv={4},ret={5}", + MDetailLog("{0}, BSPIDVMotor.step,ts={1},err={2},runnInt={3},deriv={4},ret={5}", BSScene.DetailLogZero, timeStep, error, RunningIntegration, derivitive, ret); return ret; diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs index 6437b04896..d17c8e76c0 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSParam.cs @@ -706,7 +706,7 @@ public static class BSParam new ParameterDefn("ResetBroadphasePool", "Setting this is any value resets the broadphase collision pool", 0f, (s) => { return 0f; }, - (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v); } ), + (s,v) => { BSParam.ResetBroadphasePoolTainted(s, v, false /* inTaintTime */); } ), new ParameterDefn("ResetConstraintSolver", "Setting this is any value resets the constraint solver", 0f, (s) => { return 0f; }, @@ -792,10 +792,10 @@ public static class BSParam // ===================================================================== // There are parameters that, when set, cause things to happen in the physics engine. // This causes the broadphase collision cache to be cleared. - private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v) + private static void ResetBroadphasePoolTainted(BSScene pPhysScene, float v, bool inTaintTime) { BSScene physScene = pPhysScene; - physScene.TaintedObject("BSParam.ResetBroadphasePoolTainted", delegate() + physScene.TaintedObject(inTaintTime, "BSParam.ResetBroadphasePoolTainted", delegate() { physScene.PE.ResetBroadphasePool(physScene.World); }); diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs index a4c5e08693..a0d5c42172 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPhysObject.cs @@ -210,6 +210,7 @@ public abstract class BSPhysObject : PhysicsActor AddAngularForce(force, pushforce, false); } public abstract void AddAngularForce(OMV.Vector3 force, bool pushforce, bool inTaintTime); + public abstract void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime); public abstract OMV.Vector3 ForceRotationalVelocity { get; set; } diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs index 95bdc7b32f..b2947c623d 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrim.cs @@ -70,18 +70,17 @@ public class BSPrim : BSPhysObject private int CrossingFailures { get; set; } // Keep a handle to the vehicle actor so it is easy to set parameters on same. - public BSDynamics VehicleActor; public const string VehicleActorName = "BasicVehicle"; // Parameters for the hover actor - public const string HoverActorName = "HoverActor"; + public const string HoverActorName = "BSPrim.HoverActor"; // Parameters for the axis lock actor public const String LockedAxisActorName = "BSPrim.LockedAxis"; // Parameters for the move to target actor - public const string MoveToTargetActorName = "MoveToTargetActor"; + public const string MoveToTargetActorName = "BSPrim.MoveToTargetActor"; // Parameters for the setForce and setTorque actors - public const string SetForceActorName = "SetForceActor"; - public const string SetTorqueActorName = "SetTorqueActor"; + public const string SetForceActorName = "BSPrim.SetForceActor"; + public const string SetTorqueActorName = "BSPrim.SetTorqueActor"; public BSPrim(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) @@ -100,9 +99,8 @@ public class BSPrim : BSPhysObject _isPhysical = pisPhysical; _isVolumeDetect = false; - // We keep a handle to the vehicle actor so we can set vehicle parameters later. - VehicleActor = new BSDynamics(PhysScene, this, VehicleActorName); - PhysicalActors.Add(VehicleActorName, VehicleActor); + // Add a dynamic vehicle to our set of actors that can move this prim. + PhysicalActors.Add(VehicleActorName, new BSDynamics(PhysScene, this, VehicleActorName)); _mass = CalculateMass(); @@ -450,6 +448,9 @@ public class BSPrim : BSPhysObject Gravity = ComputeGravity(Buoyancy); PhysScene.PE.SetGravity(PhysBody, Gravity); + OMV.Vector3 currentScale = PhysScene.PE.GetLocalScaling(PhysShape.physShapeInfo); // DEBUG DEBUG + DetailLog("{0},BSPrim.UpdateMassProperties,currentScale{1},shape={2}", LocalID, currentScale, PhysShape.physShapeInfo); // DEBUG DEBUG + Inertia = PhysScene.PE.CalculateLocalInertia(PhysShape.physShapeInfo, physMass); PhysScene.PE.SetMassProps(PhysBody, physMass, Inertia); PhysScene.PE.UpdateInertiaTensor(PhysBody); @@ -502,9 +503,25 @@ public class BSPrim : BSPhysObject } } + // Find and return a handle to the current vehicle actor. + // Return 'null' if there is no vehicle actor. + public BSDynamics GetVehicleActor() + { + BSDynamics ret = null; + BSActor actor; + if (PhysicalActors.TryGetActor(VehicleActorName, out actor)) + { + ret = actor as BSDynamics; + } + return ret; + } public override int VehicleType { get { - return (int)VehicleActor.Type; + int ret = (int)Vehicle.TYPE_NONE; + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + ret = (int)vehicleActor.Type; + return ret; } set { Vehicle type = (Vehicle)value; @@ -515,8 +532,12 @@ public class BSPrim : BSPhysObject // change all the parameters. Like a plane changing to CAR when on the // ground. In this case, don't want to zero motion. // ZeroMotion(true /* inTaintTime */); - VehicleActor.ProcessTypeChange(type); - ActivateIfPhysical(false); + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + { + vehicleActor.ProcessTypeChange(type); + ActivateIfPhysical(false); + } }); } } @@ -524,31 +545,47 @@ public class BSPrim : BSPhysObject { PhysScene.TaintedObject("BSPrim.VehicleFloatParam", delegate() { - VehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); - ActivateIfPhysical(false); + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + { + vehicleActor.ProcessFloatVehicleParam((Vehicle)param, value); + ActivateIfPhysical(false); + } }); } public override void VehicleVectorParam(int param, OMV.Vector3 value) { PhysScene.TaintedObject("BSPrim.VehicleVectorParam", delegate() { - VehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); - ActivateIfPhysical(false); + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + { + vehicleActor.ProcessVectorVehicleParam((Vehicle)param, value); + ActivateIfPhysical(false); + } }); } public override void VehicleRotationParam(int param, OMV.Quaternion rotation) { PhysScene.TaintedObject("BSPrim.VehicleRotationParam", delegate() { - VehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); - ActivateIfPhysical(false); + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + { + vehicleActor.ProcessRotationVehicleParam((Vehicle)param, rotation); + ActivateIfPhysical(false); + } }); } public override void VehicleFlags(int param, bool remove) { PhysScene.TaintedObject("BSPrim.VehicleFlags", delegate() { - VehicleActor.ProcessVehicleFlags(param, remove); + BSDynamics vehicleActor = GetVehicleActor(); + if (vehicleActor != null) + { + vehicleActor.ProcessVehicleFlags(param, remove); + } }); } @@ -1040,6 +1077,20 @@ public class BSPrim : BSPhysObject } } + public override OMV.Vector3 PIDTarget + { + set + { + base.PIDTarget = value; + BSActor actor; + if (PhysicalActors.TryGetActor(MoveToTargetActorName, out actor)) + { + // if the actor exists, tell it to refresh its values. + actor.Refresh(); + } + + } + } // Used for llSetHoverHeight and maybe vehicle height // Hover Height will override MoveTo target's Z public override bool PIDHoverActive { @@ -1063,7 +1114,7 @@ public class BSPrim : BSPhysObject // Applying a force just adds this to the total force on the object. // This added force will only last the next simulation tick. - public void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { + public override void AddForce(OMV.Vector3 force, bool pushforce, bool inTaintTime) { // for an object, doesn't matter if force is a pushforce or not if (IsPhysicallyActive) { diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs index 235da782e1..87eed98c4b 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPrimLinkable.cs @@ -41,12 +41,15 @@ public class BSPrimLinkable : BSPrimDisplaced // The index of this child prim. public int LinksetChildIndex { get; set; } - public BSLinksetInfo LinksetInfo { get; set; } + public BSLinkset.LinksetImplementation LinksetType { get; set; } public BSPrimLinkable(uint localID, String primName, BSScene parent_scene, OMV.Vector3 pos, OMV.Vector3 size, OMV.Quaternion rotation, PrimitiveBaseShape pbs, bool pisPhysical) : base(localID, primName, parent_scene, pos, size, rotation, pbs, pisPhysical) { + // Default linkset implementation for this prim + LinksetType = (BSLinkset.LinksetImplementation)BSParam.LinksetImplementation; + Linkset = BSLinkset.Factory(PhysScene, this); PhysScene.TaintedObject("BSPrimLinksetCompound.Refresh", delegate() diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs index dec6b6f24c..1645c989d7 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSScene.cs @@ -223,8 +223,8 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters // can be left in and every call doesn't have to check for null. if (m_physicsLoggingEnabled) { - PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes); - PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output error messages. + PhysicsLogging = new Logging.LogWriter(m_physicsLoggingDir, m_physicsLoggingPrefix, m_physicsLoggingFileMinutes, m_physicsLoggingDoFlush); + PhysicsLogging.ErrorLogger = m_log; // for DEBUG. Let's the logger output its own error messages. } else { @@ -1106,8 +1106,6 @@ public sealed class BSScene : PhysicsScene, IPhysicsParameters public void DetailLog(string msg, params Object[] args) { PhysicsLogging.Write(msg, args); - // Add the Flush() if debugging crashes. Gets all the messages written out. - if (m_physicsLoggingDoFlush) PhysicsLogging.Flush(); } // Used to fill in the LocalID when there isn't one. It's the correct number of characters. public const string DetailLogZero = "0000000000"; diff --git a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs index b040e21280..583c436872 100755 --- a/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/Tests/BasicVehicles.cs @@ -114,21 +114,25 @@ public class BasicVehicles : OpenSimTestCase // Instead the appropriate values are set and calls are made just the parts of the // controller we want to exercise. Stepping the physics engine then applies // the actions of that one feature. - TestVehicle.VehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); - TestVehicle.VehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale); - TestVehicle.VehicleActor.enableAngularVerticalAttraction = true; - - TestVehicle.IsPhysical = true; - PhysicsScene.ProcessTaints(); - - // Step the simulator a bunch of times and vertical attraction should orient the vehicle up - for (int ii = 0; ii < simSteps; ii++) + BSDynamics vehicleActor = TestVehicle.GetVehicleActor(); + if (vehicleActor != null) { - TestVehicle.VehicleActor.ForgetKnownVehicleProperties(); - TestVehicle.VehicleActor.ComputeAngularVerticalAttraction(); - TestVehicle.VehicleActor.PushKnownChanged(); + vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_EFFICIENCY, efficiency); + vehicleActor.ProcessFloatVehicleParam(Vehicle.VERTICAL_ATTRACTION_TIMESCALE, timeScale); + vehicleActor.enableAngularVerticalAttraction = true; - PhysicsScene.Simulate(simulationTimeStep); + TestVehicle.IsPhysical = true; + PhysicsScene.ProcessTaints(); + + // Step the simulator a bunch of times and vertical attraction should orient the vehicle up + for (int ii = 0; ii < simSteps; ii++) + { + vehicleActor.ForgetKnownVehicleProperties(); + vehicleActor.ComputeAngularVerticalAttraction(); + vehicleActor.PushKnownChanged(); + + PhysicsScene.Simulate(simulationTimeStep); + } } TestVehicle.IsPhysical = false; diff --git a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs index 687cf8ddb1..7483395124 100644 --- a/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs +++ b/OpenSim/Server/Handlers/GridUser/GridUserServerPostHandler.cs @@ -185,10 +185,12 @@ namespace OpenSim.Server.Handlers.GridUser GridUserInfo guinfo = m_GridUserService.GetGridUserInfo(user); Dictionary result = new Dictionary(); - result["result"] = guinfo.ToKeyValuePairs(); + if (guinfo != null) + result["result"] = guinfo.ToKeyValuePairs(); + else + result["result"] = "null"; string xmlString = ServerUtils.BuildXmlResponse(result); - //m_log.DebugFormat("[GRID USER HANDLER]: resp string: {0}", xmlString); return Util.UTF8NoBomEncoding.GetBytes(xmlString); } diff --git a/OpenSim/Services/UserAccountService/GridUserService.cs b/OpenSim/Services/UserAccountService/GridUserService.cs index 83881809f9..fa9a4a8481 100644 --- a/OpenSim/Services/UserAccountService/GridUserService.cs +++ b/OpenSim/Services/UserAccountService/GridUserService.cs @@ -46,12 +46,28 @@ namespace OpenSim.Services.UserAccountService public GridUserService(IConfigSource config) : base(config) { - m_log.Debug("[USER GRID SERVICE]: Starting user grid service"); + m_log.Debug("[GRID USER SERVICE]: Starting user grid service"); } public virtual GridUserInfo GetGridUserInfo(string userID) { - GridUserData d = m_Database.Get(userID); + GridUserData d = null; + if (userID.Length > 36) // it's a UUI + d = m_Database.Get(userID); + else // it's a UUID + { + GridUserData[] ds = m_Database.GetAll(userID); + if (ds == null) + return null; + + if (ds.Length > 0) + { + d = ds[0]; + foreach (GridUserData dd in ds) + if (dd.UserID.Length > d.UserID.Length) // find the longest + d = dd; + } + } if (d == null) return null; diff --git a/prebuild.xml b/prebuild.xml index 5076cf4ddd..fc49fdfb19 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1602,6 +1602,7 @@ +