Fix Forward button icon and crash

This commit is contained in:
Serhii Snitsaruk 2024-01-10 00:02:24 +01:00
parent cdd5159a08
commit 960f04b0ab
2 changed files with 11 additions and 5 deletions

View File

@ -44,27 +44,28 @@
#endif // ! LIMBOAI_MODULE #endif // ! LIMBOAI_MODULE
#ifdef LIMBOAI_GDEXTENSION #ifdef LIMBOAI_GDEXTENSION
#include "godot_cpp/classes/editor_interface.hpp"
#include "godot_cpp/classes/editor_paths.hpp"
#include "godot_cpp/classes/ref_counted.hpp"
#include <godot_cpp/classes/button_group.hpp> #include <godot_cpp/classes/button_group.hpp>
#include <godot_cpp/classes/config_file.hpp> #include <godot_cpp/classes/config_file.hpp>
#include <godot_cpp/classes/dir_access.hpp> #include <godot_cpp/classes/dir_access.hpp>
#include <godot_cpp/classes/display_server.hpp> #include <godot_cpp/classes/display_server.hpp>
#include <godot_cpp/classes/editor_file_system.hpp> #include <godot_cpp/classes/editor_file_system.hpp>
#include <godot_cpp/classes/editor_inspector.hpp> #include <godot_cpp/classes/editor_inspector.hpp>
#include <godot_cpp/classes/editor_interface.hpp>
#include <godot_cpp/classes/editor_paths.hpp>
#include <godot_cpp/classes/editor_settings.hpp> #include <godot_cpp/classes/editor_settings.hpp>
#include <godot_cpp/classes/editor_undo_redo_manager.hpp> #include <godot_cpp/classes/editor_undo_redo_manager.hpp>
#include <godot_cpp/classes/file_access.hpp> #include <godot_cpp/classes/file_access.hpp>
#include <godot_cpp/classes/input.hpp> #include <godot_cpp/classes/input.hpp>
#include <godot_cpp/classes/input_event.hpp> #include <godot_cpp/classes/input_event.hpp>
#include <godot_cpp/classes/project_settings.hpp> #include <godot_cpp/classes/project_settings.hpp>
#include <godot_cpp/classes/ref_counted.hpp>
#include <godot_cpp/classes/resource_loader.hpp> #include <godot_cpp/classes/resource_loader.hpp>
#include <godot_cpp/classes/resource_saver.hpp> #include <godot_cpp/classes/resource_saver.hpp>
#include <godot_cpp/classes/script.hpp> #include <godot_cpp/classes/script.hpp>
#include <godot_cpp/classes/script_editor.hpp> #include <godot_cpp/classes/script_editor.hpp>
#include <godot_cpp/classes/script_editor_base.hpp> #include <godot_cpp/classes/script_editor_base.hpp>
#include <godot_cpp/classes/v_separator.hpp> #include <godot_cpp/classes/v_separator.hpp>
#include <godot_cpp/core/error_macros.hpp>
#endif // ! LIMBOAI_GDEXTENSION #endif // ! LIMBOAI_GDEXTENSION
//**** LimboAIEditor //**** LimboAIEditor
@ -178,7 +179,7 @@ void LimboAIEditor::_update_header() const {
void LimboAIEditor::_update_history_buttons() { void LimboAIEditor::_update_history_buttons() {
history_back->set_disabled(idx_history == 0); history_back->set_disabled(idx_history == 0);
history_forward->set_disabled(idx_history == (history.size() - 1)); history_forward->set_disabled(idx_history >= (history.size() - 1));
} }
void LimboAIEditor::_new_bt() { void LimboAIEditor::_new_bt() {
@ -691,11 +692,13 @@ void LimboAIEditor::_on_save_pressed() {
} }
void LimboAIEditor::_on_history_back() { void LimboAIEditor::_on_history_back() {
ERR_FAIL_COND(history.size() == 0);
idx_history = MAX(idx_history - 1, 0); idx_history = MAX(idx_history - 1, 0);
EDIT_RESOURCE(history[idx_history]); EDIT_RESOURCE(history[idx_history]);
} }
void LimboAIEditor::_on_history_forward() { void LimboAIEditor::_on_history_forward() {
ERR_FAIL_COND(history.size() == 0);
idx_history = MIN(idx_history + 1, history.size() - 1); idx_history = MIN(idx_history + 1, history.size() - 1);
EDIT_RESOURCE(history[idx_history]); EDIT_RESOURCE(history[idx_history]);
} }
@ -1039,6 +1042,9 @@ void LimboAIEditor::_notification(int p_what) {
EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload)); EDITOR_FILE_SYSTEM()->connect("resources_reload", callable_mp(this, &LimboAIEditor::_on_resources_reload));
_update_history_buttons();
_update_header();
} break; } break;
case NOTIFICATION_THEME_CHANGED: { case NOTIFICATION_THEME_CHANGED: {
_do_update_theme_item_cache(); _do_update_theme_item_cache();

View File

@ -72,7 +72,7 @@ LimboStringNames::LimboStringNames() {
font = SN("font"); font = SN("font");
font_color = SN("font_color"); font_color = SN("font_color");
font_size = SN("font_size"); font_size = SN("font_size");
Forward = SN("Tools"); Forward = SN("Forward");
gui_input = SN("gui_input"); gui_input = SN("gui_input");
GuiTreeArrowDown = SN("GuiTreeArrowDown"); GuiTreeArrowDown = SN("GuiTreeArrowDown");
GuiTreeArrowRight = SN("GuiTreeArrowRight"); GuiTreeArrowRight = SN("GuiTreeArrowRight");