Editor: Show alert about editing project settings in GDExtension
This commit is contained in:
parent
dc8dcf9d71
commit
27d3ec7555
|
@ -272,8 +272,10 @@ void LimboAIEditor::_edit_project_settings() {
|
|||
ProjectSettingsEditor::get_singleton()->connect(LW_NAME(visibility_changed), callable_mp(this, &LimboAIEditor::_update_banners), CONNECT_ONE_SHOT);
|
||||
#elif LIMBOAI_GDEXTENSION
|
||||
// TODO: Find a way to show project setting in GDExtension.
|
||||
// TODO: Maybe show a popup dialog instead.
|
||||
ERR_PRINT("Can't do in GDExtension. To edit project settings, navigate to \"Project->Project Settings\", enable \"Advanced settings\", and scroll down to the \"LimboAI\" section.");
|
||||
String text = "Can't open settings in GDExtension, sorry :(\n"
|
||||
"To edit project settings, navigate to \"Project->Project Settings\",\n"
|
||||
"enable \"Advanced settings\", and scroll down to the \"LimboAI\" section.";
|
||||
_popup_info_dialog(text);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -882,6 +884,11 @@ void LimboAIEditor::_resave_modified(String _str) {
|
|||
disk_changed_files.clear();
|
||||
}
|
||||
|
||||
void LimboAIEditor::_popup_info_dialog(const String &p_text) {
|
||||
info_dialog->set_text(p_text);
|
||||
info_dialog->popup_centered();
|
||||
}
|
||||
|
||||
void LimboAIEditor::_rename_task_confirmed() {
|
||||
ERR_FAIL_COND(!task_tree->get_selected().is_valid());
|
||||
rename_dialog->hide();
|
||||
|
@ -1112,6 +1119,7 @@ void LimboAIEditor::_bind_methods() {
|
|||
}
|
||||
|
||||
LimboAIEditor::LimboAIEditor() {
|
||||
plugin = nullptr;
|
||||
idx_history = 0;
|
||||
|
||||
LW_SHORTCUT("limbo_ai/rename_task", TTR("Rename"), LW_KEY(F2));
|
||||
|
@ -1352,6 +1360,9 @@ LimboAIEditor::LimboAIEditor() {
|
|||
disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave");
|
||||
}
|
||||
|
||||
info_dialog = memnew(AcceptDialog);
|
||||
add_child(info_dialog);
|
||||
|
||||
BASE_CONTROL()->add_child(disk_changed);
|
||||
|
||||
GLOBAL_DEF(PropertyInfo(Variant::STRING, "limbo_ai/behavior_tree/behavior_tree_default_dir", PROPERTY_HINT_DIR), "res://ai/trees");
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include "editor/gui/editor_spin_slider.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
#include "scene/gui/control.h"
|
||||
#include "scene/gui/dialogs.h"
|
||||
#include "scene/gui/file_dialog.h"
|
||||
#include "scene/gui/flow_container.h"
|
||||
#include "scene/gui/line_edit.h"
|
||||
|
@ -44,6 +45,7 @@
|
|||
#endif // LIMBOAI_MODULE
|
||||
|
||||
#ifdef LIMBOAI_GDEXTENSION
|
||||
#include "godot_cpp/classes/accept_dialog.hpp"
|
||||
#include <godot_cpp/classes/control.hpp>
|
||||
#include <godot_cpp/classes/editor_plugin.hpp>
|
||||
#include <godot_cpp/classes/editor_spin_slider.hpp>
|
||||
|
@ -153,6 +155,8 @@ private:
|
|||
Tree *disk_changed_list;
|
||||
HashSet<String> disk_changed_files;
|
||||
|
||||
AcceptDialog *info_dialog;
|
||||
|
||||
void _add_task(const Ref<BTTask> &p_task);
|
||||
Ref<BTTask> _create_task_by_class_or_path(const String &p_class_or_path) const;
|
||||
void _add_task_by_class_or_path(const String &p_class_or_path);
|
||||
|
@ -175,6 +179,7 @@ private:
|
|||
void _reload_modified();
|
||||
void _resave_modified(String _str = "");
|
||||
void _popup_file_dialog(FileDialog *p_dialog) { p_dialog->popup_centered_clamped(Size2i(700, 500), 0.8f); }
|
||||
void _popup_info_dialog(const String &p_text);
|
||||
|
||||
void _rename_task_confirmed();
|
||||
void _on_tree_rmb(const Vector2 &p_menu_pos);
|
||||
|
|
Loading…
Reference in New Issue