Add action banner if native method override warning is set to Error

This commit is contained in:
Serhii Snitsaruk 2024-01-17 14:49:43 +01:00
parent 242c1f03d7
commit dc8dcf9d71
4 changed files with 21 additions and 0 deletions

View File

@ -992,6 +992,17 @@ void LimboAIEditor::_update_banners() {
banners->call_deferred(LW_NAME(add_child), banner); banners->call_deferred(LW_NAME(add_child), banner);
} }
} }
#ifdef LIMBOAI_GDEXTENSION
if (!limitations_banner_shown && GLOBAL_GET("debug/gdscript/warnings/native_method_override") == Variant(2)) {
ActionBanner *banner = memnew(ActionBanner);
banner->set_text(vformat(TTR("In Project Settings, \"debug/gdscript/warnings/native_method_override\" is set to \"Error\"")));
banner->add_action(TTR("Instructions"), callable_mp(LimboUtility::get_singleton(), &LimboUtility::open_doc_gdextension_limitations));
banner->add_action(TTR("Dismiss"), callable_mp(banner, &ActionBanner::close));
banners->call_deferred(LW_NAME(add_child), banner);
limitations_banner_shown = true;
}
#endif // LIMBOAI_GDEXTENSION
} }
void LimboAIEditor::_do_update_theme_item_cache() { void LimboAIEditor::_do_update_theme_item_cache() {

View File

@ -107,6 +107,10 @@ private:
Ref<Texture2D> behavior_tree_icon; Ref<Texture2D> behavior_tree_icon;
} theme_cache; } theme_cache;
#ifdef LIMBOAI_GDEXTENSION
bool limitations_banner_shown = false;
#endif // LIMBOAI_GDEXTENSION
EditorPlugin *plugin; EditorPlugin *plugin;
Vector<Ref<BehaviorTree>> history; Vector<Ref<BehaviorTree>> history;
int idx_history; int idx_history;

View File

@ -343,6 +343,11 @@ void LimboUtility::open_doc_online() {
LIMBO_DOC_VERSION)); LIMBO_DOC_VERSION));
} }
void LimboUtility::open_doc_gdextension_limitations() {
OS::get_singleton()->shell_open(vformat("https://limboai.readthedocs.io/en/%s/getting-started/gdextension.html#limitations-of-the-gdextension-version",
LIMBO_DOC_VERSION));
}
void LimboUtility::open_doc_class(const String &p_class_name) { void LimboUtility::open_doc_class(const String &p_class_name) {
if (p_class_name.begins_with("res://")) { if (p_class_name.begins_with("res://")) {
SHOW_DOC(vformat("class_name:\"%s\"", p_class_name)); SHOW_DOC(vformat("class_name:\"%s\"", p_class_name));

View File

@ -95,6 +95,7 @@ public:
void open_doc_introduction(); void open_doc_introduction();
void open_doc_online(); void open_doc_online();
void open_doc_gdextension_limitations();
void open_doc_class(const String &p_class_name); void open_doc_class(const String &p_class_name);
#endif // TOOLS_ENABLED #endif // TOOLS_ENABLED