From c68a465f47d1206e26b06b04cb0b46245a168f74 Mon Sep 17 00:00:00 2001 From: matthew1006 Date: Wed, 18 Jul 2018 09:22:59 +0100 Subject: [PATCH] Fixed OS.has_feature not using custom feature tags. (cherry picked from commit 25e64ffa20a15abe6c435ae8abf517be209fea53) --- core/os/os.cpp | 3 +++ core/project_settings.cpp | 4 ++++ core/project_settings.h | 2 ++ 3 files changed, 9 insertions(+) diff --git a/core/os/os.cpp b/core/os/os.cpp index f7ff70c239e..3d0e1c23e38 100644 --- a/core/os/os.cpp +++ b/core/os/os.cpp @@ -613,6 +613,9 @@ bool OS::has_feature(const String &p_feature) { if (_check_internal_feature_support(p_feature)) return true; + if (ProjectSettings::get_singleton()->has_custom_feature(p_feature)) + return true; + return false; } diff --git a/core/project_settings.cpp b/core/project_settings.cpp index 545cdbc7f7e..09ad1cc50af 100644 --- a/core/project_settings.cpp +++ b/core/project_settings.cpp @@ -886,6 +886,10 @@ Variant ProjectSettings::get_setting(const String &p_setting) const { return get(p_setting); } +bool ProjectSettings::has_custom_feature(const String &p_feature) const { + return custom_features.has(p_feature); +} + void ProjectSettings::_bind_methods() { ClassDB::bind_method(D_METHOD("has_setting", "name"), &ProjectSettings::has_setting); diff --git a/core/project_settings.h b/core/project_settings.h index 6ae23b3bc97..8ee20408c74 100644 --- a/core/project_settings.h +++ b/core/project_settings.h @@ -148,6 +148,8 @@ public: void set_registering_order(bool p_enable); + bool has_custom_feature(const String &p_feature) const; + ProjectSettings(); ~ProjectSettings(); };