From 7a79eee5234b48334c32099e55c16cc7068c0174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Sat, 16 Feb 2019 14:40:52 +0100 Subject: [PATCH] Expose OS::get_current_video_driver to scripting languages --- core/bind/core_bind.cpp | 13 +++++++++++-- core/bind/core_bind.h | 9 ++++++++- doc/classes/Animation.xml | 6 ++++++ doc/classes/MultiMesh.xml | 18 ++++++++++++++++++ doc/classes/OS.xml | 17 ++++++++++++++++- doc/classes/OptionButton.xml | 18 +++++++++--------- doc/classes/TabContainer.xml | 2 ++ doc/classes/Tabs.xml | 2 ++ 8 files changed, 72 insertions(+), 13 deletions(-) diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index f17d7372e26..f6828ea76ab 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -225,8 +225,12 @@ int _OS::get_video_driver_count() const { return OS::get_singleton()->get_video_driver_count(); } -String _OS::get_video_driver_name(int p_driver) const { - return OS::get_singleton()->get_video_driver_name(p_driver); +String _OS::get_video_driver_name(VideoDriver p_driver) const { + return OS::get_singleton()->get_video_driver_name((int)p_driver); +} + +_OS::VideoDriver _OS::get_current_video_driver() const { + return (VideoDriver)OS::get_singleton()->get_current_video_driver(); } int _OS::get_audio_driver_count() const { @@ -1108,6 +1112,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_video_driver_count"), &_OS::get_video_driver_count); ClassDB::bind_method(D_METHOD("get_video_driver_name", "driver"), &_OS::get_video_driver_name); + ClassDB::bind_method(D_METHOD("get_current_video_driver"), &_OS::get_current_video_driver); + ClassDB::bind_method(D_METHOD("get_audio_driver_count"), &_OS::get_audio_driver_count); ClassDB::bind_method(D_METHOD("get_audio_driver_name", "driver"), &_OS::get_audio_driver_name); ClassDB::bind_method(D_METHOD("get_connected_midi_inputs"), &_OS::get_connected_midi_inputs); @@ -1276,6 +1282,9 @@ void _OS::_bind_methods() { ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_position"), "set_window_position", "get_window_position"); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "window_size"), "set_window_size", "get_window_size"); + BIND_ENUM_CONSTANT(VIDEO_DRIVER_GLES2); + BIND_ENUM_CONSTANT(VIDEO_DRIVER_GLES3); + BIND_ENUM_CONSTANT(DAY_SUNDAY); BIND_ENUM_CONSTANT(DAY_MONDAY); BIND_ENUM_CONSTANT(DAY_TUESDAY); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 1c8b985d734..f3bc4644d8f 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -103,6 +103,11 @@ protected: static _OS *singleton; public: + enum VideoDriver { + VIDEO_DRIVER_GLES3, + VIDEO_DRIVER_GLES2, + }; + enum PowerState { POWERSTATE_UNKNOWN, /**< cannot determine power status */ POWERSTATE_ON_BATTERY, /**< Not plugged in, running on the battery */ @@ -152,7 +157,8 @@ public: Array get_fullscreen_mode_list(int p_screen = 0) const; virtual int get_video_driver_count() const; - virtual String get_video_driver_name(int p_driver) const; + virtual String get_video_driver_name(VideoDriver p_driver) const; + virtual VideoDriver get_current_video_driver() const; virtual int get_audio_driver_count() const; virtual String get_audio_driver_name(int p_driver) const; @@ -355,6 +361,7 @@ public: _OS(); }; +VARIANT_ENUM_CAST(_OS::VideoDriver); VARIANT_ENUM_CAST(_OS::PowerState); VARIANT_ENUM_CAST(_OS::Weekday); VARIANT_ENUM_CAST(_OS::Month); diff --git a/doc/classes/Animation.xml b/doc/classes/Animation.xml index a7cae709a4c..eaaa64d53d1 100644 --- a/doc/classes/Animation.xml +++ b/doc/classes/Animation.xml @@ -648,6 +648,12 @@ The animation step value. + + + + + + Value tracks set values in node properties, but only those which can be Interpolated. diff --git a/doc/classes/MultiMesh.xml b/doc/classes/MultiMesh.xml index 79864618406..565e19c2298 100644 --- a/doc/classes/MultiMesh.xml +++ b/doc/classes/MultiMesh.xml @@ -48,6 +48,14 @@ Return the transform of a specific instance. + + + + + + + + @@ -81,6 +89,16 @@ Set the transform for a specific instance. + + + + + + + + + + diff --git a/doc/classes/OS.xml b/doc/classes/OS.xml index f6ad71b6e28..5e71ed094ea 100644 --- a/doc/classes/OS.xml +++ b/doc/classes/OS.xml @@ -159,6 +159,13 @@ + + + + + Returns the currently used video driver, using one of the values from [enum OS.VideoDriver]. + + @@ -459,14 +466,16 @@ + Returns the number of video drivers supported on the current platform. - + + Returns the name of the video driver matching the given [code]driver[/code] index. This index is a value from [enum OS.VideoDriver], and you can use [method get_current_video_driver] to get the current backend's index. @@ -806,6 +815,12 @@ + + The GLES2 rendering backend. It uses OpenGL ES 2.0 on mobile devices, OpenGL 2.1 on desktop platforms and WebGL 1.0 on the web. + + + The GLES3 rendering backend. It uses OpenGL ES 3.0 on mobile devices, OpenGL 3.3 on desktop platforms and WebGL 2.0 on the web. + Sunday. diff --git a/doc/classes/OptionButton.xml b/doc/classes/OptionButton.xml index 09b91671493..0f795b4bf8b 100644 --- a/doc/classes/OptionButton.xml +++ b/doc/classes/OptionButton.xml @@ -74,15 +74,15 @@ Return the ID of the item at index [code]idx[/code]. - - - - - - - Return the index of the item with the given [code]id[/code]. - - + + + + + + + Return the index of the item with the given [code]id[/code]. + + diff --git a/doc/classes/TabContainer.xml b/doc/classes/TabContainer.xml index 04285b62dfa..3c5bc25def2 100644 --- a/doc/classes/TabContainer.xml +++ b/doc/classes/TabContainer.xml @@ -216,6 +216,8 @@ + + diff --git a/doc/classes/Tabs.xml b/doc/classes/Tabs.xml index de57250d8b9..b22d9d73da4 100644 --- a/doc/classes/Tabs.xml +++ b/doc/classes/Tabs.xml @@ -279,6 +279,8 @@ + +