Просмотр исходного кода

Merge pull request #20240 from matthew1006/has-custom-feature-tag-fix

Fixed OS.has_feature not using custom feature tags.
Rémi Verschelde 7 лет назад
Родитель
Сommit
d603a74c53
3 измененных файлов с 9 добавлено и 0 удалено
  1. 3 0
      core/os/os.cpp
  2. 4 0
      core/project_settings.cpp
  3. 2 0
      core/project_settings.h

+ 3 - 0
core/os/os.cpp

@@ -614,6 +614,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;
 }
 

+ 4 - 0
core/project_settings.cpp

@@ -912,6 +912,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);

+ 2 - 0
core/project_settings.h

@@ -151,6 +151,8 @@ public:
 
 	void set_registering_order(bool p_enable);
 
+	bool has_custom_feature(const String &p_feature) const;
+
 	ProjectSettings();
 	~ProjectSettings();
 };