From ba98d6fffe03389d6538a11d5eec45c863964403 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 17 Feb 2012 08:03:53 -0500 Subject: Fix missing telehub handling on login --- OpenSim/Region/Framework/Scenes/Scene.cs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4c8e2d2..ecc553d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3427,6 +3427,27 @@ namespace OpenSim.Region.Framework.Scenes agent.startpos.Z = 720; } } + + // Honor Estate teleport routing via Telehubs + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && RegionInfo.EstateSettings.AllowDirectTeleport == false) + { + SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); + // Can have multiple SpawnPoints + List spawnpoints = RegionInfo.RegionSettings.SpawnPoints(); + if ( spawnpoints.Count > 1) + { + // We have multiple SpawnPoints, Route the agent to a random one + agent.startpos = spawnpoints[Util.RandomClass.Next(spawnpoints.Count)].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + else + { + // We have a single SpawnPoint and will route the agent to it + agent.startpos = spawnpoints[0].GetLocation(telehub.AbsolutePosition, telehub.GroupRotation); + } + + return true; + } + // Honor parcel landing type and position. if (land != null) { -- cgit v1.1 From 6baa13ab7aeb7d0ee08f2460f52961dbd79bada1 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 17 Feb 2012 09:12:41 -0800 Subject: Add new and updated script events --- OpenSim/Region/Framework/Scenes/EventManager.cs | 58 ++++++++++++++++++++-- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 +++++ 2 files changed, 67 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d31d380..34d3da7 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -184,10 +184,62 @@ namespace OpenSim.Region.Framework.Scenes public event ClientClosed OnClientClosed; + // Fired when a script is created + // The indication that a new script exists in this region. + public delegate void NewScript(UUID clientID, SceneObjectPart part, UUID itemID); + public event NewScript OnNewScript; + public virtual void TriggerNewScript(UUID clientID, SceneObjectPart part, UUID itemID) + { + NewScript handlerNewScript = OnNewScript; + if (handlerNewScript != null) + { + foreach (NewScript d in handlerNewScript.GetInvocationList()) + { + try + { + d(clientID, part, itemID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerNewScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + + //TriggerUpdateScript: triggered after Scene receives client's upload of updated script and stores it as asset + // An indication that the script has changed. + public delegate void UpdateScript(UUID clientID, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID); + public event UpdateScript OnUpdateScript; + public virtual void TriggerUpdateScript(UUID clientId, UUID itemId, UUID primId, bool isScriptRunning, UUID newAssetID) + { + UpdateScript handlerUpdateScript = OnUpdateScript; + if (handlerUpdateScript != null) + { + foreach (UpdateScript d in handlerUpdateScript.GetInvocationList()) + { + try + { + d(clientId, itemId, primId, isScriptRunning, newAssetID); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerUpdateScript failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + /// - /// This is fired when a scene object property that a script might be interested in (such as color, scale or - /// inventory) changes. Only enough information is sent for the LSL changed event - /// (see http://lslwiki.net/lslwiki/wakka.php?wakka=changed) + /// ScriptChangedEvent is fired when a scene object property that a script might be interested + /// in (such as color, scale or inventory) changes. Only enough information sent is for the LSL changed event. + /// This is not an indication that the script has changed (see OnUpdateScript for that). + /// This event is sent to a script to tell it that some property changed on + /// the object the script is in. See http://lslwiki.net/lslwiki/wakka.php?wakka=changed . /// public event ScriptChangedEvent OnScriptChangedEvent; public delegate void ScriptChangedEvent(uint localID, uint change); diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 9d9729e..6cc78b8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -283,6 +283,10 @@ namespace OpenSim.Region.Framework.Scenes { remoteClient.SendAgentAlertMessage("Script saved", false); } + + // Tell anyone managing scripts that a script has been reloaded/changed + EventManager.TriggerUpdateScript(remoteClient.AgentId, itemId, primId, isScriptRunning, item.AssetID); + part.ParentGroup.ResumeScripts(); return errors; } @@ -1624,9 +1628,13 @@ namespace OpenSim.Region.Framework.Scenes // have state in inventory part.Inventory.CreateScriptInstance(copyID, 0, false, DefaultScriptEngine, 0); + // tell anyone watching that there is a new script in town + EventManager.TriggerNewScript(agentID, part, copyID); + // m_log.InfoFormat("[PRIMINVENTORY]: " + // "Rezzed script {0} into prim local ID {1} for user {2}", // item.inventoryName, localID, remoteClient.Name); + part.ParentGroup.ResumeScripts(); return part; @@ -1707,6 +1715,10 @@ namespace OpenSim.Region.Framework.Scenes part.Inventory.AddInventoryItem(taskItem, false); part.Inventory.CreateScriptInstance(taskItem, 0, false, DefaultScriptEngine, 0); + + // tell anyone managing scripts that a new script exists + EventManager.TriggerNewScript(agentID, part, taskItem.ItemID); + part.ParentGroup.ResumeScripts(); return part; -- cgit v1.1 From 784263f5e334aeda15effee599efc8bf546aa010 Mon Sep 17 00:00:00 2001 From: Dan Lake Date: Fri, 17 Feb 2012 13:43:14 -0800 Subject: Added the TriggerAvatarAppearanceChanged to EventManager. It's triggered by AvatarFactoryModule after an avatar's appearance has been succesfully changed and persisted (if the persist option is set). --- .../Avatar/AvatarFactory/AvatarFactoryModule.cs | 4 ++++ OpenSim/Region/Framework/Scenes/EventManager.cs | 24 ++++++++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs index c7f4c20..b0cee03 100644 --- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs +++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs @@ -496,6 +496,10 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory SetAppearanceAssets(sp.UUID, sp.Appearance); m_scene.AvatarService.SetAppearance(agentid, sp.Appearance); + + // Trigger this here because it's the final step in the set/queue/save process for appearance setting. + // Everything has been updated and stored. Ensures bakes have been persisted (if option is set to persist bakes). + m_scene.EventManager.TriggerAvatarAppearanceChanged(sp); } private void SetAppearanceAssets(UUID userID, AvatarAppearance appearance) diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs index d31d380..6586437 100644 --- a/OpenSim/Region/Framework/Scenes/EventManager.cs +++ b/OpenSim/Region/Framework/Scenes/EventManager.cs @@ -173,6 +173,9 @@ namespace OpenSim.Region.Framework.Scenes public delegate void AvatarEnteringNewParcel(ScenePresence avatar, int localLandID, UUID regionID); public event AvatarEnteringNewParcel OnAvatarEnteringNewParcel; + public delegate void AvatarAppearanceChange(ScenePresence avatar); + public event AvatarAppearanceChange OnAvatarAppearanceChange; + public event Action OnSignificantClientMovement; public delegate void IncomingInstantMessage(GridInstantMessage message); @@ -1238,6 +1241,27 @@ namespace OpenSim.Region.Framework.Scenes } } + public void TriggerAvatarAppearanceChanged(ScenePresence avatar) + { + AvatarAppearanceChange handler = OnAvatarAppearanceChange; + if (handler != null) + { + foreach (AvatarAppearanceChange d in handler.GetInvocationList()) + { + try + { + d(avatar); + } + catch (Exception e) + { + m_log.ErrorFormat( + "[EVENT MANAGER]: Delegate for TriggerAvatarAppearanceChanged failed - continuing. {0} {1}", + e.Message, e.StackTrace); + } + } + } + } + public void TriggerIncomingInstantMessage(GridInstantMessage message) { IncomingInstantMessage handlerIncomingInstantMessage = OnIncomingInstantMessage; -- cgit v1.1 From d03e878d530a551ae7fb5757f8bcd61aac46d919 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 17 Feb 2012 17:31:20 -0500 Subject: Fillin missing SQLite support for Telehubs --- .../Data/SQLite/Resources/RegionStore.migrations | 16 ++++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 102 +++++++++++++++++++++ 2 files changed, 118 insertions(+) diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index 0f40cdc..a00a8fb 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -541,4 +541,20 @@ CREATE TABLE regionwindlight ( cloud_scroll_y_lock INTEGER NOT NULL DEFAULT '0', draw_classic_clouds INTEGER NOT NULL DEFAULT '1'); +COMMIT; + + +:VERSION 24 + +BEGIN; + +CREATE TABLE IF NOT EXISTS `spawn_points` ( + `RegionID` varchar(36) NOT NULL DEFAULT '000000-0000-0000-0000-000000000000', + `Yaw` float NOT NULL, + `Pitch` float NOT NULL, + `Distance` float NOT NULL +); + +ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; + COMMIT; \ No newline at end of file diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index ce1b7b4..83f803b 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -61,6 +61,7 @@ namespace OpenSim.Data.SQLite private const string regionbanListSelect = "select * from regionban"; private const string regionSettingsSelect = "select * from regionsettings"; private const string regionWindlightSelect = "select * from regionwindlight"; + private const string regionSpawnPointsSelect = "select * from spawn_points"; private DataSet ds; private SqliteDataAdapter primDa; @@ -71,6 +72,7 @@ namespace OpenSim.Data.SQLite private SqliteDataAdapter landAccessListDa; private SqliteDataAdapter regionSettingsDa; private SqliteDataAdapter regionWindlightDa; + private SqliteDataAdapter regionSpawnPointsDa; private SqliteConnection m_conn; private String m_connectionString; @@ -140,6 +142,10 @@ namespace OpenSim.Data.SQLite SqliteCommand regionWindlightSelectCmd = new SqliteCommand(regionWindlightSelect, m_conn); regionWindlightDa = new SqliteDataAdapter(regionWindlightSelectCmd); + + SqliteCommand regionSpawnPointsSelectCmd = new SqliteCommand(regionSpawnPointsSelect, m_conn); + regionSpawnPointsDa = new SqliteDataAdapter(regionSpawnPointsSelectCmd); + // This actually does the roll forward assembly stuff Migration m = new Migration(m_conn, Assembly, "RegionStore"); m.Update(); @@ -170,6 +176,9 @@ namespace OpenSim.Data.SQLite ds.Tables.Add(createRegionWindlightTable()); setupRegionWindlightCommands(regionWindlightDa, m_conn); + ds.Tables.Add(createRegionSpawnPointsTable()); + setupRegionSpawnPointsCommands(regionSpawnPointsDa, m_conn); + // WORKAROUND: This is a work around for sqlite on // windows, which gets really unhappy with blob columns // that have no sample data in them. At some point we @@ -246,6 +255,15 @@ namespace OpenSim.Data.SQLite m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on regionwindlight table :{0}", e.Message); } + try + { + regionSpawnPointsDa.Fill(ds.Tables["spawn_points"]); + } + catch (Exception e) + { + m_log.ErrorFormat("[SQLITE REGION DB]: Caught fill error on spawn_points table :{0}", e.Message); + } + // We have to create a data set mapping for every table, otherwise the IDataAdaptor.Update() will not populate rows with values! // Not sure exactly why this is - this kind of thing was not necessary before - justincc 20100409 // Possibly because we manually set up our own DataTables before connecting to the database @@ -257,6 +275,7 @@ namespace OpenSim.Data.SQLite CreateDataSetMapping(landAccessListDa, "landaccesslist"); CreateDataSetMapping(regionSettingsDa, "regionsettings"); CreateDataSetMapping(regionWindlightDa, "regionwindlight"); + CreateDataSetMapping(regionSpawnPointsDa, "spawn_points"); } } catch (Exception e) @@ -319,6 +338,11 @@ namespace OpenSim.Data.SQLite regionWindlightDa.Dispose(); regionWindlightDa = null; } + if (regionSpawnPointsDa != null) + { + regionSpawnPointsDa.Dispose(); + regionWindlightDa = null; + } } public void StoreRegionSettings(RegionSettings rs) @@ -339,8 +363,43 @@ namespace OpenSim.Data.SQLite fillRegionSettingsRow(settingsRow, rs); } + StoreSpawnPoints(rs); + Commit(); } + + } + + public void StoreSpawnPoints(RegionSettings rs) + { + lock (ds) + { + // DataTable spawnpoints = ds.Tables["spawn_points"]; + + // remove region's spawnpoints + using ( + SqliteCommand cmd = + new SqliteCommand("delete from spawn_points where RegionID=:RegionID", + m_conn)) + { + + cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString())); + cmd.ExecuteNonQuery(); + } + } + + foreach (SpawnPoint sp in rs.SpawnPoints()) + { + using (SqliteCommand cmd = new SqliteCommand("insert into spawn_points(RegionID, Yaw, Pitch, Distance)" + + "values ( :RegionID, :Yaw, :Pitch, :Distance)", m_conn)) + { + cmd.Parameters.Add(new SqliteParameter(":RegionID", rs.RegionUUID.ToString())); + cmd.Parameters.Add(new SqliteParameter(":Yaw", sp.Yaw)); + cmd.Parameters.Add(new SqliteParameter(":Pitch", sp.Pitch)); + cmd.Parameters.Add(new SqliteParameter(":Distance", sp.Distance)); + cmd.ExecuteNonQuery(); + } + } } /// @@ -435,10 +494,31 @@ namespace OpenSim.Data.SQLite RegionSettings newSettings = buildRegionSettings(row); newSettings.OnSave += StoreRegionSettings; + LoadSpawnPoints(newSettings); + return newSettings; } } + private void LoadSpawnPoints(RegionSettings rs) + { + rs.ClearSpawnPoints(); + + DataTable spawnpoints = ds.Tables["spawn_points"]; + string byRegion = "RegionID = '" + rs.RegionUUID + "'"; + DataRow[] spForRegion = spawnpoints.Select(byRegion); + + foreach (DataRow spRow in spForRegion) + { + SpawnPoint sp = new SpawnPoint(); + sp.Pitch = (float)spRow["Pitch"]; + sp.Yaw = (float)spRow["Yaw"]; + sp.Distance = (float)spRow["Distance"]; + + rs.AddSpawnPoint(sp); + } + } + /// /// Adds an object into region storage /// @@ -1265,6 +1345,7 @@ namespace OpenSim.Data.SQLite createCol(regionsettings, "covenant", typeof(String)); createCol(regionsettings, "covenant_datetime", typeof(Int32)); createCol(regionsettings, "map_tile_ID", typeof(String)); + createCol(regionsettings, "TelehubObject", typeof(String)); regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; return regionsettings; } @@ -1345,6 +1426,17 @@ namespace OpenSim.Data.SQLite return regionwindlight; } + private static DataTable createRegionSpawnPointsTable() + { + DataTable spawn_points = new DataTable("spawn_points"); + createCol(spawn_points, "regionID", typeof(String)); + createCol(spawn_points, "Yaw", typeof(float)); + createCol(spawn_points, "Pitch", typeof(float)); + createCol(spawn_points, "Distance", typeof(float)); + + return spawn_points; + } + /*********************************************************************** * * Convert between ADO.NET <=> OpenSim Objects @@ -1666,6 +1758,7 @@ namespace OpenSim.Data.SQLite newSettings.Covenant = new UUID((String)row["covenant"]); newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); + newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); return newSettings; } @@ -2068,6 +2161,7 @@ namespace OpenSim.Data.SQLite row["covenant"] = settings.Covenant.ToString(); row["covenant_datetime"] = settings.CovenantChangedDateTime; row["map_tile_ID"] = settings.TerrainImageID.ToString(); + row["TelehubObject"] = settings.TelehubObject.ToString(); } /// @@ -2591,6 +2685,14 @@ namespace OpenSim.Data.SQLite da.UpdateCommand.Connection = conn; } + private void setupRegionSpawnPointsCommands(SqliteDataAdapter da, SqliteConnection conn) + { + da.InsertCommand = createInsertCommand("spawn_points", ds.Tables["spawn_points"]); + da.InsertCommand.Connection = conn; + da.UpdateCommand = createUpdateCommand("spawn_points", "RegionID=:RegionID", ds.Tables["spawn_points"]); + da.UpdateCommand.Connection = conn; + } + /// /// /// -- cgit v1.1 From b817c337dc2c5d8efda710f445114aa9a9344611 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Feb 2012 00:33:52 +0000 Subject: On Windows automatically load the correct native ODE library depending on whether the process is 32-bit or 64-bit In theory, this means that a 64-bit Windows OS user can now run OpenSim.exe with ODE and use more than 2 (or 3) GB of memory. However, this is completely untested since I don't currently own a 64-bit Windows box. Feedback appreciated. Using OpenSim.32BitLaunch.exe should continue to work. Other platforms are unaffected. This will currently not work with sqlite - I will add that too if this works. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 4 ++- OpenSim/Framework/Util.cs | 38 ++++++++++++++++++++- .../Region/Physics/Manager/PhysicsPluginManager.cs | 3 +- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 24 +++++++++++-- bin/lib32/ode.dll | Bin 0 -> 496640 bytes bin/ode.dll | Bin 496640 -> 0 bytes 6 files changed, 64 insertions(+), 5 deletions(-) create mode 100755 bin/lib32/ode.dll delete mode 100755 bin/ode.dll diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 545e76c..0dd01af 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -308,7 +308,9 @@ namespace OpenSim.Framework.Servers // clr version potentially is more confusing than helpful, since it doesn't tell us if we're running under Mono/MS .NET and // the clr version number doesn't match the project version number under Mono. //m_log.Info("[STARTUP]: Virtual machine runtime version: " + Environment.Version + Environment.NewLine); - m_log.Info("[STARTUP]: Operating system version: " + Environment.OSVersion + Environment.NewLine); + m_log.InfoFormat( + "[STARTUP]: Operating system version: {0}, .NET platform {1}, {2}-bit\n", + Environment.OSVersion, Environment.OSVersion.Platform, Util.Is64BitProcess() ? "64" : "32"); StartupSpecific(); diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 4b0b13c..b3ec5c2 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -35,7 +35,8 @@ using System.IO; using System.IO.Compression; using System.Net; using System.Net.Sockets; -using System.Reflection; +using System.Reflection; +using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters.Binary; using System.Security.Cryptography; @@ -375,6 +376,20 @@ namespace OpenSim.Framework } return sb.ToString(); + } + + /// + /// Is the platform Windows? + /// + /// true if so, false otherwise + public static bool IsWindows() + { + PlatformID platformId = Environment.OSVersion.Platform; + + return (platformId == PlatformID.Win32NT + || platformId == PlatformID.Win32S + || platformId == PlatformID.Win32Windows + || platformId == PlatformID.WinCE); } public static bool IsEnvironmentSupported(ref string reason) @@ -1457,6 +1472,27 @@ namespace OpenSim.Framework } return data; + } + + /// + /// Used to trigger an early library load on Windows systems. + /// + /// + /// Required to get 32-bit and 64-bit processes to automatically use the + /// appropriate native library. + /// + /// + /// + [DllImport("kernel32.dll")] + public static extern IntPtr LoadLibrary(string dllToLoad); + + /// + /// Determine whether the current process is 64 bit + /// + /// true if so, false if not + public static bool Is64BitProcess() + { + return IntPtr.Size == 8; } #region FireAndForget Threading Pattern diff --git a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs index 3763696..8587a2b 100644 --- a/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs +++ b/OpenSim/Region/Physics/Manager/PhysicsPluginManager.cs @@ -30,7 +30,8 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using Nini.Config; -using log4net; +using log4net; +using OpenSim.Framework; namespace OpenSim.Region.Physics.Manager { diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 716161a..6ee2714 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -46,7 +46,7 @@ namespace OpenSim.Region.Physics.OdePlugin /// public class OdePlugin : IPhysicsPlugin { - //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); private OdeScene m_scene; @@ -59,13 +59,33 @@ namespace OpenSim.Region.Physics.OdePlugin { if (m_scene == null) { + // We do this so that OpenSimulator on Windows loads the correct native ODE library depending on whether + // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports + // will find it already loaded later on. + // + // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be + // controlled in Ode.NET.dll.config + if (Util.IsWindows()) + { + string nativeLibraryPath; + + if (Util.Is64BitProcess()) + nativeLibraryPath = "lib64/ode.dll"; + else + nativeLibraryPath = "lib32/ode.dll"; + + m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath); + Util.LoadLibrary(nativeLibraryPath); + } + // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to // http://opensimulator.org/mantis/view.php?id=2750). d.InitODE(); m_scene = new OdeScene(sceneIdentifier); } - return (m_scene); + + return m_scene; } public string GetName() diff --git a/bin/lib32/ode.dll b/bin/lib32/ode.dll new file mode 100755 index 0000000..f310358 Binary files /dev/null and b/bin/lib32/ode.dll differ diff --git a/bin/ode.dll b/bin/ode.dll deleted file mode 100755 index f310358..0000000 Binary files a/bin/ode.dll and /dev/null differ -- cgit v1.1 From 8f8b478d366199eea49181f8d7ed0578f9e26bf7 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Fri, 17 Feb 2012 20:04:38 -0500 Subject: Parcel sales support to SQLite --- OpenSim/Data/SQLite/Resources/RegionStore.migrations | 8 +++++++- OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/OpenSim/Data/SQLite/Resources/RegionStore.migrations b/OpenSim/Data/SQLite/Resources/RegionStore.migrations index a00a8fb..1ceddf9 100644 --- a/OpenSim/Data/SQLite/Resources/RegionStore.migrations +++ b/OpenSim/Data/SQLite/Resources/RegionStore.migrations @@ -557,4 +557,10 @@ CREATE TABLE IF NOT EXISTS `spawn_points` ( ALTER TABLE `regionsettings` ADD COLUMN `TelehubObject` varchar(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; -COMMIT; \ No newline at end of file +COMMIT; + +:VERSION 25 + +BEGIN; +ALTER TABLE `regionsettings` ADD COLUMN `parcel_tile_ID` char(36) NOT NULL DEFAULT '00000000-0000-0000-0000-000000000000'; +COMMIT; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 83f803b..6295113 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -1346,6 +1346,7 @@ namespace OpenSim.Data.SQLite createCol(regionsettings, "covenant_datetime", typeof(Int32)); createCol(regionsettings, "map_tile_ID", typeof(String)); createCol(regionsettings, "TelehubObject", typeof(String)); + createCol(regionsettings, "parcel_tile_ID", typeof(String)); regionsettings.PrimaryKey = new DataColumn[] { regionsettings.Columns["regionUUID"] }; return regionsettings; } @@ -1759,6 +1760,7 @@ namespace OpenSim.Data.SQLite newSettings.CovenantChangedDateTime = Convert.ToInt32(row["covenant_datetime"]); newSettings.TerrainImageID = new UUID((String)row["map_tile_ID"]); newSettings.TelehubObject = new UUID((String)row["TelehubObject"]); + newSettings.ParcelImageID = new UUID((String)row["parcel_tile_ID"]); return newSettings; } @@ -2162,6 +2164,7 @@ namespace OpenSim.Data.SQLite row["covenant_datetime"] = settings.CovenantChangedDateTime; row["map_tile_ID"] = settings.TerrainImageID.ToString(); row["TelehubObject"] = settings.TelehubObject.ToString(); + row["parcel_tile_ID"] = settings.ParcelImageID.ToString(); } /// -- cgit v1.1 From 84184708de7f5663cabb3cf652c4f9922a14bf40 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Feb 2012 01:15:43 +0000 Subject: Fix a bug where changing shape parameters of a child prim in a linkset would not persist. Resolves http://opensimulator.org/mantis/view.php?id=5819 --- OpenSim/Region/Framework/Scenes/SceneGraph.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index e66678a..66fb493 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -1592,7 +1592,7 @@ namespace OpenSim.Region.Framework.Scenes if (group != null) { - if (m_parentScene.Permissions.CanEditObject(group.UUID,agentID)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID)) { group.UpdateExtraParam(primLocalID, type, inUse, data); } @@ -1609,7 +1609,7 @@ namespace OpenSim.Region.Framework.Scenes SceneObjectGroup group = GetGroupByPrim(primLocalID); if (group != null) { - if (m_parentScene.Permissions.CanEditObject(group.GetPartsFullID(primLocalID), agentID)) + if (m_parentScene.Permissions.CanEditObject(group.UUID, agentID)) { ObjectShapePacket.ObjectDataBlock shapeData = new ObjectShapePacket.ObjectDataBlock(); shapeData.ObjectLocalID = shapeBlock.ObjectLocalID; -- cgit v1.1 From 0ef64fbe03a0872c9ae55d615b85fb9a24bbc820 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Feb 2012 02:46:07 +0000 Subject: Actually add the Windows 64-bit ode.dll file. This might be why it didn't work. --- bin/lib64/ode.dll | Bin 0 -> 656384 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100755 bin/lib64/ode.dll diff --git a/bin/lib64/ode.dll b/bin/lib64/ode.dll new file mode 100755 index 0000000..df3a6c4 Binary files /dev/null and b/bin/lib64/ode.dll differ -- cgit v1.1 From 9846a1e56e28a5668d4a0a4076f02a9e359eef1a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 18 Feb 2012 02:52:29 +0000 Subject: Report an error if the required native Windows ODE library can't be found. --- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index 6ee2714..e8bb476 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -75,7 +75,10 @@ namespace OpenSim.Region.Physics.OdePlugin nativeLibraryPath = "lib32/ode.dll"; m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath); - Util.LoadLibrary(nativeLibraryPath); + + if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero) + m_log.ErrorFormat( + "[ODE PLUGIN]: Couldn't find native Windows ODE library at {0}", nativeLibraryPath); } // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to -- cgit v1.1 From 7bdcf9eb26842af57e31f3cecd4f403a39a27bc0 Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 18 Feb 2012 00:32:09 -0500 Subject: Propagate our teleport flags on logins --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Services/HypergridService/GatekeeperService.cs | 8 ++++++-- OpenSim/Services/LLLoginService/LLLoginService.cs | 2 ++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index ecc553d..841be96 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3261,6 +3261,9 @@ namespace OpenSim.Region.Framework.Scenes { bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); + bool viahome = ((teleportFlags & (uint)Constants.TeleportFlags.ViaHome) != 0); + bool godlike = ((teleportFlags & (uint)Constants.TeleportFlags.Godlike) != 0); + reason = String.Empty; //Teleport flags: @@ -3429,7 +3432,7 @@ namespace OpenSim.Region.Framework.Scenes } // Honor Estate teleport routing via Telehubs - if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && RegionInfo.EstateSettings.AllowDirectTeleport == false) + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && RegionInfo.EstateSettings.AllowDirectTeleport == false && !viahome && !godlike) { SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); // Can have multiple SpawnPoints diff --git a/OpenSim/Services/HypergridService/GatekeeperService.cs b/OpenSim/Services/HypergridService/GatekeeperService.cs index 5d99c79..0a59f86 100644 --- a/OpenSim/Services/HypergridService/GatekeeperService.cs +++ b/OpenSim/Services/HypergridService/GatekeeperService.cs @@ -188,9 +188,9 @@ namespace OpenSim.Services.HypergridService string authURL = string.Empty; if (aCircuit.ServiceURLs.ContainsKey("HomeURI")) authURL = aCircuit.ServiceURLs["HomeURI"].ToString(); - m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9}", + m_log.InfoFormat("[GATEKEEPER SERVICE]: Login request for {0} {1} @ {2} ({3}) at {4} using viewer {5}, channel {6}, IP {7}, Mac {8}, Id0 {9} Teleport Flags {10}", aCircuit.firstname, aCircuit.lastname, authURL, aCircuit.AgentID, destination.RegionName, - aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0); + aCircuit.Viewer, aCircuit.Channel, aCircuit.IPAddress, aCircuit.Mac, aCircuit.Id0, aCircuit.teleportFlags.ToString()); // // Check client @@ -315,6 +315,10 @@ namespace OpenSim.Services.HypergridService // Finally launch the agent at the destination // Constants.TeleportFlags loginFlag = isFirstLogin ? Constants.TeleportFlags.ViaLogin : Constants.TeleportFlags.ViaHGLogin; + + // Preserve our TeleportFlags we have gathered so-far + loginFlag |= (Constants.TeleportFlags) aCircuit.teleportFlags; + m_log.DebugFormat("[GATEKEEPER SERVICE]: launching agent {0}", loginFlag); return m_SimulationService.CreateAgent(destination, aCircuit, (uint)loginFlag, out reason); } diff --git a/OpenSim/Services/LLLoginService/LLLoginService.cs b/OpenSim/Services/LLLoginService/LLLoginService.cs index 02b5cc1..5dff512 100644 --- a/OpenSim/Services/LLLoginService/LLLoginService.cs +++ b/OpenSim/Services/LLLoginService/LLLoginService.cs @@ -465,6 +465,7 @@ namespace OpenSim.Services.LLLoginService position = pinfo.HomePosition; lookAt = pinfo.HomeLookAt; + flags |= TeleportFlags.ViaHome; } if (tryDefaults) @@ -753,6 +754,7 @@ namespace OpenSim.Services.LLLoginService { circuitCode = (uint)Util.RandomClass.Next(); ; aCircuit = MakeAgent(destination, account, avatar, session, secureSession, circuitCode, position, clientIP.Address.ToString(), viewer, channel, mac, id0); + aCircuit.teleportFlags |= (uint)flags; success = LaunchAgentIndirectly(gatekeeper, destination, aCircuit, clientIP, out reason); if (!success && m_GridService != null) { -- cgit v1.1 From f4cd35322f59b7aae548595541abaa80deefc74d Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sat, 18 Feb 2012 00:45:43 -0500 Subject: Route logins according to Estate, Telehub and TeleportFlags --- OpenSim/Region/Framework/Scenes/Scene.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 841be96..13c866d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3431,8 +3431,10 @@ namespace OpenSim.Region.Framework.Scenes } } - // Honor Estate teleport routing via Telehubs - if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && RegionInfo.EstateSettings.AllowDirectTeleport == false && !viahome && !godlike) + // Honor Estate teleport routing via Telehubs excluding ViaHome and GodLike TeleportFlags + if (RegionInfo.RegionSettings.TelehubObject != UUID.Zero && + RegionInfo.EstateSettings.AllowDirectTeleport == false && + !viahome && !godlike) { SceneObjectGroup telehub = GetSceneObjectGroup(RegionInfo.RegionSettings.TelehubObject); // Can have multiple SpawnPoints -- cgit v1.1 From 2ffc055f7ead4e6b07b82bcc47748295595d350d Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sat, 18 Feb 2012 21:59:42 -0800 Subject: This should smooth movement in heteregeneous networks by a lot: cache the region by position instead of looking it up all the time -- this was being done during the main update loop! --- .../ServiceConnectorsOut/Grid/RegionInfoCache.cs | 34 +++++++++++++++++++++- .../Grid/RemoteGridServiceConnector.cs | 8 ++++- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs index 786e0b5..be8a9a2 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RegionInfoCache.cs @@ -65,13 +65,26 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid } } + internal struct ScopedRegionPosition + { + public UUID m_scopeID; + public ulong m_regionHandle; + public ScopedRegionPosition(UUID scopeID, ulong handle) + { + m_scopeID = scopeID; + m_regionHandle = handle; + } + } + private ExpiringCache m_UUIDCache; private ExpiringCache m_NameCache; + private ExpiringCache m_PositionCache; public RegionInfoCache() { m_UUIDCache = new ExpiringCache(); - m_NameCache = new ExpiringCache(); + m_NameCache = new ExpiringCache(); + m_PositionCache = new ExpiringCache(); } public void Cache(GridRegion rinfo) @@ -96,6 +109,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid { ScopedRegionName name = new ScopedRegionName(scopeID,rinfo.RegionName); m_NameCache.AddOrUpdate(name, id, CACHE_EXPIRATION_SECONDS); + + ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, rinfo.RegionHandle); + m_PositionCache.AddOrUpdate(pos, rinfo, CACHE_EXPIRATION_SECONDS); } } @@ -114,6 +130,22 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid return null; } + public GridRegion Get(UUID scopeID, ulong handle, out bool inCache) + { + inCache = false; + + GridRegion rinfo = null; + ScopedRegionPosition pos = new ScopedRegionPosition(scopeID, handle); + if (m_PositionCache.TryGetValue(pos, out rinfo)) + { + inCache = true; + return rinfo; + } + + return null; + } + + public GridRegion Get(UUID scopeID, string name, out bool inCache) { inCache = false; diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs index 6f364ae..e6c89d7 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Grid/RemoteGridServiceConnector.cs @@ -186,10 +186,16 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Grid public GridRegion GetRegionByPosition(UUID scopeID, int x, int y) { - GridRegion rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); + bool inCache = false; + GridRegion rinfo = m_RegionInfoCache.Get(scopeID, Util.UIntsToLong((uint)x, (uint)y), out inCache); + if (inCache) + return rinfo; + + rinfo = m_LocalGridService.GetRegionByPosition(scopeID, x, y); if (rinfo == null) rinfo = m_RemoteGridService.GetRegionByPosition(scopeID, x, y); + m_RegionInfoCache.Cache(rinfo); return rinfo; } -- cgit v1.1 From a114367b9b24496bdaaeeeb037e99885ec6f511b Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Sun, 19 Feb 2012 08:51:40 +0100 Subject: Fix:OmegaX, OmegaY and OmegaZ not saved for child prims http://opensimulator.org/mantis/view.php?id=5893 Signed-off-by: nebadon --- OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index b130bf7..65905a0 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -1556,9 +1556,9 @@ namespace OpenSim.Region.Framework.Scenes dupe.GroupPosition = GroupPosition; dupe.OffsetPosition = OffsetPosition; dupe.RotationOffset = RotationOffset; - dupe.Velocity = new Vector3(0, 0, 0); - dupe.Acceleration = new Vector3(0, 0, 0); - dupe.AngularVelocity = new Vector3(0, 0, 0); + dupe.Velocity = Velocity; + dupe.Acceleration = Acceleration; + dupe.AngularVelocity = AngularVelocity; dupe.Flags = Flags; dupe.OwnershipCost = OwnershipCost; -- cgit v1.1 From d22715126c05307ce5f91816ea5754b7884ff11d Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Sun, 19 Feb 2012 09:53:50 +0100 Subject: Fix:Fly setting for Parcel dosen't work http://opensimulator.org/mantis/view.php?id=5887 Signed-off-by: nebadon --- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index d146901..cc42f7f 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -272,7 +272,8 @@ namespace OpenSim.Region.CoreModules.World.Land ParcelFlags.AllowGroupScripts | ParcelFlags.CreateGroupObjects | ParcelFlags.AllowAPrimitiveEntry | - ParcelFlags.AllowGroupObjectEntry); + ParcelFlags.AllowGroupObjectEntry | + ParcelFlags.AllowFly); } if (m_scene.Permissions.CanEditParcelProperties(remote_client.AgentId, this, GroupPowers.LandSetSale)) -- cgit v1.1 From bcb95774959edec55cfe757b5de2e7198f176eea Mon Sep 17 00:00:00 2001 From: BlueWall Date: Sun, 19 Feb 2012 12:09:57 -0500 Subject: Use localy defined name, TPFlags, for Constants.TeleportFlags --- OpenSim/Region/Framework/Scenes/Scene.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 13c866d..d2a8ad0 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -3259,10 +3259,10 @@ namespace OpenSim.Region.Framework.Scenes /// also return a reason. public bool NewUserConnection(AgentCircuitData agent, uint teleportFlags, out string reason, bool requirePresenceLookup) { - bool vialogin = ((teleportFlags & (uint)Constants.TeleportFlags.ViaLogin) != 0 || - (teleportFlags & (uint)Constants.TeleportFlags.ViaHGLogin) != 0); - bool viahome = ((teleportFlags & (uint)Constants.TeleportFlags.ViaHome) != 0); - bool godlike = ((teleportFlags & (uint)Constants.TeleportFlags.Godlike) != 0); + bool vialogin = ((teleportFlags & (uint)TPFlags.ViaLogin) != 0 || + (teleportFlags & (uint)TPFlags.ViaHGLogin) != 0); + bool viahome = ((teleportFlags & (uint)TPFlags.ViaHome) != 0); + bool godlike = ((teleportFlags & (uint)TPFlags.Godlike) != 0); reason = String.Empty; @@ -3275,9 +3275,9 @@ namespace OpenSim.Region.Framework.Scenes // Don't disable this log message - it's too helpful m_log.DebugFormat( - "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags {8}, position {9})", + "[SCENE]: Region {0} told of incoming {1} agent {2} {3} {4} (circuit code {5}, IP {6}, viewer {7}, teleportflags ({8}), position {9})", RegionInfo.RegionName, (agent.child ? "child" : "root"),agent.firstname, agent.lastname, - agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, teleportFlags, agent.startpos); + agent.AgentID, agent.circuitcode, agent.IPAddress, agent.Viewer, ((TPFlags)teleportFlags).ToString(), agent.startpos); if (LoginsDisabled) { -- cgit v1.1 From 20c65ac438ee67ecd3f837d268e44992f13a8af6 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Feb 2012 12:28:07 -0800 Subject: A few more tweaks on position updates and create child agents. Mono hates concurrent uses of the same TCP connection, and even of the connections to the same server. So let's stop doing it. This patch makes movement much smoother when there are lots of neighbours. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 12 ++++++++---- .../Framework/Scenes/SceneCommunicationService.cs | 19 +++++++++++++------ OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- 3 files changed, 23 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 928bcd0..6e4c0b1 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1258,12 +1258,16 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer if (neighbour.RegionHandle != sp.Scene.RegionInfo.RegionHandle) { - InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; try { - d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, - InformClientOfNeighbourCompleted, - d); + // Let's put this back at sync, so that it doesn't clog + // the network, especially for regions in the same physical server. + // We're really not in a hurry here. + InformClientOfNeighbourAsync(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent); + //InformClientOfNeighbourDelegate d = InformClientOfNeighbourAsync; + //d.BeginInvoke(sp, cagents[count], neighbour, neighbour.ExternalEndPoint, newAgent, + // InformClientOfNeighbourCompleted, + // d); } catch (ArgumentOutOfRangeException) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 58a7b20..c04171b 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -140,6 +140,7 @@ namespace OpenSim.Region.Framework.Scenes icon.EndInvoke(iar); } + ExpiringCache _failedSims = new ExpiringCache(); public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) { // This assumes that we know what our neighbors are. @@ -156,16 +157,22 @@ namespace OpenSim.Region.Framework.Scenes // that the region position is cached or performance will degrade Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - if (! simulatorList.Contains(dest.ServerURI)) + bool v = true; + if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v)) { // we havent seen this simulator before, add it to the list // and send it an update simulatorList.Add(dest.ServerURI); - - SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; - d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, - SendChildAgentDataUpdateCompleted, - d); + // Let move this to sync. Mono definitely does not like async networking. + if (!m_scene.SimulationService.UpdateAgent(dest, cAgentData)) + // Also if it fails, get it out of the loop for a bit + _failedSims.Add(dest.ServerURI, true, 120); + + // Leaving this here as a reminder that we tried, and it sucks. + //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; + //d.BeginInvoke(cAgentData, m_regionInfo.ScopeID, dest, + // SendChildAgentDataUpdateCompleted, + // d); } } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 77f7b32..8639697 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -2738,7 +2738,8 @@ namespace OpenSim.Region.Framework.Scenes AgentPosition agentpos = new AgentPosition(); agentpos.CopyFrom(cadu); - m_scene.SendOutChildAgentUpdates(agentpos, this); + // Let's get this out of the update loop + Util.FireAndForget(delegate { m_scene.SendOutChildAgentUpdates(agentpos, this); }); } } -- cgit v1.1 From b489c85226f50d791c64588a82b73fabe42490a5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Feb 2012 15:37:37 -0800 Subject: Amend to last commit. This should have been committed too. --- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8639697..daf711c 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1219,7 +1219,7 @@ namespace OpenSim.Region.Framework.Scenes { IEntityTransferModule m_agentTransfer = m_scene.RequestModuleInterface(); if (m_agentTransfer != null) - m_agentTransfer.EnableChildAgents(this); + Util.FireAndForget(delegate { m_agentTransfer.EnableChildAgents(this); }); IFriendsModule friendsModule = m_scene.RequestModuleInterface(); if (friendsModule != null) -- cgit v1.1 From 1c3ee5d1cedbd3952ef523778f61c3f7d8e67332 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Sun, 19 Feb 2012 16:42:01 -0800 Subject: One more tweak related to the previous 2 commits. --- .../CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 6e4c0b1..8f047ea 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -994,6 +994,9 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer neighbourRegion.RegionHandle); return agent; } + // No turning back + agent.IsChildAgent = true; + string capsPath = neighbourRegion.ServerURI + CapsUtil.GetCapsSeedPath(agentcaps); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending new CAPS seed url {0} to client {1}", capsPath, agent.UUID); @@ -1138,7 +1141,6 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// /// This informs all neighbouring regions about agent "avatar". - /// Calls an asynchronous method to do so.. so it doesn't lag the sim. /// /// public void EnableChildAgents(ScenePresence sp) -- cgit v1.1 From 99b9c1a9d5d4d9b76609ab8f91dd8d9ebe248ff5 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 20 Feb 2012 10:58:07 -0800 Subject: More improvements on agent position updates: if the target sims fail, blacklist them for 2 min, so that we don't keep doing remote calls that fail. --- .../Framework/Scenes/SceneCommunicationService.cs | 7 ++----- .../Simulation/SimulationServiceConnector.cs | 20 ++++++++++++++------ 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index c04171b..19c9745 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -140,7 +140,6 @@ namespace OpenSim.Region.Framework.Scenes icon.EndInvoke(iar); } - ExpiringCache _failedSims = new ExpiringCache(); public void SendChildAgentDataUpdate(AgentPosition cAgentData, ScenePresence presence) { // This assumes that we know what our neighbors are. @@ -158,15 +157,13 @@ namespace OpenSim.Region.Framework.Scenes Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); bool v = true; - if (! simulatorList.Contains(dest.ServerURI) && !_failedSims.TryGetValue(dest.ServerURI, out v)) + if (! simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update simulatorList.Add(dest.ServerURI); // Let move this to sync. Mono definitely does not like async networking. - if (!m_scene.SimulationService.UpdateAgent(dest, cAgentData)) - // Also if it fails, get it out of the loop for a bit - _failedSims.Add(dest.ServerURI, true, 120); + m_scene.SimulationService.UpdateAgent(dest, cAgentData); // Leaving this here as a reminder that we tried, and it sucks. //SendChildAgentDataUpdateDelegate d = SendChildAgentDataUpdateAsync; diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c45f456..c45e312 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -153,6 +153,7 @@ namespace OpenSim.Services.Connectors.Simulation return UpdateAgent(destination, (IAgentData)data, 200000); // yes, 200 seconds } + private ExpiringCache _failedSims = new ExpiringCache(); /// /// Send updated position information about an agent in this region to a neighbor /// This operation may be called very frequently if an avatar is moving about in @@ -160,6 +161,10 @@ namespace OpenSim.Services.Connectors.Simulation /// public bool UpdateAgent(GridRegion destination, AgentPosition data) { + bool v = true; + if (_failedSims.TryGetValue(destination.ServerURI, out v)) + return false; + // The basic idea of this code is that the first thread that needs to // send an update for a specific avatar becomes the worker for any subsequent // requests until there are no more outstanding requests. Further, only send the most @@ -183,9 +188,10 @@ namespace OpenSim.Services.Connectors.Simulation // Otherwise update the reference and start processing m_updateAgentQueue[uri] = data; } - + AgentPosition pos = null; - while (true) + bool success = true; + while (success) { lock (m_updateAgentQueue) { @@ -205,11 +211,13 @@ namespace OpenSim.Services.Connectors.Simulation } } - UpdateAgent(destination, (IAgentData)pos, 10000); + success = UpdateAgent(destination, (IAgentData)pos, 10000); } - - // unreachable -// return true; + // we get here iff success == false + // blacklist sim for 2 minutes + _failedSims.AddOrUpdate(destination.ServerURI, true, 120); + m_updateAgentQueue.Clear(); + return false; } /// -- cgit v1.1 From 4a329098e8eba012cbf9f66627443968cbf9d726 Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Mon, 20 Feb 2012 11:12:02 -0800 Subject: Amend to last commit: synchronize access to queues. --- .../Services/Connectors/Simulation/SimulationServiceConnector.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index c45e312..65f01b3 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -215,8 +215,11 @@ namespace OpenSim.Services.Connectors.Simulation } // we get here iff success == false // blacklist sim for 2 minutes - _failedSims.AddOrUpdate(destination.ServerURI, true, 120); - m_updateAgentQueue.Clear(); + lock (m_updateAgentQueue) + { + _failedSims.AddOrUpdate(destination.ServerURI, true, 120); + m_updateAgentQueue.Remove(uri); + } return false; } -- cgit v1.1 From 19d271d3fc96360e3c2b0889ef0a2e1f97f25fe7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 01:45:17 +0000 Subject: Remove PhysXPlugin and wrappers. In over 4 years this never progressed beyond an unimplemented stub. This doesn't mean that it can't come back if someone is interested in implementing PhysX support. --- OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs | 58 ---- .../Region/Physics/PhysXPlugin/PhysXCharacter.cs | 349 --------------------- OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs | 76 ----- OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs | 341 -------------------- OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs | 177 ----------- bin/PhysX-wrapper.dll | Bin 57344 -> 0 bytes bin/PhysX_Wrapper_Dotnet.dll | Bin 8704 -> 0 bytes prebuild.xml | 25 -- 8 files changed, 1026 deletions(-) delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs delete mode 100644 OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs delete mode 100755 bin/PhysX-wrapper.dll delete mode 100755 bin/PhysX_Wrapper_Dotnet.dll diff --git a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs b/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs deleted file mode 100644 index fa5e66a..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Reflection; -using System.Runtime.InteropServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly : AssemblyTitle("RealPhysXplugin")] -[assembly : AssemblyDescription("")] -[assembly : AssemblyConfiguration("")] -[assembly : AssemblyCompany("http://opensimulator.org")] -[assembly : AssemblyProduct("RealPhysXplugin")] -[assembly : AssemblyCopyright("Copyright (c) OpenSimulator.org Developers 2007-2009")] -[assembly : AssemblyTrademark("")] -[assembly : AssemblyCulture("")] - -// This sets the default COM visibility of types in the assembly to invisible. -// If you need to expose a type to COM, use [ComVisible(true)] on that type. - -[assembly : ComVisible(false)] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly : AssemblyVersion("0.6.5.*")] diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs deleted file mode 100644 index 9216a9e..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXCharacter.cs +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using PhysXWrapper; -using Quaternion=OpenMetaverse.Quaternion; -using System.Reflection; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.PhysXPlugin -{ - public class PhysXCharacter : PhysicsActor - { - private Vector3 _position; - private Vector3 _velocity; - private Vector3 m_rotationalVelocity = Vector3.Zero; - private Vector3 _acceleration; - private NxCharacter _character; - private bool flying; - private bool iscolliding = false; - private float gravityAccel; - - public PhysXCharacter(NxCharacter character) - { - _character = character; - } - - public override int PhysicsActorType - { - get { return (int) ActorTypes.Agent; } - set { return; } - } - - public override bool SetAlwaysRun - { - get { return false; } - set { return; } - } - - public override uint LocalID - { - set { return; } - } - - public override bool Grabbed - { - set { return; } - } - - public override bool Selected - { - set { return; } - } - - public override float Buoyancy - { - get { return 0f; } - set { return; } - } - - public override bool FloatOnWater - { - set { return; } - } - - public override bool IsPhysical - { - get { return false; } - set { return; } - } - - public override bool ThrottleUpdates - { - get { return false; } - set { return; } - } - - public override bool Flying - { - get { return flying; } - set { flying = value; } - } - - public override bool IsColliding - { - get { return iscolliding; } - set { iscolliding = value; } - } - - public override bool CollidingGround - { - get { return false; } - set { return; } - } - - public override bool CollidingObj - { - get { return false; } - set { return; } - } - - public override Vector3 RotationalVelocity - { - get { return m_rotationalVelocity; } - set { m_rotationalVelocity = value; } - } - - public override bool Stopped - { - get { return false; } - } - - public override Vector3 Position - { - get { return _position; } - set - { - _position = value; - Vec3 ps = new Vec3(); - ps.X = value.X; - ps.Y = value.Y; - ps.Z = value.Z; - _character.Position = ps; - } - } - - public override Vector3 Size - { - get { return Vector3.Zero; } - set { } - } - - public override float Mass - { - get { return 0f; } - } - - public override Vector3 Force - { - get { return Vector3.Zero; } - set { return; } - } - - public override int VehicleType - { - get { return 0; } - set { return; } - } - - public override void VehicleFloatParam(int param, float value) - { - } - - public override void VehicleVectorParam(int param, Vector3 value) - { - } - - public override void VehicleRotationParam(int param, Quaternion rotation) - { - } - - public override void VehicleFlags(int param, bool remove) - { - } - - public override void SetVolumeDetect(int param) - { - } - - public override Vector3 CenterOfMass - { - get { return Vector3.Zero; } - } - - public override Vector3 GeometricCenter - { - get { return Vector3.Zero; } - } - - public override Vector3 Velocity - { - get { return _velocity; } - set { _velocity = value; } - } - - public override float CollisionScore - { - get { return 0f; } - set { } - } - - public override bool Kinematic - { - get { return false; } - set { } - } - - public override Quaternion Orientation - { - get { return Quaternion.Identity; } - set { } - } - - public override Vector3 Acceleration - { - get { return _acceleration; } - set { _acceleration = value; } - } - - public override void AddForce(Vector3 force, bool pushforce) - { - } - - public override Vector3 Torque - { - get { return Vector3.Zero; } - set { return; } - } - - public override void AddAngularForce(Vector3 force, bool pushforce) - { - } - - public override void link(PhysicsActor obj) - { - } - - public override void delink() - { - } - - public override void LockAngularMotion(Vector3 axis) - { - } - - public override void SetMomentum(Vector3 momentum) - { - } - - public void Move(float timeStep) - { - Vec3 vec = new Vec3(); - vec.X = _velocity.X*timeStep; - vec.Y = _velocity.Y*timeStep; - if (flying) - { - vec.Z = (_velocity.Z)*timeStep; - } - else - { - gravityAccel += -9.8f; - vec.Z = (gravityAccel + _velocity.Z)*timeStep; - } - int res = _character.Move(vec); - if (res == 1) - { - gravityAccel = 0; - } - } - - public override PrimitiveBaseShape Shape - { - set { return; } - } - - public void UpdatePosition() - { - Vec3 vec = _character.Position; - _position.X = vec.X; - _position.Y = vec.Y; - _position.Z = vec.Z; - } - - public override void CrossingFailure() - { - } - - public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } - public override float PIDTau { set { return; } } - - public override float PIDHoverHeight { set { return; } } - public override bool PIDHoverActive { set { return; } } - public override PIDHoverType PIDHoverType { set { return; } } - public override float PIDHoverTau { set { return; } } - - public override Quaternion APIDTarget - { - set { return; } - } - - public override bool APIDActive - { - set { return; } - } - - public override float APIDStrength - { - set { return; } - } - - public override float APIDDamping - { - set { return; } - } - - public override void SubscribeEvents(int ms) - { - - } - public override void UnSubscribeEvents() - { - - } - public override bool SubscribedEvents() - { - return false; - } - } -} diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs deleted file mode 100644 index ca7a4f8..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using PhysXWrapper; -using Quaternion=OpenMetaverse.Quaternion; -using System.Reflection; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.PhysXPlugin -{ - /// - /// Will be the PhysX plugin but for now will be a very basic physics engine - /// - public class PhysXPlugin : IPhysicsPlugin - { - //private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private PhysXScene _mScene; - - public PhysXPlugin() - { - } - - public bool Init() - { - return true; - } - - public PhysicsScene GetScene(string sceneIdentifier) - { - if (_mScene == null) - { - _mScene = new PhysXScene(sceneIdentifier); - } - return (_mScene); - } - - public string GetName() - { - return ("RealPhysX"); - } - - public void Dispose() - { - } - } -} diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs deleted file mode 100644 index 42bd119..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPrim.cs +++ /dev/null @@ -1,341 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using PhysXWrapper; -using Quaternion=OpenMetaverse.Quaternion; -using System.Reflection; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.PhysXPlugin -{ - public class PhysXPrim : PhysicsActor - { - private Vector3 _velocity; - private Vector3 _acceleration; - private Vector3 m_rotationalVelocity; - private NxActor _prim; - - public PhysXPrim(NxActor prim) - { - _velocity = Vector3.Zero; - _acceleration = Vector3.Zero; - _prim = prim; - } - - public override int PhysicsActorType - { - get { return (int) ActorTypes.Prim; } - set { return; } - } - - public override bool IsPhysical - { - get { return false; } - set { return; } - } - - public override bool SetAlwaysRun - { - get { return false; } - set { return; } - } - - public override uint LocalID - { - set { return; } - } - - public override bool Grabbed - { - set { return; } - } - - public override bool Selected - { - set { return; } - } - - public override float Buoyancy - { - get { return 0f; } - set { return; } - } - - public override bool FloatOnWater - { - set { return; } - } - - public override bool ThrottleUpdates - { - get { return false; } - set { return; } - } - - public override Vector3 RotationalVelocity - { - get { return m_rotationalVelocity; } - set { m_rotationalVelocity = value; } - } - - public override bool Flying - { - get { return false; //no flying prims for you - } - set { } - } - - public override bool IsColliding - { - get { return false; } - set { } - } - - public override bool CollidingGround - { - get { return false; } - set { return; } - } - - public override bool CollidingObj - { - get { return false; } - set { return; } - } - - public override bool Stopped - { - get { return false; } - } - - public override Vector3 Position - { - get - { - Vector3 pos = Vector3.Zero; - Vec3 vec = _prim.Position; - pos.X = vec.X; - pos.Y = vec.Y; - pos.Z = vec.Z; - return pos; - } - set - { - Vector3 vec = value; - Vec3 pos = new Vec3(); - pos.X = vec.X; - pos.Y = vec.Y; - pos.Z = vec.Z; - _prim.Position = pos; - } - } - - public override PrimitiveBaseShape Shape - { - set { return; } - } - - public override Vector3 Velocity - { - get { return _velocity; } - set { _velocity = value; } - } - - public override Vector3 Torque - { - get { return Vector3.Zero; } - set { return; } - } - - public override float CollisionScore - { - get { return 0f; } - set { } - } - - public override bool Kinematic - { - get { return _prim.Kinematic; } - set { _prim.Kinematic = value; } - } - - public override Quaternion Orientation - { - get - { - Quaternion res; - PhysXWrapper.Quaternion quat = _prim.GetOrientation(); - res.W = quat.W; - res.X = quat.X; - res.Y = quat.Y; - res.Z = quat.Z; - return res; - } - set { } - } - - public override Vector3 Acceleration - { - get { return _acceleration; } - set { _acceleration = value; } - } - - public override void AddForce(Vector3 force, bool pushforce) - { - } - - public override void AddAngularForce(Vector3 force, bool pushforce) - { - } - - public override void SetMomentum(Vector3 momentum) - { - } - - public override Vector3 Size - { - get { return Vector3.Zero; } - set { } - } - - public override void link(PhysicsActor obj) - { - } - - public override void delink() - { - } - - public override void LockAngularMotion(Vector3 axis) - { - - } - - public override float Mass - { - get { return 0f; } - } - - public override Vector3 Force - { - get { return Vector3.Zero; } - set { return; } - } - - public override int VehicleType - { - get { return 0; } - set { return; } - } - - public override void VehicleFloatParam(int param, float value) - { - - } - - public override void VehicleVectorParam(int param, Vector3 value) - { - - } - - public override void VehicleRotationParam(int param, Quaternion rotation) - { - - } - - public override void VehicleFlags(int param, bool remove) { } - - public override void SetVolumeDetect(int param) - { - - } - - public override Vector3 CenterOfMass - { - get { return Vector3.Zero; } - } - - public override Vector3 GeometricCenter - { - get { return Vector3.Zero; } - } - - public override void CrossingFailure() - { - } - - public override Vector3 PIDTarget { set { return; } } - public override bool PIDActive { set { return; } } - public override float PIDTau { set { return; } } - - public override float PIDHoverHeight { set { return; } } - public override bool PIDHoverActive { set { return; } } - public override PIDHoverType PIDHoverType { set { return; } } - public override float PIDHoverTau { set { return; } } - - public override Quaternion APIDTarget - { - set { return; } - } - - public override bool APIDActive - { - set { return; } - } - - public override float APIDStrength - { - set { return; } - } - - public override float APIDDamping - { - set { return; } - } - - - - public override void SubscribeEvents(int ms) - { - - } - public override void UnSubscribeEvents() - { - - } - public override bool SubscribedEvents() - { - return false; - } - } -} diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs deleted file mode 100644 index beb3404..0000000 --- a/OpenSim/Region/Physics/PhysXPlugin/PhysXScene.cs +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using Nini.Config; -using OpenSim.Framework; -using OpenSim.Region.Physics.Manager; -using PhysXWrapper; -using Quaternion=OpenMetaverse.Quaternion; -using System.Reflection; -using log4net; -using OpenMetaverse; - -namespace OpenSim.Region.Physics.PhysXPlugin -{ - public class PhysXScene : PhysicsScene - { - private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private List _characters = new List(); - private List _prims = new List(); - private float[] _heightMap = null; - private NxPhysicsSDK mySdk; - private NxScene scene; - - // protected internal string sceneIdentifier; - public PhysXScene(string _sceneIdentifier) - { - //sceneIdentifier = _sceneIdentifier; - - mySdk = NxPhysicsSDK.CreateSDK(); - m_log.Info("Sdk created - now creating scene"); - scene = mySdk.CreateScene(); - } - - public override void Initialise(IMesher meshmerizer, IConfigSource config) - { - // Does nothing right now - } - public override void Dispose() - { - - } - - public override void SetWaterLevel(float baseheight) - { - - } - - public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying) - { - Vec3 pos = new Vec3(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - PhysXCharacter act = new PhysXCharacter(scene.AddCharacter(pos)); - act.Flying = isFlying; - act.Position = position; - _characters.Add(act); - return act; - } - - public override void RemovePrim(PhysicsActor prim) - { - } - - public override void RemoveAvatar(PhysicsActor actor) - { - } - - private PhysicsActor AddPrim(Vector3 position, Vector3 size, Quaternion rotation) - { - Vec3 pos = new Vec3(); - pos.X = position.X; - pos.Y = position.Y; - pos.Z = position.Z; - Vec3 siz = new Vec3(); - siz.X = size.X; - siz.Y = size.Y; - siz.Z = size.Z; - PhysXPrim act = new PhysXPrim(scene.AddNewBox(pos, siz)); - _prims.Add(act); - return act; - } - - public override PhysicsActor AddPrimShape(string primName, PrimitiveBaseShape pbs, Vector3 position, - Vector3 size, Quaternion rotation, bool isPhysical, uint localid) - { - return AddPrim(position, size, rotation); - } - - public override void AddPhysicsActorTaint(PhysicsActor prim) - { - } - - public override float Simulate(float timeStep) - { - float fps = 0f; - try - { - foreach (PhysXCharacter actor in _characters) - { - actor.Move(timeStep); - } - scene.Simulate(timeStep); - scene.FetchResults(); - scene.UpdateControllers(); - - foreach (PhysXCharacter actor in _characters) - { - actor.UpdatePosition(); - } - } - catch (Exception e) - { - m_log.Error(e.Message); - } - return fps; - } - - public override void GetResults() - { - } - - public override bool IsThreaded - { - // for now we won't be multithreaded - get { return (false); } - } - - public override void SetTerrain(float[] heightMap) - { - if (_heightMap != null) - { - m_log.Debug("PhysX - deleting old terrain"); - scene.DeleteTerrain(); - } - _heightMap = heightMap; - scene.AddTerrain(heightMap); - } - - public override void DeleteTerrain() - { - scene.DeleteTerrain(); - } - - public override Dictionary GetTopColliders() - { - Dictionary returncolliders = new Dictionary(); - return returncolliders; - } - } -} diff --git a/bin/PhysX-wrapper.dll b/bin/PhysX-wrapper.dll deleted file mode 100755 index 5259ffc..0000000 Binary files a/bin/PhysX-wrapper.dll and /dev/null differ diff --git a/bin/PhysX_Wrapper_Dotnet.dll b/bin/PhysX_Wrapper_Dotnet.dll deleted file mode 100755 index c66bf3a..0000000 Binary files a/bin/PhysX_Wrapper_Dotnet.dll and /dev/null differ diff --git a/prebuild.xml b/prebuild.xml index 54f42f4..79814ac 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -521,31 +521,6 @@ - - - - ../../../../bin/Physics/ - - - - - ../../../../bin/Physics/ - - - - ../../../../bin/ - - - - - - - - - - - - -- cgit v1.1 From 90dc5f47e7db7d921ad82033a581fcd5c5704906 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 01:57:19 +0000 Subject: Fix bug where NPCs would establish child agents on other neighbour regions that had come up after the NPC was created. --- OpenSim/Region/Framework/Scenes/Scene.cs | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d2a8ad0..e7f835c 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -864,16 +864,16 @@ namespace OpenSim.Region.Framework.Scenes try { ForEachRootScenePresence(delegate(ScenePresence agent) - { - //agent.ControllingClient.new - //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); - - List old = new List(); - old.Add(otherRegion.RegionHandle); - agent.DropOldNeighbours(old); - if (m_teleportModule != null) - m_teleportModule.EnableChildAgent(agent, otherRegion); - }); + { + //agent.ControllingClient.new + //this.CommsManager.InterRegion.InformRegionOfChildAgent(otherRegion.RegionHandle, agent.ControllingClient.RequestClientInfo()); + + List old = new List(); + old.Add(otherRegion.RegionHandle); + agent.DropOldNeighbours(old); + if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) + m_teleportModule.EnableChildAgent(agent, otherRegion); + }); } catch (NullReferenceException) { @@ -881,7 +881,6 @@ namespace OpenSim.Region.Framework.Scenes // This shouldn't happen too often anymore. m_log.Error("[SCENE]: Couldn't inform client of regionup because we got a null reference exception"); } - } else { @@ -1009,10 +1008,10 @@ namespace OpenSim.Region.Framework.Scenes try { ForEachRootScenePresence(delegate(ScenePresence agent) - { - if (m_teleportModule != null) - m_teleportModule.EnableChildAgent(agent, r); - }); + { + if (m_teleportModule != null && agent.PresenceType != PresenceType.Npc) + m_teleportModule.EnableChildAgent(agent, r); + }); } catch (NullReferenceException) { -- cgit v1.1 From 68a4ef5ef62aef3d5e1ec5c20b03b3b4fa51743b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 02:52:20 +0000 Subject: Add 64 bit Windows sqlite3.dll and use this if running a 64-bit windows process. --- OpenSim/Data/SQLite/SQLiteAssetData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteAuthenticationData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteEstateData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteFramework.cs | 2 ++ OpenSim/Data/SQLite/SQLiteInventoryStore.cs | 3 +++ OpenSim/Data/SQLite/SQLiteSimulationData.cs | 3 +++ OpenSim/Data/SQLite/SQLiteXInventoryData.cs | 3 +++ OpenSim/Framework/Util.cs | 30 ++++++++++++++++++++++++ OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 15 +----------- bin/lib32/sqlite3.dll | Bin 0 -> 559244 bytes bin/lib64/sqlite3.dll | Bin 0 -> 618496 bytes bin/sqlite3.dll | Bin 559244 -> 0 bytes 12 files changed, 51 insertions(+), 14 deletions(-) create mode 100755 bin/lib32/sqlite3.dll create mode 100755 bin/lib64/sqlite3.dll delete mode 100755 bin/sqlite3.dll diff --git a/OpenSim/Data/SQLite/SQLiteAssetData.cs b/OpenSim/Data/SQLite/SQLiteAssetData.cs index bb23fc1..d0e24c3 100644 --- a/OpenSim/Data/SQLite/SQLiteAssetData.cs +++ b/OpenSim/Data/SQLite/SQLiteAssetData.cs @@ -81,6 +81,9 @@ namespace OpenSim.Data.SQLite /// connect string override public void Initialise(string dbconnect) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + if (dbconnect == string.Empty) { dbconnect = "URI=file:Asset.db,version=3"; diff --git a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs index f51aa28..5120453 100644 --- a/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs +++ b/OpenSim/Data/SQLite/SQLiteAuthenticationData.cs @@ -65,6 +65,9 @@ namespace OpenSim.Data.SQLite if (!m_initialized) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + m_Connection = new SqliteConnection(connectionString); m_Connection.Open(); diff --git a/OpenSim/Data/SQLite/SQLiteEstateData.cs b/OpenSim/Data/SQLite/SQLiteEstateData.cs index 8db9262..c042ba2 100644 --- a/OpenSim/Data/SQLite/SQLiteEstateData.cs +++ b/OpenSim/Data/SQLite/SQLiteEstateData.cs @@ -69,6 +69,9 @@ namespace OpenSim.Data.SQLite public void Initialise(string connectionString) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + m_connectionString = connectionString; m_log.Info("[ESTATE DB]: Sqlite - connecting: "+m_connectionString); diff --git a/OpenSim/Data/SQLite/SQLiteFramework.cs b/OpenSim/Data/SQLite/SQLiteFramework.cs index 4992bcc..1594717 100644 --- a/OpenSim/Data/SQLite/SQLiteFramework.cs +++ b/OpenSim/Data/SQLite/SQLiteFramework.cs @@ -48,6 +48,8 @@ namespace OpenSim.Data.SQLite protected SQLiteFramework(string connectionString) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); } ////////////////////////////////////////////////////////////// diff --git a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs index 7dc07ec..ccbd154 100644 --- a/OpenSim/Data/SQLite/SQLiteInventoryStore.cs +++ b/OpenSim/Data/SQLite/SQLiteInventoryStore.cs @@ -77,6 +77,9 @@ namespace OpenSim.Data.SQLite { m_Initialized = true; + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + if (dbconnect == string.Empty) { dbconnect = "URI=file:inventoryStore.db,version=3"; diff --git a/OpenSim/Data/SQLite/SQLiteSimulationData.cs b/OpenSim/Data/SQLite/SQLiteSimulationData.cs index 6295113..186a586 100644 --- a/OpenSim/Data/SQLite/SQLiteSimulationData.cs +++ b/OpenSim/Data/SQLite/SQLiteSimulationData.cs @@ -110,6 +110,9 @@ namespace OpenSim.Data.SQLite { try { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + m_connectionString = connectionString; ds = new DataSet("Region"); diff --git a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs index 16f9046..1f36986 100644 --- a/OpenSim/Data/SQLite/SQLiteXInventoryData.cs +++ b/OpenSim/Data/SQLite/SQLiteXInventoryData.cs @@ -52,6 +52,9 @@ namespace OpenSim.Data.SQLite public SQLiteXInventoryData(string conn, string realm) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + m_Folders = new SQLiteGenericTableHandler( conn, "inventoryfolders", "XInventoryStore"); m_Items = new SqliteItemHandler( diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index b3ec5c2..efa4a7b 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs @@ -392,6 +392,36 @@ namespace OpenSim.Framework || platformId == PlatformID.WinCE); } + public static bool LoadArchSpecificWindowsDll(string libraryName) + { + // We do this so that OpenSimulator on Windows loads the correct native library depending on whether + // it's running as a 32-bit process or a 64-bit one. By invoking LoadLibary here, later DLLImports + // will find it already loaded later on. + // + // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be + // controlled in config files. + string nativeLibraryPath; + + if (Util.Is64BitProcess()) + nativeLibraryPath = "lib64/" + libraryName; + else + nativeLibraryPath = "lib32/" + libraryName; + + m_log.DebugFormat("[UTIL]: Loading native Windows library at {0}", nativeLibraryPath); + + if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero) + { + m_log.ErrorFormat( + "[UTIL]: Couldn't find native Windows library at {0}", nativeLibraryPath); + + return false; + } + else + { + return true; + } + } + public static bool IsEnvironmentSupported(ref string reason) { // Must have .NET 2.0 (Generics / libsl) diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs index e8bb476..478dd95 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs @@ -66,20 +66,7 @@ namespace OpenSim.Region.Physics.OdePlugin // This isn't necessary for other platforms (e.g. Mac OSX and Linux) since the DLL used can be // controlled in Ode.NET.dll.config if (Util.IsWindows()) - { - string nativeLibraryPath; - - if (Util.Is64BitProcess()) - nativeLibraryPath = "lib64/ode.dll"; - else - nativeLibraryPath = "lib32/ode.dll"; - - m_log.DebugFormat("[ODE PLUGIN]: Loading native Windows ODE library at {0}", nativeLibraryPath); - - if (Util.LoadLibrary(nativeLibraryPath) == IntPtr.Zero) - m_log.ErrorFormat( - "[ODE PLUGIN]: Couldn't find native Windows ODE library at {0}", nativeLibraryPath); - } + Util.LoadArchSpecificWindowsDll("ode.dll"); // Initializing ODE only when a scene is created allows alternative ODE plugins to co-habit (according to // http://opensimulator.org/mantis/view.php?id=2750). diff --git a/bin/lib32/sqlite3.dll b/bin/lib32/sqlite3.dll new file mode 100755 index 0000000..f29dc62 Binary files /dev/null and b/bin/lib32/sqlite3.dll differ diff --git a/bin/lib64/sqlite3.dll b/bin/lib64/sqlite3.dll new file mode 100755 index 0000000..dadf7dd Binary files /dev/null and b/bin/lib64/sqlite3.dll differ diff --git a/bin/sqlite3.dll b/bin/sqlite3.dll deleted file mode 100755 index f29dc62..0000000 Binary files a/bin/sqlite3.dll and /dev/null differ -- cgit v1.1 From 1b906ef2addd966242d5f3a0bae274022257eee2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 03:24:01 +0000 Subject: Replace win 64-bit sqlite3.dll with another version, though I suspect this one won't work either. --- bin/lib64/sqlite3.dll | Bin 618496 -> 613888 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/lib64/sqlite3.dll b/bin/lib64/sqlite3.dll index dadf7dd..3682eee 100755 Binary files a/bin/lib64/sqlite3.dll and b/bin/lib64/sqlite3.dll differ -- cgit v1.1 From a15b00d3ef6a082c1cd6e49ef648654daf28c4d4 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 04:01:27 +0000 Subject: Replace previous windows 64-bit sqlite3.dll with one from http://system.data.sqlite.org/downloads/1.0.79.0/sqlite-netFx35-binary-bundle-x64-2008-1.0.79.0.zip In this zip, it's called System.Data.SQLite.dll. We rename it to lib64/sqlite3.dll This is a little unexpected but it works. For some reason my hand-rolled one in Visual Studio 2008 did not. This is sqlite 3.7.10. Other libraries are still currently 3.7.6 but this should make no difference. This should make it possible to use OpenSim.exe on 64-bit Windows now, though currently the bullet physics plugin will still complain (can be ignored if you are not using bullet). --- bin/lib64/sqlite3.dll | Bin 613888 -> 1083392 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/bin/lib64/sqlite3.dll b/bin/lib64/sqlite3.dll index 3682eee..815c4d3 100755 Binary files a/bin/lib64/sqlite3.dll and b/bin/lib64/sqlite3.dll differ -- cgit v1.1 From daee2eda93c3135964784417f81c5cb4ce52871f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 04:10:39 +0000 Subject: Load 32-bit or 64-bit BulletSim Windows library automatically as appropriate. This uses the same approach as ODE. radams, if this doesn't work for you please feel free to revert. --- OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs | 3 +++ bin/BulletSim-x86_64.dll | Bin 768000 -> 0 bytes bin/BulletSim.dll | Bin 562176 -> 0 bytes bin/lib32/BulletSim.dll | Bin 0 -> 562176 bytes bin/lib64/BulletSim-x86_64.dll | Bin 0 -> 768000 bytes 5 files changed, 3 insertions(+) delete mode 100755 bin/BulletSim-x86_64.dll delete mode 100755 bin/BulletSim.dll create mode 100755 bin/lib32/BulletSim.dll create mode 100755 bin/lib64/BulletSim-x86_64.dll diff --git a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs index 61be56d..0730824 100644 --- a/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs +++ b/OpenSim/Region/Physics/BulletSPlugin/BSPlugin.cs @@ -51,6 +51,9 @@ public class BSPlugin : IPhysicsPlugin { if (_mScene == null) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("BulletSim.dll"); + _mScene = new BSScene(sceneIdentifier); } return (_mScene); diff --git a/bin/BulletSim-x86_64.dll b/bin/BulletSim-x86_64.dll deleted file mode 100755 index ec21dfe..0000000 Binary files a/bin/BulletSim-x86_64.dll and /dev/null differ diff --git a/bin/BulletSim.dll b/bin/BulletSim.dll deleted file mode 100755 index d1571cf..0000000 Binary files a/bin/BulletSim.dll and /dev/null differ diff --git a/bin/lib32/BulletSim.dll b/bin/lib32/BulletSim.dll new file mode 100755 index 0000000..d1571cf Binary files /dev/null and b/bin/lib32/BulletSim.dll differ diff --git a/bin/lib64/BulletSim-x86_64.dll b/bin/lib64/BulletSim-x86_64.dll new file mode 100755 index 0000000..ec21dfe Binary files /dev/null and b/bin/lib64/BulletSim-x86_64.dll differ -- cgit v1.1 From a27e5a9c956be2150d52340543b5eec74a76f28d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 04:12:17 +0000 Subject: Both 32-bit and 64-bit BulletSim.dll must have the same name. Rename the 64 bit one in lib64 --- bin/lib64/BulletSim-x86_64.dll | Bin 768000 -> 0 bytes bin/lib64/BulletSim.dll | Bin 0 -> 768000 bytes 2 files changed, 0 insertions(+), 0 deletions(-) delete mode 100755 bin/lib64/BulletSim-x86_64.dll create mode 100755 bin/lib64/BulletSim.dll diff --git a/bin/lib64/BulletSim-x86_64.dll b/bin/lib64/BulletSim-x86_64.dll deleted file mode 100755 index ec21dfe..0000000 Binary files a/bin/lib64/BulletSim-x86_64.dll and /dev/null differ diff --git a/bin/lib64/BulletSim.dll b/bin/lib64/BulletSim.dll new file mode 100755 index 0000000..ec21dfe Binary files /dev/null and b/bin/lib64/BulletSim.dll differ -- cgit v1.1 From 15ce73caca9ea6448e34b95d344cbbf5c9507f6d Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Tue, 21 Feb 2012 19:37:14 +0100 Subject: Fix:Cannot drag inventory from child prim into inventory http://opensimulator.org/mantis/view.php?id=5569 --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6cc78b8..132f15d 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1144,6 +1144,11 @@ namespace OpenSim.Region.Framework.Scenes return; } + UUID partUUID = part.UUID; + SceneObjectGroup group = part.ParentGroup; + if (group != null) + partUUID = group.RootPart.UUID; + TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (null == taskItem) @@ -1155,19 +1160,18 @@ namespace OpenSim.Region.Framework.Scenes return; } - TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to // edit the prim. - if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) + if (!Permissions.CanEditObjectInventory(partUUID, remoteClient.AgentId)) return; } else { // If the item is copiable, then we just need to have perms // on it. The delete check is a pure rights check - if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) + if (!Permissions.CanDeleteObject(partUUID, remoteClient.AgentId)) return; } -- cgit v1.1 From 76f411147d69b2a57c8eb7db0f48f3341ca5fd51 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 22:49:06 +0000 Subject: Revert "Fix:Cannot drag inventory from child prim into inventory http://opensimulator.org/mantis/view.php?id=5569" This reverts commit 15ce73caca9ea6448e34b95d344cbbf5c9507f6d. As per the COMMENTS in http://opensimulator.org/mantis/view.php?id=5569, I was going to fix this in a more general way. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 132f15d..6cc78b8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1144,11 +1144,6 @@ namespace OpenSim.Region.Framework.Scenes return; } - UUID partUUID = part.UUID; - SceneObjectGroup group = part.ParentGroup; - if (group != null) - partUUID = group.RootPart.UUID; - TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); if (null == taskItem) @@ -1160,18 +1155,19 @@ namespace OpenSim.Region.Framework.Scenes return; } - if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); + if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to // edit the prim. - if (!Permissions.CanEditObjectInventory(partUUID, remoteClient.AgentId)) + if (!Permissions.CanEditObjectInventory(part.UUID, remoteClient.AgentId)) return; } else { // If the item is copiable, then we just need to have perms // on it. The delete check is a pure rights check - if (!Permissions.CanDeleteObject(partUUID, remoteClient.AgentId)) + if (!Permissions.CanDeleteObject(part.UUID, remoteClient.AgentId)) return; } -- cgit v1.1 From 5397a6d4c626818af9aed1e2e0dedd430fb4b948 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 22:54:30 +0000 Subject: Fix problem with dragging child part inventory item to user inventory. This fixes the problem by fixing the permissions module to look at root part permissions rather than having to do this for every caller. Resolves http://opensimulator.org/mantis/view.php?id=5569 --- .../World/Permissions/PermissionsModule.cs | 22 +++------------------- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 12 +----------- 2 files changed, 4 insertions(+), 30 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index f3c6a30..7023984 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -677,18 +677,12 @@ namespace OpenSim.Region.CoreModules.World.Permissions bool permission = false; bool locked = false; - if (!m_scene.Entities.ContainsKey(objId)) - { - return false; - } + SceneObjectPart part = m_scene.GetSceneObjectPart(objId); - // If it's not an object, we cant edit it. - if ((!(m_scene.Entities[objId] is SceneObjectGroup))) - { + if (part == null) return false; - } - SceneObjectGroup group = (SceneObjectGroup)m_scene.Entities[objId]; + SceneObjectGroup group = part.ParentGroup; UUID objectOwner = group.OwnerID; locked = ((group.RootPart.OwnerMask & PERM_LOCKED) == 0); @@ -977,16 +971,6 @@ namespace OpenSim.Region.CoreModules.World.Permissions DebugPermissionInformation(MethodInfo.GetCurrentMethod().Name); if (m_bypassPermissions) return m_bypassPermissionsValue; - SceneObjectPart part = m_scene.GetSceneObjectPart(objectID); - - // If we selected a sub-prim to edit, the objectID won't represent the object, but only a part. - // We have to check the permissions of the group, though. - if (part.ParentID != 0) - { - objectID = part.ParentUUID; - part = m_scene.GetSceneObjectPart(objectID); - } - return GenericObjectPermission(editorID, objectID, false); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 6cc78b8..83e3a45 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1146,17 +1146,7 @@ namespace OpenSim.Region.Framework.Scenes TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); - if (null == taskItem) - { - m_log.WarnFormat("[PRIM INVENTORY]: Move of inventory item {0} from prim with local id {1} failed" - + " because the inventory item could not be found", - itemId, primLocalId); - - return; - } - - TaskInventoryItem item = part.Inventory.GetInventoryItem(itemId); - if ((item.CurrentPermissions & (uint)PermissionMask.Copy) == 0) + if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to // edit the prim. -- cgit v1.1 From 1c533eb5200d5a2443731abba55b6cd34eb067f7 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Tue, 21 Feb 2012 20:57:51 +0100 Subject: Fix:LINK_ROOT flag for llGetLinkName() by SinglePrim --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 0bdd84a..61a6907 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -3845,7 +3845,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api // Single prim if (m_host.LinkNum == 0) { - if (linknum == 0) + if (linknum == 0 || linknum == ScriptBaseClass.LINK_ROOT) return m_host.Name; else return UUID.Zero.ToString(); -- cgit v1.1 From cf9b3e7708f0cf58c94fcfd76974733c37ac0d1c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 21 Feb 2012 23:41:48 +0000 Subject: Restore the taskItem null check that I accidentally blatted in 5397a6d This is a valid check because the caller could supply an invalid uuid. --- OpenSim/Region/Framework/Scenes/Scene.Inventory.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs index 83e3a45..23f39a8 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.Inventory.cs @@ -1146,6 +1146,15 @@ namespace OpenSim.Region.Framework.Scenes TaskInventoryItem taskItem = part.Inventory.GetInventoryItem(itemId); + if (null == taskItem) + { + m_log.WarnFormat("[PRIM INVENTORY]: Move of inventory item {0} from prim with local id {1} failed" + + " because the inventory item could not be found", + itemId, primLocalId); + + return; + } + if ((taskItem.CurrentPermissions & (uint)PermissionMask.Copy) == 0) { // If the item to be moved is no copy, we need to be able to -- cgit v1.1 From 5d312671855bf5fda2ae5960fdcd19f1d9f1d1cb Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 22 Feb 2012 00:55:16 +0000 Subject: Remove two spurious m_sceneGraph != null checks in Scene.cs. It's set in constructor and never subsequent set to null. --- OpenSim/Region/Framework/Scenes/Scene.cs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e7f835c..ec32701 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4257,10 +4257,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForEachRootScenePresence(Action action) { - if (m_sceneGraph != null) - { - m_sceneGraph.ForEachAvatar(action); - } + m_sceneGraph.ForEachAvatar(action); } /// @@ -4269,10 +4266,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void ForEachScenePresence(Action action) { - if (m_sceneGraph != null) - { - m_sceneGraph.ForEachScenePresence(action); - } + m_sceneGraph.ForEachScenePresence(action); } /// -- cgit v1.1 From 1dfc9902649bfb4f02340644a0589fe139a3322a Mon Sep 17 00:00:00 2001 From: Melanie Date: Thu, 23 Feb 2012 01:40:30 +0000 Subject: Add a position parameter to region crossing of objects. This avoids the potential bad update that places an object at the opposite side of the origin sim for a moment before actually crossing it. Especially important in grids like OSG where lag between sims is high. --- .../Framework/EntityTransfer/EntityTransferModule.cs | 9 ++++----- .../Simulation/LocalSimulationConnector.cs | 6 +++--- .../Simulation/RemoteSimulationConnector.cs | 6 +++--- OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++++- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +- OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs | 10 +++++++--- .../Connectors/Simulation/SimulationServiceConnector.cs | 3 ++- OpenSim/Services/Interfaces/ISimulationService.cs | 2 +- 8 files changed, 25 insertions(+), 18 deletions(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 8f047ea..f6e4dbf 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs @@ -1704,14 +1704,13 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer // Offset the positions for the new region across the border Vector3 oldGroupPosition = grp.RootPart.GroupPosition; - grp.RootPart.GroupPosition = pos; // If we fail to cross the border, then reset the position of the scene object on that border. uint x = 0, y = 0; Utils.LongToUInts(newRegionHandle, out x, out y); GridRegion destination = scene.GridService.GetRegionByPosition(scene.RegionInfo.ScopeID, (int)x, (int)y); - if (destination == null || !CrossPrimGroupIntoNewRegion(destination, grp, silent)) + if (destination == null || !CrossPrimGroupIntoNewRegion(destination, pos, grp, silent)) { m_log.InfoFormat("[ENTITY TRANSFER MODULE] cross region transfer failed for object {0}",grp.UUID); @@ -1741,7 +1740,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer /// true if the crossing itself was successful, false on failure /// FIMXE: we still return true if the crossing object was not successfully deleted from the originating region /// - protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, SceneObjectGroup grp, bool silent) + protected bool CrossPrimGroupIntoNewRegion(GridRegion destination, Vector3 newPosition, SceneObjectGroup grp, bool silent) { //m_log.Debug(" >>> CrossPrimGroupIntoNewRegion <<<"); @@ -1766,7 +1765,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer //if (m_interregionCommsOut != null) // successYN = m_interregionCommsOut.SendCreateObject(newRegionHandle, grp, true); if (m_aScene.SimulationService != null) - successYN = m_aScene.SimulationService.CreateObject(destination, grp, true); + successYN = m_aScene.SimulationService.CreateObject(destination, newPosition, grp, true); if (successYN) { @@ -1825,7 +1824,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer gobj.IsAttachment = false; //gobj.RootPart.LastOwnerID = gobj.GetFromAssetID(); m_log.DebugFormat("[ENTITY TRANSFER MODULE]: Sending attachment {0} to region {1}", gobj.UUID, destination.RegionName); - CrossPrimGroupIntoNewRegion(destination, gobj, silent); + CrossPrimGroupIntoNewRegion(destination, Vector3.Zero, gobj, silent); } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs index a17c6ae..85e7e94 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/LocalSimulationConnector.cs @@ -315,7 +315,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation * Object-related communications */ - public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) + public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall) { if (destination == null) return false; @@ -330,12 +330,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // We need to make a local copy of the object ISceneObject sogClone = sog.CloneForNewScene(); sogClone.SetState(sog.GetStateSnapshot(), s); - return s.IncomingCreateObject(sogClone); + return s.IncomingCreateObject(newPosition, sogClone); } else { // Use the object as it came through the wire - return s.IncomingCreateObject(sog); + return s.IncomingCreateObject(newPosition, sog); } } } diff --git a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs index f8cea71..eaf9506 100644 --- a/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs +++ b/OpenSim/Region/CoreModules/ServiceConnectorsOut/Simulation/RemoteSimulationConnector.cs @@ -282,13 +282,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation * Object-related communications */ - public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) + public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall) { if (destination == null) return false; // Try local first - if (m_localBackend.CreateObject(destination, sog, isLocalCall)) + if (m_localBackend.CreateObject(destination, newPosition, sog, isLocalCall)) { //m_log.Debug("[REST COMMS]: LocalBackEnd SendCreateObject succeeded"); return true; @@ -296,7 +296,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Simulation // else do the remote thing if (!m_localBackend.IsLocalRegion(destination.RegionHandle)) - return m_remoteConnector.CreateObject(destination, sog, isLocalCall); + return m_remoteConnector.CreateObject(destination, newPosition, sog, isLocalCall); return false; } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e7f835c..7b79732 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -2317,7 +2317,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// /// - public bool IncomingCreateObject(ISceneObject sog) + public bool IncomingCreateObject(Vector3 newPosition, ISceneObject sog) { //m_log.DebugFormat(" >>> IncomingCreateObject(sog) <<< {0} deleted? {1} isAttach? {2}", ((SceneObjectGroup)sog).AbsolutePosition, // ((SceneObjectGroup)sog).IsDeleted, ((SceneObjectGroup)sog).RootPart.IsAttachment); @@ -2333,6 +2333,9 @@ namespace OpenSim.Region.Framework.Scenes return false; } + if (newPosition != Vector3.Zero) + newObject.RootPart.GroupPosition = newPosition; + if (!AddSceneObject(newObject)) { m_log.DebugFormat("[SCENE]: Problem adding scene object {0} in {1} ", sog.UUID, RegionInfo.RegionName); diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index daf711c..9cfdf9f 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3223,7 +3223,7 @@ namespace OpenSim.Region.Framework.Scenes ((SceneObjectGroup)so).LocalId = 0; ((SceneObjectGroup)so).RootPart.ClearUpdateSchedule(); so.SetState(cAgent.AttachmentObjectStates[i++], m_scene); - m_scene.IncomingCreateObject(so); + m_scene.IncomingCreateObject(Vector3.Zero, so); } } } diff --git a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs index 984b843..f0d8f69 100644 --- a/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs +++ b/OpenSim/Server/Handlers/Simulation/ObjectHandlers.cs @@ -136,6 +136,8 @@ namespace OpenSim.Server.Handlers.Simulation int x = 0, y = 0; UUID uuid = UUID.Zero; string regionname = string.Empty; + Vector3 newPosition = Vector3.Zero; + if (args.ContainsKey("destination_x") && args["destination_x"] != null) Int32.TryParse(args["destination_x"].AsString(), out x); if (args.ContainsKey("destination_y") && args["destination_y"] != null) @@ -144,6 +146,8 @@ namespace OpenSim.Server.Handlers.Simulation UUID.TryParse(args["destination_uuid"].AsString(), out uuid); if (args.ContainsKey("destination_name") && args["destination_name"] != null) regionname = args["destination_name"].ToString(); + if (args.ContainsKey("new_position") && args["new_position"] != null) + Vector3.TryParse(args["new_position"], out newPosition); GridRegion destination = new GridRegion(); destination.RegionID = uuid; @@ -199,7 +203,7 @@ namespace OpenSim.Server.Handlers.Simulation try { // This is the meaning of POST object - result = CreateObject(destination, sog); + result = CreateObject(destination, newPosition, sog); } catch (Exception e) { @@ -211,9 +215,9 @@ namespace OpenSim.Server.Handlers.Simulation } // subclasses can override this - protected virtual bool CreateObject(GridRegion destination, ISceneObject sog) + protected virtual bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog) { - return m_SimulationService.CreateObject(destination, sog, false); + return m_SimulationService.CreateObject(destination, newPosition, sog, false); } protected virtual void DoObjectPut(Hashtable request, Hashtable responsedata, UUID regionID) diff --git a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs index 65f01b3..cb003d1 100644 --- a/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs +++ b/OpenSim/Services/Connectors/Simulation/SimulationServiceConnector.cs @@ -408,7 +408,7 @@ namespace OpenSim.Services.Connectors.Simulation /// /// /// - public bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall) + public bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall) { // m_log.DebugFormat("[REMOTE SIMULATION CONNECTOR]: CreateObject start"); @@ -421,6 +421,7 @@ namespace OpenSim.Services.Connectors.Simulation args["sog"] = OSD.FromString(sog.ToXml2()); args["extra"] = OSD.FromString(sog.ExtraToXmlString()); args["modified"] = OSD.FromBoolean(sog.HasGroupChanged); + args["new_position"] = newPosition.ToString(); string state = sog.GetStateSnapshot(); if (state.Length > 0) diff --git a/OpenSim/Services/Interfaces/ISimulationService.cs b/OpenSim/Services/Interfaces/ISimulationService.cs index 5f9ce6d..36fd6fc 100644 --- a/OpenSim/Services/Interfaces/ISimulationService.cs +++ b/OpenSim/Services/Interfaces/ISimulationService.cs @@ -98,7 +98,7 @@ namespace OpenSim.Services.Interfaces /// /// /// - bool CreateObject(GridRegion destination, ISceneObject sog, bool isLocalCall); + bool CreateObject(GridRegion destination, Vector3 newPosition, ISceneObject sog, bool isLocalCall); /// /// Create an object from the user's inventory in the destination region. -- cgit v1.1 From 90ea00a1098c918d5eb5a2be2793b109c6622a35 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Feb 2012 22:56:42 +0000 Subject: Try to resolve some problems with viewers crashing after hitting parcel banlines or freezing on the banline. This involves 1) On forcible teleport, call m_scene.RequestTeleportLocation() rather than ScenePresence.Teleport() - only EntityTransferModule now should call SP.Teleport() 2) When avatar is being forcibly moved due to banlines, use a 'stop movement' tolerance of 0.2 to requested position rather than 1 This prevents the avatar sometimes being stuck to banlines until they teleport somewhere else. This aims to fix some problems in http://opensimulator.org/mantis/view.php?id=5822 --- .../CoreModules/World/Land/LandManagementModule.cs | 27 +++++++++++++++++----- OpenSim/Region/Framework/Scenes/Scene.cs | 17 ++++++++++---- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 13 +++++++---- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 1c503aa..f6d4b40 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -94,8 +94,11 @@ namespace OpenSim.Region.CoreModules.World.Land // caches ExtendedLandData private Cache parcelInfoCache; - private Dictionary forcedPosition = - new Dictionary(); + + /// + /// Record positions that avatar's are currently being forced to move to due to parcel entry restrictions. + /// + private Dictionary forcedPosition = new Dictionary(); #region INonSharedRegionModule Members @@ -224,22 +227,34 @@ namespace OpenSim.Region.CoreModules.World.Land //When the avatar walks into a ban line on the ground, it prevents getting stuck agentData.ControlFlags = (uint)AgentManager.ControlFlags.AGENT_CONTROL_FLY; - //Make sure we stop if they get about to the right place to prevent yoyo and prevents getting stuck on banlines if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) < .2) { - Debug.WriteLine(string.Format("Stopping force position because {0} is close enough to position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Stopping force position of {0} because {1} is close enough to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + forcedPosition.Remove(remoteClient.AgentId); } //if we are far away, teleport else if (Vector3.Distance(clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]) > 3) { - Debug.WriteLine(string.Format("Teleporting out because {0} is too far from avatar position {1}", forcedPosition[remoteClient.AgentId], clientAvatar.AbsolutePosition)); - clientAvatar.Teleport(forcedPosition[remoteClient.AgentId]); + Vector3 forcePosition = forcedPosition[remoteClient.AgentId]; +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Teleporting out {0} because {1} is too far from avatar position {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcePosition); + + m_scene.RequestTeleportLocation(remoteClient, m_scene.RegionInfo.RegionHandle, + forcePosition, clientAvatar.Lookat, (uint)Constants.TeleportFlags.ForceRedirect); + forcedPosition.Remove(remoteClient.AgentId); } else { +// m_log.DebugFormat( +// "[LAND MANAGEMENT MODULE]: Forcing {0} from {1} to {2}", +// clientAvatar.Name, clientAvatar.AbsolutePosition, forcedPosition[remoteClient.AgentId]); + //Forces them toward the forced position we want if they aren't there yet agentData.UseClientAgentPosition = true; agentData.ClientAgentPosition = forcedPosition[remoteClient.AgentId]; diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 6187803..cf6e6af 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -4699,7 +4699,10 @@ namespace OpenSim.Region.Framework.Scenes Vector3? nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("Found a sane previous position based on velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: Found a sane previous position based on velocity for {0}, sending them to {1} in {2}", +// avatar.Name, nearestPoint, nearestParcel.LandData.Name); + return nearestPoint.Value; } @@ -4709,12 +4712,16 @@ namespace OpenSim.Region.Framework.Scenes nearestPoint = GetNearestPointInParcelAlongDirectionFromPoint(avatar.AbsolutePosition, dir, nearestParcel); if (nearestPoint != null) { - Debug.WriteLine("They had a zero velocity, sending them to: " + nearestPoint.ToString()); +// m_log.DebugFormat( +// "[SCENE]: {0} had a zero velocity, sending them to {1}", avatar.Name, nearestPoint); + return nearestPoint.Value; } - //Ultimate backup if we have no idea where they are - Debug.WriteLine("Have no idea where they are, sending them to: " + avatar.lastKnownAllowedPosition.ToString()); + //Ultimate backup if we have no idea where they are +// m_log.DebugFormat( +// "[SCENE]: No idea where {0} is, sending them to {1}", avatar.Name, avatar.lastKnownAllowedPosition); + return avatar.lastKnownAllowedPosition; } @@ -5120,7 +5127,7 @@ namespace OpenSim.Region.Framework.Scenes // presence.Name, presence.AbsolutePosition, presence.MoveToPositionTarget); Vector3 agent_control_v3 = new Vector3(); - presence.HandleMoveToTargetUpdate(ref agent_control_v3); + presence.HandleMoveToTargetUpdate(1, ref agent_control_v3); presence.AddNewMovement(agent_control_v3); } } diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9cfdf9f..40c8d06 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -1048,7 +1048,7 @@ namespace OpenSim.Region.Framework.Scenes } /// - /// + /// Do not call this directly. Call Scene.RequestTeleportLocation() instead. /// /// public void Teleport(Vector3 pos) @@ -1522,7 +1522,10 @@ namespace OpenSim.Region.Framework.Scenes } else if (bAllowUpdateMoveToPosition) { - if (HandleMoveToTargetUpdate(ref agent_control_v3)) + // The UseClientAgentPosition is set if parcel ban is forcing the avatar to move to a + // certain position. It's only check for tolerance on returning to that position is 0.2 + // rather than 1, at which point it removes its force target. + if (HandleMoveToTargetUpdate(agentData.UseClientAgentPosition ? 0.2 : 1, ref agent_control_v3)) update_movementflag = true; } } @@ -1584,7 +1587,7 @@ namespace OpenSim.Region.Framework.Scenes /// /// Cumulative agent movement that this method will update. /// True if movement has been updated in some way. False otherwise. - public bool HandleMoveToTargetUpdate(ref Vector3 agent_control_v3) + public bool HandleMoveToTargetUpdate(double tolerance, ref Vector3 agent_control_v3) { // m_log.DebugFormat("[SCENE PRESENCE]: Called HandleMoveToTargetUpdate() for {0}", Name); @@ -1601,7 +1604,7 @@ namespace OpenSim.Region.Framework.Scenes // Name, AbsolutePosition, MoveToPositionTarget, distanceToTarget); // Check the error term of the current position in relation to the target position - if (distanceToTarget <= 1) + if (distanceToTarget <= tolerance) { // We are close enough to the target AbsolutePosition = MoveToPositionTarget; @@ -1777,7 +1780,7 @@ namespace OpenSim.Region.Framework.Scenes // m_log.DebugFormat("[SCENE PRESENCE]: Body rot for {0} set to {1}", Name, Rotation); Vector3 agent_control_v3 = new Vector3(); - HandleMoveToTargetUpdate(ref agent_control_v3); + HandleMoveToTargetUpdate(1, ref agent_control_v3); AddNewMovement(agent_control_v3); } -- cgit v1.1 From f034958bdca00cdec77f05b7cbddd07ea2584b02 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 23 Feb 2012 23:11:47 +0000 Subject: Load appropriate 32-bit/64-bit Windows sqlite dll if using WebStatsModule. This should resolve http://opensimulator.org/mantis/view.php?id=5901 --- OpenSim/Region/UserStatistics/WebStatsModule.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenSim/Region/UserStatistics/WebStatsModule.cs b/OpenSim/Region/UserStatistics/WebStatsModule.cs index f627e37..ad272f7 100644 --- a/OpenSim/Region/UserStatistics/WebStatsModule.cs +++ b/OpenSim/Region/UserStatistics/WebStatsModule.cs @@ -83,6 +83,9 @@ namespace OpenSim.Region.UserStatistics { if (m_scenes.Count == 0) { + if (Util.IsWindows()) + Util.LoadArchSpecificWindowsDll("sqlite3.dll"); + //IConfig startupConfig = config.Configs["Startup"]; dbConn = new SqliteConnection("URI=file:LocalUserStatistics.db,version=3"); -- cgit v1.1 From 0b9f4d7e749a14c556d7f8a4ea64c54625cf58dc Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Wed, 22 Feb 2012 20:15:42 +0100 Subject: llLinkSitTarget implementation http://wiki.secondlife.com/wiki/LlLinkSitTarget --- .../Shared/Api/Implementation/LSL_Api.cs | 32 ++++++++++++++++++---- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 5 ++++ 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 61a6907..2eba2b1 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -6376,16 +6376,38 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } } - public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + protected void SitTarget(SceneObjectPart part, LSL_Vector offset, LSL_Rotation rot) { - m_host.AddScriptLPS(1); // LSL quaternions can normalize to 0, normal Quaternions can't. if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) rot.z = 1; // ZERO_ROTATION = 0,0,0,1 - m_host.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); - m_host.SitTargetOrientation = Rot2Quaternion(rot); - m_host.ParentGroup.HasGroupChanged = true; + part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); + part.SitTargetOrientation = Rot2Quaternion(rot); + part.ParentGroup.HasGroupChanged = true; + } + + public void llSitTarget(LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + SitTarget(m_host, offset, rot); + } + + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_host.AddScriptLPS(1); + if (link == ScriptBaseClass.LINK_ROOT) + SitTarget(m_host.ParentGroup.RootPart, offset, rot); + else if (link == ScriptBaseClass.LINK_THIS) + SitTarget(m_host, offset, rot); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + { + SitTarget(part, offset, rot); + } + } } public LSL_String llAvatarOnSitTarget() diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 6106a65..7d39ccc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -218,6 +218,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetDisplayName(string id); LSL_String llRequestDisplayName(string id); void llLinkParticleSystem(int linknum, LSL_List rules); + void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot); LSL_String llList2CSV(LSL_List src); LSL_Float llList2Float(LSL_List src, int index); LSL_Integer llList2Integer(LSL_List src, int index); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 83550a5..24c3d95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1688,6 +1688,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase m_LSL_Functions.llSitTarget(offset, rot); } + public void llLinkSitTarget(LSL_Integer link, LSL_Vector offset, LSL_Rotation rot) + { + m_LSL_Functions.llLinkSitTarget(link, offset, rot); + } + public void llSleep(double sec) { m_LSL_Functions.llSleep(sec); -- cgit v1.1 From fe229f10e65ca979a127b316f75bb48fc7d19aa2 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 04:08:59 +0000 Subject: In osSetSpeed(), if no avatar for a uuid is found then don't attempt to set speed. --- OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c55e2ae..ff1f5fd 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -2740,7 +2740,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.Moderate, "osSetSpeed"); m_host.AddScriptLPS(1); ScenePresence avatar = World.GetScenePresence(new UUID(UUID)); - avatar.SpeedModifier = (float)SpeedModifier; + + if (avatar != null) + avatar.SpeedModifier = (float)SpeedModifier; } public void osKickAvatar(string FirstName,string SurName,string alert) -- cgit v1.1 From f67f37074f3f7e0602b66aa66a044dd9fd107f6a Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:02:33 +0000 Subject: Stop spurious scene loop startup timeout alarms for scenes with many prims. On the first frame, all startup scene objects are added to the physics scene. This can cause a considerable delay, so we don't start raising the alarm on scene loop timeouts until the second frame. This commit also slightly changes the behaviour of timeout reporting. Previously, a report was made for the very first timed out thread, ignoring all others until the next watchdog check. Instead, we now report every timed out thread, though we still only do this once no matter how long the timeout. --- .../HttpServer/PollServiceRequestManager.cs | 2 + OpenSim/Framework/Watchdog.cs | 57 +++++++++++++++------- .../Region/ClientStack/Linden/UDP/LLUDPServer.cs | 7 ++- .../InterGrid/OpenGridProtocolModule.cs | 2 +- .../CoreModules/World/WorldMap/WorldMapModule.cs | 1 + OpenSim/Region/Framework/Scenes/Scene.cs | 12 +++-- .../Server/IRCClientView.cs | 2 +- .../InternetRelayClientView/Server/IRCServer.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 2 + .../Api/Implementation/AsyncCommandManager.cs | 4 +- 10 files changed, 65 insertions(+), 26 deletions(-) diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs index 2206feb..0062d4e 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceRequestManager.cs @@ -65,6 +65,7 @@ namespace OpenSim.Framework.Servers.HttpServer String.Format("PollServiceWorkerThread{0}", i), ThreadPriority.Normal, false, + true, int.MaxValue); } @@ -73,6 +74,7 @@ namespace OpenSim.Framework.Servers.HttpServer "PollServiceWatcherThread", ThreadPriority.Normal, false, + true, 1000 * 60 * 10); } diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 2dd6ebe..e443f0a 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -72,6 +72,11 @@ namespace OpenSim.Framework /// public bool IsTimedOut { get; set; } + /// + /// Will this thread trigger the alarm function if it has timed out? + /// + public bool AlarmIfTimeout { get; set; } + public ThreadWatchdogInfo(Thread thread, int timeout) { Thread = thread; @@ -112,12 +117,13 @@ namespace OpenSim.Framework /// The method that will be executed in a new thread /// A name to give to the new thread /// Priority to run the thread at - /// True to run this thread as a background - /// thread, otherwise false + /// True to run this thread as a background thread, otherwise false + /// Trigger an alarm function is we have timed out /// The newly created Thread object - public static Thread StartThread(ThreadStart start, string name, ThreadPriority priority, bool isBackground) + public static Thread StartThread( + ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout) { - return StartThread(start, name, priority, isBackground, WATCHDOG_TIMEOUT_MS); + return StartThread(start, name, priority, isBackground, alarmIfTimeout, WATCHDOG_TIMEOUT_MS); } /// @@ -128,21 +134,21 @@ namespace OpenSim.Framework /// Priority to run the thread at /// True to run this thread as a background /// thread, otherwise false - /// - /// Number of milliseconds to wait until we issue a warning about timeout. - /// + /// Trigger an alarm function is we have timed out + /// Number of milliseconds to wait until we issue a warning about timeout. /// The newly created Thread object public static Thread StartThread( - ThreadStart start, string name, ThreadPriority priority, bool isBackground, int timeout) + ThreadStart start, string name, ThreadPriority priority, bool isBackground, bool alarmIfTimeout, int timeout) { Thread thread = new Thread(start); thread.Name = name; thread.Priority = priority; thread.IsBackground = isBackground; - ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout); + ThreadWatchdogInfo twi = new ThreadWatchdogInfo(thread, timeout) { AlarmIfTimeout = alarmIfTimeout }; - m_log.Debug("[WATCHDOG]: Started tracking thread \"" + twi.Thread.Name + "\" (ID " + twi.Thread.ManagedThreadId + ")"); + m_log.DebugFormat( + "[WATCHDOG]: Started tracking thread {0}, ID {1}", twi.Thread.Name, twi.Thread.ManagedThreadId); lock (m_threads) m_threads.Add(twi.Thread.ManagedThreadId, twi); @@ -230,6 +236,26 @@ namespace OpenSim.Framework return m_threads.Values.ToArray(); } + /// + /// Return the current thread's watchdog info. + /// + /// The watchdog info. null if the thread isn't being monitored. + public static ThreadWatchdogInfo GetCurrentThreadInfo() + { + lock (m_threads) + { + if (m_threads.ContainsKey(Thread.CurrentThread.ManagedThreadId)) + return m_threads[Thread.CurrentThread.ManagedThreadId]; + } + + return null; + } + + /// + /// Check watched threads. Fire alarm if appropriate. + /// + /// + /// private static void WatchdogTimerElapsed(object sender, System.Timers.ElapsedEventArgs e) { WatchdogTimeout callback = OnWatchdogTimeout; @@ -246,21 +272,18 @@ namespace OpenSim.Framework { if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { - timedOut = threadInfo; RemoveThread(threadInfo.Thread.ManagedThreadId); - break; + callback(threadInfo.Thread, threadInfo.LastTick); } else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { threadInfo.IsTimedOut = true; - timedOut = threadInfo; - break; + + if (threadInfo.AlarmIfTimeout) + callback(threadInfo.Thread, threadInfo.LastTick); } } } - - if (timedOut != null) - callback(timedOut.Thread, timedOut.LastTick); } m_watchdogTimer.Start(); diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 1e22fcc..fb6b11e 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs @@ -244,8 +244,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP base.Start(m_recvBufferSize, m_asyncPacketHandling); // Start the packet processing threads - Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); - Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); + Watchdog.StartThread( + IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + Watchdog.StartThread( + OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false, true); + m_elapsedMSSinceLastStatReport = Environment.TickCount; } diff --git a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs index f367739..a6e2548 100644 --- a/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs +++ b/OpenSim/Region/CoreModules/InterGrid/OpenGridProtocolModule.cs @@ -1210,7 +1210,7 @@ namespace OpenSim.Region.CoreModules.InterGrid if (homeScene.TryGetScenePresence(avatarId,out avatar)) { KillAUser ku = new KillAUser(avatar,mod); - Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true); + Watchdog.StartThread(ku.ShutdownNoLogout, "OGPShutdown", ThreadPriority.Normal, true, true); } } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs index b315d2c..74b047b 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/WorldMapModule.cs @@ -351,6 +351,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap process, string.Format("MapItemRequestThread ({0})", m_scene.RegionInfo.RegionName), ThreadPriority.BelowNormal, + true, true); } diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index cf6e6af..19d4bad 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1140,7 +1140,7 @@ namespace OpenSim.Region.Framework.Scenes HeartbeatThread = Watchdog.StartThread( - Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false); + Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); } /// @@ -1178,6 +1178,13 @@ namespace OpenSim.Region.Framework.Scenes try { m_eventManager.TriggerOnRegionStarted(this); + + // The first frame can take a very long time due to physics actors being added on startup. Therefore, + // don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false + // alarms for scenes with many objects. + Update(); + Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; + while (!shuttingdown) Update(); @@ -1206,7 +1213,7 @@ namespace OpenSim.Region.Framework.Scenes ++Frame; -// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); +// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); try { @@ -1418,7 +1425,6 @@ namespace OpenSim.Region.Framework.Scenes entry.checkAtTargets(); } - /// /// Send out simstats data to all clients /// diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index c928af7..d3c96e2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -70,7 +70,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_client = client; m_scene = scene; - Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false); + Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); } private void SendServerCommand(string command) diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index eb39026..a7c5020 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs @@ -57,7 +57,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server m_listener.Start(50); - Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false); + Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); m_baseScene = baseScene; } diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 75364b7..97890ee 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1474,6 +1474,8 @@ Console.WriteLine("CreateGeom:"); /// private void changeadd() { +// m_log.DebugFormat("[ODE PRIM]: Adding prim {0}", Name); + int[] iprimspaceArrItem = _parent_scene.calculateSpaceArrayItemFromPos(_position); IntPtr targetspace = _parent_scene.calculateSpaceForGeom(_position); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index ee32755..14edde4 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs @@ -137,7 +137,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api if (cmdHandlerThread == null) { // Start the thread that will be doing the work - cmdHandlerThread = Watchdog.StartThread(CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true); + cmdHandlerThread + = Watchdog.StartThread( + CmdHandlerThreadLoop, "AsyncLSLCmdHandlerThread", ThreadPriority.Normal, true, true); } } -- cgit v1.1 From 84735b644cbd8902dd749fadb4056d26044fd564 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:12:56 +0000 Subject: Get rid of some of the identical exception catching in Scene.Update(). --- OpenSim/Region/Framework/Scenes/Scene.cs | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 19d4bad..9bca654 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1368,26 +1368,10 @@ namespace OpenSim.Region.Framework.Scenes { throw; } - catch (AccessViolationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } - //catch (NullReferenceException e) - //{ - // m_log.Error("[REGION]: Failed with exception " + e.ToString() + " On Region: " + RegionInfo.RegionName); - //} - catch (InvalidOperationException e) - { - m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", - RegionInfo.RegionName, e.Message, e.StackTrace); - } catch (Exception e) { m_log.ErrorFormat( - "[REGION]: Failed on region {0} with exception {1}{2}", + "[SCENE]: Failed on region {0} with exception {1}{2}", RegionInfo.RegionName, e.Message, e.StackTrace); } -- cgit v1.1 From 9e6ffe779841f470c0e2dbe673ef4b10253bcd84 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:15:47 +0000 Subject: Rename Watchdog.GetThreads() to GetThreadsInfo() to reflect what it actually returns and for consistency. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 2 +- OpenSim/Framework/Watchdog.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 0dd01af..6a3135e 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -247,7 +247,7 @@ namespace OpenSim.Framework.Servers string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; StringBuilder sb = new StringBuilder(); - Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); + Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreadsInfo(); sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index e443f0a..4891a66 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -230,7 +230,7 @@ namespace OpenSim.Framework /// Get currently watched threads for diagnostic purposes /// /// - public static ThreadWatchdogInfo[] GetThreads() + public static ThreadWatchdogInfo[] GetThreadsInfo() { lock (m_threads) return m_threads.Values.ToArray(); -- cgit v1.1 From bafef292f4d41df14a1edeafc7ba5f9d623d7822 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 24 Feb 2012 05:25:18 +0000 Subject: Take watchdog alarm calling back outside the m_threads lock. This is how it was originally. This stops a very long running alarm callback from causing a problem. --- OpenSim/Framework/Watchdog.cs | 19 ++++++++++++++++--- .../Framework/Scenes/SceneCommunicationService.cs | 4 ++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 4891a66..e93e50e 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -262,7 +262,7 @@ namespace OpenSim.Framework if (callback != null) { - ThreadWatchdogInfo timedOut = null; + List callbackInfos = null; lock (m_threads) { @@ -273,17 +273,30 @@ namespace OpenSim.Framework if (threadInfo.Thread.ThreadState == ThreadState.Stopped) { RemoveThread(threadInfo.Thread.ManagedThreadId); - callback(threadInfo.Thread, threadInfo.LastTick); + + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); } else if (!threadInfo.IsTimedOut && now - threadInfo.LastTick >= threadInfo.Timeout) { threadInfo.IsTimedOut = true; if (threadInfo.AlarmIfTimeout) - callback(threadInfo.Thread, threadInfo.LastTick); + { + if (callbackInfos == null) + callbackInfos = new List(); + + callbackInfos.Add(threadInfo); + } } } } + + if (callbackInfos != null) + foreach (ThreadWatchdogInfo callbackInfo in callbackInfos) + callback(callbackInfo.Thread, callbackInfo.LastTick); } m_watchdogTimer.Start(); diff --git a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs index 19c9745..4d98f00 100644 --- a/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs +++ b/OpenSim/Region/Framework/Scenes/SceneCommunicationService.cs @@ -156,8 +156,8 @@ namespace OpenSim.Region.Framework.Scenes // that the region position is cached or performance will degrade Utils.LongToUInts(regionHandle, out x, out y); GridRegion dest = m_scene.GridService.GetRegionByPosition(UUID.Zero, (int)x, (int)y); - bool v = true; - if (! simulatorList.Contains(dest.ServerURI)) +// bool v = true; + if (!simulatorList.Contains(dest.ServerURI)) { // we havent seen this simulator before, add it to the list // and send it an update -- cgit v1.1 From 7b5e42c744ceeee739f1fbdb2c96552dfd4add52 Mon Sep 17 00:00:00 2001 From: PixelTomsen Date: Fri, 24 Feb 2012 20:46:14 +0100 Subject: llGetLinkMedia, llSetLinkMedia, llClearLinkMedia implementation mantis: http://opensimulator.org/mantis/view.php?id=5756 http://opensimulator.org/mantis/view.php?id=5755 http://opensimulator.org/mantis/view.php?id=5754 --- .../Shared/Api/Implementation/LSL_Api.cs | 106 ++++++++++++++++----- .../ScriptEngine/Shared/Api/Interface/ILSL_Api.cs | 7 +- .../ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs | 19 +++- 3 files changed, 105 insertions(+), 27 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 2eba2b1..525c3c3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -8173,23 +8173,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return GetPrimMediaParams(m_host, face, rules); + } + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return GetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return GetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return GetPrimMediaParams(part, face, rules); + } + + return new LSL_List(); + } + private LSL_List GetPrimMediaParams(SceneObjectPart part, int face, LSL_List rules) + { // LSL Spec http://wiki.secondlife.com/wiki/LlGetPrimMediaParams says to fail silently if face is invalid // TODO: Need to correctly handle case where a face has no media (which gives back an empty list). // Assuming silently fail means give back an empty list. Ideally, need to check this. - if (face < 0 || face > m_host.GetNumberOfSides() - 1) + if (face < 0 || face > part.GetNumberOfSides() - 1) return new LSL_List(); - return GetPrimMediaParams(face, rules); - } - - private LSL_List GetPrimMediaParams(int face, LSL_List rules) - { IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return new LSL_List(); - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); // As per http://wiki.secondlife.com/wiki/LlGetPrimMediaParams if (null == me) @@ -8271,33 +8288,52 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: res.Add(new LSL_Integer((int)me.ControlPermissions)); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } return res; } - public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) + public LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules) { m_host.AddScriptLPS(1); ScriptSleep(1000); + return SetPrimMediaParams(m_host, face, rules); + } - // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid - // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. - // Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return SetPrimMediaParams(m_host.ParentGroup.RootPart, face, rules); + else if (link == ScriptBaseClass.LINK_THIS) + return SetPrimMediaParams(m_host, face, rules); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return SetPrimMediaParams(part, face, rules); + } - return SetPrimMediaParams(face, rules); + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; } - private LSL_Integer SetPrimMediaParams(int face, LSL_List rules) + private LSL_Integer SetPrimMediaParams(SceneObjectPart part, LSL_Integer face, LSL_List rules) { + // LSL Spec http://wiki.secondlife.com/wiki/LlSetPrimMediaParams says to fail silently if face is invalid + // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. + // Don't perform the media check directly + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - MediaEntry me = module.GetMediaEntry(m_host, face); + MediaEntry me = module.GetMediaEntry(part, face); if (null == me) me = new MediaEntry(); @@ -8376,10 +8412,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api case ScriptBaseClass.PRIM_MEDIA_PERMS_CONTROL: me.ControlPermissions = (MediaPermission)(byte)(int)rules.GetLSLIntegerItem(i++); break; + + default: return ScriptBaseClass.LSL_STATUS_MALFORMED_PARAMS; } } - module.SetMediaEntry(m_host, face, me); + module.SetMediaEntry(part, face, me); return ScriptBaseClass.LSL_STATUS_OK; } @@ -8388,18 +8426,40 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { m_host.AddScriptLPS(1); ScriptSleep(1000); + return ClearPrimMedia(m_host, face); + } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + m_host.AddScriptLPS(1); + ScriptSleep(1000); + if (link == ScriptBaseClass.LINK_ROOT) + return ClearPrimMedia(m_host.ParentGroup.RootPart, face); + else if (link == ScriptBaseClass.LINK_THIS) + return ClearPrimMedia(m_host, face); + else + { + SceneObjectPart part = m_host.ParentGroup.GetLinkNumPart(link); + if (null != part) + return ClearPrimMedia(part, face); + } + + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; + } + + private LSL_Integer ClearPrimMedia(SceneObjectPart part, LSL_Integer face) + { // LSL Spec http://wiki.secondlife.com/wiki/LlClearPrimMedia says to fail silently if face is invalid // Assuming silently fail means sending back LSL_STATUS_OK. Ideally, need to check this. // FIXME: Don't perform the media check directly - if (face < 0 || face > m_host.GetNumberOfSides() - 1) - return ScriptBaseClass.LSL_STATUS_OK; + if (face < 0 || face > part.GetNumberOfSides() - 1) + return ScriptBaseClass.LSL_STATUS_NOT_FOUND; IMoapModule module = m_ScriptEngine.World.RequestModuleInterface(); if (null == module) - throw new Exception("Media on a prim functions not available"); + return ScriptBaseClass.LSL_STATUS_NOT_SUPPORTED; - module.ClearMediaEntry(m_host, face); + module.ClearMediaEntry(part, face); return ScriptBaseClass.LSL_STATUS_OK; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs index 7d39ccc..0f53bc3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/ILSL_Api.cs @@ -64,6 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_List llCastRay(LSL_Vector start, LSL_Vector end, LSL_List options); LSL_Integer llCeil(double f); void llClearCameraParams(); + LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face); LSL_Integer llClearPrimMedia(LSL_Integer face); void llCloseRemoteDataChannel(string channel); LSL_Float llCloud(LSL_Vector offset); @@ -139,7 +140,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces LSL_String llGetLinkName(int linknum); LSL_Integer llGetLinkNumber(); LSL_Integer llGetLinkNumberOfSides(int link); - LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); + LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); + LSL_List llGetLinkPrimitiveParams(int linknum, LSL_List rules); LSL_Integer llGetListEntryType(LSL_List src, int index); LSL_Integer llGetListLength(LSL_List src); LSL_Vector llGetLocalPos(); @@ -335,6 +337,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetInventoryPermMask(string item, int mask, int value); void llSetLinkAlpha(int linknumber, double alpha, int face); void llSetLinkColor(int linknumber, LSL_Vector color, int face); + LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules); void llSetLinkPrimitiveParams(int linknumber, LSL_List rules); void llSetLinkTexture(int linknumber, string texture, int face); void llSetLinkTextureAnim(int linknum, int mode, int face, int sizex, int sizey, double start, double length, double rate); @@ -345,7 +348,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces void llSetParcelMusicURL(string url); void llSetPayPrice(int price, LSL_List quick_pay_buttons); void llSetPos(LSL_Vector pos); - LSL_Integer llSetPrimMediaParams(int face, LSL_List rules); + LSL_Integer llSetPrimMediaParams(LSL_Integer face, LSL_List rules); void llSetPrimitiveParams(LSL_List rules); void llSetLinkPrimitiveParamsFast(int linknum, LSL_List rules); void llSetPrimURL(string url); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs index 24c3d95..f8e3c36 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/LSL_Stub.cs @@ -1887,17 +1887,32 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase { return m_LSL_Functions.llGetPrimMediaParams(face, rules); } - + + public LSL_List llGetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llGetLinkMedia(link, face, rules); + } + public LSL_Integer llSetPrimMediaParams(int face, LSL_List rules) { return m_LSL_Functions.llSetPrimMediaParams(face, rules); } - + + public LSL_Integer llSetLinkMedia(LSL_Integer link, LSL_Integer face, LSL_List rules) + { + return m_LSL_Functions.llSetLinkMedia(link, face, rules); + } + public LSL_Integer llClearPrimMedia(LSL_Integer face) { return m_LSL_Functions.llClearPrimMedia(face); } + public LSL_Integer llClearLinkMedia(LSL_Integer link, LSL_Integer face) + { + return m_LSL_Functions.llClearLinkMedia(link, face); + } + public void print(string str) { m_LSL_Functions.print(str); -- cgit v1.1