diff --git a/editor/debugger/behavior_tree_view.cpp b/editor/debugger/behavior_tree_view.cpp index 6bdf9a4..cfc5130 100644 --- a/editor/debugger/behavior_tree_view.cpp +++ b/editor/debugger/behavior_tree_view.cpp @@ -134,9 +134,9 @@ void BehaviorTreeView::clear() { } void BehaviorTreeView::_do_update_theme_item_cache() { - theme_cache.icon_running = get_theme_icon(LW_NAME(LimboExtraClock), LW_NAME(EditorIcons)); - theme_cache.icon_success = get_theme_icon(LW_NAME(BTAlwaysSucceed), LW_NAME(EditorIcons)); - theme_cache.icon_failure = get_theme_icon(LW_NAME(BTAlwaysFail), LW_NAME(EditorIcons)); + theme_cache.icon_running = LimboUtility::get_singleton()->get_task_icon("LimboExtraClock"); + theme_cache.icon_success = LimboUtility::get_singleton()->get_task_icon("BTAlwaysSucceed"); + theme_cache.icon_failure = LimboUtility::get_singleton()->get_task_icon("BTAlwaysFail"); theme_cache.font_custom_name = get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts)); diff --git a/editor/debugger/limbo_debugger_plugin.cpp b/editor/debugger/limbo_debugger_plugin.cpp index 6687ec9..691ed50 100644 --- a/editor/debugger/limbo_debugger_plugin.cpp +++ b/editor/debugger/limbo_debugger_plugin.cpp @@ -16,6 +16,7 @@ #include "../../bt/behavior_tree.h" #include "../../editor/debugger/behavior_tree_data.h" #include "../../editor/debugger/behavior_tree_view.h" +#include "../../util/limbo_utility.h" #include "limbo_debugger.h" #ifdef LIMBOAI_MODULE @@ -183,7 +184,7 @@ void LimboDebuggerTab::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { alert_icon->set_texture(get_theme_icon(LW_NAME(StatusWarning), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(resource_header, get_theme_icon(LW_NAME(BehaviorTree), LW_NAME(EditorIcons))); + BUTTON_SET_ICON(resource_header, LimboUtility::get_singleton()->get_task_icon("BehaviorTree")); } break; } } diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index a15df40..9a1980d 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -981,12 +981,13 @@ void LimboAIEditor::_do_update_theme_item_cache() { theme_cache.move_task_up_icon = get_theme_icon(LW_NAME(MoveUp), LW_NAME(EditorIcons)); theme_cache.open_debugger_icon = get_theme_icon(LW_NAME(Debug), LW_NAME(EditorIcons)); theme_cache.open_doc_icon = get_theme_icon(LW_NAME(Help), LW_NAME(EditorIcons)); - theme_cache.percent_icon = get_theme_icon(LW_NAME(LimboPercent), LW_NAME(EditorIcons)); theme_cache.remove_task_icon = get_theme_icon(LW_NAME(Remove), LW_NAME(EditorIcons)); theme_cache.rename_task_icon = get_theme_icon(LW_NAME(Rename), LW_NAME(EditorIcons)); theme_cache.change_type_icon = get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons)); - theme_cache.extract_subtree_icon = get_theme_icon(LW_NAME(LimboExtractSubtree), LW_NAME(EditorIcons)); - theme_cache.behavior_tree_icon = get_theme_icon(LW_NAME(BehaviorTree), LW_NAME(EditorIcons)); + + theme_cache.behavior_tree_icon = LimboUtility::get_singleton()->get_task_icon("BehaviorTree"); + theme_cache.percent_icon = LimboUtility::get_singleton()->get_task_icon("LimboPercent"); + theme_cache.extract_subtree_icon = LimboUtility::get_singleton()->get_task_icon("LimboExtractSubtree"); } void LimboAIEditor::_notification(int p_what) { @@ -1394,6 +1395,12 @@ bool LimboAIEditorPlugin::_handles(Object *p_object) const { return false; } +#ifdef LIMBOAI_GDEXTENSION +Ref LimboAIEditorPlugin::_get_plugin_icon() const { + return LimboUtility::get_singleton()->get_task_icon("LimboAI"); +} +#endif // LIMBOAI_GDEXTENSION + LimboAIEditorPlugin::LimboAIEditorPlugin() { limbo_ai_editor = memnew(LimboAIEditor()); limbo_ai_editor->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/limbo_ai_editor_plugin.h b/editor/limbo_ai_editor_plugin.h index fd64132..fec355e 100644 --- a/editor/limbo_ai_editor_plugin.h +++ b/editor/limbo_ai_editor_plugin.h @@ -243,6 +243,7 @@ public: virtual void _apply_changes() override; virtual void _edit(Object *p_object) override; virtual bool _handles(Object *p_object) const override; + virtual Ref _get_plugin_icon() const override; #endif // LIMBOAI_GDEXTENSION LimboAIEditorPlugin(); diff --git a/editor/task_palette.cpp b/editor/task_palette.cpp index a725d3a..5a923cd 100644 --- a/editor/task_palette.cpp +++ b/editor/task_palette.cpp @@ -580,11 +580,12 @@ void TaskPalette::_notification(int p_what) { BUTTON_SET_ICON(tool_filters, get_theme_icon(LW_NAME(AnimationFilter), LW_NAME(EditorIcons))); BUTTON_SET_ICON(tool_refresh, get_theme_icon(LW_NAME(Reload), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(select_all, get_theme_icon(LW_NAME(LimboSelectAll), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(deselect_all, get_theme_icon(LW_NAME(LimboDeselectAll), LW_NAME(EditorIcons))); filter_edit->set_right_icon(get_theme_icon(LW_NAME(Search), LW_NAME(EditorIcons))); + BUTTON_SET_ICON(select_all, LimboUtility::get_singleton()->get_task_icon("LimboSelectAll")); + BUTTON_SET_ICON(deselect_all, LimboUtility::get_singleton()->get_task_icon("LimboDeselectAll")); + category_choice->queue_redraw(); if (is_visible_in_tree()) { diff --git a/util/limbo_string_names.cpp b/util/limbo_string_names.cpp index 4c2e7a6..6df10d9 100644 --- a/util/limbo_string_names.cpp +++ b/util/limbo_string_names.cpp @@ -126,6 +126,7 @@ LimboStringNames::LimboStringNames() { text_changed = SN("text_changed"); timeout = SN("timeout"); toggled = SN("toggled"); + Tools = SN("Tools"); update_task = SN("update_task"); update_tree = SN("update_tree"); updated = SN("updated"); diff --git a/util/limbo_utility.cpp b/util/limbo_utility.cpp index 5ff09c8..9fd6e0a 100644 --- a/util/limbo_utility.cpp +++ b/util/limbo_utility.cpp @@ -32,6 +32,7 @@ #include "godot_cpp/classes/input_event_key.hpp" #include "godot_cpp/variant/utility_functions.hpp" #include +#include #include #include @@ -106,7 +107,19 @@ Ref LimboUtility::get_task_icon(String p_class_or_script_path) const } // Return generic resource icon as a fallback. return theme->get_icon(SNAME("Resource"), SNAME("EditorIcons")); -#endif // TOOLS_ENABLED +#endif // ! TOOLS_ENABLED && LIMBOAI_MODULE + +#ifdef LIMBOAI_GDEXTENSION + String path; + if (p_class_or_script_path.begins_with("res://")) { + path = p_class_or_script_path; + } else { + path = "res://addons/limboai/icons/" + p_class_or_script_path + ".svg"; + } + + Ref icon = RESOURCE_LOAD(path, "Texture2D"); + return icon; +#endif // LIMBOAI_GDEXTENSION // TODO: GDExtension needs the icons too.