From ac72598c6bd974c426863262a1c5ac9210bd986c Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Mon, 4 Jul 2016 08:29:26 +0100 Subject: [PATCH] add OSSL osGetPhysicsEngineName(). this returns a string with name and version. does no permition checks or it whould be less usefull ( only ubOde returns value) --- .../PhysicsModules/SharedBase/PhysicsScene.cs | 2 ++ OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs | 7 ++++++- OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs | 6 +++--- .../Shared/Api/Implementation/OSSL_Api.cs | 16 ++++++++++++++++ .../Shared/Api/Interface/IOSSL_Api.cs | 1 + .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 5 +++++ 6 files changed, 33 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs index 8623891650..65d88674cb 100644 --- a/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs +++ b/OpenSim/Region/PhysicsModules/SharedBase/PhysicsScene.cs @@ -112,6 +112,8 @@ namespace OpenSim.Region.PhysicsModules.SharedBase /// public string EngineType { get; protected set; } + public string EngineName { get; protected set; } + // The only thing that should register for this event is the SceneGraph // Anything else could cause problems. public event physicsCrash OnPhysicsCrash; diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs index dd1c0ab6a9..51b8e4e144 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEModule.cs @@ -29,6 +29,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde get { return "ubODE"; } } + public string Version + { + get { return "1.0"; } + } + public Type ReplaceableInterface { get { return null; } @@ -75,7 +80,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde if(m_scenes.ContainsKey(scene)) // ??? return; - ODEScene newodescene = new ODEScene(scene, m_config, Name, OSOdeLib); + ODEScene newodescene = new ODEScene(scene, m_config, Name, Version, OSOdeLib); m_scenes[scene] = newodescene; } diff --git a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs index aec7ec3101..e0644e38ea 100644 --- a/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs +++ b/OpenSim/Region/PhysicsModules/ubOde/ODEScene.cs @@ -324,13 +324,13 @@ namespace OpenSim.Region.PhysicsModule.ubOde IConfig physicsconfig = null; - public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, bool pOSOdeLib) + public ODEScene(Scene pscene, IConfigSource psourceconfig, string pname, string pversion, bool pOSOdeLib) { OdeLock = new Object(); EngineType = pname; PhysicsSceneName = EngineType + "/" + pscene.RegionInfo.RegionName; - + EngineName = pname + " " + pversion; m_config = psourceconfig; m_OSOdeLib = pOSOdeLib; @@ -355,7 +355,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde m_log.ErrorFormat("[ubOde] No mesher. module disabled"); return; } - + m_meshWorker = new ODEMeshWorker(this, m_log, mesher, physicsconfig); m_frameWorkScene.PhysicsEnabled = true; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 90b7494464..204f73e318 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -1724,6 +1724,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return ret; } + public string osGetPhysicsEngineName() + { + // not doing security checks + // this whould limit the use of this + + m_host.AddScriptLPS(1); + string ret = "NoEngine"; + if (m_ScriptEngine.World.PhysicsScene != null) + { + ret = m_ScriptEngine.World.PhysicsScene.EngineName; + // An old physics engine might have an uninitialized engine type + if (ret == null) + ret = "UnknownEngine"; + } + return ret; + } public string osGetSimulatorVersion() { // High because it can be used to target attacks to known weaknesses diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs index e1bb139e1e..c1a177a1a9 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Interface/IOSSL_Api.cs @@ -262,6 +262,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces string osGetSimulatorVersion(); LSL_Integer osCheckODE(); string osGetPhysicsEngineType(); + string osGetPhysicsEngineName(); Object osParseJSONNew(string JSON); Hashtable osParseJSON(string JSON); diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 00220202d8..d58629081f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -435,6 +435,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase return m_OSSL_Functions.osGetPhysicsEngineType(); } + public string osGetPhysicsEngineName() + { + return m_OSSL_Functions.osGetPhysicsEngineName(); + } + public string osGetSimulatorVersion() { return m_OSSL_Functions.osGetSimulatorVersion();