From 70994acd1513c8b9d3e0867d7d33bcbf5545ba9e Mon Sep 17 00:00:00 2001 From: "Wilson E. Alvarez" Date: Sat, 2 Nov 2024 20:55:48 -0400 Subject: [PATCH] Fix internal Button set_icon calls to set_button_icon Due to upstream change: https://github.com/godotengine/godot/commit/562c666e3dfc9f0fe72a33974c23373dff77c825 --- editor/blackboard_plan_editor.cpp | 12 ++++++------ editor/debugger/limbo_debugger_plugin.cpp | 2 +- editor/editor_property_bb_param.cpp | 6 +++--- editor/editor_property_property_path.cpp | 2 +- editor/editor_property_variable_name.cpp | 14 +++++++------- editor/limbo_ai_editor_plugin.cpp | 12 ++++++------ editor/mode_switch_button.h | 2 +- editor/task_palette.cpp | 14 +++++++------- editor/tree_search.cpp | 6 +++--- util/limbo_compat.h | 2 -- 10 files changed, 35 insertions(+), 37 deletions(-) diff --git a/editor/blackboard_plan_editor.cpp b/editor/blackboard_plan_editor.cpp index 5e509c0..b9dd910 100644 --- a/editor/blackboard_plan_editor.cpp +++ b/editor/blackboard_plan_editor.cpp @@ -278,7 +278,7 @@ void BlackboardPlanEditor::_refresh() { Button *drag_button = memnew(Button); props_hbox->add_child(drag_button); drag_button->set_custom_minimum_size(Size2(28.0, 28.0) * EDSCALE); - BUTTON_SET_ICON(drag_button, theme_cache.grab_icon); + drag_button->set_button_icon(theme_cache.grab_icon); drag_button->connect(LW_NAME(gui_input), callable_mp(this, &BlackboardPlanEditor::_drag_button_gui_input)); drag_button->connect(LW_NAME(button_down), callable_mp(this, &BlackboardPlanEditor::_drag_button_down).bind(row_panel)); drag_button->connect(LW_NAME(button_up), callable_mp(this, &BlackboardPlanEditor::_drag_button_up)); @@ -297,7 +297,7 @@ void BlackboardPlanEditor::_refresh() { type_choice->set_custom_minimum_size(Size2(170, 0.0) * EDSCALE); type_choice->set_text(Variant::get_type_name(var.get_type())); type_choice->set_tooltip_text(Variant::get_type_name(var.get_type())); - BUTTON_SET_ICON(type_choice, get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons))); + type_choice->set_button_icon(get_theme_icon(Variant::get_type_name(var.get_type()), LW_NAME(EditorIcons))); type_choice->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); type_choice->set_flat(true); type_choice->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT); @@ -326,7 +326,7 @@ void BlackboardPlanEditor::_refresh() { Button *trash_button = memnew(Button); props_hbox->add_child(trash_button); trash_button->set_custom_minimum_size(Size2(24.0, 0.0) * EDSCALE); - BUTTON_SET_ICON(trash_button, theme_cache.trash_icon); + trash_button->set_button_icon(theme_cache.trash_icon); trash_button->connect(LW_NAME(pressed), callable_mp(this, &BlackboardPlanEditor::_trash_var).bind(i)); } } @@ -337,7 +337,7 @@ void BlackboardPlanEditor::_notification(int p_what) { theme_cache.trash_icon = get_theme_icon(LW_NAME(Remove), LW_NAME(EditorIcons)); theme_cache.grab_icon = get_theme_icon(LW_NAME(TripleBar), LW_NAME(EditorIcons)); - BUTTON_SET_ICON(add_var_tool, get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons))); + add_var_tool->set_button_icon(get_theme_icon(LW_NAME(Add), LW_NAME(EditorIcons))); type_menu->clear(); for (int i = 0; i < Variant::VARIANT_MAX; i++) { @@ -522,7 +522,7 @@ void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) { goto_btn->set_text(TTR("Edit Base")); goto_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER); goto_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE); - BUTTON_SET_ICON(goto_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons))); + goto_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(Edit), LW_NAME(EditorIcons))); goto_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_open_base_plan).bind(plan)); } else { Button *edit_btn = memnew(Button); @@ -530,7 +530,7 @@ void EditorInspectorPluginBBPlan::_parse_begin(Object *p_object) { edit_btn->set_text(TTR("Manage...")); edit_btn->set_h_size_flags(Control::SIZE_SHRINK_CENTER); edit_btn->set_custom_minimum_size(Size2(150.0, 0.0) * EDSCALE); - BUTTON_SET_ICON(edit_btn, EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons))); + edit_btn->set_button_icon(EditorInterface::get_singleton()->get_editor_theme()->get_icon(LW_NAME(EditAddRemove), LW_NAME(EditorIcons))); edit_btn->connect(LW_NAME(pressed), callable_mp(this, &EditorInspectorPluginBBPlan::_edit_plan).bind(plan)); } diff --git a/editor/debugger/limbo_debugger_plugin.cpp b/editor/debugger/limbo_debugger_plugin.cpp index db6bcb5..e8f0f7d 100644 --- a/editor/debugger/limbo_debugger_plugin.cpp +++ b/editor/debugger/limbo_debugger_plugin.cpp @@ -209,7 +209,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, LimboUtility::get_singleton()->get_task_icon("BehaviorTree")); + resource_header->set_button_icon(LimboUtility::get_singleton()->get_task_icon("BehaviorTree")); } break; } } diff --git a/editor/editor_property_bb_param.cpp b/editor/editor_property_bb_param.cpp index 5969baa..4ab8e89 100644 --- a/editor/editor_property_bb_param.cpp +++ b/editor/editor_property_bb_param.cpp @@ -287,14 +287,14 @@ void EditorPropertyBBParam::update_property() { variable_editor->update_property(); variable_editor->show(); bottom_container->hide(); - type_choice->set_icon(get_editor_theme_icon(SNAME("LimboExtraVariable"))); + type_choice->set_button_icon(get_editor_theme_icon(SNAME("LimboExtraVariable"))); } else { _create_value_editor(param->get_type()); variable_editor->hide(); value_editor->show(); value_editor->set_object_and_property(param.ptr(), SNAME("saved_value")); value_editor->update_property(); - type_choice->set_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type()))); + type_choice->set_button_icon(get_editor_theme_icon(Variant::get_type_name(param->get_type()))); } } @@ -316,7 +316,7 @@ void EditorPropertyBBParam::_notification(int p_what) { { String type = Variant::get_type_name(_get_edited_param()->get_type()); - type_choice->set_icon(get_editor_theme_icon(type)); + type_choice->set_button_icon(get_editor_theme_icon(type)); } // Initialize type choice. diff --git a/editor/editor_property_property_path.cpp b/editor/editor_property_property_path.cpp index 6d6de88..78dfc2c 100644 --- a/editor/editor_property_property_path.cpp +++ b/editor/editor_property_property_path.cpp @@ -156,7 +156,7 @@ void EditorPropertyPropertyPath::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { - BUTTON_SET_ICON(action_menu, get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons))); + action_menu->set_button_icon(get_theme_icon(LW_NAME(GuiTabMenuHl), LW_NAME(EditorIcons))); action_menu->get_popup()->set_item_icon(ACTION_CLEAR, get_theme_icon(LW_NAME(Clear), LW_NAME(EditorIcons))); action_menu->get_popup()->set_item_icon(ACTION_COPY, get_theme_icon(LW_NAME(ActionCopy), LW_NAME(EditorIcons))); action_menu->get_popup()->set_item_icon(ACTION_EDIT, get_theme_icon(LW_NAME(Edit), LW_NAME(EditorIcons))); diff --git a/editor/editor_property_variable_name.cpp b/editor/editor_property_variable_name.cpp index 4232591..75cdcbe 100644 --- a/editor/editor_property_variable_name.cpp +++ b/editor/editor_property_variable_name.cpp @@ -86,24 +86,24 @@ void EditorPropertyVariableName::_update_status() { } String var_name = name_edit->get_text(); if (var_name.is_empty() && allow_empty) { - BUTTON_SET_ICON(status_btn, theme_cache.var_empty_icon); + status_btn->set_button_icon(theme_cache.var_empty_icon); status_btn->set_tooltip_text(TTR("Variable name not specified.\nClick to open the blackboard plan.")); } else if (plan->has_var(var_name)) { if (expected_type == Variant::NIL || plan->get_var(var_name).get_type() == expected_type) { - BUTTON_SET_ICON(status_btn, theme_cache.var_exists_icon); + status_btn->set_button_icon(theme_cache.var_exists_icon); status_btn->set_tooltip_text(TTR("This variable is present in the blackboard plan.\nClick to open the blackboard plan.")); } else { - BUTTON_SET_ICON(status_btn, theme_cache.var_error_icon); + status_btn->set_button_icon(theme_cache.var_error_icon); status_btn->set_tooltip_text(TTR(vformat( "The %s variable in the blackboard plan should be of type %s.\nClick to open the blackboard plan.", LimboUtility::get_singleton()->decorate_var(var_name), Variant::get_type_name(expected_type)))); } } else if (name_edit->get_text().begins_with("_")) { - BUTTON_SET_ICON(status_btn, theme_cache.var_private_icon); + status_btn->set_button_icon(theme_cache.var_private_icon); status_btn->set_tooltip_text(TTR("This variable is private and is not included in the blackboard plan.\nClick to open the blackboard plan.")); } else { - BUTTON_SET_ICON(status_btn, theme_cache.var_not_found_icon); + status_btn->set_button_icon(theme_cache.var_not_found_icon); status_btn->set_tooltip_text(TTR("No matching variable found in the blackboard plan!\nClick to open the blackboard plan.")); } } @@ -122,7 +122,7 @@ void EditorPropertyVariableName::_status_pressed() { void EditorPropertyVariableName::_status_mouse_entered() { ERR_FAIL_NULL(plan); if (!plan->has_var(name_edit->get_text())) { - BUTTON_SET_ICON(status_btn, theme_cache.var_add_icon); + status_btn->set_button_icon(theme_cache.var_add_icon); } } @@ -182,7 +182,7 @@ void EditorPropertyVariableName::_notification(int p_what) { } } break; case NOTIFICATION_THEME_CHANGED: { - BUTTON_SET_ICON(drop_btn, get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons))); + drop_btn->set_button_icon(get_theme_icon(LW_NAME(GuiOptionArrow), LW_NAME(EditorIcons))); theme_cache.var_add_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarAdd)); theme_cache.var_exists_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarExists)); theme_cache.var_not_found_icon = LimboUtility::get_singleton()->get_task_icon(LW_NAME(LimboVarNotFound)); diff --git a/editor/limbo_ai_editor_plugin.cpp b/editor/limbo_ai_editor_plugin.cpp index e50b06e..32b6a79 100644 --- a/editor/limbo_ai_editor_plugin.cpp +++ b/editor/limbo_ai_editor_plugin.cpp @@ -1359,7 +1359,7 @@ void LimboAIEditor::_update_favorite_tasks() { } btn->set_text(task_name); btn->set_meta(LW_NAME(task_meta), task_meta); - BUTTON_SET_ICON(btn, LimboUtility::get_singleton()->get_task_icon(task_meta)); + btn->set_button_icon(LimboUtility::get_singleton()->get_task_icon(task_meta)); btn->set_tooltip_text(vformat(TTR("Add %s task."), task_name)); btn->set_flat(true); btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size. @@ -1530,11 +1530,11 @@ void LimboAIEditor::_notification(int p_what) { ADD_STYLEBOX_OVERRIDE(tab_bar_panel, "panel", get_theme_stylebox("tabbar_background", "TabContainer")); - BUTTON_SET_ICON(new_btn, get_theme_icon(LW_NAME(New), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(load_btn, get_theme_icon(LW_NAME(Load), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(save_btn, get_theme_icon(LW_NAME(Save), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(new_script_btn, get_theme_icon(LW_NAME(ScriptCreate), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(misc_btn, get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons))); + new_btn->set_button_icon(get_theme_icon(LW_NAME(New), LW_NAME(EditorIcons))); + load_btn->set_button_icon(get_theme_icon(LW_NAME(Load), LW_NAME(EditorIcons))); + save_btn->set_button_icon(get_theme_icon(LW_NAME(Save), LW_NAME(EditorIcons))); + new_script_btn->set_button_icon(get_theme_icon(LW_NAME(ScriptCreate), LW_NAME(EditorIcons))); + misc_btn->set_button_icon(get_theme_icon(LW_NAME(Tools), LW_NAME(EditorIcons))); _update_favorite_tasks(); } break; diff --git a/editor/mode_switch_button.h b/editor/mode_switch_button.h index 4bc6a09..e7b5e3e 100644 --- a/editor/mode_switch_button.h +++ b/editor/mode_switch_button.h @@ -44,7 +44,7 @@ private: _FORCE_INLINE_ void _set_mode_by_index(int p_index) { current_mode_index = p_index; - BUTTON_SET_ICON(this, modes[current_mode_index].icon); + this->set_button_icon(modes[current_mode_index].icon); if (!modes[current_mode_index].tooltip.is_empty()) { set_tooltip_text(modes[current_mode_index].tooltip); } diff --git a/editor/task_palette.cpp b/editor/task_palette.cpp index b0af452..7f427a6 100644 --- a/editor/task_palette.cpp +++ b/editor/task_palette.cpp @@ -184,7 +184,7 @@ void TaskPaletteSection::set_filter(String p_filter_text) { void TaskPaletteSection::add_task_button(const String &p_name, const Ref &icon, const String &p_meta) { TaskButton *btn = memnew(TaskButton); btn->set_text(p_name); - BUTTON_SET_ICON(btn, icon); + btn->set_button_icon(icon); btn->set_tooltip_text("dummy_text"); // Force tooltip to be shown. btn->set_task_meta(p_meta); btn->add_theme_constant_override(LW_NAME(icon_max_width), 16 * EDSCALE); // Force user icons to be of the proper size. @@ -195,7 +195,7 @@ void TaskPaletteSection::add_task_button(const String &p_name, const Refset_visible(!p_collapsed); - BUTTON_SET_ICON(section_header, (p_collapsed ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon)); + section_header->set_button_icon((p_collapsed ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon)); } bool TaskPaletteSection::is_collapsed() const { @@ -214,7 +214,7 @@ void TaskPaletteSection::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { _do_update_theme_item_cache(); - BUTTON_SET_ICON(section_header, (is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon)); + section_header->set_button_icon((is_collapsed() ? theme_cache.arrow_right_icon : theme_cache.arrow_down_icon)); section_header->add_theme_font_override(LW_NAME(font), get_theme_font(LW_NAME(bold), LW_NAME(EditorFonts))); } break; } @@ -600,13 +600,13 @@ void TaskPalette::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { _do_update_theme_item_cache(); - 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))); + tool_filters->set_button_icon(get_theme_icon(LW_NAME(AnimationFilter), LW_NAME(EditorIcons))); + tool_refresh->set_button_icon(get_theme_icon(LW_NAME(Reload), 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")); + select_all->set_button_icon(LimboUtility::get_singleton()->get_task_icon("LimboSelectAll")); + deselect_all->set_button_icon(LimboUtility::get_singleton()->get_task_icon("LimboDeselectAll")); category_choice->queue_redraw(); diff --git a/editor/tree_search.cpp b/editor/tree_search.cpp index cea10fc..e510edd 100644 --- a/editor/tree_search.cpp +++ b/editor/tree_search.cpp @@ -559,9 +559,9 @@ void TreeSearchPanel::_notification(int p_what) { break; } case NOTIFICATION_THEME_CHANGED: { - BUTTON_SET_ICON(close_button, get_theme_icon(LW_NAME(Close), LW_NAME(EditorIcons))); - BUTTON_SET_ICON(find_prev_button, get_theme_icon("MoveUp", LW_NAME(EditorIcons))); - BUTTON_SET_ICON(find_next_button, get_theme_icon("MoveDown", LW_NAME(EditorIcons))); + close_button->set_button_icon(get_theme_icon(LW_NAME(Close), LW_NAME(EditorIcons))); + find_prev_button->set_button_icon(get_theme_icon("MoveUp", LW_NAME(EditorIcons))); + find_next_button->set_button_icon(get_theme_icon("MoveDown", LW_NAME(EditorIcons))); label_filter->set_text(TTR("Filter")); break; } diff --git a/util/limbo_compat.h b/util/limbo_compat.h index 61201af..59a0bda 100644 --- a/util/limbo_compat.h +++ b/util/limbo_compat.h @@ -37,7 +37,6 @@ #define IS_CLASS(m_obj, m_class) (m_obj->is_class_ptr(m_class::get_class_ptr_static())) #define RAND_RANGE(m_from, m_to) (Math::random(m_from, m_to)) #define RANDF() (Math::randf()) -#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_icon(m_icon) #define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::load(m_path, m_hint) #define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::load(m_path, m_hint, ResourceFormatLoader::CACHE_MODE_IGNORE) #define RESOURCE_SAVE(m_res, m_path, m_flags) ResourceSaver::save(m_res, m_path, m_flags) @@ -96,7 +95,6 @@ using namespace godot; #define IS_CLASS(m_obj, m_class) (m_obj->is_class(#m_class)) #define RAND_RANGE(m_from, m_to) (UtilityFunctions::randf_range(m_from, m_to)) #define RANDF() (UtilityFunctions::randf()) -#define BUTTON_SET_ICON(m_btn, m_icon) m_btn->set_button_icon(m_icon) #define RESOURCE_LOAD(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint) #define RESOURCE_LOAD_NO_CACHE(m_path, m_hint) ResourceLoader::get_singleton()->load(m_path, m_hint, ResourceLoader::CACHE_MODE_IGNORE) #define RESOURCE_SAVE(m_res, m_path, m_flags) ResourceSaver::get_singleton()->save(m_res, m_path, m_flags)