diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/bind/core_bind.cpp | 7 | ||||
-rw-r--r-- | core/bind/core_bind.h | 2 | ||||
-rw-r--r-- | core/io/resource_loader.cpp | 2 | ||||
-rw-r--r-- | core/io/resource_saver.cpp | 2 | ||||
-rw-r--r-- | core/os/input_event.cpp | 3 | ||||
-rw-r--r-- | core/os/input_event.h | 3 | ||||
-rw-r--r-- | core/os/os.h | 2 | ||||
-rw-r--r-- | core/script_language.cpp | 8 | ||||
-rw-r--r-- | core/script_language.h | 1 |
9 files changed, 28 insertions, 2 deletions
diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index f6828ea76a..f5dbacd62d 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1093,6 +1093,11 @@ void _OS::alert(const String &p_alert, const String &p_title) { OS::get_singleton()->alert(p_alert, p_title); } +bool _OS::request_permission(const String &p_name) { + + return OS::get_singleton()->request_permission(p_name); +} + _OS *_OS::singleton = NULL; void _OS::_bind_methods() { @@ -1265,6 +1270,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_power_seconds_left"), &_OS::get_power_seconds_left); ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left); + ClassDB::bind_method(D_METHOD("request_permission", "name"), &_OS::request_permission); + ADD_PROPERTY(PropertyInfo(Variant::STRING, "clipboard"), "set_clipboard", "get_clipboard"); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen"); ADD_PROPERTY(PropertyInfo(Variant::INT, "exit_code"), "set_exit_code", "get_exit_code"); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index f3bc4644d8..803743bc93 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -356,6 +356,8 @@ public: bool has_feature(const String &p_feature) const; + bool request_permission(const String &p_name); + static _OS *get_singleton() { return singleton; } _OS(); diff --git a/core/io/resource_loader.cpp b/core/io/resource_loader.cpp index c917b9ba28..e4b694b64f 100644 --- a/core/io/resource_loader.cpp +++ b/core/io/resource_loader.cpp @@ -946,7 +946,7 @@ void ResourceLoader::add_custom_loaders() { for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) { StringName class_name = E->get(); - StringName base_class = ScriptServer::get_global_class_base(class_name); + StringName base_class = ScriptServer::get_global_class_native_base(class_name); if (base_class == custom_loader_base_class) { String path = ScriptServer::get_global_class_path(class_name); diff --git a/core/io/resource_saver.cpp b/core/io/resource_saver.cpp index c992e2bf94..0cecca904d 100644 --- a/core/io/resource_saver.cpp +++ b/core/io/resource_saver.cpp @@ -249,7 +249,7 @@ void ResourceSaver::add_custom_savers() { for (List<StringName>::Element *E = global_classes.front(); E; E = E->next()) { StringName class_name = E->get(); - StringName base_class = ScriptServer::get_global_class_base(class_name); + StringName base_class = ScriptServer::get_global_class_native_base(class_name); if (base_class == custom_saver_base_class) { String path = ScriptServer::get_global_class_path(class_name); diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 40308f4f7d..25a5c2afeb 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -33,6 +33,9 @@ #include "core/input_map.h" #include "core/os/keyboard.h" +const int InputEvent::DEVICE_ID_TOUCH_MOUSE = -1; +const int InputEvent::DEVICE_ID_INTERNAL = -2; + void InputEvent::set_device(int p_device) { device = p_device; } diff --git a/core/os/input_event.h b/core/os/input_event.h index 47f9293a7f..ba01516519 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -165,6 +165,9 @@ protected: static void _bind_methods(); public: + static const int DEVICE_ID_TOUCH_MOUSE; + static const int DEVICE_ID_INTERNAL; + void set_device(int p_device); int get_device() const; diff --git a/core/os/os.h b/core/os/os.h index ebfe7d20dc..d02d5a2c84 100644 --- a/core/os/os.h +++ b/core/os/os.h @@ -518,6 +518,8 @@ public: bool is_restart_on_exit_set() const; List<String> get_restart_on_exit_arguments() const; + virtual bool request_permission(const String &p_name) { return true; } + virtual void process_and_drop_events() {} OS(); virtual ~OS(); diff --git a/core/script_language.cpp b/core/script_language.cpp index 1c244661b0..4a6f904f9d 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -190,6 +190,14 @@ StringName ScriptServer::get_global_class_base(const String &p_class) { ERR_FAIL_COND_V(!global_classes.has(p_class), String()); return global_classes[p_class].base; } +StringName ScriptServer::get_global_class_native_base(const String &p_class) { + ERR_FAIL_COND_V(!global_classes.has(p_class), String()); + String base = global_classes[p_class].base; + while (global_classes.has(base)) { + base = global_classes[base].base; + } + return base; +} void ScriptServer::get_global_class_list(List<StringName> *r_global_classes) { const StringName *K = NULL; List<StringName> classes; diff --git a/core/script_language.h b/core/script_language.h index 65fb0f0268..b6d7bea9c7 100644 --- a/core/script_language.h +++ b/core/script_language.h @@ -87,6 +87,7 @@ public: static StringName get_global_class_language(const StringName &p_class); static String get_global_class_path(const String &p_class); static StringName get_global_class_base(const String &p_class); + static StringName get_global_class_native_base(const String &p_class); static void get_global_class_list(List<StringName> *r_global_classes); static void save_global_classes(); |