diff options
Diffstat (limited to 'editor')
101 files changed, 828 insertions, 602 deletions
diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index 13d5ce5df2..7cfedffcbf 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -577,6 +577,7 @@ String InputEventConfigurationDialog::_get_device_string(int p_device) const { void InputEventConfigurationDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { input_list_search->set_right_icon(input_list_search->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); @@ -731,9 +732,9 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { store_command_checkbox->set_pressed(true); store_command_checkbox->set_text(TTR("Store Command")); #ifdef APPLE_STYLE_KEYS - store_command_checkbox->set_tooltip(TTR("Toggles between serializing 'command' and 'meta'. Used for compatibility with Windows/Linux style keyboard.")); + store_command_checkbox->set_tooltip_text(TTR("Toggles between serializing 'command' and 'meta'. Used for compatibility with Windows/Linux style keyboard.")); #else - store_command_checkbox->set_tooltip(TTR("Toggles between serializing 'command' and 'control'. Used for compatibility with Apple Style keyboards.")); + store_command_checkbox->set_tooltip_text(TTR("Toggles between serializing 'command' and 'control'. Used for compatibility with Apple Style keyboards.")); #endif mod_container->add_child(store_command_checkbox); @@ -744,7 +745,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { physical_key_checkbox = memnew(CheckBox); physical_key_checkbox->set_text(TTR("Use Physical Keycode")); - physical_key_checkbox->set_tooltip(TTR("Stores the physical position of the key on the keyboard rather than the key's value. Used for compatibility with non-latin layouts.\nThis should generally be enabled for most game shortcuts, but not in non-game applications.")); + physical_key_checkbox->set_tooltip_text(TTR("Stores the physical position of the key on the keyboard rather than the key's value. Used for compatibility with non-latin layouts.\nThis should generally be enabled for most game shortcuts, but not in non-game applications.")); physical_key_checkbox->connect("toggled", callable_mp(this, &InputEventConfigurationDialog::_physical_keycode_toggled)); physical_key_checkbox->hide(); additional_options_container->add_child(physical_key_checkbox); @@ -804,7 +805,7 @@ String ActionMapEditor::_check_new_action_name(const String &p_name) { void ActionMapEditor::_add_edit_text_changed(const String &p_name) { String error = _check_new_action_name(p_name); - add_button->set_tooltip(error); + add_button->set_tooltip_text(error); add_button->set_disabled(!error.is_empty()); } @@ -1057,6 +1058,7 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, void ActionMapEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { action_list_search->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); if (!actions_cache.is_empty()) { diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index c121ab42d3..9af8b907c4 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -216,8 +216,8 @@ void AnimationBezierTrackEdit::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { bezier_icon = get_theme_icon(SNAME("KeyBezierPoint"), SNAME("EditorIcons")); bezier_handle_icon = get_theme_icon(SNAME("KeyBezierHandle"), SNAME("EditorIcons")); diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index de5ed426a4..aaaf3e6f04 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1489,6 +1489,7 @@ int AnimationTimelineEdit::get_name_limit() const { void AnimationTimelineEdit::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); add_track->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); @@ -1750,13 +1751,13 @@ void AnimationTimelineEdit::update_values() { if (use_fps && animation->get_step() > 0) { length->set_value(animation->get_length() / animation->get_step()); length->set_step(1); - length->set_tooltip(TTR("Animation length (frames)")); - time_icon->set_tooltip(TTR("Animation length (frames)")); + length->set_tooltip_text(TTR("Animation length (frames)")); + time_icon->set_tooltip_text(TTR("Animation length (frames)")); } else { length->set_value(animation->get_length()); length->set_step(0.001); - length->set_tooltip(TTR("Animation length (seconds)")); - time_icon->set_tooltip(TTR("Animation length (seconds)")); + length->set_tooltip_text(TTR("Animation length (seconds)")); + time_icon->set_tooltip_text(TTR("Animation length (seconds)")); } switch (animation->get_loop_mode()) { @@ -1941,7 +1942,7 @@ AnimationTimelineEdit::AnimationTimelineEdit() { len_hb->add_child(expander); time_icon = memnew(TextureRect); time_icon->set_v_size_flags(SIZE_SHRINK_CENTER); - time_icon->set_tooltip(TTR("Animation length (seconds)")); + time_icon->set_tooltip_text(TTR("Animation length (seconds)")); len_hb->add_child(time_icon); length = memnew(EditorSpinSlider); length->set_min(0.001); @@ -1950,12 +1951,12 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_allow_greater(true); length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); length->set_hide_slider(true); - length->set_tooltip(TTR("Animation length (seconds)")); + length->set_tooltip_text(TTR("Animation length (seconds)")); length->connect("value_changed", callable_mp(this, &AnimationTimelineEdit::_anim_length_changed)); len_hb->add_child(length); loop = memnew(Button); loop->set_flat(true); - loop->set_tooltip(TTR("Animation Looping")); + loop->set_tooltip_text(TTR("Animation Looping")); loop->connect("pressed", callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed)); loop->set_toggle_mode(true); len_hb->add_child(loop); @@ -4595,7 +4596,7 @@ void AnimationTrackEditor::_update_tracks() { g->set_type_and_name(icon, name, animation->track_get_path(i)); g->set_root(root); - g->set_tooltip(tooltip); + g->set_tooltip_text(tooltip); g->set_timeline(timeline); groups.push_back(g); VBoxContainer *vb = memnew(VBoxContainer); @@ -4762,8 +4763,8 @@ void AnimationTrackEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { panner->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/animation_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { zoom_icon->set_texture(get_theme_icon(SNAME("Zoom"), SNAME("EditorIcons"))); bezier_edit_icon->set_icon(get_theme_icon(SNAME("EditBezier"), SNAME("EditorIcons"))); @@ -6626,7 +6627,7 @@ AnimationTrackEditor::AnimationTrackEditor() { imported_anim_warning = memnew(Button); imported_anim_warning->hide(); imported_anim_warning->set_text(TTR("Imported Scene")); - imported_anim_warning->set_tooltip(TTR("Warning: Editing imported animation")); + imported_anim_warning->set_tooltip_text(TTR("Warning: Editing imported animation")); imported_anim_warning->connect("pressed", callable_mp(this, &AnimationTrackEditor::_show_imported_anim_warning)); bottom_hb->add_child(imported_anim_warning); @@ -6637,7 +6638,7 @@ AnimationTrackEditor::AnimationTrackEditor() { bezier_edit_icon->set_disabled(true); bezier_edit_icon->set_toggle_mode(true); bezier_edit_icon->connect("pressed", callable_mp(this, &AnimationTrackEditor::_toggle_bezier_edit)); - bezier_edit_icon->set_tooltip(TTR("Toggle between the bezier curve editor and track editor.")); + bezier_edit_icon->set_tooltip_text(TTR("Toggle between the bezier curve editor and track editor.")); bottom_hb->add_child(bezier_edit_icon); @@ -6645,7 +6646,7 @@ AnimationTrackEditor::AnimationTrackEditor() { selected_filter->set_flat(true); selected_filter->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same. selected_filter->set_toggle_mode(true); - selected_filter->set_tooltip(TTR("Only show tracks from nodes selected in tree.")); + selected_filter->set_tooltip_text(TTR("Only show tracks from nodes selected in tree.")); bottom_hb->add_child(selected_filter); @@ -6653,7 +6654,7 @@ AnimationTrackEditor::AnimationTrackEditor() { view_group->set_flat(true); view_group->connect("pressed", callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); view_group->set_toggle_mode(true); - view_group->set_tooltip(TTR("Group tracks by node or display them as plain list.")); + view_group->set_tooltip_text(TTR("Group tracks by node or display them as plain list.")); bottom_hb->add_child(view_group); bottom_hb->add_child(memnew(VSeparator)); @@ -6672,7 +6673,7 @@ AnimationTrackEditor::AnimationTrackEditor() { step->set_step(0.001); step->set_hide_slider(true); step->set_custom_minimum_size(Size2(100, 0) * EDSCALE); - step->set_tooltip(TTR("Animation step value.")); + step->set_tooltip_text(TTR("Animation step value.")); bottom_hb->add_child(step); step->connect("value_changed", callable_mp(this, &AnimationTrackEditor::_update_step)); step->set_read_only(true); @@ -6704,7 +6705,7 @@ AnimationTrackEditor::AnimationTrackEditor() { edit->set_text(TTR("Edit")); edit->set_flat(false); edit->set_disabled(true); - edit->set_tooltip(TTR("Animation properties.")); + edit->set_tooltip_text(TTR("Animation properties.")); edit->get_popup()->add_item(TTR("Copy Tracks"), EDIT_COPY_TRACKS); edit->get_popup()->add_item(TTR("Paste Tracks"), EDIT_PASTE_TRACKS); edit->get_popup()->add_separator(); diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index 65f2f5fbcc..2b1584b20c 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -1740,6 +1740,10 @@ void CodeTextEditor::_update_status_bar_theme() { void CodeTextEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: { + _update_status_bar_theme(); + } break; + case NOTIFICATION_THEME_CHANGED: { _update_status_bar_theme(); if (toggle_scripts_button->is_visible()) { @@ -1858,7 +1862,7 @@ void CodeTextEditor::update_toggle_scripts_button() { } else { toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Back") : SNAME("Forward"), SNAME("EditorIcons"))); } - toggle_scripts_button->set_tooltip(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text())); + toggle_scripts_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text())); } CodeTextEditor::CodeTextEditor() { @@ -1951,7 +1955,7 @@ CodeTextEditor::CodeTextEditor() { error_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); error_button->set_default_cursor_shape(CURSOR_POINTING_HAND); error_button->connect("pressed", callable_mp(this, &CodeTextEditor::_error_button_pressed)); - error_button->set_tooltip(TTR("Errors")); + error_button->set_tooltip_text(TTR("Errors")); set_error_count(0); // Warnings @@ -1961,14 +1965,14 @@ CodeTextEditor::CodeTextEditor() { warning_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND); warning_button->connect("pressed", callable_mp(this, &CodeTextEditor::_warning_button_pressed)); - warning_button->set_tooltip(TTR("Warnings")); + warning_button->set_tooltip_text(TTR("Warnings")); set_warning_count(0); // Line and column line_and_col_txt = memnew(Label); status_bar->add_child(line_and_col_txt); line_and_col_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); - line_and_col_txt->set_tooltip(TTR("Line and column numbers.")); + line_and_col_txt->set_tooltip_text(TTR("Line and column numbers.")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); text_editor->connect("gui_input", callable_mp(this, &CodeTextEditor::_text_editor_gui_input)); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 14a81e2b8a..587c16c229 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -230,8 +230,9 @@ void ConnectDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { bind_editor->edit(cdbinds); - } break; + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < type_list->get_item_count(); i++) { String type_name = Variant::get_type_name((Variant::Type)type_list->get_item_id(i)); @@ -459,7 +460,7 @@ ConnectDialog::ConnectDialog() { vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true); unbind_count = memnew(SpinBox); - unbind_count->set_tooltip(TTR("Allows to drop arguments sent by signal emitter.")); + unbind_count->set_tooltip_text(TTR("Allows to drop arguments sent by signal emitter.")); unbind_count->connect("value_changed", callable_mp(this, &ConnectDialog::_unbind_count_changed)); vbc_right->add_margin_child(TTR("Unbind Signal Arguments:"), unbind_count); @@ -480,13 +481,13 @@ ConnectDialog::ConnectDialog() { deferred = memnew(CheckBox); deferred->set_h_size_flags(0); deferred->set_text(TTR("Deferred")); - deferred->set_tooltip(TTR("Defers the signal, storing it in a queue and only firing it at idle time.")); + deferred->set_tooltip_text(TTR("Defers the signal, storing it in a queue and only firing it at idle time.")); vbc_right->add_child(deferred); oneshot = memnew(CheckBox); oneshot->set_h_size_flags(0); oneshot->set_text(TTR("Oneshot")); - oneshot->set_tooltip(TTR("Disconnects the signal after its first emission.")); + oneshot->set_tooltip_text(TTR("Disconnects the signal after its first emission.")); vbc_right->add_child(oneshot); cdbinds = memnew(ConnectDialogBinds); @@ -912,6 +913,7 @@ void ConnectionsDock::_connect_pressed() { void ConnectionsDock::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); } break; diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 4a0fd64ce8..03e636d43a 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -423,10 +423,16 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) { } } +void CreateDialog::_update_theme() { + search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + favorite->set_icon(search_options->get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons"))); +} + void CreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &CreateDialog::_confirmed)); + _update_theme(); } break; case NOTIFICATION_EXIT_TREE: { @@ -443,8 +449,7 @@ void CreateDialog::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); - favorite->set_icon(search_options->get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons"))); + _update_theme(); } break; } } @@ -775,7 +780,7 @@ CreateDialog::CreateDialog() { favorite = memnew(Button); favorite->set_toggle_mode(true); - favorite->set_tooltip(TTR("(Un)favorite selected item.")); + favorite->set_tooltip_text(TTR("(Un)favorite selected item.")); favorite->connect("pressed", callable_mp(this, &CreateDialog::_favorite_toggled)); search_hb->add_child(favorite); vbc->add_margin_child(TTR("Search:"), search_hb); diff --git a/editor/create_dialog.h b/editor/create_dialog.h index 9a17993e11..f7731d2726 100644 --- a/editor/create_dialog.h +++ b/editor/create_dialog.h @@ -101,6 +101,8 @@ class CreateDialog : public ConfirmationDialog { bool _is_class_disabled_by_feature_profile(const StringName &p_class) const; void _load_favorites_and_history(); + void _update_theme(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/debugger/editor_network_profiler.cpp b/editor/debugger/editor_network_profiler.cpp index 185553cac0..8c18eba71d 100644 --- a/editor/debugger/editor_network_profiler.cpp +++ b/editor/debugger/editor_network_profiler.cpp @@ -40,6 +40,7 @@ void EditorNetworkProfiler::_bind_methods() { void EditorNetworkProfiler::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index aca12ea125..b49cab9df7 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -394,9 +394,10 @@ void EditorProfiler::_clear_pressed() { void EditorProfiler::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: - case NOTIFICATION_TRANSLATION_CHANGED: - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_TRANSLATION_CHANGED: { activate->set_icon(get_theme_icon(SNAME("Play"), SNAME("EditorIcons"))); clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); } break; @@ -606,7 +607,7 @@ EditorProfiler::EditorProfiler() { display_time = memnew(OptionButton); display_time->add_item(TTR("Inclusive")); display_time->add_item(TTR("Self")); - display_time->set_tooltip(TTR("Inclusive: Includes time from other functions called by this function.\nUse this to spot bottlenecks.\n\nSelf: Only count the time spent in the function itself, not in other functions called by that function.\nUse this to find individual functions to optimize.")); + display_time->set_tooltip_text(TTR("Inclusive: Includes time from other functions called by this function.\nUse this to spot bottlenecks.\n\nSelf: Only count the time spent in the function itself, not in other functions called by that function.\nUse this to find individual functions to optimize.")); display_time->connect("item_selected", callable_mp(this, &EditorProfiler::_combo_changed)); hb->add_child(display_time); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index df1a59cc99..6f3dd1793c 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -424,9 +424,10 @@ void EditorVisualProfiler::_clear_pressed() { void EditorVisualProfiler::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: - case NOTIFICATION_TRANSLATION_CHANGED: - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_TRANSLATION_CHANGED: { if (is_layout_rtl()) { activate->set_icon(get_theme_icon(SNAME("PlayBackwards"), SNAME("EditorIcons"))); } else { diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index beb50ecd75..fab211f18c 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -369,7 +369,7 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } } - vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total)); + vmem_total->set_tooltip_text(TTR("Bytes:") + " " + itos(total)); vmem_total->set_text(String::humanize_size(total)); } else if (p_msg == "stack_dump") { @@ -776,7 +776,7 @@ void ScriptEditorDebugger::_set_reason_text(const String &p_reason, MessageType reason->add_theme_color_override("font_color", get_theme_color(SNAME("success_color"), SNAME("Editor"))); } reason->set_text(p_reason); - reason->set_tooltip(p_reason.word_wrap(80)); + reason->set_tooltip_text(p_reason.word_wrap(80)); } void ScriptEditorDebugger::_notification(int p_what) { @@ -787,8 +787,8 @@ void ScriptEditorDebugger::_notification(int p_what) { error_tree->connect("item_selected", callable_mp(this, &ScriptEditorDebugger::_error_selected)); error_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_error_activated)); breakpoints_tree->connect("item_activated", callable_mp(this, &ScriptEditorDebugger::_breakpoint_tree_clicked)); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { skip_breakpoints->set_icon(get_theme_icon(skip_breakpoints_value ? SNAME("DebugSkipBreakpointsOn") : SNAME("DebugSkipBreakpointsOff"), SNAME("EditorIcons"))); copy->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); @@ -964,7 +964,7 @@ void ScriptEditorDebugger::stop() { peer->close(); peer.unref(); reason->set_text(""); - reason->set_tooltip(""); + reason->set_tooltip_text(""); } node_path_cache.clear(); @@ -1706,7 +1706,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { skip_breakpoints = memnew(Button); skip_breakpoints->set_flat(true); hbc->add_child(skip_breakpoints); - skip_breakpoints->set_tooltip(TTR("Skip Breakpoints")); + skip_breakpoints->set_tooltip_text(TTR("Skip Breakpoints")); skip_breakpoints->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints)); hbc->add_child(memnew(VSeparator)); @@ -1714,7 +1714,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { copy = memnew(Button); copy->set_flat(true); hbc->add_child(copy); - copy->set_tooltip(TTR("Copy Error")); + copy->set_tooltip_text(TTR("Copy Error")); copy->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_copy)); hbc->add_child(memnew(VSeparator)); @@ -1722,14 +1722,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() { step = memnew(Button); step->set_flat(true); hbc->add_child(step); - step->set_tooltip(TTR("Step Into")); + step->set_tooltip_text(TTR("Step Into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); step->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_step)); next = memnew(Button); next->set_flat(true); hbc->add_child(next); - next->set_tooltip(TTR("Step Over")); + next->set_tooltip_text(TTR("Step Over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); next->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_next)); @@ -1738,14 +1738,14 @@ ScriptEditorDebugger::ScriptEditorDebugger() { dobreak = memnew(Button); dobreak->set_flat(true); hbc->add_child(dobreak); - dobreak->set_tooltip(TTR("Break")); + dobreak->set_tooltip_text(TTR("Break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); dobreak->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_break)); docontinue = memnew(Button); docontinue->set_flat(true); hbc->add_child(docontinue); - docontinue->set_tooltip(TTR("Continue")); + docontinue->set_tooltip_text(TTR("Continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); docontinue->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_continue)); @@ -1917,7 +1917,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { vmem_hb->add_child(vmem_refresh); vmem_export = memnew(Button); vmem_export->set_flat(true); - vmem_export->set_tooltip(TTR("Export list to a CSV file")); + vmem_export->set_tooltip_text(TTR("Export list to a CSV file")); vmem_hb->add_child(vmem_export); vmem_vb->add_child(vmem_hb); vmem_refresh->connect("pressed", callable_mp(this, &ScriptEditorDebugger::_video_mem_request)); diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index f3c95a76c6..7baaffb1be 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -38,18 +38,22 @@ // The metadata key used to store and retrieve the version text to copy to the clipboard. static const String META_TEXT_TO_COPY = "text_to_copy"; +void EditorAbout::_theme_changed() { + const Ref<Font> font = get_theme_font(SNAME("source"), SNAME("EditorFonts")); + const int font_size = get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts")); + _tpl_text->add_theme_font_override("normal_font", font); + _tpl_text->add_theme_font_size_override("normal_font_size", font_size); + _tpl_text->add_theme_constant_override("line_separation", 4 * EDSCALE); + _license_text->add_theme_font_override("normal_font", font); + _license_text->add_theme_font_size_override("normal_font_size", font_size); + _license_text->add_theme_constant_override("line_separation", 4 * EDSCALE); + _logo->set_texture(get_theme_icon(SNAME("Logo"), SNAME("EditorIcons"))); +} + void EditorAbout::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { - const Ref<Font> font = get_theme_font(SNAME("source"), SNAME("EditorFonts")); - const int font_size = get_theme_font_size(SNAME("source_size"), SNAME("EditorFonts")); - _tpl_text->add_theme_font_override("normal_font", font); - _tpl_text->add_theme_font_size_override("normal_font_size", font_size); - _tpl_text->add_theme_constant_override("line_separation", 4 * EDSCALE); - _license_text->add_theme_font_override("normal_font", font); - _license_text->add_theme_font_size_override("normal_font_size", font_size); - _license_text->add_theme_constant_override("line_separation", 4 * EDSCALE); - _logo->set_texture(get_theme_icon(SNAME("Logo"), SNAME("EditorIcons"))); + case NOTIFICATION_ENTER_TREE: { + _theme_changed(); } break; } } @@ -116,6 +120,7 @@ EditorAbout::EditorAbout() { set_hide_on_ok(true); VBoxContainer *vbc = memnew(VBoxContainer); + vbc->connect("theme_changed", callable_mp(this, &EditorAbout::_theme_changed)); HBoxContainer *hbc = memnew(HBoxContainer); hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->set_alignment(BoxContainer::ALIGNMENT_CENTER); @@ -142,7 +147,7 @@ EditorAbout::EditorAbout() { // Set the text to copy in metadata as it slightly differs from the button's text. version_btn->set_meta(META_TEXT_TO_COPY, "v" VERSION_FULL_BUILD + hash); version_btn->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - version_btn->set_tooltip(TTR("Click to copy.")); + version_btn->set_tooltip_text(TTR("Click to copy.")); version_btn->connect("pressed", callable_mp(this, &EditorAbout::_version_button_pressed)); version_info_vbc->add_child(version_btn); diff --git a/editor/editor_about.h b/editor/editor_about.h index b152f1b4d3..971843f6d2 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -62,6 +62,8 @@ private: RichTextLabel *_tpl_text = nullptr; TextureRect *_logo = nullptr; + void _theme_changed(); + protected: void _notification(int p_what); static void _bind_methods(); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index dd2f6c82b2..a95cc4981a 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -66,6 +66,7 @@ void EditorAudioBus::_update_visible_channels() { void EditorAudioBus::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < CHANNELS_MAX; i++) { channel[i].vu_l->set_under_texture(get_theme_icon(SNAME("BusVuEmpty"), SNAME("EditorIcons"))); @@ -394,7 +395,7 @@ void EditorAudioBus::_show_value(float slider_value) { // Also set the preview text as a standard Control tooltip. // This way, it can be seen when the slider is merely hovered (instead of dragged). - slider->set_tooltip(text); + slider->set_tooltip_text(text); audio_value_preview_label->set_text(text); const Vector2 slider_size = slider->get_size(); const Vector2 slider_position = slider->get_global_position(); @@ -778,7 +779,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { buses = p_buses; is_master = p_is_master; - set_tooltip(TTR("Drag & drop to rearrange.")); + set_tooltip_text(TTR("Drag & drop to rearrange.")); VBoxContainer *vb = memnew(VBoxContainer); add_child(vb); @@ -795,21 +796,21 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { solo = memnew(Button); solo->set_flat(true); solo->set_toggle_mode(true); - solo->set_tooltip(TTR("Solo")); + solo->set_tooltip_text(TTR("Solo")); solo->set_focus_mode(FOCUS_NONE); solo->connect("pressed", callable_mp(this, &EditorAudioBus::_solo_toggled)); hbc->add_child(solo); mute = memnew(Button); mute->set_flat(true); mute->set_toggle_mode(true); - mute->set_tooltip(TTR("Mute")); + mute->set_tooltip_text(TTR("Mute")); mute->set_focus_mode(FOCUS_NONE); mute->connect("pressed", callable_mp(this, &EditorAudioBus::_mute_toggled)); hbc->add_child(mute); bypass = memnew(Button); bypass->set_flat(true); bypass->set_toggle_mode(true); - bypass->set_tooltip(TTR("Bypass")); + bypass->set_tooltip_text(TTR("Bypass")); bypass->set_focus_mode(FOCUS_NONE); bypass->connect("pressed", callable_mp(this, &EditorAudioBus::_bypass_toggled)); hbc->add_child(bypass); @@ -935,7 +936,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { bus_options->set_shortcut_context(this); bus_options->set_h_size_flags(SIZE_SHRINK_END); bus_options->set_anchor(SIDE_RIGHT, 0.0); - bus_options->set_tooltip(TTR("Bus Options")); + bus_options->set_tooltip_text(TTR("Bus Options")); hbc->add_child(bus_options); bus_popup = bus_options->get_popup(); @@ -1024,6 +1025,7 @@ EditorAudioBuses *EditorAudioBuses::register_editor() { void EditorAudioBuses::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { bus_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); } break; @@ -1280,7 +1282,7 @@ EditorAudioBuses::EditorAudioBuses() { add = memnew(Button); top_hb->add_child(add); add->set_text(TTR("Add Bus")); - add->set_tooltip(TTR("Add a new Audio Bus to this layout.")); + add->set_tooltip_text(TTR("Add a new Audio Bus to this layout.")); add->connect("pressed", callable_mp(this, &EditorAudioBuses::_add_bus)); VSeparator *separator = memnew(VSeparator); @@ -1288,25 +1290,25 @@ EditorAudioBuses::EditorAudioBuses() { load = memnew(Button); load->set_text(TTR("Load")); - load->set_tooltip(TTR("Load an existing Bus Layout.")); + load->set_tooltip_text(TTR("Load an existing Bus Layout.")); top_hb->add_child(load); load->connect("pressed", callable_mp(this, &EditorAudioBuses::_load_layout)); save_as = memnew(Button); save_as->set_text(TTR("Save As")); - save_as->set_tooltip(TTR("Save this Bus Layout to a file.")); + save_as->set_tooltip_text(TTR("Save this Bus Layout to a file.")); top_hb->add_child(save_as); save_as->connect("pressed", callable_mp(this, &EditorAudioBuses::_save_as_layout)); _default = memnew(Button); _default->set_text(TTR("Load Default")); - _default->set_tooltip(TTR("Load the default Bus Layout.")); + _default->set_tooltip_text(TTR("Load the default Bus Layout.")); top_hb->add_child(_default); _default->connect("pressed", callable_mp(this, &EditorAudioBuses::_load_default_layout)); _new = memnew(Button); _new->set_text(TTR("Create")); - _new->set_tooltip(TTR("Create a new Bus Layout.")); + _new->set_tooltip_text(TTR("Create a new Bus Layout.")); top_hb->add_child(_new); _new->connect("pressed", callable_mp(this, &EditorAudioBuses::_new_layout)); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index 7dff0d54f7..120ac5b984 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -59,6 +59,7 @@ void EditorAutoloadSettings::_notification(int p_what) { get_tree()->get_root()->call_deferred(SNAME("add_child"), info.node); } } + browse_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); } break; case NOTIFICATION_THEME_CHANGED: { diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index d26349b2c7..5d249b0fab 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -70,6 +70,7 @@ VBoxContainer *EditorFileDialog::get_vbox() { void EditorFileDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_READY: case NOTIFICATION_THEME_CHANGED: case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { @@ -1624,13 +1625,13 @@ EditorFileDialog::EditorFileDialog() { dir_prev = memnew(Button); dir_prev->set_flat(true); - dir_prev->set_tooltip(TTR("Go to previous folder.")); + dir_prev->set_tooltip_text(TTR("Go to previous folder.")); dir_next = memnew(Button); dir_next->set_flat(true); - dir_next->set_tooltip(TTR("Go to next folder.")); + dir_next->set_tooltip_text(TTR("Go to next folder.")); dir_up = memnew(Button); dir_up->set_flat(true); - dir_up->set_tooltip(TTR("Go to parent folder.")); + dir_up->set_tooltip_text(TTR("Go to parent folder.")); pathhb->add_child(dir_prev); pathhb->add_child(dir_next); @@ -1654,14 +1655,14 @@ EditorFileDialog::EditorFileDialog() { refresh = memnew(Button); refresh->set_flat(true); - refresh->set_tooltip(TTR("Refresh files.")); + refresh->set_tooltip_text(TTR("Refresh files.")); refresh->connect("pressed", callable_mp(this, &EditorFileDialog::update_file_list)); pathhb->add_child(refresh); favorite = memnew(Button); favorite->set_flat(true); favorite->set_toggle_mode(true); - favorite->set_tooltip(TTR("(Un)favorite current folder.")); + favorite->set_tooltip_text(TTR("(Un)favorite current folder.")); favorite->connect("pressed", callable_mp(this, &EditorFileDialog::_favorite_pressed)); pathhb->add_child(favorite); @@ -1669,7 +1670,7 @@ EditorFileDialog::EditorFileDialog() { show_hidden->set_flat(true); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); - show_hidden->set_tooltip(TTR("Toggle the visibility of hidden files.")); + show_hidden->set_tooltip_text(TTR("Toggle the visibility of hidden files.")); show_hidden->connect("toggled", callable_mp(this, &EditorFileDialog::set_show_hidden_files)); pathhb->add_child(show_hidden); @@ -1684,7 +1685,7 @@ EditorFileDialog::EditorFileDialog() { mode_thumbnails->set_toggle_mode(true); mode_thumbnails->set_pressed(display_mode == DISPLAY_THUMBNAILS); mode_thumbnails->set_button_group(view_mode_group); - mode_thumbnails->set_tooltip(TTR("View items as a grid of thumbnails.")); + mode_thumbnails->set_tooltip_text(TTR("View items as a grid of thumbnails.")); pathhb->add_child(mode_thumbnails); mode_list = memnew(Button); @@ -1693,7 +1694,7 @@ EditorFileDialog::EditorFileDialog() { mode_list->set_toggle_mode(true); mode_list->set_pressed(display_mode == DISPLAY_LIST); mode_list->set_button_group(view_mode_group); - mode_list->set_tooltip(TTR("View items as a list.")); + mode_list->set_tooltip_text(TTR("View items as a list.")); pathhb->add_child(mode_list); shortcuts_container = memnew(HBoxContainer); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index ba6510d7b7..fe03166a01 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -44,6 +44,29 @@ DocTools *EditorHelp::doc = nullptr; +void EditorHelp::_update_theme() { + text_color = get_theme_color(SNAME("text_color"), SNAME("EditorHelp")); + title_color = get_theme_color(SNAME("title_color"), SNAME("EditorHelp")); + headline_color = get_theme_color(SNAME("headline_color"), SNAME("EditorHelp")); + comment_color = get_theme_color(SNAME("comment_color"), SNAME("EditorHelp")); + symbol_color = get_theme_color(SNAME("symbol_color"), SNAME("EditorHelp")); + value_color = get_theme_color(SNAME("value_color"), SNAME("EditorHelp")); + qualifier_color = get_theme_color(SNAME("qualifier_color"), SNAME("EditorHelp")); + type_color = get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); + + class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("selection_color"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("line_separation", get_theme_constant(SNAME("line_separation"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("table_h_separation", get_theme_constant(SNAME("table_h_separation"), SNAME("EditorHelp"))); + class_desc->add_theme_constant_override("table_v_separation", get_theme_constant(SNAME("table_v_separation"), SNAME("EditorHelp"))); + + doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); + doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); + doc_title_font = get_theme_font(SNAME("doc_title"), SNAME("EditorFonts")); + doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); + + doc_title_font_size = get_theme_font_size(SNAME("doc_title_size"), SNAME("EditorFonts")); +} + void EditorHelp::_search(bool p_search_previous) { if (p_search_previous) { find_bar->search_prev(); @@ -216,6 +239,27 @@ void EditorHelp::_add_type(const String &p_type, const String &p_enum) { class_desc->pop(); } +void EditorHelp::_add_type_icon(const String &p_type, int p_size) { + Ref<Texture2D> icon; + if (has_theme_icon(p_type, SNAME("EditorIcons"))) { + icon = get_theme_icon(p_type, SNAME("EditorIcons")); + } else if (ClassDB::class_exists(p_type) && ClassDB::is_parent_class(p_type, "Object")) { + icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); + } else { + icon = get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons")); + } + + Vector2i size = Vector2i(icon->get_width(), icon->get_height()); + if (p_size > 0) { + // Ensures icon scales proportionally on both axis, based on icon height. + float ratio = p_size / float(size.height); + size.width *= ratio; + size.height *= ratio; + } + + class_desc->add_image(icon, size.width, size.height); +} + String EditorHelp::_fix_constant(const String &p_constant) const { if (p_constant.strip_edges() == "4294967295") { return "0xFFFFFFFF"; @@ -502,26 +546,18 @@ void EditorHelp::_update_doc() { method_line.clear(); section_line.clear(); + _update_theme(); String link_color_text = title_color.to_html(false); DocData::ClassDoc cd = doc->class_list[edited_class]; // Make a copy, so we can sort without worrying. - Ref<Texture2D> icon; - if (has_theme_icon(edited_class, SNAME("EditorIcons"))) { - icon = get_theme_icon(edited_class, SNAME("EditorIcons")); - } else if (ClassDB::class_exists(edited_class) && ClassDB::is_parent_class(edited_class, "Object")) { - icon = get_theme_icon(SNAME("Object"), SNAME("EditorIcons")); - } else { - icon = get_theme_icon(SNAME("ArrowRight"), SNAME("EditorIcons")); - } - // Class name section_line.push_back(Pair<String, int>(TTR("Top"), 0)); class_desc->push_font(doc_title_font); class_desc->push_font_size(doc_title_font_size); class_desc->push_color(title_color); class_desc->add_text(TTR("Class:") + " "); - class_desc->add_image(icon, icon->get_width(), icon->get_height()); + _add_type_icon(edited_class, doc_title_font_size); class_desc->add_text(" "); class_desc->push_color(headline_color); _add_text(edited_class); @@ -542,6 +578,8 @@ void EditorHelp::_update_doc() { String inherits = cd.inherits; while (!inherits.is_empty()) { + _add_type_icon(inherits); + class_desc->add_text(" "); // Extra space, otherwise icon borrows hyperlink from _add_type(). _add_type(inherits); inherits = doc->class_list[inherits].inherits; @@ -573,7 +611,8 @@ void EditorHelp::_update_doc() { if (prev) { class_desc->add_text(" , "); } - + _add_type_icon(E.value.name); + class_desc->add_text(" "); // Extra space, otherwise icon borrows hyperlink from _add_type(). _add_type(E.value.name); prev = true; } @@ -1970,29 +2009,10 @@ void EditorHelp::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - _class_desc_resized(true); + if (is_inside_tree()) { + _class_desc_resized(true); + } update_toggle_scripts_button(); - - text_color = get_theme_color(SNAME("text_color"), SNAME("EditorHelp")); - title_color = get_theme_color(SNAME("title_color"), SNAME("EditorHelp")); - headline_color = get_theme_color(SNAME("headline_color"), SNAME("EditorHelp")); - comment_color = get_theme_color(SNAME("comment_color"), SNAME("EditorHelp")); - symbol_color = get_theme_color(SNAME("symbol_color"), SNAME("EditorHelp")); - value_color = get_theme_color(SNAME("value_color"), SNAME("EditorHelp")); - qualifier_color = get_theme_color(SNAME("qualifier_color"), SNAME("EditorHelp")); - type_color = get_theme_color(SNAME("type_color"), SNAME("EditorHelp")); - - class_desc->add_theme_color_override("selection_color", get_theme_color(SNAME("selection_color"), SNAME("EditorHelp"))); - class_desc->add_theme_constant_override("line_separation", get_theme_constant(SNAME("line_separation"), SNAME("EditorHelp"))); - class_desc->add_theme_constant_override("table_h_separation", get_theme_constant(SNAME("table_h_separation"), SNAME("EditorHelp"))); - class_desc->add_theme_constant_override("table_v_separation", get_theme_constant(SNAME("table_v_separation"), SNAME("EditorHelp"))); - - doc_font = get_theme_font(SNAME("doc"), SNAME("EditorFonts")); - doc_bold_font = get_theme_font(SNAME("doc_bold"), SNAME("EditorFonts")); - doc_title_font = get_theme_font(SNAME("doc_title"), SNAME("EditorFonts")); - doc_code_font = get_theme_font(SNAME("doc_source"), SNAME("EditorFonts")); - - doc_title_font_size = get_theme_font_size(SNAME("doc_title_size"), SNAME("EditorFonts")); } break; case NOTIFICATION_VISIBILITY_CHANGED: { @@ -2073,7 +2093,7 @@ void EditorHelp::update_toggle_scripts_button() { } else { toggle_scripts_button->set_icon(get_theme_icon(ScriptEditor::get_singleton()->is_scripts_panel_toggled() ? SNAME("Back") : SNAME("Forward"), SNAME("EditorIcons"))); } - toggle_scripts_button->set_tooltip(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text())); + toggle_scripts_button->set_tooltip_text(vformat("%s (%s)", TTR("Toggle Scripts Panel"), ED_GET_SHORTCUT("script_editor/toggle_scripts_panel")->get_as_text())); } void EditorHelp::_bind_methods() { @@ -2170,6 +2190,7 @@ void EditorHelpBit::_bind_methods() { void EditorHelpBit::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { rich_text->add_theme_color_override("selection_color", get_theme_color(SNAME("selection_color"), SNAME("EditorHelp"))); rich_text->clear(); @@ -2251,6 +2272,7 @@ void FindBar::popup_search() { void FindBar::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { find_prev->set_icon(get_theme_icon(SNAME("MoveUp"), SNAME("EditorIcons"))); find_next->set_icon(get_theme_icon(SNAME("MoveDown"), SNAME("EditorIcons"))); diff --git a/editor/editor_help.h b/editor/editor_help.h index 70e39b5507..c9c1afb51b 100644 --- a/editor/editor_help.h +++ b/editor/editor_help.h @@ -145,6 +145,7 @@ class EditorHelp : public VBoxContainer { int scroll_to = -1; + void _update_theme(); void _help_callback(const String &p_topic); void _add_text(const String &p_bbcode); @@ -152,6 +153,7 @@ class EditorHelp : public VBoxContainer { //void _button_pressed(int p_idx); void _add_type(const String &p_type, const String &p_enum = String()); + void _add_type_icon(const String &p_type, int p_size = 0); void _add_method(const DocData::MethodDoc &p_method, bool p_overview = true); void _add_bulletpoint(); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 297d1226e3..b4678d8363 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -206,7 +206,7 @@ EditorHelpSearch::EditorHelpSearch() { case_sensitive_button = memnew(Button); case_sensitive_button->set_flat(true); - case_sensitive_button->set_tooltip(TTR("Case Sensitive")); + case_sensitive_button->set_tooltip_text(TTR("Case Sensitive")); case_sensitive_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(Control::FOCUS_NONE); @@ -214,7 +214,7 @@ EditorHelpSearch::EditorHelpSearch() { hierarchy_button = memnew(Button); hierarchy_button->set_flat(true); - hierarchy_button->set_tooltip(TTR("Show Hierarchy")); + hierarchy_button->set_tooltip_text(TTR("Show Hierarchy")); hierarchy_button->connect("pressed", callable_mp(this, &EditorHelpSearch::_update_results)); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index da2c9d5648..8716196658 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -2051,7 +2051,7 @@ void EditorInspectorArray::_setup() { ae.panel->set_mouse_filter(MOUSE_FILTER_PASS); ae.panel->set_drag_forwarding(this); ae.panel->set_meta("index", begin_array_index + i); - ae.panel->set_tooltip(vformat(TTR("Element %d: %s%d*"), i, array_element_prefix, i)); + ae.panel->set_tooltip_text(vformat(TTR("Element %d: %s%d*"), i, array_element_prefix, i)); ae.panel->connect("focus_entered", callable_mp((CanvasItem *)ae.panel, &PanelContainer::update)); ae.panel->connect("focus_exited", callable_mp((CanvasItem *)ae.panel, &PanelContainer::update)); ae.panel->connect("draw", callable_mp(this, &EditorInspectorArray::_panel_draw).bind(i)); @@ -2175,6 +2175,7 @@ bool EditorInspectorArray::can_drop_data_fw(const Point2 &p_point, const Variant void EditorInspectorArray::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { Color color = get_theme_color(SNAME("dark_color_1"), SNAME("Editor")); odd_style->set_bg_color(color.darkened(-0.08)); @@ -2368,6 +2369,7 @@ void EditorPaginator::update(int p_page, int p_max_page) { void EditorPaginator::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { first_page_button->set_icon(get_theme_icon(SNAME("PageFirst"), SNAME("EditorIcons"))); prev_page_button->set_icon(get_theme_icon(SNAME("PagePrevious"), SNAME("EditorIcons"))); @@ -2786,7 +2788,7 @@ void EditorInspector::update_tree() { class_descr_cache[doc_name] = descr; } - category->set_tooltip(p.name + "::" + (class_descr_cache[doc_name].is_empty() ? "" : class_descr_cache[doc_name])); + category->set_tooltip_text(p.name + "::" + (class_descr_cache[doc_name].is_empty() ? "" : class_descr_cache[doc_name])); } // Add editors at the start of a category. @@ -2979,7 +2981,7 @@ void EditorInspector::update_tree() { Color c = sscolor; c.a /= level; section->setup(acc_path, label, object, c, use_folding, section_depth); - section->set_tooltip(tooltip); + section->set_tooltip_text(tooltip); // Add editors at the start of a group. for (Ref<EditorInspectorPlugin> &ped : valid_plugins) { @@ -3223,9 +3225,9 @@ void EditorInspector::update_tree() { ep->connect("resource_selected", callable_mp(this, &EditorInspector::_resource_selected), CONNECT_DEFERRED); ep->connect("object_id_selected", callable_mp(this, &EditorInspector::_object_id_selected), CONNECT_DEFERRED); if (!doc_info.description.is_empty()) { - ep->set_tooltip(property_prefix + p.name + "::" + doc_info.description); + ep->set_tooltip_text(property_prefix + p.name + "::" + doc_info.description); } else { - ep->set_tooltip(property_prefix + p.name); + ep->set_tooltip_text(property_prefix + p.name); } ep->set_doc_path(doc_info.path); ep->update_property(); diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp index 0cf7f7df2a..87da67fb05 100644 --- a/editor/editor_locale_dialog.cpp +++ b/editor/editor_locale_dialog.cpp @@ -493,7 +493,7 @@ EditorLocaleDialog::EditorLocaleDialog() { { lang_code = memnew(LineEdit); lang_code->set_max_length(3); - lang_code->set_tooltip("Language"); + lang_code->set_tooltip_text("Language"); vb_language->add_child(lang_code); } hb_locale->add_child(vb_language); @@ -509,7 +509,7 @@ EditorLocaleDialog::EditorLocaleDialog() { { script_code = memnew(LineEdit); script_code->set_max_length(4); - script_code->set_tooltip("Script"); + script_code->set_tooltip_text("Script"); vb_script->add_child(script_code); } hb_locale->add_child(vb_script); @@ -525,7 +525,7 @@ EditorLocaleDialog::EditorLocaleDialog() { { country_code = memnew(LineEdit); country_code->set_max_length(2); - country_code->set_tooltip("Country"); + country_code->set_tooltip_text("Country"); vb_country->add_child(country_code); } hb_locale->add_child(vb_country); @@ -542,7 +542,7 @@ EditorLocaleDialog::EditorLocaleDialog() { variant_code = memnew(LineEdit); variant_code->set_h_size_flags(Control::SIZE_EXPAND_FILL); variant_code->set_placeholder("Variant"); - variant_code->set_tooltip("Variant"); + variant_code->set_tooltip_text("Variant"); vb_variant->add_child(variant_code); } hb_locale->add_child(vb_variant); diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp index 5c66df394b..86b0145240 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -64,48 +64,52 @@ void EditorLog::_error_handler(void *p_self, const char *p_func, const char *p_f } } +void EditorLog::_update_theme() { + Ref<Font> normal_font = get_theme_font(SNAME("output_source"), SNAME("EditorFonts")); + if (normal_font.is_valid()) { + log->add_theme_font_override("normal_font", normal_font); + } + + log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts"))); + log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4)); + + Ref<Font> bold_font = get_theme_font(SNAME("bold"), SNAME("EditorFonts")); + if (bold_font.is_valid()) { + log->add_theme_font_override("bold_font", bold_font); + } + + type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons"))); + type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); + type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); + type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); + + type_filter_map[MSG_TYPE_STD]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); + + clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); + copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); + collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons"))); + show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + + theme_cache.error_color = get_theme_color(SNAME("error_color"), SNAME("Editor")); + theme_cache.error_icon = get_theme_icon(SNAME("Error"), SNAME("EditorIcons")); + theme_cache.warning_color = get_theme_color(SNAME("warning_color"), SNAME("Editor")); + theme_cache.warning_icon = get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")); + theme_cache.message_color = get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.6); +} + void EditorLog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { + _update_theme(); _load_state(); } break; case NOTIFICATION_THEME_CHANGED: { - Ref<Font> normal_font = get_theme_font(SNAME("output_source"), SNAME("EditorFonts")); - if (normal_font.is_valid()) { - log->add_theme_font_override("normal_font", normal_font); - } - - log->add_theme_font_size_override("normal_font_size", get_theme_font_size(SNAME("output_source_size"), SNAME("EditorFonts"))); - log->add_theme_color_override("selection_color", get_theme_color(SNAME("accent_color"), SNAME("Editor")) * Color(1, 1, 1, 0.4)); - - Ref<Font> bold_font = get_theme_font(SNAME("bold"), SNAME("EditorFonts")); - if (bold_font.is_valid()) { - log->add_theme_font_override("bold_font", bold_font); - } - - type_filter_map[MSG_TYPE_STD]->toggle_button->set_icon(get_theme_icon(SNAME("Popup"), SNAME("EditorIcons"))); - type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_icon(get_theme_icon(SNAME("StatusError"), SNAME("EditorIcons"))); - type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_icon(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); - type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); - - type_filter_map[MSG_TYPE_STD]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); - type_filter_map[MSG_TYPE_ERROR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); - type_filter_map[MSG_TYPE_WARNING]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); - type_filter_map[MSG_TYPE_EDITOR]->toggle_button->set_theme_type_variation("EditorLogFilterButton"); - - clear_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); - copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons"))); - collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons"))); - show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); - search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); - - theme_cache.error_color = get_theme_color(SNAME("error_color"), SNAME("Editor")); - theme_cache.error_icon = get_theme_icon(SNAME("Error"), SNAME("EditorIcons")); - theme_cache.warning_color = get_theme_color(SNAME("warning_color"), SNAME("Editor")); - theme_cache.warning_icon = get_theme_icon(SNAME("Warning"), SNAME("EditorIcons")); - theme_cache.message_color = get_theme_color(SNAME("font_color"), SNAME("Editor")) * Color(1, 1, 1, 0.6); - + _update_theme(); _rebuild_log(); } break; } @@ -415,7 +419,7 @@ EditorLog::EditorLog() { collapse_button = memnew(Button); collapse_button->set_flat(true); collapse_button->set_focus_mode(FOCUS_NONE); - collapse_button->set_tooltip(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); + collapse_button->set_tooltip_text(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); collapse_button->set_toggle_mode(true); collapse_button->set_pressed(false); collapse_button->connect("toggled", callable_mp(this, &EditorLog::_set_collapse)); diff --git a/editor/editor_log.h b/editor/editor_log.h index 71126b742f..43d7037414 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -95,7 +95,7 @@ private: toggle_button->set_toggle_mode(true); toggle_button->set_pressed(true); toggle_button->set_text(itos(message_count)); - toggle_button->set_tooltip(TTR(p_tooltip)); + toggle_button->set_tooltip_text(TTR(p_tooltip)); // Don't tint the icon even when in "pressed" state. toggle_button->add_theme_color_override("icon_color_pressed", Color(1, 1, 1, 1)); toggle_button->set_focus_mode(FOCUS_NONE); @@ -175,6 +175,8 @@ private: void _save_state(); void _load_state(); + void _update_theme(); + protected: static void _bind_methods(); void _notification(int p_what); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 375aa26de9..9a188bbe38 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -845,7 +845,7 @@ void EditorNode::_update_update_spinner() { update_popup->set_item_checked(update_popup->get_item_index(SETTINGS_UPDATE_WHEN_CHANGED), !update_continuously); if (update_continuously) { - update_spinner->set_tooltip(TTR("Spins when the editor window redraws.\nUpdate Continuously is enabled, which can increase power usage. Click to disable it.")); + update_spinner->set_tooltip_text(TTR("Spins when the editor window redraws.\nUpdate Continuously is enabled, which can increase power usage. Click to disable it.")); // Use a different color for the update spinner when Update Continuously is enabled, // as this feature should only be enabled for troubleshooting purposes. @@ -855,7 +855,7 @@ void EditorNode::_update_update_spinner() { update_spinner->set_self_modulate( gui_base->get_theme_color(SNAME("error_color"), SNAME("Editor")) * (dark_theme ? Color(1.1, 1.1, 1.1) : Color(4.25, 4.25, 4.25))); } else { - update_spinner->set_tooltip(TTR("Spins when the editor window redraws.")); + update_spinner->set_tooltip_text(TTR("Spins when the editor window redraws.")); update_spinner->set_self_modulate(Color(1, 1, 1)); } @@ -2497,16 +2497,16 @@ void EditorNode::_run(bool p_current, const String &p_custom) { run_current_filename = run_filename; play_scene_button->set_pressed(true); play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); - play_scene_button->set_tooltip(TTR("Reload the played scene.")); + play_scene_button->set_tooltip_text(TTR("Reload the played scene.")); } else if (!p_custom.is_empty()) { run_custom_filename = p_custom; play_custom_scene_button->set_pressed(true); play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); - play_custom_scene_button->set_tooltip(TTR("Reload the played scene.")); + play_custom_scene_button->set_tooltip_text(TTR("Reload the played scene.")); } else { play_button->set_pressed(true); play_button->set_icon(gui_base->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); - play_button->set_tooltip(TTR("Reload the played scene.")); + play_button->set_tooltip_text(TTR("Reload the played scene.")); } stop_button->set_disabled(false); @@ -2534,13 +2534,13 @@ void EditorNode::_run_native(const Ref<EditorExportPreset> &p_preset) { void EditorNode::_reset_play_buttons() { play_button->set_pressed(false); play_button->set_icon(gui_base->get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); - play_button->set_tooltip(TTR("Play the project.")); + play_button->set_tooltip_text(TTR("Play the project.")); play_scene_button->set_pressed(false); play_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayScene"), SNAME("EditorIcons"))); - play_scene_button->set_tooltip(TTR("Play the edited scene.")); + play_scene_button->set_tooltip_text(TTR("Play the edited scene.")); play_custom_scene_button->set_pressed(false); play_custom_scene_button->set_icon(gui_base->get_theme_icon(SNAME("PlayCustom"), SNAME("EditorIcons"))); - play_custom_scene_button->set_tooltip(TTR("Play a custom scene.")); + play_custom_scene_button->set_tooltip_text(TTR("Play a custom scene.")); } void EditorNode::_android_build_source_selected(const String &p_file) { @@ -3702,6 +3702,18 @@ void EditorNode::fix_dependencies(const String &p_for_file) { int EditorNode::new_scene() { int idx = editor_data.add_edited_scene(-1); + // Remove placeholder empty scene. + if (editor_data.get_edited_scene_count() > 1) { + for (int i = 0; i < editor_data.get_edited_scene_count() - 1; i++) { + bool unsaved = get_undo_redo()->is_history_unsaved(editor_data.get_scene_history_id(i)); + if (!unsaved && editor_data.get_scene_path(i).is_empty()) { + editor_data.remove_scene(i); + idx--; + } + } + } + idx = MAX(idx, 0); + _scene_tab_changed(idx); editor_data.clear_editor_states(); _update_scene_tabs(); @@ -6503,7 +6515,7 @@ EditorNode::EditorNode() { scene_tab_add = memnew(Button); scene_tab_add->set_flat(true); - scene_tab_add->set_tooltip(TTR("Add a new scene.")); + scene_tab_add->set_tooltip_text(TTR("Add a new scene.")); scene_tab_add->set_icon(gui_base->get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); scene_tab_add->add_theme_color_override("icon_normal_color", Color(0.6f, 0.6f, 0.6f, 0.8f)); scene_tabs->add_child(scene_tab_add); @@ -6519,7 +6531,7 @@ EditorNode::EditorNode() { ED_SHORTCUT_AND_COMMAND("editor/distraction_free_mode", TTR("Distraction Free Mode"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::F11); ED_SHORTCUT_OVERRIDE("editor/distraction_free_mode", "macos", KeyModifierMask::CMD | KeyModifierMask::CTRL | Key::D); distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); - distraction_free->set_tooltip(TTR("Toggle distraction-free mode.")); + distraction_free->set_tooltip_text(TTR("Toggle distraction-free mode.")); distraction_free->connect("pressed", callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); distraction_free->set_icon(gui_base->get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons"))); distraction_free->set_toggle_mode(true); @@ -6571,7 +6583,7 @@ EditorNode::EditorNode() { prev_scene = memnew(Button); prev_scene->set_flat(true); prev_scene->set_icon(gui_base->get_theme_icon(SNAME("PrevScene"), SNAME("EditorIcons"))); - prev_scene->set_tooltip(TTR("Go to previously opened scene.")); + prev_scene->set_tooltip_text(TTR("Go to previously opened scene.")); prev_scene->set_disabled(true); prev_scene->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(FILE_OPEN_PREV)); gui_base->add_child(prev_scene); @@ -6829,7 +6841,7 @@ EditorNode::EditorNode() { pause_button->set_toggle_mode(true); pause_button->set_icon(gui_base->get_theme_icon(SNAME("Pause"), SNAME("EditorIcons"))); pause_button->set_focus_mode(Control::FOCUS_NONE); - pause_button->set_tooltip(TTR("Pause the scene execution for debugging.")); + pause_button->set_tooltip_text(TTR("Pause the scene execution for debugging.")); pause_button->set_disabled(true); play_hb->add_child(pause_button); @@ -6843,7 +6855,7 @@ EditorNode::EditorNode() { stop_button->set_focus_mode(Control::FOCUS_NONE); stop_button->set_icon(gui_base->get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); stop_button->connect("pressed", callable_mp(this, &EditorNode::_menu_option).bind(RUN_STOP)); - stop_button->set_tooltip(TTR("Stop the scene.")); + stop_button->set_tooltip_text(TTR("Stop the scene.")); stop_button->set_disabled(true); ED_SHORTCUT("editor/stop", TTR("Stop"), Key::F8); @@ -6885,7 +6897,7 @@ EditorNode::EditorNode() { write_movie_button->set_pressed(false); write_movie_button->set_icon(gui_base->get_theme_icon(SNAME("MainMovieWrite"), SNAME("EditorIcons"))); write_movie_button->set_focus_mode(Control::FOCUS_NONE); - write_movie_button->set_tooltip(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file.")); + write_movie_button->set_tooltip_text(TTR("Enable Movie Maker mode.\nThe project will run at stable FPS and the visual and audio output will be recorded to a video file.")); // This button behaves differently, so color it as such. write_movie_button->add_theme_color_override("icon_normal_color", Color(1, 1, 1, 0.7)); @@ -7072,7 +7084,7 @@ EditorNode::EditorNode() { // Fade out the version label to be less prominent, but still readable. version_btn->set_self_modulate(Color(1, 1, 1, 0.65)); version_btn->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - version_btn->set_tooltip(TTR("Click to copy.")); + version_btn->set_tooltip_text(TTR("Click to copy.")); version_btn->connect("pressed", callable_mp(this, &EditorNode::_version_button_pressed)); version_info_vbc->add_child(version_btn); diff --git a/editor/editor_path.cpp b/editor/editor_path.cpp index 3181907a9d..a8f8f7ab97 100644 --- a/editor/editor_path.cpp +++ b/editor/editor_path.cpp @@ -150,14 +150,14 @@ void EditorPath::update_path() { } current_object_label->set_text(" " + name); // An extra space so the text is not too close of the icon. - set_tooltip(obj->get_class()); + set_tooltip_text(obj->get_class()); } } } void EditorPath::clear_path() { set_disabled(true); - set_tooltip(""); + set_tooltip_text(""); current_object_label->set_text(""); current_object_icon->set_texture(nullptr); @@ -182,6 +182,7 @@ void EditorPath::_id_pressed(int p_idx) { void EditorPath::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { update_path(); @@ -230,5 +231,5 @@ EditorPath::EditorPath(EditorSelectionHistory *p_history) { sub_objects_menu->connect("about_to_popup", callable_mp(this, &EditorPath::_about_to_show)); sub_objects_menu->connect("id_pressed", callable_mp(this, &EditorPath::_id_pressed)); - set_tooltip(TTR("Open a list of sub-resources.")); + set_tooltip_text(TTR("Open a list of sub-resources.")); } diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index ae6d68df62..0e69c0e2f4 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -167,7 +167,8 @@ void EditorPropertyMultilineText::update_property() { void EditorPropertyMultilineText::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { Ref<Texture2D> df = get_theme_icon(SNAME("DistractionFree"), SNAME("EditorIcons")); open_big_text->set_icon(df); @@ -321,6 +322,7 @@ void EditorPropertyTextEnum::_bind_methods() { void EditorPropertyTextEnum::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { edit_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); accept_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons"))); @@ -394,7 +396,7 @@ void EditorPropertyLocale::_locale_pressed() { void EditorPropertyLocale::update_property() { String locale_code = get_edited_object()->get(get_edited_property()); locale->set_text(locale_code); - locale->set_tooltip(locale_code); + locale->set_tooltip_text(locale_code); } void EditorPropertyLocale::setup(const String &p_hint_text) { @@ -402,6 +404,7 @@ void EditorPropertyLocale::setup(const String &p_hint_text) { void EditorPropertyLocale::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { locale_edit->set_icon(get_theme_icon(SNAME("Translation"), SNAME("EditorIcons"))); } break; @@ -482,7 +485,7 @@ void EditorPropertyPath::_path_pressed() { void EditorPropertyPath::update_property() { String full_path = get_edited_object()->get(get_edited_property()); path->set_text(full_path); - path->set_tooltip(full_path); + path->set_tooltip_text(full_path); } void EditorPropertyPath::setup(const Vector<String> &p_extensions, bool p_folder, bool p_global) { @@ -497,6 +500,7 @@ void EditorPropertyPath::set_save_mode() { void EditorPropertyPath::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { path_edit->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); } break; @@ -1149,6 +1153,7 @@ void EditorPropertyLayersGrid::_bind_methods() { void EditorPropertyLayers::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { button->set_normal_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); button->set_pressed_texture(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); @@ -1672,7 +1677,8 @@ void EditorPropertyEasing::setup(bool p_positive_only, bool p_flip) { void EditorPropertyEasing::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { preset->clear(); preset->add_icon_item(get_theme_icon(SNAME("CurveLinear"), SNAME("EditorIcons")), "Linear", EASING_LINEAR); preset->add_icon_item(get_theme_icon(SNAME("CurveIn"), SNAME("EditorIcons")), "Ease In", EASING_IN); @@ -1769,6 +1775,7 @@ void EditorPropertyVector2::_update_ratio() { void EditorPropertyVector2::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); @@ -1878,6 +1885,7 @@ void EditorPropertyRect2::update_property() { void EditorPropertyRect2::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -2045,6 +2053,7 @@ Vector3 EditorPropertyVector3::get_vector() { void EditorPropertyVector3::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); @@ -2179,6 +2188,7 @@ void EditorPropertyVector2i::_update_ratio() { void EditorPropertyVector2i::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); @@ -2288,6 +2298,7 @@ void EditorPropertyRect2i::update_property() { void EditorPropertyRect2i::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -2428,6 +2439,7 @@ void EditorPropertyVector3i::_update_ratio() { void EditorPropertyVector3i::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { linked->set_normal_texture(get_theme_icon(SNAME("Unlinked"), SNAME("EditorIcons"))); linked->set_pressed_texture(get_theme_icon(SNAME("Instance"), SNAME("EditorIcons"))); @@ -2539,6 +2551,7 @@ void EditorPropertyPlane::update_property() { void EditorPropertyPlane::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -2692,6 +2705,7 @@ void EditorPropertyQuaternion::_warning_pressed() { void EditorPropertyQuaternion::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -2846,6 +2860,7 @@ void EditorPropertyVector4::update_property() { void EditorPropertyVector4::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -2937,6 +2952,7 @@ void EditorPropertyVector4i::update_property() { void EditorPropertyVector4i::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 4; i++) { @@ -3031,6 +3047,7 @@ void EditorPropertyAABB::update_property() { void EditorPropertyAABB::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 6; i++) { @@ -3113,6 +3130,7 @@ void EditorPropertyTransform2D::update_property() { void EditorPropertyTransform2D::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 6; i++) { @@ -3209,6 +3227,7 @@ void EditorPropertyBasis::update_property() { void EditorPropertyBasis::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 9; i++) { @@ -3306,6 +3325,7 @@ void EditorPropertyTransform3D::update_using_transform(Transform3D p_transform) void EditorPropertyTransform3D::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 12; i++) { @@ -3411,6 +3431,7 @@ void EditorPropertyProjection::update_using_transform(Projection p_transform) { void EditorPropertyProjection::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { const Color *colors = _get_property_colors(); for (int i = 0; i < 16; i++) { @@ -3481,6 +3502,7 @@ void EditorPropertyColor::_picker_opening() { void EditorPropertyColor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { picker->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); } break; @@ -3493,14 +3515,14 @@ void EditorPropertyColor::update_property() { // Add a tooltip to display each channel's values without having to click the ColorPickerButton if (picker->is_editing_alpha()) { - picker->set_tooltip(vformat( + picker->set_tooltip_text(vformat( "R: %s\nG: %s\nB: %s\nA: %s", rtos(color.r).pad_decimals(2), rtos(color.g).pad_decimals(2), rtos(color.b).pad_decimals(2), rtos(color.a).pad_decimals(2))); } else { - picker->set_tooltip(vformat( + picker->set_tooltip_text(vformat( "R: %s\nG: %s\nB: %s", rtos(color.r).pad_decimals(2), rtos(color.g).pad_decimals(2), @@ -3658,7 +3680,7 @@ void EditorPropertyNodePath::update_property() { p = get_edited_object()->get(get_edited_property()); } - assign->set_tooltip(p); + assign->set_tooltip_text(p); if (p == NodePath()) { assign->set_icon(Ref<Texture2D>()); assign->set_text(TTR("Assign...")); @@ -3704,6 +3726,7 @@ void EditorPropertyNodePath::setup(const NodePath &p_base_hint, Vector<StringNam void EditorPropertyNodePath::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")); clear->set_icon(t); @@ -4115,6 +4138,7 @@ void EditorPropertyResource::set_use_sub_inspector(bool p_enable) { void EditorPropertyResource::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (!updating_theme) { _update_property_bg(); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index 3c178ba156..f6953e8866 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -485,7 +485,8 @@ void EditorPropertyArray::drop_data_fw(const Point2 &p_point, const Variant &p_d void EditorPropertyArray::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { change_type->clear(); for (int i = 0; i < Variant::VARIANT_MAX; i++) { if (i == Variant::CALLABLE || i == Variant::SIGNAL || i == Variant::RID) { @@ -1110,7 +1111,7 @@ void EditorPropertyDictionary::update_property() { if (i < amount) { String cs = key.get_construct_string(); prop->set_label(key.get_construct_string()); - prop->set_tooltip(cs); + prop->set_tooltip_text(cs); change_index = i + offset; } else if (i == amount) { prop->set_label(TTR("New Key:")); @@ -1165,7 +1166,8 @@ void EditorPropertyDictionary::_object_id_selected(const StringName &p_property, void EditorPropertyDictionary::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { change_type->clear(); for (int i = 0; i < Variant::VARIANT_MAX; i++) { if (i == Variant::CALLABLE || i == Variant::SIGNAL || i == Variant::RID) { @@ -1359,7 +1361,7 @@ void EditorPropertyLocalizableString::update_property() { String cs = key.get_construct_string(); prop->set_label(cs); - prop->set_tooltip(cs); + prop->set_tooltip_text(cs); remove_index = i + offset; prop->set_selectable(false); @@ -1403,7 +1405,8 @@ void EditorPropertyLocalizableString::_object_id_selected(const StringName &p_pr void EditorPropertyLocalizableString::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { if (Object::cast_to<Button>(button_add_item)) { button_add_item->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 029e2cfbbe..ce05026696 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -62,7 +62,7 @@ void EditorResourcePicker::_update_resource() { if (edited_resource == Ref<Resource>()) { assign_button->set_icon(Ref<Texture2D>()); assign_button->set_text(TTR("[empty]")); - assign_button->set_tooltip(""); + assign_button->set_tooltip_text(""); } else { assign_button->set_icon(EditorNode::get_singleton()->get_object_icon(edited_resource.operator->(), "Object")); @@ -73,13 +73,13 @@ void EditorResourcePicker::_update_resource() { } else { assign_button->set_text(edited_resource->get_class()); } - assign_button->set_tooltip(resource_path + TTR("Type:") + " " + edited_resource->get_class()); + assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + edited_resource->get_class()); // Preview will override the above, so called at the end. EditorResourcePreview::get_singleton()->queue_edited_resource_preview(edited_resource, this, "_update_resource_preview", edited_resource->get_instance_id()); } } else if (edited_resource.is_valid()) { - assign_button->set_tooltip(resource_path + TTR("Type:") + " " + edited_resource->get_class()); + assign_button->set_tooltip_text(resource_path + TTR("Type:") + " " + edited_resource->get_class()); } assign_button->set_disabled(!editable && !edited_resource.is_valid()); @@ -108,7 +108,7 @@ void EditorResourcePicker::_update_resource_preview(const String &p_path, const preview_rect->set_stretch_mode(TextureRect::STRETCH_KEEP_ASPECT_CENTERED); int thumbnail_size = EditorSettings::get_singleton()->get("filesystem/file_dialog/thumbnail_size"); thumbnail_size *= EDSCALE; - assign_button->set_custom_minimum_size(Size2(MIN(1, assign_button_min_size.x), MIN(thumbnail_size, assign_button_min_size.y))); + assign_button->set_custom_minimum_size(Size2(MAX(1, assign_button_min_size.x), MAX(thumbnail_size, assign_button_min_size.y))); } preview_rect->set_texture(p_preview); @@ -762,8 +762,8 @@ void EditorResourcePicker::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { _update_resource(); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { edit_button->set_icon(get_theme_icon(SNAME("select_arrow"), SNAME("Tree"))); } break; @@ -1038,6 +1038,7 @@ EditorShaderPicker::EditorShaderPicker() { void EditorAudioStreamPicker::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_READY: case NOTIFICATION_THEME_CHANGED: { _update_resource(); } break; diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index d8b738be17..3e8f17085d 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -77,9 +77,9 @@ void EditorRunNative::_notification(int p_what) { mb->get_popup()->clear(); mb->show(); if (dc == 1) { - mb->set_tooltip(eep->get_option_tooltip(0)); + mb->set_tooltip_text(eep->get_option_tooltip(0)); } else { - mb->set_tooltip(eep->get_options_tooltip()); + mb->set_tooltip_text(eep->get_options_tooltip()); for (int i = 0; i < dc; i++) { mb->get_popup()->add_icon_item(eep->get_option_icon(i), eep->get_option_label(i)); mb->get_popup()->set_item_tooltip(-1, eep->get_option_tooltip(i)); diff --git a/editor/editor_spin_slider.cpp b/editor/editor_spin_slider.cpp index 128d90cd62..b9a3e9decf 100644 --- a/editor/editor_spin_slider.cpp +++ b/editor/editor_spin_slider.cpp @@ -431,6 +431,7 @@ void EditorSpinSlider::_draw_spin_slider() { void EditorSpinSlider::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { _update_value_input_stylebox(); } break; diff --git a/editor/editor_toaster.cpp b/editor/editor_toaster.cpp index 6b9e5abac9..bb29b1c171 100644 --- a/editor/editor_toaster.cpp +++ b/editor/editor_toaster.cpp @@ -105,6 +105,7 @@ void EditorToaster::_notification(int p_what) { } } break; + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (vbox_container->is_visible()) { main_button->set_icon(get_theme_icon(SNAME("Notification"), SNAME("EditorIcons"))); @@ -235,11 +236,11 @@ void EditorToaster::_auto_hide_or_free_toasts() { } if (toasts.is_empty()) { - main_button->set_tooltip(TTR("No notifications.")); + main_button->set_tooltip_text(TTR("No notifications.")); main_button->set_modulate(Color(0.5, 0.5, 0.5)); main_button->set_disabled(true); } else { - main_button->set_tooltip(TTR("Show notifications.")); + main_button->set_tooltip_text(TTR("Show notifications.")); main_button->set_modulate(Color(1, 1, 1)); main_button->set_disabled(false); } @@ -340,7 +341,7 @@ void EditorToaster::_repop_old() { Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_time, String p_tooltip) { // Create the panel according to the severity. PanelContainer *panel = memnew(PanelContainer); - panel->set_tooltip(p_tooltip); + panel->set_tooltip_text(p_tooltip); switch (p_severity) { case SEVERITY_INFO: panel->add_theme_style_override("panel", info_panel_style_background); @@ -517,7 +518,7 @@ EditorToaster::EditorToaster() { // Main button. main_button = memnew(Button); - main_button->set_tooltip(TTR("No notifications.")); + main_button->set_tooltip_text(TTR("No notifications.")); main_button->set_modulate(Color(0.5, 0.5, 0.5)); main_button->set_disabled(true); main_button->set_flat(true); @@ -533,7 +534,7 @@ EditorToaster::EditorToaster() { add_child(disable_notifications_panel); disable_notifications_button = memnew(Button); - disable_notifications_button->set_tooltip(TTR("Silence the notifications.")); + disable_notifications_button->set_tooltip_text(TTR("Silence the notifications.")); disable_notifications_button->set_flat(true); disable_notifications_button->connect("pressed", callable_mp(this, &EditorToaster::_set_notifications_enabled).bind(false)); disable_notifications_panel->add_child(disable_notifications_button); diff --git a/editor/editor_zoom_widget.cpp b/editor/editor_zoom_widget.cpp index 512fa1c86c..e4beea5e5f 100644 --- a/editor/editor_zoom_widget.cpp +++ b/editor/editor_zoom_widget.cpp @@ -143,6 +143,7 @@ void EditorZoomWidget::set_zoom_by_increments(int p_increment_count, bool p_inte void EditorZoomWidget::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { zoom_minus->set_icon(get_theme_icon(SNAME("ZoomLess"), SNAME("EditorIcons"))); zoom_plus->set_icon(get_theme_icon(SNAME("ZoomMore"), SNAME("EditorIcons"))); diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index cbcc47fad0..a0afcf4237 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -754,6 +754,7 @@ Error ExportTemplateManager::install_android_template_from_file(const String &p_ void ExportTemplateManager::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { current_value->add_theme_font_override("font", get_theme_font(SNAME("main"), SNAME("EditorFonts"))); current_missing_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); @@ -867,13 +868,13 @@ ExportTemplateManager::ExportTemplateManager() { current_open_button = memnew(Button); current_open_button->set_text(TTR("Open Folder")); - current_open_button->set_tooltip(TTR("Open the folder containing installed templates for the current version.")); + current_open_button->set_tooltip_text(TTR("Open the folder containing installed templates for the current version.")); current_installed_hb->add_child(current_open_button); current_open_button->connect("pressed", callable_mp(this, &ExportTemplateManager::_open_template_folder).bind(VERSION_FULL_CONFIG)); current_uninstall_button = memnew(Button); current_uninstall_button->set_text(TTR("Uninstall")); - current_uninstall_button->set_tooltip(TTR("Uninstall templates for the current version.")); + current_uninstall_button->set_tooltip_text(TTR("Uninstall templates for the current version.")); current_installed_hb->add_child(current_uninstall_button); current_uninstall_button->connect("pressed", callable_mp(this, &ExportTemplateManager::_uninstall_template).bind(VERSION_FULL_CONFIG)); @@ -914,14 +915,14 @@ ExportTemplateManager::ExportTemplateManager() { Button *download_current_button = memnew(Button); download_current_button->set_text(TTR("Download and Install")); - download_current_button->set_tooltip(TTR("Download and install templates for the current version from the best possible mirror.")); + download_current_button->set_tooltip_text(TTR("Download and install templates for the current version from the best possible mirror.")); download_install_hb->add_child(download_current_button); download_current_button->connect("pressed", callable_mp(this, &ExportTemplateManager::_download_current)); // Update downloads buttons to prevent unsupported downloads. if (!downloads_available) { download_current_button->set_disabled(true); - download_current_button->set_tooltip(TTR("Official export templates aren't available for development builds.")); + download_current_button->set_tooltip_text(TTR("Official export templates aren't available for development builds.")); } HBoxContainer *install_file_hb = memnew(HBoxContainer); @@ -930,7 +931,7 @@ ExportTemplateManager::ExportTemplateManager() { install_file_button = memnew(Button); install_file_button->set_text(TTR("Install from File")); - install_file_button->set_tooltip(TTR("Install templates from a local file.")); + install_file_button->set_tooltip_text(TTR("Install templates from a local file.")); install_file_hb->add_child(install_file_button); install_file_button->connect("pressed", callable_mp(this, &ExportTemplateManager::_install_file)); @@ -955,7 +956,7 @@ ExportTemplateManager::ExportTemplateManager() { Button *download_cancel_button = memnew(Button); download_cancel_button->set_text(TTR("Cancel")); - download_cancel_button->set_tooltip(TTR("Cancel the download of the templates.")); + download_cancel_button->set_tooltip_text(TTR("Cancel the download of the templates.")); download_progress_hb->add_child(download_cancel_button); download_cancel_button->connect("pressed", callable_mp(this, &ExportTemplateManager::_cancel_template_download)); diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index 76493d330f..00a0e08d3a 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -185,9 +185,9 @@ void ProjectExportDialog::_update_export_all() { export_all_button->set_disabled(!can_export); if (can_export) { - export_all_button->set_tooltip(TTR("Export the project for all the presets defined.")); + export_all_button->set_tooltip_text(TTR("Export the project for all the presets defined.")); } else { - export_all_button->set_tooltip(TTR("All presets must have an export path defined for Export All to work.")); + export_all_button->set_tooltip_text(TTR("All presets must have an export path defined for Export All to work.")); } } @@ -1020,12 +1020,12 @@ ProjectExportDialog::ProjectExportDialog() { mc->add_child(presets); presets->connect("item_selected", callable_mp(this, &ProjectExportDialog::_edit_preset)); duplicate_preset = memnew(Button); - duplicate_preset->set_tooltip(TTR("Duplicate")); + duplicate_preset->set_tooltip_text(TTR("Duplicate")); duplicate_preset->set_flat(true); preset_hb->add_child(duplicate_preset); duplicate_preset->connect("pressed", callable_mp(this, &ProjectExportDialog::_duplicate_preset)); delete_preset = memnew(Button); - delete_preset->set_tooltip(TTR("Delete")); + delete_preset->set_tooltip_text(TTR("Delete")); delete_preset->set_flat(true); preset_hb->add_child(delete_preset); delete_preset->connect("pressed", callable_mp(this, &ProjectExportDialog::_delete_preset)); @@ -1041,7 +1041,7 @@ ProjectExportDialog::ProjectExportDialog() { name->connect("text_changed", callable_mp(this, &ProjectExportDialog::_name_changed)); runnable = memnew(CheckButton); runnable->set_text(TTR("Runnable")); - runnable->set_tooltip(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable.")); + runnable->set_tooltip_text(TTR("If checked, the preset will be available for use in one-click deploy.\nOnly one preset per platform may be marked as runnable.")); runnable->connect("pressed", callable_mp(this, &ProjectExportDialog::_runnable_pressed)); settings_vb->add_child(runnable); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index b823db68f0..a42433caee 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -614,11 +614,11 @@ void FileSystemDock::_set_file_display(bool p_active) { if (p_active) { file_list_display_mode = FILE_LIST_DISPLAY_LIST; button_file_list_display_mode->set_icon(get_theme_icon(SNAME("FileThumbnail"), SNAME("EditorIcons"))); - button_file_list_display_mode->set_tooltip(TTR("View items as a grid of thumbnails.")); + button_file_list_display_mode->set_tooltip_text(TTR("View items as a grid of thumbnails.")); } else { file_list_display_mode = FILE_LIST_DISPLAY_THUMBNAILS; button_file_list_display_mode->set_icon(get_theme_icon(SNAME("FileList"), SNAME("EditorIcons"))); - button_file_list_display_mode->set_tooltip(TTR("View items as a list.")); + button_file_list_display_mode->set_tooltip_text(TTR("View items as a list.")); } _update_file_list(true); @@ -2977,7 +2977,7 @@ void FileSystemDock::_file_sort_popup(int p_id) { MenuButton *FileSystemDock::_create_file_menu_button() { MenuButton *button = memnew(MenuButton); button->set_flat(true); - button->set_tooltip(TTR("Sort files")); + button->set_tooltip_text(TTR("Sort files")); PopupMenu *p = button->get_popup(); p->connect("id_pressed", callable_mp(this, &FileSystemDock::_file_sort_popup)); @@ -3040,14 +3040,14 @@ FileSystemDock::FileSystemDock() { button_hist_prev->set_flat(true); button_hist_prev->set_disabled(true); button_hist_prev->set_focus_mode(FOCUS_NONE); - button_hist_prev->set_tooltip(TTR("Previous Folder/File")); + button_hist_prev->set_tooltip_text(TTR("Previous Folder/File")); toolbar_hbc->add_child(button_hist_prev); button_hist_next = memnew(Button); button_hist_next->set_flat(true); button_hist_next->set_disabled(true); button_hist_next->set_focus_mode(FOCUS_NONE); - button_hist_next->set_tooltip(TTR("Next Folder/File")); + button_hist_next->set_tooltip_text(TTR("Next Folder/File")); toolbar_hbc->add_child(button_hist_next); current_path = memnew(LineEdit); @@ -3059,7 +3059,7 @@ FileSystemDock::FileSystemDock() { button_reload = memnew(Button); button_reload->connect("pressed", callable_mp(this, &FileSystemDock::_rescan)); button_reload->set_focus_mode(FOCUS_NONE); - button_reload->set_tooltip(TTR("Re-Scan Filesystem")); + button_reload->set_tooltip_text(TTR("Re-Scan Filesystem")); button_reload->hide(); toolbar_hbc->add_child(button_reload); @@ -3067,7 +3067,7 @@ FileSystemDock::FileSystemDock() { button_toggle_display_mode->set_toggle_mode(true); button_toggle_display_mode->connect("toggled", callable_mp(this, &FileSystemDock::_toggle_split_mode)); button_toggle_display_mode->set_focus_mode(FOCUS_NONE); - button_toggle_display_mode->set_tooltip(TTR("Toggle Split Mode")); + button_toggle_display_mode->set_tooltip_text(TTR("Toggle Split Mode")); button_toggle_display_mode->set_flat(true); toolbar_hbc->add_child(button_toggle_display_mode); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index 81b71b5609..56387e87f5 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -373,7 +373,7 @@ FindInFilesDialog::FindInFilesDialog() { Label *filter_label = memnew(Label); filter_label->set_text(TTR("Filters:")); - filter_label->set_tooltip(TTR("Include the files with the following extensions. Add or remove them in ProjectSettings.")); + filter_label->set_tooltip_text(TTR("Include the files with the following extensions. Add or remove them in ProjectSettings.")); gc->add_child(filter_label); _filters_container = memnew(HBoxContainer); diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 87721a2bbf..15add50fd4 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -380,6 +380,7 @@ void GroupDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_TRANSLATION_CHANGED: case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED: + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (is_layout_rtl()) { add_button->set_icon(groups->get_theme_icon(SNAME("Back"), SNAME("EditorIcons"))); diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index 38a98a1249..cc7c5809d6 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -42,7 +42,8 @@ void AudioStreamImportSettings::_notification(int p_what) { connect("confirmed", callable_mp(this, &AudioStreamImportSettings::_reimport)); } break; - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: + case NOTIFICATION_ENTER_TREE: { _play_button->set_icon(get_theme_icon(SNAME("MainPlay"), SNAME("EditorIcons"))); _stop_button->set_icon(get_theme_icon(SNAME("Stop"), SNAME("EditorIcons"))); _preview->set_color(get_theme_color(SNAME("dark_color_2"), SNAME("Editor"))); @@ -525,7 +526,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() { loop_hb->add_theme_constant_override("separation", 4 * EDSCALE); loop = memnew(CheckBox); loop->set_text(TTR("Enable")); - loop->set_tooltip(TTR("Enable looping.")); + loop->set_tooltip_text(TTR("Enable looping.")); loop->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); loop_hb->add_child(loop); loop_hb->add_spacer(); @@ -534,7 +535,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() { loop_offset->set_max(10000); loop_offset->set_step(0.001); loop_offset->set_suffix("sec"); - loop_offset->set_tooltip(TTR("Loop offset (from beginning). Note that if BPM is set, this setting will be ignored.")); + loop_offset->set_tooltip_text(TTR("Loop offset (from beginning). Note that if BPM is set, this setting will be ignored.")); loop_offset->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); loop_hb->add_child(loop_offset); main_vbox->add_margin_child(TTR("Loop:"), loop_hb); @@ -548,14 +549,14 @@ AudioStreamImportSettings::AudioStreamImportSettings() { bpm_edit = memnew(SpinBox); bpm_edit->set_max(400); bpm_edit->set_step(0.01); - bpm_edit->set_tooltip(TTR("Configure the Beats Per Measure (tempo) used for the interactive streams.\nThis is required in order to configure beat information.")); + bpm_edit->set_tooltip_text(TTR("Configure the Beats Per Measure (tempo) used for the interactive streams.\nThis is required in order to configure beat information.")); bpm_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); interactive_hb->add_child(bpm_edit); interactive_hb->add_spacer(); bar_beats_label = memnew(Label(TTR("Beats/Bar:"))); interactive_hb->add_child(bar_beats_label); bar_beats_edit = memnew(SpinBox); - bar_beats_edit->set_tooltip(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams.")); + bar_beats_edit->set_tooltip_text(TTR("Configure the Beats Per Bar. This used for music-aware transitions between AudioStreams.")); bar_beats_edit->set_min(2); bar_beats_edit->set_max(32); bar_beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); @@ -566,7 +567,7 @@ AudioStreamImportSettings::AudioStreamImportSettings() { beats_enabled->connect("toggled", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); interactive_hb->add_child(beats_enabled); beats_edit = memnew(SpinBox); - beats_edit->set_tooltip(TTR("Configure the amount of Beats used for music-aware looping. If zero, it will be autodetected from the length.\nIt is recommended to set this value (either manually or by clicking on a beat number in the preview) to ensure looping works properly.")); + beats_edit->set_tooltip_text(TTR("Configure the amount of Beats used for music-aware looping. If zero, it will be autodetected from the length.\nIt is recommended to set this value (either manually or by clicking on a beat number in the preview) to ensure looping works properly.")); beats_edit->set_max(99999); beats_edit->connect("value_changed", callable_mp(this, &AudioStreamImportSettings::_settings_changed).unbind(1)); interactive_hb->add_child(beats_edit); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 2f25135b2f..0575f3cbf3 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -876,6 +876,7 @@ void DynamicFontImportSettings::_notification(int p_what) { connect("confirmed", callable_mp(this, &DynamicFontImportSettings::_re_import)); } break; + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { add_var->set_icon(add_var->get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); } break; @@ -1238,7 +1239,7 @@ DynamicFontImportSettings::DynamicFontImportSettings() { add_var = memnew(Button); page2_hb_vars->add_child(add_var); - add_var->set_tooltip(TTR("Add configuration")); + add_var->set_tooltip_text(TTR("Add configuration")); add_var->set_icon(add_var->get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); add_var->connect("pressed", callable_mp(this, &DynamicFontImportSettings::_variation_add)); diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 087ef48b56..02270e163f 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -584,12 +584,12 @@ void ImportDock::_set_dirty(bool p_dirty) { // Add a dirty marker to notify the user that they should reimport the selected resource to see changes. import->set_text(TTR("Reimport") + " (*)"); import->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); - import->set_tooltip(TTR("You have pending changes that haven't been applied yet. Click Reimport to apply changes made to the import options.\nSelecting another resource in the FileSystem dock without clicking Reimport first will discard changes made in the Import dock.")); + import->set_tooltip_text(TTR("You have pending changes that haven't been applied yet. Click Reimport to apply changes made to the import options.\nSelecting another resource in the FileSystem dock without clicking Reimport first will discard changes made in the Import dock.")); } else { // Remove the dirty marker on the Reimport button. import->set_text(TTR("Reimport")); import->remove_theme_color_override("font_color"); - import->set_tooltip(""); + import->set_tooltip_text(""); } } diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index b0ff678a3e..7af04e17c1 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -633,20 +633,20 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_new_button = memnew(Button); resource_new_button->set_flat(true); - resource_new_button->set_tooltip(TTR("Create a new resource in memory and edit it.")); + resource_new_button->set_tooltip_text(TTR("Create a new resource in memory and edit it.")); general_options_hb->add_child(resource_new_button); resource_new_button->connect("pressed", callable_mp(this, &InspectorDock::_new_resource)); resource_new_button->set_focus_mode(Control::FOCUS_NONE); resource_load_button = memnew(Button); resource_load_button->set_flat(true); - resource_load_button->set_tooltip(TTR("Load an existing resource from disk and edit it.")); + resource_load_button->set_tooltip_text(TTR("Load an existing resource from disk and edit it.")); general_options_hb->add_child(resource_load_button); resource_load_button->connect("pressed", callable_mp(this, &InspectorDock::_open_resource_selector)); resource_load_button->set_focus_mode(Control::FOCUS_NONE); resource_save_button = memnew(MenuButton); - resource_save_button->set_tooltip(TTR("Save the currently edited resource.")); + resource_save_button->set_tooltip_text(TTR("Save the currently edited resource.")); general_options_hb->add_child(resource_save_button); resource_save_button->get_popup()->add_item(TTR("Save"), RESOURCE_SAVE); resource_save_button->get_popup()->add_item(TTR("Save As..."), RESOURCE_SAVE_AS); @@ -655,7 +655,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_save_button->set_disabled(true); resource_extra_button = memnew(MenuButton); - resource_extra_button->set_tooltip(TTR("Extra resource options.")); + resource_extra_button->set_tooltip_text(TTR("Extra resource options.")); general_options_hb->add_child(resource_extra_button); resource_extra_button->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_resource_extra_popup)); resource_extra_button->get_popup()->add_icon_shortcut(get_theme_icon(SNAME("ActionPaste"), SNAME("EditorIcons")), ED_SHORTCUT("property_editor/paste_resource", TTR("Edit Resource from Clipboard")), RESOURCE_EDIT_CLIPBOARD); @@ -671,19 +671,19 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { backward_button = memnew(Button); backward_button->set_flat(true); general_options_hb->add_child(backward_button); - backward_button->set_tooltip(TTR("Go to the previous edited object in history.")); + backward_button->set_tooltip_text(TTR("Go to the previous edited object in history.")); backward_button->set_disabled(true); backward_button->connect("pressed", callable_mp(this, &InspectorDock::_edit_back)); forward_button = memnew(Button); forward_button->set_flat(true); general_options_hb->add_child(forward_button); - forward_button->set_tooltip(TTR("Go to the next edited object in history.")); + forward_button->set_tooltip_text(TTR("Go to the next edited object in history.")); forward_button->set_disabled(true); forward_button->connect("pressed", callable_mp(this, &InspectorDock::_edit_forward)); history_menu = memnew(MenuButton); - history_menu->set_tooltip(TTR("History of recently edited objects.")); + history_menu->set_tooltip_text(TTR("History of recently edited objects.")); general_options_hb->add_child(history_menu); history_menu->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_history)); history_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_select_history)); @@ -697,7 +697,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { open_docs_button = memnew(Button); open_docs_button->set_flat(true); open_docs_button->set_disabled(true); - open_docs_button->set_tooltip(TTR("Open documentation for this object.")); + open_docs_button->set_tooltip_text(TTR("Open documentation for this object.")); open_docs_button->set_shortcut(ED_SHORTCUT("property_editor/open_help", TTR("Open Documentation"))); subresource_hb->add_child(open_docs_button); open_docs_button->connect("pressed", callable_mp(this, &InspectorDock::_menu_option).bind(OBJECT_REQUEST_HELP)); @@ -719,7 +719,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { object_menu = memnew(MenuButton); object_menu->set_shortcut_context(this); property_tools_hb->add_child(object_menu); - object_menu->set_tooltip(TTR("Manage object properties.")); + object_menu->set_tooltip_text(TTR("Manage object properties.")); object_menu->get_popup()->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_menu)); object_menu->get_popup()->connect("id_pressed", callable_mp(this, &InspectorDock::_menu_option)); diff --git a/editor/node_dock.cpp b/editor/node_dock.cpp index e366f3ce3c..55fa2f22dd 100644 --- a/editor/node_dock.cpp +++ b/editor/node_dock.cpp @@ -53,6 +53,7 @@ void NodeDock::_bind_methods() { void NodeDock::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { connections_button->set_icon(get_theme_icon(SNAME("Signals"), SNAME("EditorIcons"))); groups_button->set_icon(get_theme_icon(SNAME("Groups"), SNAME("EditorIcons"))); diff --git a/editor/plugin_config_dialog.cpp b/editor/plugin_config_dialog.cpp index 6d323572e6..88aa6354e4 100644 --- a/editor/plugin_config_dialog.cpp +++ b/editor/plugin_config_dialog.cpp @@ -111,32 +111,32 @@ void PluginConfigDialog::_on_required_text_changed(const String &) { name_validation->set_texture(valid_icon); subfolder_validation->set_texture(valid_icon); script_validation->set_texture(valid_icon); - name_validation->set_tooltip(""); - subfolder_validation->set_tooltip(""); - script_validation->set_tooltip(""); + name_validation->set_tooltip_text(""); + subfolder_validation->set_tooltip_text(""); + script_validation->set_tooltip_text(""); // Change valid status to invalid depending on conditions. Vector<String> errors; if (name_edit->get_text().is_empty()) { is_valid = false; name_validation->set_texture(invalid_icon); - name_validation->set_tooltip(TTR("Plugin name cannot be blank.")); + name_validation->set_tooltip_text(TTR("Plugin name cannot be blank.")); } if ((!script_edit->get_text().get_extension().is_empty() && script_edit->get_text().get_extension() != ext) || script_edit->get_text().ends_with(".")) { is_valid = false; script_validation->set_texture(invalid_icon); - script_validation->set_tooltip(vformat(TTR("Script extension must match chosen language extension (.%s)."), ext)); + script_validation->set_tooltip_text(vformat(TTR("Script extension must match chosen language extension (.%s)."), ext)); } if (!subfolder_edit->get_text().is_empty() && !subfolder_edit->get_text().is_valid_filename()) { is_valid = false; subfolder_validation->set_texture(invalid_icon); - subfolder_validation->set_tooltip(TTR("Subfolder name is not a valid folder name.")); + subfolder_validation->set_tooltip_text(TTR("Subfolder name is not a valid folder name.")); } else { String path = "res://addons/" + _get_subfolder(); if (!_edit_mode && DirAccess::exists(path)) { // Only show this error if in "create" mode. is_valid = false; subfolder_validation->set_texture(invalid_icon); - subfolder_validation->set_tooltip(TTR("Subfolder cannot be one which already exists.")); + subfolder_validation->set_tooltip_text(TTR("Subfolder cannot be one which already exists.")); } } diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index ca8ca83753..c928b95642 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -151,6 +151,7 @@ void AbstractPolygon2DEditor::_menu_option(int p_option) { void AbstractPolygon2DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { button_create->set_icon(get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons"))); button_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons"))); @@ -234,13 +235,13 @@ void AbstractPolygon2DEditor::disable_polygon_editing(bool p_disable, String p_r button_delete->set_disabled(p_disable); if (p_disable) { - button_create->set_tooltip(p_reason); - button_edit->set_tooltip(p_reason); - button_delete->set_tooltip(p_reason); + button_create->set_tooltip_text(p_reason); + button_edit->set_tooltip_text(p_reason); + button_delete->set_tooltip_text(p_reason); } else { - button_create->set_tooltip(TTR("Create points.")); - button_edit->set_tooltip(TTR("Edit points.\nLMB: Move Point\nRMB: Erase Point")); - button_delete->set_tooltip(TTR("Erase points.")); + button_create->set_tooltip_text(TTR("Create points.")); + button_edit->set_tooltip_text(TTR("Edit points.\nLMB: Move Point\nRMB: Erase Point")); + button_delete->set_tooltip_text(TTR("Erase points.")); } } diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 3ae48f38fc..3b7829c37b 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -550,6 +550,7 @@ void AnimationNodeBlendSpace1DEditor::_open_editor() { void AnimationNodeBlendSpace1DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); @@ -634,7 +635,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); tool_blend->set_pressed(true); - tool_blend->set_tooltip(TTR("Set the blending position within the space")); + tool_blend->set_tooltip_text(TTR("Set the blending position within the space")); tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); @@ -642,7 +643,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); - tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); + tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); @@ -650,7 +651,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); - tool_create->set_tooltip(TTR("Create points.")); + tool_create->set_tooltip_text(TTR("Create points.")); tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(1)); tool_erase_sep = memnew(VSeparator); @@ -658,7 +659,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_erase = memnew(Button); tool_erase->set_flat(true); top_hb->add_child(tool_erase); - tool_erase->set_tooltip(TTR("Erase points.")); + tool_erase->set_tooltip_text(TTR("Erase points.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected)); top_hb->add_child(memnew(VSeparator)); @@ -668,7 +669,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); - snap->set_tooltip(TTR("Enable snap and show grid.")); + snap->set_tooltip_text(TTR("Enable snap and show grid.")); snap->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace1DEditor::_snap_toggled)); snap_value = memnew(SpinBox); diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index fac0136203..d904ccb5e0 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -772,6 +772,7 @@ void AnimationNodeBlendSpace2DEditor::_edit_point_pos(double) { void AnimationNodeBlendSpace2DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); @@ -867,7 +868,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_blend->set_button_group(bg); top_hb->add_child(tool_blend); tool_blend->set_pressed(true); - tool_blend->set_tooltip(TTR("Set the blending position within the space")); + tool_blend->set_tooltip_text(TTR("Set the blending position within the space")); tool_blend->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); @@ -875,7 +876,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); top_hb->add_child(tool_select); - tool_select->set_tooltip(TTR("Select and move points, create points with RMB.")); + tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); @@ -883,7 +884,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); top_hb->add_child(tool_create); - tool_create->set_tooltip(TTR("Create points.")); + tool_create->set_tooltip_text(TTR("Create points.")); tool_create->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(1)); tool_triangle = memnew(Button); @@ -891,7 +892,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_triangle->set_toggle_mode(true); tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); - tool_triangle->set_tooltip(TTR("Create triangles by connecting points.")); + tool_triangle->set_tooltip_text(TTR("Create triangles by connecting points.")); tool_triangle->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(2)); tool_erase_sep = memnew(VSeparator); @@ -899,7 +900,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_erase = memnew(Button); tool_erase->set_flat(true); top_hb->add_child(tool_erase); - tool_erase->set_tooltip(TTR("Erase points and triangles.")); + tool_erase->set_tooltip_text(TTR("Erase points and triangles.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected)); tool_erase->set_disabled(true); @@ -910,7 +911,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(auto_triangles); auto_triangles->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled)); auto_triangles->set_toggle_mode(true); - auto_triangles->set_tooltip(TTR("Generate blend triangles automatically (instead of manually)")); + auto_triangles->set_tooltip_text(TTR("Generate blend triangles automatically (instead of manually)")); top_hb->add_child(memnew(VSeparator)); @@ -919,7 +920,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { snap->set_toggle_mode(true); top_hb->add_child(snap); snap->set_pressed(true); - snap->set_tooltip(TTR("Enable snap and show grid.")); + snap->set_tooltip_text(TTR("Enable snap and show grid.")); snap->connect("pressed", callable_mp(this, &AnimationNodeBlendSpace2DEditor::_snap_toggled)); snap_x = memnew(SpinBox); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index 11054ee11e..8dd3223b19 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -799,10 +799,16 @@ void AnimationNodeBlendTreeEditor::_update_editor_settings() { graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); } +void AnimationNodeBlendTreeEditor::_update_theme() { + error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); + error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); +} + void AnimationNodeBlendTreeEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { _update_editor_settings(); + _update_theme(); } break; case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { @@ -810,8 +816,7 @@ void AnimationNodeBlendTreeEditor::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); - error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); + _update_theme(); if (is_visible_in_tree()) { _update_graph(); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.h b/editor/plugins/animation_blend_tree_editor_plugin.h index cdbf2975f2..30a54930a2 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.h +++ b/editor/plugins/animation_blend_tree_editor_plugin.h @@ -123,6 +123,7 @@ class AnimationNodeBlendTreeEditor : public AnimationTreeNodeEditorPlugin { void _removed_from_graph(); void _update_editor_settings(); + void _update_theme(); EditorFileDialog *open_file = nullptr; Ref<AnimationNode> file_loaded; diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index f374f48fb2..1ab60e8fc8 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -843,15 +843,16 @@ void AnimationPlayerEditor::_update_player() { animation->clear(); + tool_anim->set_disabled(player == nullptr); + pin->set_disabled(player == nullptr); + if (!player) { AnimationPlayerEditor::get_singleton()->get_track_editor()->update_keying(); return; } List<StringName> libraries; - if (player) { - player->get_animation_library_list(&libraries); - } + player->get_animation_library_list(&libraries); int active_idx = -1; bool no_anims_found = true; @@ -926,10 +927,8 @@ void AnimationPlayerEditor::_update_player() { frame->set_editable(!no_anims_found); animation->set_disabled(no_anims_found); autoplay->set_disabled(no_anims_found); - tool_anim->set_disabled(player == nullptr); onion_toggle->set_disabled(no_anims_found); onion_skinning->set_disabled(no_anims_found); - pin->set_disabled(player == nullptr); _update_animation_list_icons(); @@ -1646,28 +1645,28 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug play_bw_from = memnew(Button); play_bw_from->set_flat(true); - play_bw_from->set_tooltip(TTR("Play selected animation backwards from current pos. (A)")); + play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)")); hb->add_child(play_bw_from); play_bw = memnew(Button); play_bw->set_flat(true); - play_bw->set_tooltip(TTR("Play selected animation backwards from end. (Shift+A)")); + play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)")); hb->add_child(play_bw); stop = memnew(Button); stop->set_flat(true); stop->set_toggle_mode(true); hb->add_child(stop); - stop->set_tooltip(TTR("Stop animation playback. (S)")); + stop->set_tooltip_text(TTR("Stop animation playback. (S)")); play = memnew(Button); play->set_flat(true); - play->set_tooltip(TTR("Play selected animation from start. (Shift+D)")); + play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)")); hb->add_child(play); play_from = memnew(Button); play_from->set_flat(true); - play_from->set_tooltip(TTR("Play selected animation from current pos. (D)")); + play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); hb->add_child(play_from); frame = memnew(SpinBox); @@ -1675,7 +1674,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug frame->set_custom_minimum_size(Size2(80, 0) * EDSCALE); frame->set_stretch_ratio(2); frame->set_step(0.0001); - frame->set_tooltip(TTR("Animation position (in seconds).")); + frame->set_tooltip_text(TTR("Animation position (in seconds).")); hb->add_child(memnew(VSeparator)); @@ -1683,7 +1682,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug hb->add_child(scale); scale->set_h_size_flags(SIZE_EXPAND_FILL); scale->set_stretch_ratio(1); - scale->set_tooltip(TTR("Scale animation playback globally for the node.")); + scale->set_tooltip_text(TTR("Scale animation playback globally for the node.")); scale->hide(); delete_dialog = memnew(ConfirmationDialog); @@ -1693,7 +1692,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug tool_anim = memnew(MenuButton); tool_anim->set_shortcut_context(this); tool_anim->set_flat(false); - tool_anim->set_tooltip(TTR("Animation Tools")); + tool_anim->set_tooltip_text(TTR("Animation Tools")); tool_anim->set_text(TTR("Animation")); tool_anim->get_popup()->add_shortcut(ED_SHORTCUT("animation_player_editor/new_animation", TTR("New")), TOOL_NEW_ANIM); tool_anim->get_popup()->add_separator(); @@ -1712,13 +1711,13 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug animation = memnew(OptionButton); hb->add_child(animation); animation->set_h_size_flags(SIZE_EXPAND_FILL); - animation->set_tooltip(TTR("Display list of animations in player.")); + animation->set_tooltip_text(TTR("Display list of animations in player.")); animation->set_clip_text(true); autoplay = memnew(Button); autoplay->set_flat(true); hb->add_child(autoplay); - autoplay->set_tooltip(TTR("Autoplay on Load")); + autoplay->set_tooltip_text(TTR("Autoplay on Load")); hb->add_child(memnew(VSeparator)); @@ -1731,12 +1730,12 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug onion_toggle = memnew(Button); onion_toggle->set_flat(true); onion_toggle->set_toggle_mode(true); - onion_toggle->set_tooltip(TTR("Enable Onion Skinning")); + onion_toggle->set_tooltip_text(TTR("Enable Onion Skinning")); onion_toggle->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu).bind(ONION_SKINNING_ENABLE)); hb->add_child(onion_toggle); onion_skinning = memnew(MenuButton); - onion_skinning->set_tooltip(TTR("Onion Skinning Options")); + onion_skinning->set_tooltip_text(TTR("Onion Skinning Options")); onion_skinning->get_popup()->add_separator(TTR("Directions")); // TRANSLATORS: Opposite of "Future", refers to a direction in animation onion skinning. onion_skinning->get_popup()->add_check_item(TTR("Past"), ONION_SKINNING_PAST); @@ -1759,7 +1758,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug pin = memnew(Button); pin->set_flat(true); pin->set_toggle_mode(true); - pin->set_tooltip(TTR("Pin AnimationPlayer")); + pin->set_tooltip_text(TTR("Pin AnimationPlayer")); hb->add_child(pin); pin->connect("pressed", callable_mp(this, &AnimationPlayerEditor::_pin_pressed)); diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 5d5d113262..be1e531cb8 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -476,9 +476,9 @@ void AnimationNodeStateMachineEditor::_state_machine_gui_input(const Ref<InputEv to = String(transition_lines[closest].multi_transitions[i].to_node); tooltip += "\n" + from + " -> " + to; } - state_machine_draw->set_tooltip(tooltip); + state_machine_draw->set_tooltip_text(tooltip); } else { - state_machine_draw->set_tooltip(""); + state_machine_draw->set_tooltip_text(""); } } } @@ -1544,9 +1544,10 @@ void AnimationNodeStateMachineEditor::_update_graph() { void AnimationNodeStateMachineEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: - case NOTIFICATION_TRANSLATION_CHANGED: - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_TRANSLATION_CHANGED: { error_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); error_label->add_theme_color_override("font_color", get_theme_color(SNAME("error_color"), SNAME("Editor"))); panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); @@ -1916,7 +1917,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->set_toggle_mode(true); tool_select->set_button_group(bg); tool_select->set_pressed(true); - tool_select->set_tooltip(TTR("Select and move nodes.\nRMB: Add node at position clicked.\nShift+LMB+Drag: Connects the selected node with another node or creates a new node if you select an area without nodes.")); + tool_select->set_tooltip_text(TTR("Select and move nodes.\nRMB: Add node at position clicked.\nShift+LMB+Drag: Connects the selected node with another node or creates a new node if you select an area without nodes.")); tool_select->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_create = memnew(Button); @@ -1924,7 +1925,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { top_hb->add_child(tool_create); tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); - tool_create->set_tooltip(TTR("Create new nodes.")); + tool_create->set_tooltip_text(TTR("Create new nodes.")); tool_create->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_connect = memnew(Button); @@ -1932,7 +1933,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { top_hb->add_child(tool_connect); tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); - tool_connect->set_tooltip(TTR("Connect nodes.")); + tool_connect->set_tooltip_text(TTR("Connect nodes.")); tool_connect->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_erase_hb = memnew(HBoxContainer); @@ -1941,21 +1942,21 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_group = memnew(Button); tool_group->set_flat(true); - tool_group->set_tooltip(TTR("Group Selected Node(s)") + " (Ctrl+G)"); + tool_group->set_tooltip_text(TTR("Group Selected Node(s)") + " (Ctrl+G)"); tool_group->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_group_selected_nodes)); tool_group->set_disabled(true); tool_erase_hb->add_child(tool_group); tool_ungroup = memnew(Button); tool_ungroup->set_flat(true); - tool_ungroup->set_tooltip(TTR("Ungroup Selected Node") + " (Ctrl+Shift+G)"); + tool_ungroup->set_tooltip_text(TTR("Ungroup Selected Node") + " (Ctrl+Shift+G)"); tool_ungroup->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_ungroup_selected_nodes)); tool_ungroup->set_visible(false); tool_erase_hb->add_child(tool_ungroup); tool_erase = memnew(Button); tool_erase->set_flat(true); - tool_erase->set_tooltip(TTR("Remove selected node or transition.")); + tool_erase->set_tooltip_text(TTR("Remove selected node or transition.")); tool_erase->connect("pressed", callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected).bind(false)); tool_erase->set_disabled(true); tool_erase_hb->add_child(tool_erase); diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 3c12d17c57..8ee162d085 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -193,6 +193,7 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const void EditorAssetLibraryItemDescription::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { previews_bg->add_theme_style_override("panel", previews->get_theme_stylebox(SNAME("normal"), SNAME("TextEdit"))); } break; @@ -400,6 +401,7 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse void EditorAssetLibraryItemDownload::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("AssetLib"))); status->add_theme_color_override("font_color", get_theme_color(SNAME("status_color"), SNAME("AssetLib"))); @@ -578,6 +580,7 @@ void EditorAssetLibrary::_notification(int p_what) { error_label->raise(); } break; + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { error_tr->set_texture(get_theme_icon(SNAME("Error"), SNAME("EditorIcons"))); filter->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 5db9249af1..c16dca00a3 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -294,7 +294,7 @@ void BoneMapper::create_editor() { clear_mapping_button = memnew(Button); clear_mapping_button->set_icon(get_theme_icon(SNAME("Clear"), SNAME("EditorIcons"))); - clear_mapping_button->set_tooltip(TTR("Clear mappings in current group.")); + clear_mapping_button->set_tooltip_text(TTR("Clear mappings in current group.")); clear_mapping_button->connect("pressed", callable_mp(this, &BoneMapper::_clear_mapping_current_group)); group_hbox->add_child(clear_mapping_button); diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 66cdd1f279..37c79d4974 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -4261,11 +4261,11 @@ void CanvasItemEditor::_insert_animation_keys(bool p_location, bool p_rotation, void CanvasItemEditor::_update_override_camera_button(bool p_game_running) { if (p_game_running) { override_camera_button->set_disabled(false); - override_camera_button->set_tooltip(TTR("Project Camera Override\nOverrides the running project's camera with the editor viewport camera.")); + override_camera_button->set_tooltip_text(TTR("Project Camera Override\nOverrides the running project's camera with the editor viewport camera.")); } else { override_camera_button->set_disabled(true); override_camera_button->set_pressed(false); - override_camera_button->set_tooltip(TTR("Project Camera Override\nNo project instance running. Run the project from the editor to use this feature.")); + override_camera_button->set_tooltip_text(TTR("Project Camera Override\nNo project instance running. Run the project from the editor to use this feature.")); } } @@ -5104,7 +5104,7 @@ CanvasItemEditor::CanvasItemEditor() { select_button->set_pressed(true); select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTR("Select Mode"), Key::Q)); select_button->set_shortcut_context(this); - select_button->set_tooltip(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Alt+Drag: Scale selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("RMB: Add node at position clicked.")); + select_button->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Alt+Drag: Scale selected node.") + "\n" + TTR("V: Set selected node's pivot position.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("RMB: Add node at position clicked.")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5115,7 +5115,7 @@ CanvasItemEditor::CanvasItemEditor() { move_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_MOVE)); move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTR("Move Mode"), Key::W)); move_button->set_shortcut_context(this); - move_button->set_tooltip(TTR("Move Mode")); + move_button->set_tooltip_text(TTR("Move Mode")); rotate_button = memnew(Button); rotate_button->set_flat(true); @@ -5124,7 +5124,7 @@ CanvasItemEditor::CanvasItemEditor() { rotate_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_ROTATE)); rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTR("Rotate Mode"), Key::E)); rotate_button->set_shortcut_context(this); - rotate_button->set_tooltip(TTR("Rotate Mode")); + rotate_button->set_tooltip_text(TTR("Rotate Mode")); scale_button = memnew(Button); scale_button->set_flat(true); @@ -5133,7 +5133,7 @@ CanvasItemEditor::CanvasItemEditor() { scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_SCALE)); scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTR("Scale Mode"), Key::S)); scale_button->set_shortcut_context(this); - scale_button->set_tooltip(TTR("Shift: Scale proportionally.")); + scale_button->set_tooltip_text(TTR("Shift: Scale proportionally.")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5142,14 +5142,14 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(list_select_button); list_select_button->set_toggle_mode(true); list_select_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_LIST_SELECT)); - list_select_button->set_tooltip(TTR("Show list of selectable nodes at position clicked.")); + list_select_button->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.")); pivot_button = memnew(Button); pivot_button->set_flat(true); main_menu_hbox->add_child(pivot_button); pivot_button->set_toggle_mode(true); pivot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_EDIT_PIVOT)); - pivot_button->set_tooltip(TTR("Click to change object's rotation pivot.")); + pivot_button->set_tooltip_text(TTR("Click to change object's rotation pivot.")); pan_button = memnew(Button); pan_button->set_flat(true); @@ -5158,7 +5158,7 @@ CanvasItemEditor::CanvasItemEditor() { pan_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_PAN)); pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTR("Pan Mode"), Key::G)); pan_button->set_shortcut_context(this); - pan_button->set_tooltip(TTR("You can also use Pan View shortcut (Space by default) to pan in any mode.")); + pan_button->set_tooltip_text(TTR("You can also use Pan View shortcut (Space by default) to pan in any mode.")); ruler_button = memnew(Button); ruler_button->set_flat(true); @@ -5167,7 +5167,7 @@ CanvasItemEditor::CanvasItemEditor() { ruler_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_RULER)); ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTR("Ruler Mode"), Key::R)); ruler_button->set_shortcut_context(this); - ruler_button->set_tooltip(TTR("Ruler Mode")); + ruler_button->set_tooltip_text(TTR("Ruler Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5176,7 +5176,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(smart_snap_button); smart_snap_button->set_toggle_mode(true); smart_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_smart_snap)); - smart_snap_button->set_tooltip(TTR("Toggle smart snapping.")); + smart_snap_button->set_tooltip_text(TTR("Toggle smart snapping.")); smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTR("Use Smart Snap"), KeyModifierMask::SHIFT | Key::S)); smart_snap_button->set_shortcut_context(this); @@ -5185,7 +5185,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(grid_snap_button); grid_snap_button->set_toggle_mode(true); grid_snap_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_grid_snap)); - grid_snap_button->set_tooltip(TTR("Toggle grid snapping.")); + grid_snap_button->set_tooltip_text(TTR("Toggle grid snapping.")); grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTR("Use Grid Snap"), KeyModifierMask::SHIFT | Key::G)); grid_snap_button->set_shortcut_context(this); @@ -5193,7 +5193,7 @@ CanvasItemEditor::CanvasItemEditor() { snap_config_menu->set_shortcut_context(this); main_menu_hbox->add_child(snap_config_menu); snap_config_menu->set_h_size_flags(SIZE_SHRINK_END); - snap_config_menu->set_tooltip(TTR("Snapping Options")); + snap_config_menu->set_tooltip_text(TTR("Snapping Options")); snap_config_menu->set_switch_on_hover(true); PopupMenu *p = snap_config_menu->get_popup(); @@ -5227,7 +5227,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(lock_button); lock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(LOCK_SELECTED)); - lock_button->set_tooltip(TTR("Lock selected node, preventing selection and movement.")); + lock_button->set_tooltip_text(TTR("Lock selected node, preventing selection and movement.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. lock_button->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD | Key::L)); @@ -5235,7 +5235,7 @@ CanvasItemEditor::CanvasItemEditor() { unlock_button->set_flat(true); main_menu_hbox->add_child(unlock_button); unlock_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNLOCK_SELECTED)); - unlock_button->set_tooltip(TTR("Unlock selected node, allowing selection and movement.")); + unlock_button->set_tooltip_text(TTR("Unlock selected node, allowing selection and movement.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. unlock_button->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::L)); @@ -5243,7 +5243,7 @@ CanvasItemEditor::CanvasItemEditor() { group_button->set_flat(true); main_menu_hbox->add_child(group_button); group_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(GROUP_SELECTED)); - group_button->set_tooltip(TTR("Make selected node's children not selectable.")); + group_button->set_tooltip_text(TTR("Make selected node's children not selectable.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. group_button->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD | Key::G)); @@ -5251,7 +5251,7 @@ CanvasItemEditor::CanvasItemEditor() { ungroup_button->set_flat(true); main_menu_hbox->add_child(ungroup_button); ungroup_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNGROUP_SELECTED)); - ungroup_button->set_tooltip(TTR("Make selected node's children selectable.")); + ungroup_button->set_tooltip_text(TTR("Make selected node's children selectable.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. ungroup_button->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::G)); @@ -5260,7 +5260,7 @@ CanvasItemEditor::CanvasItemEditor() { skeleton_menu = memnew(MenuButton); skeleton_menu->set_shortcut_context(this); main_menu_hbox->add_child(skeleton_menu); - skeleton_menu->set_tooltip(TTR("Skeleton Options")); + skeleton_menu->set_tooltip_text(TTR("Skeleton Options")); skeleton_menu->set_switch_on_hover(true); p = skeleton_menu->get_popup(); @@ -5340,7 +5340,7 @@ CanvasItemEditor::CanvasItemEditor() { key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); key_loc_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_POS)); - key_loc_button->set_tooltip(TTR("Translation mask for inserting keys.")); + key_loc_button->set_tooltip_text(TTR("Translation mask for inserting keys.")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -5349,7 +5349,7 @@ CanvasItemEditor::CanvasItemEditor() { key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); key_rot_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_ROT)); - key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys.")); + key_rot_button->set_tooltip_text(TTR("Rotation mask for inserting keys.")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); @@ -5357,14 +5357,14 @@ CanvasItemEditor::CanvasItemEditor() { key_scale_button->set_toggle_mode(true); key_scale_button->set_focus_mode(FOCUS_NONE); key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_SCALE)); - key_scale_button->set_tooltip(TTR("Scale mask for inserting keys.")); + key_scale_button->set_tooltip_text(TTR("Scale mask for inserting keys.")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); key_insert_button->set_flat(true); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_KEY)); - key_insert_button->set_tooltip(TTR("Insert keys (based on mask).")); + key_insert_button->set_tooltip_text(TTR("Insert keys (based on mask).")); key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTR("Insert Key"), Key::INSERT)); key_insert_button->set_shortcut_context(this); animation_hb->add_child(key_insert_button); @@ -5373,14 +5373,14 @@ CanvasItemEditor::CanvasItemEditor() { key_auto_insert_button->set_flat(true); key_auto_insert_button->set_toggle_mode(true); key_auto_insert_button->set_focus_mode(FOCUS_NONE); - key_auto_insert_button->set_tooltip(TTR("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time.")); + key_auto_insert_button->set_tooltip_text(TTR("Auto insert keys when objects are translated, rotated or scaled (based on mask).\nKeys are only added to existing tracks, no new tracks will be created.\nKeys must be inserted manually for the first time.")); key_auto_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_auto_insert_key", TTR("Auto Insert Key"))); key_auto_insert_button->set_shortcut_context(this); animation_hb->add_child(key_auto_insert_button); animation_menu = memnew(MenuButton); animation_menu->set_shortcut_context(this); - animation_menu->set_tooltip(TTR("Animation Key and Pose Options")); + animation_menu->set_tooltip_text(TTR("Animation Key and Pose Options")); animation_hb->add_child(animation_menu); animation_menu->get_popup()->connect("id_pressed", callable_mp(this, &CanvasItemEditor::_popup_callback)); animation_menu->set_switch_on_hover(true); @@ -5856,21 +5856,26 @@ Node *CanvasItemEditorViewport::_make_texture_node_type(String texture_node_type return node; } +void CanvasItemEditorViewport::_update_theme() { + List<BaseButton *> btn_list; + button_group->get_buttons(&btn_list); + + for (int i = 0; i < btn_list.size(); i++) { + CheckBox *check = Object::cast_to<CheckBox>(btn_list[i]); + check->set_icon(get_theme_icon(check->get_text(), SNAME("EditorIcons"))); + } + + label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); +} + void CanvasItemEditorViewport::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { - List<BaseButton *> btn_list; - button_group->get_buttons(&btn_list); - - for (int i = 0; i < btn_list.size(); i++) { - CheckBox *check = Object::cast_to<CheckBox>(btn_list[i]); - check->set_icon(get_theme_icon(check->get_text(), SNAME("EditorIcons"))); - } - - label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + _update_theme(); } break; case NOTIFICATION_ENTER_TREE: { + _update_theme(); connect("mouse_exited", callable_mp(this, &CanvasItemEditorViewport::_on_mouse_exit)); } break; diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index a4107c009e..0a840d6fd6 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -616,6 +616,7 @@ class CanvasItemEditorViewport : public Control { bool _create_instance(Node *parent, String &path, const Point2 &p_point); void _perform_drop_data(); void _show_resource_type_selector(); + void _update_theme(); static void _bind_methods(); diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index cd87208307..69f32a3a98 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -69,14 +69,14 @@ void ControlPositioningWarning::_update_toggler() { Ref<Texture2D> arrow; if (hint_label->is_visible()) { arrow = get_theme_icon(SNAME("arrow"), SNAME("Tree")); - set_tooltip(TTR("Collapse positioning hint.")); + set_tooltip_text(TTR("Collapse positioning hint.")); } else { if (is_layout_rtl()) { arrow = get_theme_icon(SNAME("arrow_collapsed"), SNAME("Tree")); } else { arrow = get_theme_icon(SNAME("arrow_collapsed_mirrored"), SNAME("Tree")); } - set_tooltip(TTR("Expand positioning hint.")); + set_tooltip_text(TTR("Expand positioning hint.")); } hint_icon->set_texture(arrow); @@ -102,6 +102,7 @@ void ControlPositioningWarning::gui_input(const Ref<InputEvent> &p_event) { void ControlPositioningWarning::_notification(int p_notification) { switch (p_notification) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: _update_warning(); _update_toggler(); @@ -491,6 +492,7 @@ void ControlEditorPopupButton::_popup_visibility_changed(bool p_visible) { void ControlEditorPopupButton::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { arrow_icon = get_theme_icon("select_arrow", "Tree"); } break; @@ -536,7 +538,7 @@ void ControlEditorPresetPicker::_add_row_button(HBoxContainer *p_row, const int Button *b = memnew(Button); b->set_custom_minimum_size(Size2i(36, 36) * EDSCALE); b->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER); - b->set_tooltip(p_name); + b->set_tooltip_text(p_name); b->set_flat(true); p_row->add_child(b); b->connect("pressed", callable_mp(this, &ControlEditorPresetPicker::_preset_button_pressed).bind(p_preset)); @@ -556,6 +558,7 @@ void AnchorPresetPicker::_preset_button_pressed(const int p_preset) { void AnchorPresetPicker::_notification(int p_notification) { switch (p_notification) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { preset_buttons[PRESET_TOP_LEFT]->set_icon(get_theme_icon(SNAME("ControlAlignTopLeft"), SNAME("EditorIcons"))); preset_buttons[PRESET_CENTER_TOP]->set_icon(get_theme_icon(SNAME("ControlAlignCenterTop"), SNAME("EditorIcons"))); @@ -655,15 +658,16 @@ void SizeFlagPresetPicker::set_allowed_flags(Vector<SizeFlags> &p_flags) { expand_button->set_disabled(!p_flags.has(SIZE_EXPAND)); if (p_flags.has(SIZE_EXPAND)) { - expand_button->set_tooltip(TTR("Enable to also set the Expand flag.\nDisable to only set Shrink/Fill flags.")); + expand_button->set_tooltip_text(TTR("Enable to also set the Expand flag.\nDisable to only set Shrink/Fill flags.")); } else { expand_button->set_pressed(false); - expand_button->set_tooltip(TTR("Some parents of the selected nodes do not support the Expand flag.")); + expand_button->set_tooltip_text(TTR("Some parents of the selected nodes do not support the Expand flag.")); } } void SizeFlagPresetPicker::_notification(int p_notification) { switch (p_notification) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (vertical) { preset_buttons[SIZE_SHRINK_BEGIN]->set_icon(get_theme_icon(SNAME("ControlAlignCenterTop"), SNAME("EditorIcons"))); @@ -706,7 +710,7 @@ SizeFlagPresetPicker::SizeFlagPresetPicker(bool p_vertical) { expand_button = memnew(CheckBox); expand_button->set_flat(true); expand_button->set_text(TTR("Align with Expand")); - expand_button->set_tooltip(TTR("Enable to also set the Expand flag.\nDisable to only set Shrink/Fill flags.")); + expand_button->set_tooltip_text(TTR("Enable to also set the Expand flag.\nDisable to only set Shrink/Fill flags.")); main_vb->add_child(expand_button); } @@ -970,6 +974,7 @@ void ControlEditorToolbar::_selection_changed() { void ControlEditorToolbar::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { anchors_button->set_icon(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons"))); anchor_mode_button->set_icon(get_theme_icon(SNAME("Anchor"), SNAME("EditorIcons"))); @@ -983,7 +988,7 @@ ControlEditorToolbar::ControlEditorToolbar() { // Anchor and offset tools. anchors_button = memnew(ControlEditorPopupButton); - anchors_button->set_tooltip(TTR("Presets for the anchor and offset values of a Control node.")); + anchors_button->set_tooltip_text(TTR("Presets for the anchor and offset values of a Control node.")); add_child(anchors_button); Label *anchors_label = memnew(Label); @@ -999,20 +1004,20 @@ ControlEditorToolbar::ControlEditorToolbar() { Button *keep_ratio_button = memnew(Button); keep_ratio_button->set_text_alignment(HORIZONTAL_ALIGNMENT_LEFT); keep_ratio_button->set_text(TTR("Set to Current Ratio")); - keep_ratio_button->set_tooltip(TTR("Adjust anchors and offsets to match the current rect size.")); + keep_ratio_button->set_tooltip_text(TTR("Adjust anchors and offsets to match the current rect size.")); anchors_button->get_popup_hbox()->add_child(keep_ratio_button); keep_ratio_button->connect("pressed", callable_mp(this, &ControlEditorToolbar::_anchors_to_current_ratio)); anchor_mode_button = memnew(Button); anchor_mode_button->set_flat(true); anchor_mode_button->set_toggle_mode(true); - anchor_mode_button->set_tooltip(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); + anchor_mode_button->set_tooltip_text(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); add_child(anchor_mode_button); anchor_mode_button->connect("toggled", callable_mp(this, &ControlEditorToolbar::_anchor_mode_toggled)); // Container tools. containers_button = memnew(ControlEditorPopupButton); - containers_button->set_tooltip(TTR("Sizing settings for children of a Container node.")); + containers_button->set_tooltip_text(TTR("Sizing settings for children of a Container node.")); add_child(containers_button); Label *container_h_label = memnew(Label); diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index 727db2416c..935b0a5501 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -152,6 +152,7 @@ bool EditorPropertyFontOTObject::_property_get_revert(const StringName &p_name, void EditorPropertyFontMetaOverride::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (Object::cast_to<Button>(button_add)) { button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); @@ -289,7 +290,7 @@ void EditorPropertyFontMetaOverride::update_property() { } else { prop->set_label(TranslationServer::get_singleton()->get_locale_name(name)); } - prop->set_tooltip(name); + prop->set_tooltip_text(name); prop->set_selectable(false); prop->connect("property_changed", callable_mp(this, &EditorPropertyFontMetaOverride::_property_changed)); @@ -379,6 +380,14 @@ EditorPropertyFontMetaOverride::EditorPropertyFontMetaOverride(bool p_script) { /* EditorPropertyOTVariation */ /*************************************************************************/ +void EditorPropertyOTVariation::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_THEME_CHANGED: { + } break; + } +} + void EditorPropertyOTVariation::_property_changed(const String &p_property, Variant p_value, const String &p_name, bool p_changing) { if (p_property.begins_with("keys")) { Dictionary dict = object->get_dict(); @@ -478,7 +487,7 @@ void EditorPropertyOTVariation::update_property() { String name = TS->tag_to_name(name_tag); prop->set_label(name.capitalize()); - prop->set_tooltip(name); + prop->set_tooltip_text(name); prop->set_selectable(false); prop->connect("property_changed", callable_mp(this, &EditorPropertyOTVariation::_property_changed)); @@ -538,6 +547,7 @@ EditorPropertyOTVariation::EditorPropertyOTVariation() { void EditorPropertyOTFeatures::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { if (Object::cast_to<Button>(button_add)) { button_add->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); @@ -756,7 +766,7 @@ void EditorPropertyOTFeatures::update_property() { disp_name = vformat("%s (%s)", disp_name, info["label"].operator String()); } prop->set_label(disp_name); - prop->set_tooltip(name); + prop->set_tooltip_text(name); prop->set_selectable(false); prop->connect("property_changed", callable_mp(this, &EditorPropertyOTFeatures::_property_changed)); diff --git a/editor/plugins/font_config_plugin.h b/editor/plugins/font_config_plugin.h index ae138bab8f..41dde3cc59 100644 --- a/editor/plugins/font_config_plugin.h +++ b/editor/plugins/font_config_plugin.h @@ -139,6 +139,7 @@ class EditorPropertyOTVariation : public EditorProperty { EditorPaginator *paginator = nullptr; protected: + void _notification(int p_what); static void _bind_methods(){}; void _edit_pressed(); diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp index b54cb515e4..59d665342f 100644 --- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp @@ -101,7 +101,7 @@ void GPUParticlesCollisionSDF3DEditorPlugin::_notification(int p_what) { return; } - bake->set_tooltip(text); + bake->set_tooltip_text(text); } break; } } diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index 460178490e..f368d5bea1 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -135,7 +135,7 @@ void EditorInspectorPluginGradient::parse_begin(Object *p_object) { add_custom_control(gradient_tools_hbox); reverse_btn->connect("pressed", callable_mp(this, &EditorInspectorPluginGradient::_reverse_button_pressed)); - reverse_btn->set_tooltip(TTR("Reverse/mirror gradient.")); + reverse_btn->set_tooltip_text(TTR("Reverse/mirror gradient.")); } void EditorInspectorPluginGradient::_reverse_button_pressed() { diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp index cacde1ce76..5aaf450d3f 100644 --- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp @@ -104,6 +104,7 @@ void GradientTexture2DEditorRect::set_snap_size(float p_snap_size) { void GradientTexture2DEditorRect::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { checkerboard->set_texture(get_theme_icon(SNAME("GuiMiniCheckerboard"), SNAME("EditorIcons"))); } break; @@ -213,6 +214,7 @@ void GradientTexture2DEditor::set_texture(Ref<GradientTexture2D> &p_texture) { void GradientTexture2DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { reverse_button->set_icon(get_theme_icon(SNAME("ReverseGradient"), SNAME("EditorIcons"))); snap_button->set_icon(get_theme_icon(SNAME("SnapGrid"), SNAME("EditorIcons"))); @@ -227,14 +229,14 @@ GradientTexture2DEditor::GradientTexture2DEditor() { add_child(toolbar); reverse_button = memnew(Button); - reverse_button->set_tooltip(TTR("Swap Gradient Fill Points")); + reverse_button->set_tooltip_text(TTR("Swap Gradient Fill Points")); toolbar->add_child(reverse_button); reverse_button->connect("pressed", callable_mp(this, &GradientTexture2DEditor::_reverse_button_pressed)); toolbar->add_child(memnew(VSeparator)); snap_button = memnew(Button); - snap_button->set_tooltip(TTR("Toggle Grid Snap")); + snap_button->set_tooltip_text(TTR("Toggle Grid Snap")); snap_button->set_toggle_mode(true); toolbar->add_child(snap_button); snap_button->connect("toggled", callable_mp(this, &GradientTexture2DEditor::_set_snap_enabled)); diff --git a/editor/plugins/input_event_editor_plugin.cpp b/editor/plugins/input_event_editor_plugin.cpp index 6b323e0e57..153eab32d2 100644 --- a/editor/plugins/input_event_editor_plugin.cpp +++ b/editor/plugins/input_event_editor_plugin.cpp @@ -35,6 +35,7 @@ void InputEventConfigContainer::_bind_methods() { void InputEventConfigContainer::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { open_config_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); } break; diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index b501b90dfe..f165b83999 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -5818,11 +5818,11 @@ void Node3DEditor::_update_camera_override_button(bool p_game_running) { if (p_game_running) { button->set_disabled(false); - button->set_tooltip(TTR("Project Camera Override\nOverrides the running project's camera with the editor viewport camera.")); + button->set_tooltip_text(TTR("Project Camera Override\nOverrides the running project's camera with the editor viewport camera.")); } else { button->set_disabled(true); button->set_pressed(false); - button->set_tooltip(TTR("Project Camera Override\nNo project instance running. Run the project from the editor to use this feature.")); + button->set_tooltip_text(TTR("Project Camera Override\nNo project instance running. Run the project from the editor to use this feature.")); } } @@ -7134,6 +7134,42 @@ void Node3DEditor::_add_environment_to_scene(bool p_already_added_sun) { undo_redo->commit_action(); } +void Node3DEditor::_update_theme() { + tool_button[TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons"))); + tool_button[TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons"))); + tool_button[TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons"))); + tool_button[TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons"))); + tool_button[TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons"))); + tool_button[TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons"))); + tool_button[TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons"))); + tool_button[TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons"))); + tool_button[TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons"))); + + tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons"))); + tool_option_button[TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); + tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons"))); + + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons"))); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons"))); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels2Alt"), SNAME("EditorIcons"))); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon(SNAME("Panels3"), SNAME("EditorIcons"))); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons"))); + view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons"))); + + sun_button->set_icon(get_theme_icon(SNAME("DirectionalLight3D"), SNAME("EditorIcons"))); + environ_button->set_icon(get_theme_icon(SNAME("WorldEnvironment"), SNAME("EditorIcons"))); + sun_environ_settings->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); + + sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); + environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); + + sun_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); + environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); + environ_ground_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); + + context_menu_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("ContextualToolbar"), SNAME("EditorStyles"))); +} + void Node3DEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { @@ -7156,6 +7192,7 @@ void Node3DEditor::_notification(int p_what) { } break; case NOTIFICATION_ENTER_TREE: { + _update_theme(); _register_all_gizmos(); _update_gizmos_menu(); _init_indicators(); @@ -7167,40 +7204,7 @@ void Node3DEditor::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - tool_button[TOOL_MODE_SELECT]->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons"))); - tool_button[TOOL_MODE_MOVE]->set_icon(get_theme_icon(SNAME("ToolMove"), SNAME("EditorIcons"))); - tool_button[TOOL_MODE_ROTATE]->set_icon(get_theme_icon(SNAME("ToolRotate"), SNAME("EditorIcons"))); - tool_button[TOOL_MODE_SCALE]->set_icon(get_theme_icon(SNAME("ToolScale"), SNAME("EditorIcons"))); - tool_button[TOOL_MODE_LIST_SELECT]->set_icon(get_theme_icon(SNAME("ListSelect"), SNAME("EditorIcons"))); - tool_button[TOOL_LOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Lock"), SNAME("EditorIcons"))); - tool_button[TOOL_UNLOCK_SELECTED]->set_icon(get_theme_icon(SNAME("Unlock"), SNAME("EditorIcons"))); - tool_button[TOOL_GROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Group"), SNAME("EditorIcons"))); - tool_button[TOOL_UNGROUP_SELECTED]->set_icon(get_theme_icon(SNAME("Ungroup"), SNAME("EditorIcons"))); - - tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_icon(get_theme_icon(SNAME("Object"), SNAME("EditorIcons"))); - tool_option_button[TOOL_OPT_USE_SNAP]->set_icon(get_theme_icon(SNAME("Snap"), SNAME("EditorIcons"))); - tool_option_button[TOOL_OPT_OVERRIDE_CAMERA]->set_icon(get_theme_icon(SNAME("Camera3D"), SNAME("EditorIcons"))); - - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_1_VIEWPORT), get_theme_icon(SNAME("Panels1"), SNAME("EditorIcons"))); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS), get_theme_icon(SNAME("Panels2"), SNAME("EditorIcons"))); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_2_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels2Alt"), SNAME("EditorIcons"))); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS), get_theme_icon(SNAME("Panels3"), SNAME("EditorIcons"))); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_3_VIEWPORTS_ALT), get_theme_icon(SNAME("Panels3Alt"), SNAME("EditorIcons"))); - view_menu->get_popup()->set_item_icon(view_menu->get_popup()->get_item_index(MENU_VIEW_USE_4_VIEWPORTS), get_theme_icon(SNAME("Panels4"), SNAME("EditorIcons"))); - - sun_button->set_icon(get_theme_icon(SNAME("DirectionalLight3D"), SNAME("EditorIcons"))); - environ_button->set_icon(get_theme_icon(SNAME("WorldEnvironment"), SNAME("EditorIcons"))); - sun_environ_settings->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); - - sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); - environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); - - sun_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); - environ_sky_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); - environ_ground_color->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); - - context_menu_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("ContextualToolbar"), SNAME("EditorStyles"))); - + _update_theme(); _update_gizmos_menu_theme(); sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); @@ -7743,7 +7747,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_SELECT)); tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTR("Select Mode"), Key::Q)); tool_button[TOOL_MODE_SELECT]->set_shortcut_context(this); - tool_button[TOOL_MODE_SELECT]->set_tooltip(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.")); + tool_button[TOOL_MODE_SELECT]->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.")); main_menu_hbox->add_child(memnew(VSeparator)); tool_button[TOOL_MODE_MOVE] = memnew(Button); @@ -7778,13 +7782,13 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_LIST_SELECT]->set_toggle_mode(true); tool_button[TOOL_MODE_LIST_SELECT]->set_flat(true); tool_button[TOOL_MODE_LIST_SELECT]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_LIST_SELECT)); - tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip(TTR("Show list of selectable nodes at position clicked.")); + tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.")); tool_button[TOOL_LOCK_SELECTED] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]); tool_button[TOOL_LOCK_SELECTED]->set_flat(true); tool_button[TOOL_LOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_LOCK_SELECTED)); - tool_button[TOOL_LOCK_SELECTED]->set_tooltip(TTR("Lock selected node, preventing selection and movement.")); + tool_button[TOOL_LOCK_SELECTED]->set_tooltip_text(TTR("Lock selected node, preventing selection and movement.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. tool_button[TOOL_LOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/lock_selected_nodes", TTR("Lock Selected Node(s)"), KeyModifierMask::CMD | Key::L)); @@ -7792,7 +7796,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]); tool_button[TOOL_UNLOCK_SELECTED]->set_flat(true); tool_button[TOOL_UNLOCK_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNLOCK_SELECTED)); - tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip(TTR("Unlock selected node, allowing selection and movement.")); + tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip_text(TTR("Unlock selected node, allowing selection and movement.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. tool_button[TOOL_UNLOCK_SELECTED]->set_shortcut(ED_SHORTCUT("editor/unlock_selected_nodes", TTR("Unlock Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::L)); @@ -7800,7 +7804,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]); tool_button[TOOL_GROUP_SELECTED]->set_flat(true); tool_button[TOOL_GROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_GROUP_SELECTED)); - tool_button[TOOL_GROUP_SELECTED]->set_tooltip(TTR("Make selected node's children not selectable.")); + tool_button[TOOL_GROUP_SELECTED]->set_tooltip_text(TTR("Make selected node's children not selectable.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. tool_button[TOOL_GROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/group_selected_nodes", TTR("Group Selected Node(s)"), KeyModifierMask::CMD | Key::G)); @@ -7808,7 +7812,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]); tool_button[TOOL_UNGROUP_SELECTED]->set_flat(true); tool_button[TOOL_UNGROUP_SELECTED]->connect("pressed", callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_UNGROUP_SELECTED)); - tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip(TTR("Make selected node's children selectable.")); + tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip_text(TTR("Make selected node's children selectable.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. tool_button[TOOL_UNGROUP_SELECTED]->set_shortcut(ED_SHORTCUT("editor/ungroup_selected_nodes", TTR("Ungroup Selected Node(s)"), KeyModifierMask::CMD | KeyModifierMask::SHIFT | Key::G)); @@ -7842,7 +7846,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(memnew(VSeparator)); sun_button = memnew(Button); - sun_button->set_tooltip(TTR("Toggle preview sunlight.\nIf a DirectionalLight3D node is added to the scene, preview sunlight is disabled.")); + sun_button->set_tooltip_text(TTR("Toggle preview sunlight.\nIf a DirectionalLight3D node is added to the scene, preview sunlight is disabled.")); sun_button->set_toggle_mode(true); sun_button->set_flat(true); sun_button->connect("pressed", callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); @@ -7851,7 +7855,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(sun_button); environ_button = memnew(Button); - environ_button->set_tooltip(TTR("Toggle preview environment.\nIf a WorldEnvironment node is added to the scene, preview environment is disabled.")); + environ_button->set_tooltip_text(TTR("Toggle preview environment.\nIf a WorldEnvironment node is added to the scene, preview environment is disabled.")); environ_button->set_toggle_mode(true); environ_button->set_flat(true); environ_button->connect("pressed", callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); @@ -7860,7 +7864,7 @@ Node3DEditor::Node3DEditor() { main_menu_hbox->add_child(environ_button); sun_environ_settings = memnew(Button); - sun_environ_settings->set_tooltip(TTR("Edit Sun and Environment settings.")); + sun_environ_settings->set_tooltip_text(TTR("Edit Sun and Environment settings.")); sun_environ_settings->set_flat(true); sun_environ_settings->connect("pressed", callable_mp(this, &Node3DEditor::_sun_environ_settings_pressed)); @@ -8218,7 +8222,7 @@ void fragment() { sun_add_to_scene = memnew(Button); sun_add_to_scene->set_text(TTR("Add Sun to Scene")); - sun_add_to_scene->set_tooltip(TTR("Adds a DirectionalLight3D node matching the preview sun settings to the current scene.\nHold Shift while clicking to also add the preview environment to the current scene.")); + sun_add_to_scene->set_tooltip_text(TTR("Adds a DirectionalLight3D node matching the preview sun settings to the current scene.\nHold Shift while clicking to also add the preview environment to the current scene.")); sun_add_to_scene->connect("pressed", callable_mp(this, &Node3DEditor::_add_sun_to_scene).bind(false)); sun_vb->add_spacer(); sun_vb->add_child(sun_add_to_scene); @@ -8287,7 +8291,7 @@ void fragment() { environ_add_to_scene = memnew(Button); environ_add_to_scene->set_text(TTR("Add Environment to Scene")); - environ_add_to_scene->set_tooltip(TTR("Adds a WorldEnvironment node matching the preview environment settings to the current scene.\nHold Shift while clicking to also add the preview sun to the current scene.")); + environ_add_to_scene->set_tooltip_text(TTR("Adds a WorldEnvironment node matching the preview environment settings to the current scene.\nHold Shift while clicking to also add the preview sun to the current scene.")); environ_add_to_scene->connect("pressed", callable_mp(this, &Node3DEditor::_add_environment_to_scene).bind(false)); environ_vb->add_spacer(); environ_vb->add_child(environ_add_to_scene); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index e07374dd49..e0298ebd5f 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -778,6 +778,8 @@ private: void _add_sun_to_scene(bool p_already_added_environment = false); void _add_environment_to_scene(bool p_already_added_sun = false); + void _update_theme(); + protected: void _notification(int p_what); //void _gui_input(InputEvent p_event); diff --git a/editor/plugins/packed_scene_translation_parser_plugin.cpp b/editor/plugins/packed_scene_translation_parser_plugin.cpp index 8d083d28b2..2f4ae734d1 100644 --- a/editor/plugins/packed_scene_translation_parser_plugin.cpp +++ b/editor/plugins/packed_scene_translation_parser_plugin.cpp @@ -123,7 +123,7 @@ Error PackedSceneEditorTranslationParserPlugin::parse_file(const String &p_path, PackedSceneEditorTranslationParserPlugin::PackedSceneEditorTranslationParserPlugin() { // Scene Node's properties containing strings that will be fetched for translation. lookup_properties.insert("text"); - lookup_properties.insert("hint_tooltip"); + lookup_properties.insert("tooltip_text"); lookup_properties.insert("placeholder_text"); lookup_properties.insert("items"); lookup_properties.insert("title"); diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index f9fe05dc54..dc6dfd81c2 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -40,6 +40,7 @@ void Path2DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { curve_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons"))); curve_edit_curve->set_icon(get_theme_icon(SNAME("CurveCurve"), SNAME("EditorIcons"))); @@ -536,7 +537,7 @@ Path2DEditor::Path2DEditor() { curve_edit->set_flat(true); curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); - curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); + curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); curve_edit->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_EDIT)); base_hb->add_child(curve_edit); @@ -544,7 +545,7 @@ Path2DEditor::Path2DEditor() { curve_edit_curve->set_flat(true); curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); - curve_edit_curve->set_tooltip(TTR("Select Control Points (Shift+Drag)")); + curve_edit_curve->set_tooltip_text(TTR("Select Control Points (Shift+Drag)")); curve_edit_curve->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_EDIT_CURVE)); base_hb->add_child(curve_edit_curve); @@ -552,7 +553,7 @@ Path2DEditor::Path2DEditor() { curve_create->set_flat(true); curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); - curve_create->set_tooltip(TTR("Add Point (in empty space)")); + curve_create->set_tooltip_text(TTR("Add Point (in empty space)")); curve_create->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_CREATE)); base_hb->add_child(curve_create); @@ -560,14 +561,14 @@ Path2DEditor::Path2DEditor() { curve_del->set_flat(true); curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); - curve_del->set_tooltip(TTR("Delete Point")); + curve_del->set_tooltip_text(TTR("Delete Point")); curve_del->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_DELETE)); base_hb->add_child(curve_del); curve_close = memnew(Button); curve_close->set_flat(true); curve_close->set_focus_mode(Control::FOCUS_NONE); - curve_close->set_tooltip(TTR("Close Curve")); + curve_close->set_tooltip_text(TTR("Close Curve")); curve_close->connect("pressed", callable_mp(this, &Path2DEditor::_mode_selected).bind(ACTION_CLOSE)); base_hb->add_child(curve_close); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 5853eaaf39..1029b06638 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -563,6 +563,8 @@ void Path3DEditorPlugin::_notification(int p_what) { curve_edit->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(1)); curve_del->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(2)); curve_close->connect("pressed", callable_mp(this, &Path3DEditorPlugin::_close_curve)); + + _update_theme(); } break; case NOTIFICATION_READY: { @@ -595,7 +597,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_edit->set_toggle_mode(true); curve_edit->hide(); curve_edit->set_focus_mode(Control::FOCUS_NONE); - curve_edit->set_tooltip(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); + curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_edit); curve_create = memnew(Button); @@ -603,7 +605,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_create->set_toggle_mode(true); curve_create->hide(); curve_create->set_focus_mode(Control::FOCUS_NONE); - curve_create->set_tooltip(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); + curve_create->set_tooltip_text(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_create); curve_del = memnew(Button); @@ -611,14 +613,14 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_del->set_toggle_mode(true); curve_del->hide(); curve_del->set_focus_mode(Control::FOCUS_NONE); - curve_del->set_tooltip(TTR("Delete Point")); + curve_del->set_tooltip_text(TTR("Delete Point")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_del); curve_close = memnew(Button); curve_close->set_flat(true); curve_close->hide(); curve_close->set_focus_mode(Control::FOCUS_NONE); - curve_close->set_tooltip(TTR("Close Curve")); + curve_close->set_tooltip_text(TTR("Close Curve")); Node3DEditor::get_singleton()->add_control_to_menu_panel(curve_close); PopupMenu *menu; diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index eea6573905..b71cee8882 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -91,8 +91,8 @@ void Polygon2DEditor::_notification(int p_what) { uv_vscroll->set_anchors_and_offsets_preset(PRESET_RIGHT_WIDE); uv_hscroll->set_anchors_and_offsets_preset(PRESET_BOTTOM_WIDE); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { uv_edit_draw->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); bone_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); @@ -1237,7 +1237,7 @@ Polygon2DEditor::Polygon2DEditor() { button_uv = memnew(Button); button_uv->set_flat(true); add_child(button_uv); - button_uv->set_tooltip(TTR("Open Polygon 2D UV editor.")); + button_uv->set_tooltip_text(TTR("Open Polygon 2D UV editor.")); button_uv->connect("pressed", callable_mp(this, &Polygon2DEditor::_menu_option).bind(MODE_EDIT_UV)); uv_mode = UV_MODE_EDIT_POINT; @@ -1293,17 +1293,17 @@ Polygon2DEditor::Polygon2DEditor() { uv_button[i]->set_focus_mode(FOCUS_NONE); } - uv_button[UV_MODE_CREATE]->set_tooltip(TTR("Create Polygon")); - uv_button[UV_MODE_CREATE_INTERNAL]->set_tooltip(TTR("Create Internal Vertex")); - uv_button[UV_MODE_REMOVE_INTERNAL]->set_tooltip(TTR("Remove Internal Vertex")); - uv_button[UV_MODE_EDIT_POINT]->set_tooltip(TTR("Move Points") + "\n" + TTR("Ctrl: Rotate") + "\n" + TTR("Shift: Move All") + "\n" + TTR("Shift+Ctrl: Scale")); - uv_button[UV_MODE_MOVE]->set_tooltip(TTR("Move Polygon")); - uv_button[UV_MODE_ROTATE]->set_tooltip(TTR("Rotate Polygon")); - uv_button[UV_MODE_SCALE]->set_tooltip(TTR("Scale Polygon")); - uv_button[UV_MODE_ADD_POLYGON]->set_tooltip(TTR("Create a custom polygon. Enables custom polygon rendering.")); - uv_button[UV_MODE_REMOVE_POLYGON]->set_tooltip(TTR("Remove a custom polygon. If none remain, custom polygon rendering is disabled.")); - uv_button[UV_MODE_PAINT_WEIGHT]->set_tooltip(TTR("Paint weights with specified intensity.")); - uv_button[UV_MODE_CLEAR_WEIGHT]->set_tooltip(TTR("Unpaint weights with specified intensity.")); + uv_button[UV_MODE_CREATE]->set_tooltip_text(TTR("Create Polygon")); + uv_button[UV_MODE_CREATE_INTERNAL]->set_tooltip_text(TTR("Create Internal Vertex")); + uv_button[UV_MODE_REMOVE_INTERNAL]->set_tooltip_text(TTR("Remove Internal Vertex")); + uv_button[UV_MODE_EDIT_POINT]->set_tooltip_text(TTR("Move Points") + "\n" + TTR("Ctrl: Rotate") + "\n" + TTR("Shift: Move All") + "\n" + TTR("Shift+Ctrl: Scale")); + uv_button[UV_MODE_MOVE]->set_tooltip_text(TTR("Move Polygon")); + uv_button[UV_MODE_ROTATE]->set_tooltip_text(TTR("Rotate Polygon")); + uv_button[UV_MODE_SCALE]->set_tooltip_text(TTR("Scale Polygon")); + uv_button[UV_MODE_ADD_POLYGON]->set_tooltip_text(TTR("Create a custom polygon. Enables custom polygon rendering.")); + uv_button[UV_MODE_REMOVE_POLYGON]->set_tooltip_text(TTR("Remove a custom polygon. If none remain, custom polygon rendering is disabled.")); + uv_button[UV_MODE_PAINT_WEIGHT]->set_tooltip_text(TTR("Paint weights with specified intensity.")); + uv_button[UV_MODE_CLEAR_WEIGHT]->set_tooltip_text(TTR("Unpaint weights with specified intensity.")); uv_button[UV_MODE_CREATE]->hide(); uv_button[UV_MODE_CREATE_INTERNAL]->hide(); @@ -1368,7 +1368,7 @@ Polygon2DEditor::Polygon2DEditor() { b_snap_enable->set_focus_mode(FOCUS_NONE); b_snap_enable->set_toggle_mode(true); b_snap_enable->set_pressed(use_snap); - b_snap_enable->set_tooltip(TTR("Enable Snap")); + b_snap_enable->set_tooltip_text(TTR("Enable Snap")); b_snap_enable->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_use_snap)); b_snap_grid = memnew(Button); @@ -1378,7 +1378,7 @@ Polygon2DEditor::Polygon2DEditor() { b_snap_grid->set_focus_mode(FOCUS_NONE); b_snap_grid->set_toggle_mode(true); b_snap_grid->set_pressed(snap_show_grid); - b_snap_grid->set_tooltip(TTR("Show Grid")); + b_snap_grid->set_tooltip_text(TTR("Show Grid")); b_snap_grid->connect("toggled", callable_mp(this, &Polygon2DEditor::_set_show_grid)); grid_settings = memnew(AcceptDialog); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 694fe67310..80566419b1 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -39,6 +39,7 @@ void ResourcePreloaderEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { load->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); } break; @@ -355,7 +356,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { vbc->add_child(hbc); load = memnew(Button); - load->set_tooltip(TTR("Load Resource")); + load->set_tooltip_text(TTR("Load Resource")); hbc->add_child(load); paste = memnew(Button); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 6e153a87ff..de30c4100d 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -198,7 +198,7 @@ void EditorPropertyRootMotion::_node_clear() { void EditorPropertyRootMotion::update_property() { NodePath p = get_edited_object()->get(get_edited_property()); - assign->set_tooltip(p); + assign->set_tooltip_text(p); if (p == NodePath()) { assign->set_icon(Ref<Texture2D>()); assign->set_text(TTR("Assign...")); @@ -234,6 +234,7 @@ void EditorPropertyRootMotion::setup(const NodePath &p_base_hint) { void EditorPropertyRootMotion::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { Ref<Texture2D> t = get_theme_icon(SNAME("Clear"), SNAME("EditorIcons")); clear->set_icon(t); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 2bea427bf2..98be34cb86 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -352,9 +352,9 @@ void ScriptEditorQuickOpen::_notification(int p_what) { connect("confirmed", callable_mp(this, &ScriptEditorQuickOpen::_confirmed)); search_box->set_clear_button_enabled(true); - } break; - - case NOTIFICATION_THEME_CHANGED: { + [[fallthrough]]; + } + case NOTIFICATION_VISIBILITY_CHANGED: { search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); } break; @@ -1613,8 +1613,8 @@ void ScriptEditor::_notification(int p_what) { EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &ScriptEditor::_editor_settings_changed)); EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &ScriptEditor::_filesystem_changed)); _editor_settings_changed(); - } break; - + [[fallthrough]]; + } case NOTIFICATION_TRANSLATION_CHANGED: case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_THEME_CHANGED: { @@ -3712,7 +3712,7 @@ ScriptEditor::ScriptEditor() { members_overview_alphabeta_sort_button = memnew(Button); members_overview_alphabeta_sort_button->set_flat(true); - members_overview_alphabeta_sort_button->set_tooltip(TTR("Toggle alphabetical sorting of the method list.")); + members_overview_alphabeta_sort_button->set_tooltip_text(TTR("Toggle alphabetical sorting of the method list.")); members_overview_alphabeta_sort_button->set_toggle_mode(true); members_overview_alphabeta_sort_button->set_pressed(EditorSettings::get_singleton()->get("text_editor/script_list/sort_members_outline_alphabetically")); members_overview_alphabeta_sort_button->connect("toggled", callable_mp(this, &ScriptEditor::_toggle_members_overview_alpha_sort)); @@ -3858,14 +3858,14 @@ ScriptEditor::ScriptEditor() { site_search->set_text(TTR("Online Docs")); site_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option).bind(SEARCH_WEBSITE)); menu_hb->add_child(site_search); - site_search->set_tooltip(TTR("Open Godot online documentation.")); + site_search->set_tooltip_text(TTR("Open Godot online documentation.")); help_search = memnew(Button); help_search->set_flat(true); help_search->set_text(TTR("Search Help")); help_search->connect("pressed", callable_mp(this, &ScriptEditor::_menu_option).bind(SEARCH_HELP)); menu_hb->add_child(help_search); - help_search->set_tooltip(TTR("Search the reference documentation.")); + help_search->set_tooltip_text(TTR("Search the reference documentation.")); menu_hb->add_child(memnew(VSeparator)); @@ -3874,14 +3874,14 @@ ScriptEditor::ScriptEditor() { script_back->connect("pressed", callable_mp(this, &ScriptEditor::_history_back)); menu_hb->add_child(script_back); script_back->set_disabled(true); - script_back->set_tooltip(TTR("Go to previous edited document.")); + script_back->set_tooltip_text(TTR("Go to previous edited document.")); script_forward = memnew(Button); script_forward->set_flat(true); script_forward->connect("pressed", callable_mp(this, &ScriptEditor::_history_forward)); menu_hb->add_child(script_forward); script_forward->set_disabled(true); - script_forward->set_tooltip(TTR("Go to next edited document.")); + script_forward->set_tooltip_text(TTR("Go to next edited document.")); tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed)); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 421b258f49..5e7db17edf 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1392,11 +1392,7 @@ void ScriptTextEditor::_change_syntax_highlighter(int p_idx) { void ScriptTextEditor::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: { - code_editor->get_text_editor()->set_gutter_width(connection_gutter, code_editor->get_text_editor()->get_line_height()); - } break; - - case NOTIFICATION_THEME_CHANGED: { + case NOTIFICATION_THEME_CHANGED: if (!editor_enabled) { break; } @@ -1404,6 +1400,9 @@ void ScriptTextEditor::_notification(int p_what) { _update_warnings(); _update_errors(); } + [[fallthrough]]; + case NOTIFICATION_ENTER_TREE: { + code_editor->get_text_editor()->set_gutter_width(connection_gutter, code_editor->get_text_editor()->get_line_height()); } break; } } diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index b4a0216e9f..53bc6fbdf4 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -712,6 +712,7 @@ void ShaderEditor::_menu_option(int p_option) { void ShaderEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { PopupMenu *popup = help_menu->get_popup(); popup->set_item_icon(popup->get_item_index(HELP_DOCS), get_theme_icon(SNAME("ExternalLink"), SNAME("EditorIcons"))); diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index c25f2bb25c..f21adabffb 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -733,7 +733,7 @@ void Skeleton3DEditor::create_editors() { edit_mode_button->set_flat(true); edit_mode_button->set_toggle_mode(true); edit_mode_button->set_focus_mode(FOCUS_NONE); - edit_mode_button->set_tooltip(TTR("Edit Mode\nShow buttons on joints.")); + edit_mode_button->set_tooltip_text(TTR("Edit Mode\nShow buttons on joints.")); edit_mode_button->connect("toggled", callable_mp(this, &Skeleton3DEditor::edit_mode_toggled)); edit_mode = false; @@ -754,7 +754,7 @@ void Skeleton3DEditor::create_editors() { key_loc_button->set_toggle_mode(true); key_loc_button->set_pressed(false); key_loc_button->set_focus_mode(FOCUS_NONE); - key_loc_button->set_tooltip(TTR("Translation mask for inserting keys.")); + key_loc_button->set_tooltip_text(TTR("Translation mask for inserting keys.")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -762,7 +762,7 @@ void Skeleton3DEditor::create_editors() { key_rot_button->set_toggle_mode(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); - key_rot_button->set_tooltip(TTR("Rotation mask for inserting keys.")); + key_rot_button->set_tooltip_text(TTR("Rotation mask for inserting keys.")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); @@ -770,14 +770,14 @@ void Skeleton3DEditor::create_editors() { key_scale_button->set_toggle_mode(true); key_scale_button->set_pressed(false); key_scale_button->set_focus_mode(FOCUS_NONE); - key_scale_button->set_tooltip(TTR("Scale mask for inserting keys.")); + key_scale_button->set_tooltip_text(TTR("Scale mask for inserting keys.")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); key_insert_button->set_flat(true); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys).bind(false)); - key_insert_button->set_tooltip(TTR("Insert key of bone poses already exist track.")); + key_insert_button->set_tooltip_text(TTR("Insert key of bone poses already exist track.")); key_insert_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_to_existing_tracks", TTR("Insert Key (Existing Tracks)"), Key::INSERT)); animation_hb->add_child(key_insert_button); @@ -785,7 +785,7 @@ void Skeleton3DEditor::create_editors() { key_insert_all_button->set_flat(true); key_insert_all_button->set_focus_mode(FOCUS_NONE); key_insert_all_button->connect("pressed", callable_mp(this, &Skeleton3DEditor::insert_keys).bind(true)); - key_insert_all_button->set_tooltip(TTR("Insert key of all bone poses.")); + key_insert_all_button->set_tooltip_text(TTR("Insert key of all bone poses.")); key_insert_all_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_of_all_bones", TTR("Insert Key (All Bones)"), KeyModifierMask::CMD + Key::INSERT)); animation_hb->add_child(key_insert_all_button); diff --git a/editor/plugins/sprite_2d_editor_plugin.cpp b/editor/plugins/sprite_2d_editor_plugin.cpp index a493827d60..e45c907e86 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -506,6 +506,7 @@ void Sprite2DEditor::_debug_uv_draw() { void Sprite2DEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { options->set_icon(get_theme_icon(SNAME("Sprite2D"), SNAME("EditorIcons"))); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index cccef421ea..87f0fc4ad0 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -408,6 +408,7 @@ void SpriteFramesEditor::_prepare_sprite_sheet(const String &p_file) { void SpriteFramesEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { load->set_icon(get_theme_icon(SNAME("Load"), SNAME("EditorIcons"))); load_sheet->set_icon(get_theme_icon(SNAME("SpriteSheet"), SNAME("EditorIcons"))); @@ -1160,13 +1161,13 @@ SpriteFramesEditor::SpriteFramesEditor() { new_anim = memnew(Button); new_anim->set_flat(true); - new_anim->set_tooltip(TTR("New Animation")); + new_anim->set_tooltip_text(TTR("New Animation")); hbc_animlist->add_child(new_anim); new_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_add)); remove_anim = memnew(Button); remove_anim->set_flat(true); - remove_anim->set_tooltip(TTR("Remove Animation")); + remove_anim->set_tooltip_text(TTR("Remove Animation")); hbc_animlist->add_child(remove_anim); remove_anim->connect("pressed", callable_mp(this, &SpriteFramesEditor::_animation_remove)); @@ -1214,53 +1215,53 @@ SpriteFramesEditor::SpriteFramesEditor() { load = memnew(Button); load->set_flat(true); - load->set_tooltip(TTR("Add a Texture from File")); + load->set_tooltip_text(TTR("Add a Texture from File")); hbc->add_child(load); load_sheet = memnew(Button); load_sheet->set_flat(true); - load_sheet->set_tooltip(TTR("Add Frames from a Sprite Sheet")); + load_sheet->set_tooltip_text(TTR("Add Frames from a Sprite Sheet")); hbc->add_child(load_sheet); hbc->add_child(memnew(VSeparator)); copy = memnew(Button); copy->set_flat(true); - copy->set_tooltip(TTR("Copy")); + copy->set_tooltip_text(TTR("Copy")); hbc->add_child(copy); paste = memnew(Button); paste->set_flat(true); - paste->set_tooltip(TTR("Paste")); + paste->set_tooltip_text(TTR("Paste")); hbc->add_child(paste); hbc->add_child(memnew(VSeparator)); empty = memnew(Button); empty->set_flat(true); - empty->set_tooltip(TTR("Insert Empty (Before)")); + empty->set_tooltip_text(TTR("Insert Empty (Before)")); hbc->add_child(empty); empty2 = memnew(Button); empty2->set_flat(true); - empty2->set_tooltip(TTR("Insert Empty (After)")); + empty2->set_tooltip_text(TTR("Insert Empty (After)")); hbc->add_child(empty2); hbc->add_child(memnew(VSeparator)); move_up = memnew(Button); move_up->set_flat(true); - move_up->set_tooltip(TTR("Move (Before)")); + move_up->set_tooltip_text(TTR("Move (Before)")); hbc->add_child(move_up); move_down = memnew(Button); move_down->set_flat(true); - move_down->set_tooltip(TTR("Move (After)")); + move_down->set_tooltip_text(TTR("Move (After)")); hbc->add_child(move_down); _delete = memnew(Button); _delete->set_flat(true); - _delete->set_tooltip(TTR("Delete")); + _delete->set_tooltip_text(TTR("Delete")); hbc->add_child(_delete); hbc->add_spacer(); @@ -1268,19 +1269,19 @@ SpriteFramesEditor::SpriteFramesEditor() { zoom_out = memnew(Button); zoom_out->connect("pressed", callable_mp(this, &SpriteFramesEditor::_zoom_out)); zoom_out->set_flat(true); - zoom_out->set_tooltip(TTR("Zoom Out")); + zoom_out->set_tooltip_text(TTR("Zoom Out")); hbc->add_child(zoom_out); zoom_reset = memnew(Button); zoom_reset->connect("pressed", callable_mp(this, &SpriteFramesEditor::_zoom_reset)); zoom_reset->set_flat(true); - zoom_reset->set_tooltip(TTR("Zoom Reset")); + zoom_reset->set_tooltip_text(TTR("Zoom Reset")); hbc->add_child(zoom_reset); zoom_in = memnew(Button); zoom_in->connect("pressed", callable_mp(this, &SpriteFramesEditor::_zoom_in)); zoom_in->set_flat(true); - zoom_in->set_tooltip(TTR("Zoom In")); + zoom_in->set_tooltip_text(TTR("Zoom In")); hbc->add_child(zoom_in); file = memnew(EditorFileDialog); @@ -1433,21 +1434,21 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_zoom_out = memnew(Button); split_sheet_zoom_out->set_flat(true); split_sheet_zoom_out->set_focus_mode(FOCUS_NONE); - split_sheet_zoom_out->set_tooltip(TTR("Zoom Out")); + split_sheet_zoom_out->set_tooltip_text(TTR("Zoom Out")); split_sheet_zoom_out->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_out)); split_sheet_zoom_hb->add_child(split_sheet_zoom_out); split_sheet_zoom_reset = memnew(Button); split_sheet_zoom_reset->set_flat(true); split_sheet_zoom_reset->set_focus_mode(FOCUS_NONE); - split_sheet_zoom_reset->set_tooltip(TTR("Zoom Reset")); + split_sheet_zoom_reset->set_tooltip_text(TTR("Zoom Reset")); split_sheet_zoom_reset->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_reset)); split_sheet_zoom_hb->add_child(split_sheet_zoom_reset); split_sheet_zoom_in = memnew(Button); split_sheet_zoom_in->set_flat(true); split_sheet_zoom_in->set_focus_mode(FOCUS_NONE); - split_sheet_zoom_in->set_tooltip(TTR("Zoom In")); + split_sheet_zoom_in->set_tooltip_text(TTR("Zoom In")); split_sheet_zoom_in->connect("pressed", callable_mp(this, &SpriteFramesEditor::_sheet_zoom_in)); split_sheet_zoom_hb->add_child(split_sheet_zoom_in); diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 6dbba3ced2..d4baff34e2 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -71,7 +71,15 @@ void StyleBoxPreview::_sb_changed() { void StyleBoxPreview::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { + if (!is_inside_tree()) { + // TODO: This is a workaround because `NOTIFICATION_THEME_CHANGED` + // is getting called for some reason when the `TexturePreview` is + // getting destroyed, which causes `get_theme_font()` to return `nullptr`. + // See https://github.com/godotengine/godot/issues/50743. + break; + } grid_preview->set_normal_texture(get_theme_icon(SNAME("StyleBoxGridInvisible"), SNAME("EditorIcons"))); grid_preview->set_pressed_texture(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons"))); grid_preview->set_hover_texture(get_theme_icon(SNAME("StyleBoxGridVisible"), SNAME("EditorIcons"))); diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp index 1b79527352..be382759f5 100644 --- a/editor/plugins/texture_editor_plugin.cpp +++ b/editor/plugins/texture_editor_plugin.cpp @@ -38,7 +38,16 @@ TextureRect *TexturePreview::get_texture_display() { void TexturePreview::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { + if (!is_inside_tree()) { + // TODO: This is a workaround because `NOTIFICATION_THEME_CHANGED` + // is getting called for some reason when the `TexturePreview` is + // getting destroyed, which causes `get_theme_font()` to return `nullptr`. + // See https://github.com/godotengine/godot/issues/50743. + break; + } + if (metadata_label) { Ref<Font> metadata_label_font = get_theme_font(SNAME("expression"), SNAME("EditorFonts")); metadata_label->add_theme_font_override("font", metadata_label_font); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index ae8fabe498..50a7dc7f96 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -821,6 +821,7 @@ void TextureRegionEditor::_update_autoslice() { void TextureRegionEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { edit_draw->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); } break; @@ -1109,19 +1110,19 @@ TextureRegionEditor::TextureRegionEditor() { zoom_out = memnew(Button); zoom_out->set_flat(true); - zoom_out->set_tooltip(TTR("Zoom Out")); + zoom_out->set_tooltip_text(TTR("Zoom Out")); zoom_out->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_out)); zoom_hb->add_child(zoom_out); zoom_reset = memnew(Button); zoom_reset->set_flat(true); - zoom_reset->set_tooltip(TTR("Zoom Reset")); + zoom_reset->set_tooltip_text(TTR("Zoom Reset")); zoom_reset->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_reset)); zoom_hb->add_child(zoom_reset); zoom_in = memnew(Button); zoom_in->set_flat(true); - zoom_in->set_tooltip(TTR("Zoom In")); + zoom_in->set_tooltip_text(TTR("Zoom In")); zoom_in->connect("pressed", callable_mp(this, &TextureRegionEditor::_zoom_in)); zoom_hb->add_child(zoom_in); diff --git a/editor/plugins/theme_editor_plugin.cpp b/editor/plugins/theme_editor_plugin.cpp index 91a3f44454..78b8a059a5 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -839,6 +839,7 @@ bool ThemeItemImportTree::has_selected_items() const { void ThemeItemImportTree::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { select_icons_warning_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); select_icons_warning->add_theme_color_override("font_color", get_theme_color(SNAME("disabled_font_color"), SNAME("Editor"))); @@ -1102,15 +1103,15 @@ ThemeItemImportTree::ThemeItemImportTree() { button_set->set_alignment(BoxContainer::ALIGNMENT_END); all_set->add_child(button_set); select_all_items_button->set_flat(true); - select_all_items_button->set_tooltip(select_all_items_tooltip); + select_all_items_button->set_tooltip_text(select_all_items_tooltip); button_set->add_child(select_all_items_button); select_all_items_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_select_all_data_type_pressed).bind(i)); select_full_items_button->set_flat(true); - select_full_items_button->set_tooltip(select_full_items_tooltip); + select_full_items_button->set_tooltip_text(select_full_items_tooltip); button_set->add_child(select_full_items_button); select_full_items_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_select_full_data_type_pressed).bind(i)); deselect_all_items_button->set_flat(true); - deselect_all_items_button->set_tooltip(deselect_all_items_tooltip); + deselect_all_items_button->set_tooltip_text(deselect_all_items_tooltip); button_set->add_child(deselect_all_items_button); deselect_all_items_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_deselect_all_data_type_pressed).bind(i)); @@ -1141,12 +1142,12 @@ ThemeItemImportTree::ThemeItemImportTree() { import_collapse_types_button = memnew(Button); import_collapse_types_button->set_flat(true); - import_collapse_types_button->set_tooltip(TTR("Collapse types.")); + import_collapse_types_button->set_tooltip_text(TTR("Collapse types.")); import_buttons->add_child(import_collapse_types_button); import_collapse_types_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_toggle_type_items).bind(true)); import_expand_types_button = memnew(Button); import_expand_types_button->set_flat(true); - import_expand_types_button->set_tooltip(TTR("Expand types.")); + import_expand_types_button->set_tooltip_text(TTR("Expand types.")); import_buttons->add_child(import_expand_types_button); import_expand_types_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_toggle_type_items).bind(false)); @@ -1155,19 +1156,19 @@ ThemeItemImportTree::ThemeItemImportTree() { import_select_all_button = memnew(Button); import_select_all_button->set_flat(true); import_select_all_button->set_text(TTR("Select All")); - import_select_all_button->set_tooltip(TTR("Select all Theme items.")); + import_select_all_button->set_tooltip_text(TTR("Select all Theme items.")); import_buttons->add_child(import_select_all_button); import_select_all_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_select_all_items_pressed)); import_select_full_button = memnew(Button); import_select_full_button->set_flat(true); import_select_full_button->set_text(TTR("Select With Data")); - import_select_full_button->set_tooltip(TTR("Select all Theme items with item data.")); + import_select_full_button->set_tooltip_text(TTR("Select all Theme items with item data.")); import_buttons->add_child(import_select_full_button); import_select_full_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_select_full_items_pressed)); import_deselect_all_button = memnew(Button); import_deselect_all_button->set_flat(true); import_deselect_all_button->set_text(TTR("Deselect All")); - import_deselect_all_button->set_tooltip(TTR("Deselect all Theme items.")); + import_deselect_all_button->set_tooltip_text(TTR("Deselect all Theme items.")); import_buttons->add_child(import_deselect_all_button); import_deselect_all_button->connect("pressed", callable_mp(this, &ThemeItemImportTree::_deselect_all_items_pressed)); @@ -1864,8 +1865,8 @@ void ThemeItemEditorDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("about_to_popup", callable_mp(this, &ThemeItemEditorDialog::_dialog_about_to_show)); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { edit_items_add_color->set_icon(get_theme_icon(SNAME("Color"), SNAME("EditorIcons"))); edit_items_add_constant->set_icon(get_theme_icon(SNAME("MemberConstant"), SNAME("EditorIcons"))); @@ -1953,42 +1954,42 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_toolbar->add_child(edit_items_toolbar_add_label); edit_items_add_color = memnew(Button); - edit_items_add_color->set_tooltip(TTR("Add Color Item")); + edit_items_add_color->set_tooltip_text(TTR("Add Color Item")); edit_items_add_color->set_flat(true); edit_items_add_color->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_color); edit_items_add_color->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_open_add_theme_item_dialog).bind(Theme::DATA_TYPE_COLOR)); edit_items_add_constant = memnew(Button); - edit_items_add_constant->set_tooltip(TTR("Add Constant Item")); + edit_items_add_constant->set_tooltip_text(TTR("Add Constant Item")); edit_items_add_constant->set_flat(true); edit_items_add_constant->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_constant); edit_items_add_constant->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_open_add_theme_item_dialog).bind(Theme::DATA_TYPE_CONSTANT)); edit_items_add_font = memnew(Button); - edit_items_add_font->set_tooltip(TTR("Add Font Item")); + edit_items_add_font->set_tooltip_text(TTR("Add Font Item")); edit_items_add_font->set_flat(true); edit_items_add_font->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_font); edit_items_add_font->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_open_add_theme_item_dialog).bind(Theme::DATA_TYPE_FONT)); edit_items_add_font_size = memnew(Button); - edit_items_add_font_size->set_tooltip(TTR("Add Font Size Item")); + edit_items_add_font_size->set_tooltip_text(TTR("Add Font Size Item")); edit_items_add_font_size->set_flat(true); edit_items_add_font_size->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_font_size); edit_items_add_font_size->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_open_add_theme_item_dialog).bind(Theme::DATA_TYPE_FONT_SIZE)); edit_items_add_icon = memnew(Button); - edit_items_add_icon->set_tooltip(TTR("Add Icon Item")); + edit_items_add_icon->set_tooltip_text(TTR("Add Icon Item")); edit_items_add_icon->set_flat(true); edit_items_add_icon->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_icon); edit_items_add_icon->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_open_add_theme_item_dialog).bind(Theme::DATA_TYPE_ICON)); edit_items_add_stylebox = memnew(Button); - edit_items_add_stylebox->set_tooltip(TTR("Add StyleBox Item")); + edit_items_add_stylebox->set_tooltip_text(TTR("Add StyleBox Item")); edit_items_add_stylebox->set_flat(true); edit_items_add_stylebox->set_disabled(true); edit_items_toolbar->add_child(edit_items_add_stylebox); @@ -2001,21 +2002,21 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_toolbar->add_child(edit_items_toolbar_remove_label); edit_items_remove_class = memnew(Button); - edit_items_remove_class->set_tooltip(TTR("Remove Class Items")); + edit_items_remove_class->set_tooltip_text(TTR("Remove Class Items")); edit_items_remove_class->set_flat(true); edit_items_remove_class->set_disabled(true); edit_items_toolbar->add_child(edit_items_remove_class); edit_items_remove_class->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_remove_class_items)); edit_items_remove_custom = memnew(Button); - edit_items_remove_custom->set_tooltip(TTR("Remove Custom Items")); + edit_items_remove_custom->set_tooltip_text(TTR("Remove Custom Items")); edit_items_remove_custom->set_flat(true); edit_items_remove_custom->set_disabled(true); edit_items_toolbar->add_child(edit_items_remove_custom); edit_items_remove_custom->connect("pressed", callable_mp(this, &ThemeItemEditorDialog::_remove_custom_items)); edit_items_remove_all = memnew(Button); - edit_items_remove_all->set_tooltip(TTR("Remove All Items")); + edit_items_remove_all->set_tooltip_text(TTR("Remove All Items")); edit_items_remove_all->set_flat(true); edit_items_remove_all->set_disabled(true); edit_items_toolbar->add_child(edit_items_remove_all); @@ -2193,8 +2194,8 @@ void ThemeTypeDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { connect("about_to_popup", callable_mp(this, &ThemeTypeDialog::_dialog_about_to_show)); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { _update_add_type_options(); } break; @@ -2411,7 +2412,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ item_name->set_h_size_flags(SIZE_EXPAND_FILL); item_name->set_clip_text(true); item_name->set_text(p_item_name); - item_name->set_tooltip(p_item_name); + item_name->set_tooltip_text(p_item_name); item_name_container->add_child(item_name); if (p_editable) { @@ -2424,21 +2425,21 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_rename_button = memnew(Button); item_rename_button->set_icon(get_theme_icon(SNAME("Edit"), SNAME("EditorIcons"))); - item_rename_button->set_tooltip(TTR("Rename Item")); + item_rename_button->set_tooltip_text(TTR("Rename Item")); item_rename_button->set_flat(true); item_name_container->add_child(item_rename_button); item_rename_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_cbk).bind(p_data_type, p_item_name, item_name_container)); Button *item_remove_button = memnew(Button); item_remove_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); - item_remove_button->set_tooltip(TTR("Remove Item")); + item_remove_button->set_tooltip_text(TTR("Remove Item")); item_remove_button->set_flat(true); item_name_container->add_child(item_remove_button); item_remove_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_remove_cbk).bind(p_data_type, p_item_name)); Button *item_rename_confirm_button = memnew(Button); item_rename_confirm_button->set_icon(get_theme_icon(SNAME("ImportCheck"), SNAME("EditorIcons"))); - item_rename_confirm_button->set_tooltip(TTR("Confirm Item Rename")); + item_rename_confirm_button->set_tooltip_text(TTR("Confirm Item Rename")); item_rename_confirm_button->set_flat(true); item_name_container->add_child(item_rename_confirm_button); item_rename_confirm_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_confirmed).bind(p_data_type, p_item_name, item_name_container)); @@ -2446,7 +2447,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_rename_cancel_button = memnew(Button); item_rename_cancel_button->set_icon(get_theme_icon(SNAME("ImportFail"), SNAME("EditorIcons"))); - item_rename_cancel_button->set_tooltip(TTR("Cancel Item Rename")); + item_rename_cancel_button->set_tooltip_text(TTR("Cancel Item Rename")); item_rename_cancel_button->set_flat(true); item_name_container->add_child(item_rename_cancel_button); item_rename_cancel_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_rename_canceled).bind(p_data_type, p_item_name, item_name_container)); @@ -2456,7 +2457,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_override_button = memnew(Button); item_override_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); - item_override_button->set_tooltip(TTR("Override Item")); + item_override_button->set_tooltip_text(TTR("Override Item")); item_override_button->set_flat(true); item_name_container->add_child(item_override_button); item_override_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_item_override_cbk).bind(p_data_type, p_item_name)); @@ -2666,7 +2667,7 @@ void ThemeTypeEditor::_update_type_items() { pin_leader_button->set_toggle_mode(true); pin_leader_button->set_pressed(true); pin_leader_button->set_icon(get_theme_icon(SNAME("Pin"), SNAME("EditorIcons"))); - pin_leader_button->set_tooltip(TTR("Unpin this StyleBox as a main style.")); + pin_leader_button->set_tooltip_text(TTR("Unpin this StyleBox as a main style.")); item_control->add_child(pin_leader_button); pin_leader_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_on_unpin_leader_button_pressed)); @@ -2709,7 +2710,7 @@ void ThemeTypeEditor::_update_type_items() { pin_leader_button->set_flat(true); pin_leader_button->set_toggle_mode(true); pin_leader_button->set_icon(get_theme_icon(SNAME("Pin"), SNAME("EditorIcons"))); - pin_leader_button->set_tooltip(TTR("Pin this StyleBox as a main style. Editing its properties will update the same properties in all other StyleBoxes of this type.")); + pin_leader_button->set_tooltip_text(TTR("Pin this StyleBox as a main style. Editing its properties will update the same properties in all other StyleBoxes of this type.")); item_control->add_child(pin_leader_button); pin_leader_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_on_pin_leader_button_pressed).bind(item_editor, E.key)); } else { @@ -3301,6 +3302,7 @@ void ThemeTypeEditor::_add_type_dialog_selected(const String p_type_name) { void ThemeTypeEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { add_type_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); @@ -3385,7 +3387,7 @@ ThemeTypeEditor::ThemeTypeEditor() { theme_type_list->connect("item_selected", callable_mp(this, &ThemeTypeEditor::_list_type_selected)); add_type_button = memnew(Button); - add_type_button->set_tooltip(TTR("Add a type from a list of available types or create a new one.")); + add_type_button->set_tooltip_text(TTR("Add a type from a list of available types or create a new one.")); type_list_hb->add_child(add_type_button); add_type_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_type_button_cbk)); @@ -3395,7 +3397,7 @@ ThemeTypeEditor::ThemeTypeEditor() { show_default_items_button = memnew(CheckButton); show_default_items_button->set_h_size_flags(SIZE_EXPAND_FILL); show_default_items_button->set_text(TTR("Show Default")); - show_default_items_button->set_tooltip(TTR("Show default type items alongside items that have been overridden.")); + show_default_items_button->set_tooltip_text(TTR("Show default type items alongside items that have been overridden.")); show_default_items_button->set_pressed(true); type_controls->add_child(show_default_items_button); show_default_items_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_update_type_items)); @@ -3403,7 +3405,7 @@ ThemeTypeEditor::ThemeTypeEditor() { Button *add_default_items_button = memnew(Button); add_default_items_button->set_h_size_flags(SIZE_EXPAND_FILL); add_default_items_button->set_text(TTR("Override All")); - add_default_items_button->set_tooltip(TTR("Override all default type items.")); + add_default_items_button->set_tooltip_text(TTR("Override all default type items.")); type_controls->add_child(add_default_items_button); add_default_items_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_default_type_items)); @@ -3450,7 +3452,7 @@ ThemeTypeEditor::ThemeTypeEditor() { type_variation_edit->connect("focus_exited", callable_mp(this, &ThemeTypeEditor::_update_type_items)); type_variation_button = memnew(Button); type_variation_hb->add_child(type_variation_button); - type_variation_button->set_tooltip(TTR("Select the variation base type from a list of available types.")); + type_variation_button->set_tooltip_text(TTR("Select the variation base type from a list of available types.")); type_variation_button->connect("pressed", callable_mp(this, &ThemeTypeEditor::_add_type_variation_cbk)); type_variation_locked = memnew(Label); @@ -3593,6 +3595,7 @@ void ThemeEditor::_preview_control_picked(String p_class_name) { void ThemeEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { preview_tabs->add_theme_style_override("tab_selected", get_theme_stylebox(SNAME("ThemeEditorPreviewFG"), SNAME("EditorStyles"))); preview_tabs->add_theme_style_override("tab_unselected", get_theme_stylebox(SNAME("ThemeEditorPreviewBG"), SNAME("EditorStyles"))); @@ -3630,7 +3633,7 @@ ThemeEditor::ThemeEditor() { Button *theme_edit_button = memnew(Button); theme_edit_button->set_text(TTR("Manage Items...")); - theme_edit_button->set_tooltip(TTR("Add, remove, organize and import Theme items.")); + theme_edit_button->set_tooltip_text(TTR("Add, remove, organize and import Theme items.")); theme_edit_button->set_flat(true); theme_edit_button->connect("pressed", callable_mp(this, &ThemeEditor::_theme_edit_button_cbk)); top_menu->add_child(theme_edit_button); diff --git a/editor/plugins/theme_editor_preview.cpp b/editor/plugins/theme_editor_preview.cpp index 867a568921..a8284da856 100644 --- a/editor/plugins/theme_editor_preview.cpp +++ b/editor/plugins/theme_editor_preview.cpp @@ -193,8 +193,8 @@ void ThemeEditorPreview::_notification(int p_what) { } connect("visibility_changed", callable_mp(this, &ThemeEditorPreview::_preview_visibility_changed)); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { picker_button->set_icon(get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); @@ -227,7 +227,7 @@ ThemeEditorPreview::ThemeEditorPreview() { preview_toolbar->add_child(picker_button); picker_button->set_flat(true); picker_button->set_toggle_mode(true); - picker_button->set_tooltip(TTR("Toggle the control picker, allowing to visually select control types for edit.")); + picker_button->set_tooltip_text(TTR("Toggle the control picker, allowing to visually select control types for edit.")); picker_button->connect("pressed", callable_mp(this, &ThemeEditorPreview::_picker_button_cbk)); MarginContainer *preview_body = memnew(MarginContainer); @@ -272,6 +272,7 @@ ThemeEditorPreview::ThemeEditorPreview() { void DefaultThemeEditorPreview::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { test_color_picker_button->set_custom_minimum_size(Size2(0, get_theme_constant(SNAME("color_picker_button_height"), SNAME("Editor")))); } break; @@ -474,6 +475,7 @@ void SceneThemeEditorPreview::_reload_scene() { void SceneThemeEditorPreview::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { reload_scene_button->set_icon(get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); } break; @@ -515,7 +517,7 @@ SceneThemeEditorPreview::SceneThemeEditorPreview() { reload_scene_button = memnew(Button); reload_scene_button->set_flat(true); - reload_scene_button->set_tooltip(TTR("Reload the scene to reflect its most actual state.")); + reload_scene_button->set_tooltip_text(TTR("Reload the scene to reflect its most actual state.")); preview_toolbar->add_child(reload_scene_button); reload_scene_button->connect("pressed", callable_mp(this, &SceneThemeEditorPreview::_reload_scene)); } diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index 54ba28833c..8d2b150d6d 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -160,7 +160,7 @@ void TileAtlasView::_center_view() { } void TileAtlasView::_base_tiles_root_control_gui_input(const Ref<InputEvent> &p_event) { - base_tiles_root_control->set_tooltip(""); + base_tiles_root_control->set_tooltip_text(""); Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { @@ -169,7 +169,7 @@ void TileAtlasView::_base_tiles_root_control_gui_input(const Ref<InputEvent> &p_ if (coords != TileSetSource::INVALID_ATLAS_COORDS) { coords = tile_set_atlas_source->get_tile_at_coords(coords); if (coords != TileSetSource::INVALID_ATLAS_COORDS) { - base_tiles_root_control->set_tooltip(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: 0"), source_id, coords)); + base_tiles_root_control->set_tooltip_text(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: 0"), source_id, coords)); } } } @@ -319,7 +319,7 @@ void TileAtlasView::_draw_base_tiles_shape_grid() { } void TileAtlasView::_alternative_tiles_root_control_gui_input(const Ref<InputEvent> &p_event) { - alternative_tiles_root_control->set_tooltip(""); + alternative_tiles_root_control->set_tooltip_text(""); Ref<InputEventMouseMotion> mm = p_event; if (mm.is_valid()) { @@ -328,7 +328,7 @@ void TileAtlasView::_alternative_tiles_root_control_gui_input(const Ref<InputEve Vector2i coords = Vector2i(coords3.x, coords3.y); int alternative_id = coords3.z; if (coords != TileSetSource::INVALID_ATLAS_COORDS && alternative_id != TileSetSource::INVALID_TILE_ALTERNATIVE) { - alternative_tiles_root_control->set_tooltip(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: %d"), source_id, coords, alternative_id)); + alternative_tiles_root_control->set_tooltip_text(vformat(TTR("Source: %d\nAtlas coordinates: %s\nAlternative: %d"), source_id, coords, alternative_id)); } } } @@ -542,7 +542,7 @@ TileAtlasView::TileAtlasView() { button_center_view->connect("pressed", callable_mp(this, &TileAtlasView::_center_view)); button_center_view->set_flat(true); button_center_view->set_disabled(true); - button_center_view->set_tooltip(TTR("Center View")); + button_center_view->set_tooltip_text(TTR("Center View")); add_child(button_center_view); panner.instantiate(); diff --git a/editor/plugins/tiles/tile_data_editors.cpp b/editor/plugins/tiles/tile_data_editors.cpp index 58479cbd52..73e07e6647 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -722,6 +722,7 @@ void GenericTilePolygonEditor::set_multiple_polygon_mode(bool p_multiple_polygon void GenericTilePolygonEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { button_create->set_icon(get_theme_icon(SNAME("CurveCreate"), SNAME("EditorIcons"))); button_edit->set_icon(get_theme_icon(SNAME("CurveEdit"), SNAME("EditorIcons"))); @@ -763,21 +764,21 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_create->set_toggle_mode(true); button_create->set_button_group(tools_button_group); button_create->set_pressed(true); - button_create->set_tooltip(TTR("Add polygon tool")); + button_create->set_tooltip_text(TTR("Add polygon tool")); toolbar->add_child(button_create); button_edit = memnew(Button); button_edit->set_flat(true); button_edit->set_toggle_mode(true); button_edit->set_button_group(tools_button_group); - button_edit->set_tooltip(TTR("Edit points tool")); + button_edit->set_tooltip_text(TTR("Edit points tool")); toolbar->add_child(button_edit); button_delete = memnew(Button); button_delete->set_flat(true); button_delete->set_toggle_mode(true); button_delete->set_button_group(tools_button_group); - button_delete->set_tooltip(TTR("Delete points tool")); + button_delete->set_tooltip_text(TTR("Delete points tool")); toolbar->add_child(button_delete); button_advanced_menu = memnew(MenuButton); @@ -800,7 +801,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_pixel_snap->set_flat(true); button_pixel_snap->set_toggle_mode(true); button_pixel_snap->set_pressed(true); - button_pixel_snap->set_tooltip(TTR("Snap to half-pixel")); + button_pixel_snap->set_tooltip_text(TTR("Snap to half-pixel")); toolbar->add_child(button_pixel_snap); Control *root = memnew(Control); @@ -1160,13 +1161,14 @@ void TileDataDefaultEditor::setup_property_editor(Variant::Type p_type, String p property_editor->set_label(p_label); } property_editor->connect("property_changed", callable_mp(this, &TileDataDefaultEditor::_property_value_changed).unbind(1)); - property_editor->set_tooltip(p_property); + property_editor->set_tooltip_text(p_property); property_editor->update_property(); add_child(property_editor); } void TileDataDefaultEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { picker_button->set_icon(get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); tile_bool_checked = get_theme_icon(SNAME("TileChecked"), SNAME("EditorIcons")); @@ -1369,7 +1371,7 @@ void TileDataCollisionEditor::_polygons_changed() { one_way_property_editor->set_label(one_way_property); one_way_property_editor->connect("property_changed", callable_mp(this, &TileDataCollisionEditor::_property_value_changed).unbind(1)); one_way_property_editor->connect("selected", callable_mp(this, &TileDataCollisionEditor::_property_selected)); - one_way_property_editor->set_tooltip(one_way_property_editor->get_edited_property()); + one_way_property_editor->set_tooltip_text(one_way_property_editor->get_edited_property()); one_way_property_editor->update_property(); add_child(one_way_property_editor); property_editors[one_way_property] = one_way_property_editor; @@ -1381,7 +1383,7 @@ void TileDataCollisionEditor::_polygons_changed() { one_way_margin_property_editor->set_label(one_way_margin_property); one_way_margin_property_editor->connect("property_changed", callable_mp(this, &TileDataCollisionEditor::_property_value_changed).unbind(1)); one_way_margin_property_editor->connect("selected", callable_mp(this, &TileDataCollisionEditor::_property_selected)); - one_way_margin_property_editor->set_tooltip(one_way_margin_property_editor->get_edited_property()); + one_way_margin_property_editor->set_tooltip_text(one_way_margin_property_editor->get_edited_property()); one_way_margin_property_editor->update_property(); add_child(one_way_margin_property_editor); property_editors[one_way_margin_property] = one_way_margin_property_editor; @@ -1542,7 +1544,7 @@ TileDataCollisionEditor::TileDataCollisionEditor() { linear_velocity_editor->set_label("linear_velocity"); linear_velocity_editor->connect("property_changed", callable_mp(this, &TileDataCollisionEditor::_property_value_changed).unbind(1)); linear_velocity_editor->connect("selected", callable_mp(this, &TileDataCollisionEditor::_property_selected)); - linear_velocity_editor->set_tooltip(linear_velocity_editor->get_edited_property()); + linear_velocity_editor->set_tooltip_text(linear_velocity_editor->get_edited_property()); linear_velocity_editor->update_property(); add_child(linear_velocity_editor); property_editors["linear_velocity"] = linear_velocity_editor; @@ -1552,7 +1554,7 @@ TileDataCollisionEditor::TileDataCollisionEditor() { angular_velocity_editor->set_label("angular_velocity"); angular_velocity_editor->connect("property_changed", callable_mp(this, &TileDataCollisionEditor::_property_value_changed).unbind(1)); angular_velocity_editor->connect("selected", callable_mp(this, &TileDataCollisionEditor::_property_selected)); - angular_velocity_editor->set_tooltip(angular_velocity_editor->get_edited_property()); + angular_velocity_editor->set_tooltip_text(angular_velocity_editor->get_edited_property()); angular_velocity_editor->update_property(); add_child(angular_velocity_editor); property_editors["angular_velocity"] = angular_velocity_editor; @@ -2565,6 +2567,7 @@ void TileDataTerrainsEditor::draw_over_tile(CanvasItem *p_canvas_item, Transform void TileDataTerrainsEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { picker_button->set_icon(get_theme_icon(SNAME("ColorPick"), SNAME("EditorIcons"))); } break; @@ -2599,7 +2602,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() { terrain_set_property_editor->set_object_and_property(dummy_object, "terrain_set"); terrain_set_property_editor->set_label("Terrain Set"); terrain_set_property_editor->connect("property_changed", callable_mp(this, &TileDataTerrainsEditor::_property_value_changed).unbind(1)); - terrain_set_property_editor->set_tooltip(terrain_set_property_editor->get_edited_property()); + terrain_set_property_editor->set_tooltip_text(terrain_set_property_editor->get_edited_property()); add_child(terrain_set_property_editor); terrain_property_editor = memnew(EditorPropertyEnum); diff --git a/editor/plugins/tiles/tile_map_editor.cpp b/editor/plugins/tiles/tile_map_editor.cpp index 363aba2938..556788f50c 100644 --- a/editor/plugins/tiles/tile_map_editor.cpp +++ b/editor/plugins/tiles/tile_map_editor.cpp @@ -2050,7 +2050,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { paint_tool_button->set_toggle_mode(true); paint_tool_button->set_button_group(tool_buttons_group); paint_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/paint_tool", "Paint", Key::D)); - paint_tool_button->set_tooltip(TTR("Shift: Draw line.") + "\n" + TTR("Shift+Ctrl: Draw rectangle.")); + paint_tool_button->set_tooltip_text(TTR("Shift: Draw line.") + "\n" + TTR("Shift+Ctrl: Draw rectangle.")); paint_tool_button->connect("pressed", callable_mp(this, &TileMapEditorTilesPlugin::_update_toolbar)); tilemap_tiles_tools_buttons->add_child(paint_tool_button); @@ -2091,7 +2091,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { picker_button->set_flat(true); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_SHORTCUT("tiles_editor/picker", "Picker", Key::P)); - picker_button->set_tooltip(TTR("Alternatively hold Ctrl with other tools to pick tile.")); + picker_button->set_tooltip_text(TTR("Alternatively hold Ctrl with other tools to pick tile.")); picker_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); tools_settings->add_child(picker_button); @@ -2100,7 +2100,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { erase_button->set_flat(true); erase_button->set_toggle_mode(true); erase_button->set_shortcut(ED_SHORTCUT("tiles_editor/eraser", "Eraser", Key::E)); - erase_button->set_tooltip(TTR("Alternatively use RMB to erase tiles.")); + erase_button->set_tooltip_text(TTR("Alternatively use RMB to erase tiles.")); erase_button->connect("pressed", callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); tools_settings->add_child(erase_button); @@ -2119,13 +2119,13 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { random_tile_toggle = memnew(Button); random_tile_toggle->set_flat(true); random_tile_toggle->set_toggle_mode(true); - random_tile_toggle->set_tooltip(TTR("Place Random Tile")); + random_tile_toggle->set_tooltip_text(TTR("Place Random Tile")); random_tile_toggle->connect("toggled", callable_mp(this, &TileMapEditorTilesPlugin::_on_random_tile_checkbox_toggled)); tools_settings->add_child(random_tile_toggle); // Random tile scattering. scatter_label = memnew(Label); - scatter_label->set_tooltip(TTR("Defines the probability of painting nothing instead of a randomly selected tile.")); + scatter_label->set_tooltip_text(TTR("Defines the probability of painting nothing instead of a randomly selected tile.")); scatter_label->set_text(TTR("Scattering:")); tools_settings->add_child(scatter_label); @@ -2133,7 +2133,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { scatter_spinbox->set_min(0.0); scatter_spinbox->set_max(1000); scatter_spinbox->set_step(0.001); - scatter_spinbox->set_tooltip(TTR("Defines the probability of painting nothing instead of a randomly selected tile.")); + scatter_spinbox->set_tooltip_text(TTR("Defines the probability of painting nothing instead of a randomly selected tile.")); scatter_spinbox->get_line_edit()->add_theme_constant_override("minimum_character_width", 4); scatter_spinbox->connect("value_changed", callable_mp(this, &TileMapEditorTilesPlugin::_on_scattering_spinbox_changed)); tools_settings->add_child(scatter_spinbox); @@ -2146,6 +2146,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { // --- Bottom panel tiles --- tiles_bottom_panel = memnew(VBoxContainer); + tiles_bottom_panel->connect("tree_entered", callable_mp(this, &TileMapEditorTilesPlugin::_update_theme)); tiles_bottom_panel->connect("theme_changed", callable_mp(this, &TileMapEditorTilesPlugin::_update_theme)); tiles_bottom_panel->connect("visibility_changed", callable_mp(this, &TileMapEditorTilesPlugin::_stop_dragging)); tiles_bottom_panel->connect("visibility_changed", callable_mp(this, &TileMapEditorTilesPlugin::_tab_changed)); @@ -2177,7 +2178,7 @@ TileMapEditorTilesPlugin::TileMapEditorTilesPlugin() { source_sort_button = memnew(MenuButton); source_sort_button->set_flat(true); - source_sort_button->set_tooltip(TTR("Sort sources")); + source_sort_button->set_tooltip_text(TTR("Sort sources")); PopupMenu *p = source_sort_button->get_popup(); p->connect("id_pressed", callable_mp(this, &TileMapEditorTilesPlugin::_set_source_sort)); @@ -3310,6 +3311,7 @@ TileMapEditorTerrainsPlugin::TileMapEditorTerrainsPlugin() { undo_redo = EditorNode::get_undo_redo(); main_vbox_container = memnew(VBoxContainer); + main_vbox_container->connect("tree_entered", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme)); main_vbox_container->connect("theme_changed", callable_mp(this, &TileMapEditorTerrainsPlugin::_update_theme)); main_vbox_container->set_name("Terrains"); @@ -3417,6 +3419,7 @@ TileMapEditorTerrainsPlugin::~TileMapEditorTerrainsPlugin() { void TileMapEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { missing_tile_texture = get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")); warning_pattern_texture = get_theme_icon(SNAME("WarningPattern"), SNAME("EditorIcons")); @@ -4000,7 +4003,7 @@ TileMapEditor::TileMapEditor() { layers_selection_button = memnew(OptionButton); layers_selection_button->set_custom_minimum_size(Size2(200, 0)); layers_selection_button->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); - layers_selection_button->set_tooltip(TTR("TileMap Layers")); + layers_selection_button->set_tooltip_text(TTR("TileMap Layers")); layers_selection_button->connect("item_selected", callable_mp(this, &TileMapEditor::_layers_selection_item_selected)); tile_map_toolbar->add_child(layers_selection_button); @@ -4009,7 +4012,7 @@ TileMapEditor::TileMapEditor() { toggle_highlight_selected_layer_button->set_toggle_mode(true); toggle_highlight_selected_layer_button->set_pressed(true); toggle_highlight_selected_layer_button->connect("pressed", callable_mp(this, &TileMapEditor::_update_layers_selection)); - toggle_highlight_selected_layer_button->set_tooltip(TTR("Highlight Selected TileMap Layer")); + toggle_highlight_selected_layer_button->set_tooltip_text(TTR("Highlight Selected TileMap Layer")); tile_map_toolbar->add_child(toggle_highlight_selected_layer_button); tile_map_toolbar->add_child(memnew(VSeparator)); @@ -4018,7 +4021,7 @@ TileMapEditor::TileMapEditor() { toggle_grid_button = memnew(Button); toggle_grid_button->set_flat(true); toggle_grid_button->set_toggle_mode(true); - toggle_grid_button->set_tooltip(TTR("Toggle grid visibility.")); + toggle_grid_button->set_tooltip_text(TTR("Toggle grid visibility.")); toggle_grid_button->connect("toggled", callable_mp(this, &TileMapEditor::_on_grid_toggled)); tile_map_toolbar->add_child(toggle_grid_button); diff --git a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp index 6a34e6bca6..46093469e3 100644 --- a/editor/plugins/tiles/tile_set_atlas_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_atlas_source_editor.cpp @@ -527,7 +527,7 @@ void TileSetAtlasSourceEditor::_update_tile_id_label() { if (selection.size() == 1) { TileSelection selected = selection.front()->get(); tool_tile_id_label->set_text(vformat("%d, %s, %d", tile_set_atlas_source_id, selected.tile, selected.alternative)); - tool_tile_id_label->set_tooltip(vformat(TTR("Selected tile:\nSource: %d\nAtlas coordinates: %s\nAlternative: %d"), tile_set_atlas_source_id, selected.tile, selected.alternative)); + tool_tile_id_label->set_tooltip_text(vformat(TTR("Selected tile:\nSource: %d\nAtlas coordinates: %s\nAlternative: %d"), tile_set_atlas_source_id, selected.tile, selected.alternative)); tool_tile_id_label->show(); } else { tool_tile_id_label->hide(); @@ -2287,6 +2287,7 @@ void TileSetAtlasSourceEditor::_auto_remove_tiles() { void TileSetAtlasSourceEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { tool_setup_atlas_source_button->set_icon(get_theme_icon(SNAME("Tools"), SNAME("EditorIcons"))); tool_select_button->set_icon(get_theme_icon(SNAME("ToolSelect"), SNAME("EditorIcons"))); @@ -2445,7 +2446,7 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_setup_atlas_source_button->set_toggle_mode(true); tool_setup_atlas_source_button->set_pressed(true); tool_setup_atlas_source_button->set_button_group(tools_button_group); - tool_setup_atlas_source_button->set_tooltip(TTR("Atlas setup. Add/Remove tiles tool (use the shift key to create big tiles, control for rectangle editing).")); + tool_setup_atlas_source_button->set_tooltip_text(TTR("Atlas setup. Add/Remove tiles tool (use the shift key to create big tiles, control for rectangle editing).")); toolbox->add_child(tool_setup_atlas_source_button); tool_select_button = memnew(Button); @@ -2453,14 +2454,14 @@ TileSetAtlasSourceEditor::TileSetAtlasSourceEditor() { tool_select_button->set_toggle_mode(true); tool_select_button->set_pressed(false); tool_select_button->set_button_group(tools_button_group); - tool_select_button->set_tooltip(TTR("Select tiles.")); + tool_select_button->set_tooltip_text(TTR("Select tiles.")); toolbox->add_child(tool_select_button); tool_paint_button = memnew(Button); tool_paint_button->set_flat(true); tool_paint_button->set_toggle_mode(true); tool_paint_button->set_button_group(tools_button_group); - tool_paint_button->set_tooltip(TTR("Paint properties.")); + tool_paint_button->set_tooltip_text(TTR("Paint properties.")); toolbox->add_child(tool_paint_button); // Tool settings. diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index 2ffbf65b37..dca17475e0 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -333,6 +333,7 @@ void TileSetEditor::_set_source_sort(int p_sort) { void TileSetEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { sources_delete_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); sources_add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); @@ -694,7 +695,7 @@ TileSetEditor::TileSetEditor() { source_sort_button = memnew(MenuButton); source_sort_button->set_flat(true); - source_sort_button->set_tooltip(TTR("Sort sources")); + source_sort_button->set_tooltip_text(TTR("Sort sources")); PopupMenu *p = source_sort_button->get_popup(); p->connect("id_pressed", callable_mp(this, &TileSetEditor::_set_source_sort)); diff --git a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp index 40cdb243fe..9a4b14616f 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -329,6 +329,7 @@ void TileSetScenesCollectionSourceEditor::_update_scenes_list() { void TileSetScenesCollectionSourceEditor::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { scene_tile_add_button->set_icon(get_theme_icon(SNAME("Add"), SNAME("EditorIcons"))); scene_tile_delete_button->set_icon(get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index 6db499f2c7..2b55ba64c3 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -464,7 +464,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_tools->add_child(staging_area_label); refresh_button = memnew(Button); - refresh_button->set_tooltip(TTR("Detect new changes")); + refresh_button->set_tooltip_text(TTR("Detect new changes")); refresh_button->set_text(TTR("Refresh")); refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area)); @@ -551,7 +551,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_heading = memnew(Label); diff_heading->set_text(TTR("Status")); - diff_heading->set_tooltip(TTR("View file diffs before committing them to the latest version")); + diff_heading->set_tooltip_text(TTR("View file diffs before committing them to the latest version")); diff_hbc->add_child(diff_heading); diff_file_name = memnew(Label); @@ -561,7 +561,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_hbc->add_child(diff_file_name); diff_refresh_button = memnew(Button); - diff_refresh_button->set_tooltip(TTR("Detect changes in file diff")); + diff_refresh_button->set_tooltip_text(TTR("Detect changes in file diff")); diff_refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Reload"), SNAME("EditorIcons"))); diff_refresh_button->connect("pressed", callable_mp(this, &VersionControlEditorPlugin::_refresh_file_diff)); diff_hbc->add_child(diff_refresh_button); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index afef0f8f45..83341b3016 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -754,7 +754,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); - remove_btn->set_tooltip(TTR("Remove") + " " + name_left); + remove_btn->set_tooltip_text(TTR("Remove") + " " + name_left); remove_btn->connect("pressed", callable_mp(editor, &VisualShaderEditor::_remove_input_port).bind(p_id, i), CONNECT_DEFERRED); hb->add_child(remove_btn); } else { @@ -781,7 +781,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id) { if (is_group) { Button *remove_btn = memnew(Button); remove_btn->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Remove"), SNAME("EditorIcons"))); - remove_btn->set_tooltip(TTR("Remove") + " " + name_left); + remove_btn->set_tooltip_text(TTR("Remove") + " " + name_left); remove_btn->connect("pressed", callable_mp(editor, &VisualShaderEditor::_remove_output_port).bind(p_id, i), CONNECT_DEFERRED); hb->add_child(remove_btn); @@ -1716,6 +1716,7 @@ void VisualShaderEditor::_update_graph() { graph_plugin->clear_links(); graph_plugin->make_dirty(true); + graph_plugin->update_theme(); for (int n_i = 0; n_i < nodes.size(); n_i++) { graph_plugin->add_node(type, nodes[n_i]); @@ -3703,11 +3704,9 @@ void VisualShaderEditor::_notification(int p_what) { graph->get_panner()->setup((ViewPanner::ControlScheme)EDITOR_GET("editors/panning/sub_editors_panning_scheme").operator int(), ED_GET_SHORTCUT("canvas_item_editor/pan_view"), bool(EditorSettings::get_singleton()->get("editors/panning/simple_panning"))); graph->set_warped_panning(bool(EditorSettings::get_singleton()->get("editors/panning/warped_mouse_panning"))); - } break; - + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { - graph_plugin->update_theme(); - highend_label->set_modulate(get_theme_color(SNAME("vulkan_color"), SNAME("Editor"))); node_filter->set_right_icon(Control::get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); @@ -3760,7 +3759,7 @@ void VisualShaderEditor::_notification(int p_what) { tools->set_icon(EditorNode::get_singleton()->get_gui_base()->get_theme_icon(SNAME("Tools"), SNAME("EditorIcons"))); - if (is_visible_in_tree()) { + if (p_what == NOTIFICATION_THEME_CHANGED && is_visible_in_tree()) { _update_graph(); } } break; @@ -4827,7 +4826,7 @@ VisualShaderEditor::VisualShaderEditor() { preview_shader = memnew(Button); preview_shader->set_flat(true); preview_shader->set_toggle_mode(true); - preview_shader->set_tooltip(TTR("Show generated shader code.")); + preview_shader->set_tooltip_text(TTR("Show generated shader code.")); graph->get_zoom_hbox()->add_child(preview_shader); preview_shader->connect("pressed", callable_mp(this, &VisualShaderEditor::_show_preview_text)); @@ -4897,7 +4896,7 @@ VisualShaderEditor::VisualShaderEditor() { tools = memnew(MenuButton); filter_hb->add_child(tools); - tools->set_tooltip(TTR("Options")); + tools->set_tooltip_text(TTR("Options")); tools->get_popup()->connect("id_pressed", callable_mp(this, &VisualShaderEditor::_tools_menu_option)); tools->get_popup()->add_item(TTR("Expand All"), EXPAND_ALL); tools->get_popup()->add_item(TTR("Collapse All"), COLLAPSE_ALL); @@ -4929,7 +4928,7 @@ VisualShaderEditor::VisualShaderEditor() { highend_label->set_visible(false); highend_label->set_text("Vulkan"); highend_label->set_mouse_filter(Control::MOUSE_FILTER_STOP); - highend_label->set_tooltip(TTR("High-end node")); + highend_label->set_tooltip_text(TTR("High-end node")); node_desc = memnew(RichTextLabel); members_vb->add_child(node_desc); @@ -5412,6 +5411,7 @@ VisualShaderEditor::VisualShaderEditor() { // TEXTURES add_options.push_back(AddOption("UVFunc", "Textures", "Common", "VisualShaderNodeUVFunc", TTR("Function to be applied on texture coordinates."), {}, VisualShaderNode::PORT_TYPE_VECTOR_2D)); + add_options.push_back(AddOption("UVPolarCoord", "Textures", "Common", "VisualShaderNodeUVPolarCoord", TTR("Polar coordinates conversion applied on texture coordinates."), {}, VisualShaderNode::PORT_TYPE_VECTOR_2D)); cubemap_node_option_idx = add_options.size(); add_options.push_back(AddOption("CubeMap", "Textures", "Functions", "VisualShaderNodeCubemap", TTR("Perform the cubic texture lookup."), {}, VisualShaderNode::PORT_TYPE_VECTOR_4D)); @@ -5419,6 +5419,7 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("CurveTexture", "Textures", "Functions", "VisualShaderNodeCurveTexture", TTR("Perform the curve texture lookup."), {}, VisualShaderNode::PORT_TYPE_SCALAR)); curve_xyz_node_option_idx = add_options.size(); add_options.push_back(AddOption("CurveXYZTexture", "Textures", "Functions", "VisualShaderNodeCurveXYZTexture", TTR("Perform the three components curve texture lookup."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D)); + add_options.push_back(AddOption("LinearSceneDepth", "Textures", "Functions", "VisualShaderNodeLinearSceneDepth", TTR("Returns the depth value of the DEPTH_TEXTURE node in a linear space."), {}, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); texture2d_node_option_idx = add_options.size(); add_options.push_back(AddOption("Texture2D", "Textures", "Functions", "VisualShaderNodeTexture", TTR("Perform the 2D texture lookup."), {}, VisualShaderNode::PORT_TYPE_VECTOR_4D)); texture2d_array_node_option_idx = add_options.size(); @@ -5458,6 +5459,13 @@ VisualShaderEditor::VisualShaderEditor() { add_options.push_back(AddOption("TransformConstant", "Transform", "Variables", "VisualShaderNodeTransformConstant", TTR("Transform constant."), {}, VisualShaderNode::PORT_TYPE_TRANSFORM)); add_options.push_back(AddOption("TransformUniform", "Transform", "Variables", "VisualShaderNodeTransformUniform", TTR("Transform uniform."), {}, VisualShaderNode::PORT_TYPE_TRANSFORM)); + // UTILITY + + add_options.push_back(AddOption("DistanceFade", "Utility", "", "VisualShaderNodeDistanceFade", TTR("The distance fade effect fades out each pixel based on its distance to another object."), {}, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("ProximityFade", "Utility", "", "VisualShaderNodeProximityFade", TTR("The proximity fade effect fades out each pixel based on its distance to another object."), {}, VisualShaderNode::PORT_TYPE_SCALAR, TYPE_FLAGS_FRAGMENT, Shader::MODE_SPATIAL)); + add_options.push_back(AddOption("RandomRange", "Utility", "", "VisualShaderNodeRandomRange", TTR("Returns a random value between the minimum and maximum input values."), {}, VisualShaderNode::PORT_TYPE_SCALAR)); + add_options.push_back(AddOption("Remap", "Utility", "", "VisualShaderNodeRemap", TTR("Remaps a given input from the input range to the output range."), {}, VisualShaderNode::PORT_TYPE_SCALAR)); + // VECTOR add_options.push_back(AddOption("VectorFunc", "Vector", "Common", "VisualShaderNodeVectorFunc", TTR("Vector function."), {}, VisualShaderNode::PORT_TYPE_VECTOR_3D)); diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp index e3b2be33df..713c90c075 100644 --- a/editor/plugins/voxel_gi_editor_plugin.cpp +++ b/editor/plugins/voxel_gi_editor_plugin.cpp @@ -100,7 +100,7 @@ void VoxelGIEditorPlugin::_notification(int p_what) { return; } - bake->set_tooltip(text); + bake->set_tooltip_text(text); } break; } } diff --git a/editor/project_converter_3_to_4.cpp b/editor/project_converter_3_to_4.cpp index 04c73e16ab..cdd088f0b1 100644 --- a/editor/project_converter_3_to_4.cpp +++ b/editor/project_converter_3_to_4.cpp @@ -206,6 +206,7 @@ static const char *gdscript_function_renames[][2] = { // { "set_offset", "set_progress" }, // PathFollow2D, PathFollow3D - Too common // { "set_process_mode", "set_process_callback" }, // AnimationTree broke Node, Tween, Sky // { "set_refuse_new_network_connections", "set_refuse_new_connections"}, // MultiplayerAPI broke SceneTree + // { "set_tooltip", "set_tooltip_text" }, // Control, breaks TreeItem, at least for now. // { "set_uv", "surface_set_uv" }, // ImmediateMesh broke Polygon2D // { "set_v_offset", "set_drag_vertical_offset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D // {"get_points","get_points_id"},// Astar, broke Line2D, Convexpolygonshape @@ -629,6 +630,7 @@ static const char *csharp_function_renames[][2] = { // { "SetOffset", "SetProgress" }, // PathFollow2D, PathFollow3D - Too common // { "SetProcessMode", "SetProcessCallback" }, // AnimationTree broke Node, Tween, Sky // { "SetRefuseNewNetworkConnections", "SetRefuseNewConnections"}, // MultiplayerAPI broke SceneTree + // { "SetTooltip", "SetTooltipText" }, // Control, breaks TreeItem, at least for now. // { "SetUv", "SurfaceSetUv" }, // ImmediateMesh broke Polygon2D // { "SetVOffset", "SetDragVerticalOffset" }, // Camera2D broke Camera3D, PathFollow3D, PathFollow2D // {"GetPoints","GetPointsId"},// Astar, broke Line2D, Convexpolygonshape @@ -1039,6 +1041,7 @@ static const char *gdscript_properties_renames[][2] = { { "global_rate_scale", "playback_speed_scale" }, // AudioServer { "gravity_distance_scale", "gravity_point_distance_scale" }, // Area2D { "gravity_vec", "gravity_direction" }, // Area2D + { "hint_tooltip", "tooltip_text" }, // Control { "hseparation", "h_separation" }, // Theme { "iterations_per_second", "physics_ticks_per_second" }, // Engine { "invert_enable", "invert_enabled" }, // Polygon2D @@ -1123,6 +1126,7 @@ static const char *csharp_properties_renames[][2] = { { "GlobalRateScale", "PlaybackSpeedScale" }, // AudioServer { "GravityDistanceScale", "GravityPointDistanceScale" }, // Area2D { "GravityVec", "GravityDirection" }, // Area2D + { "HintTooltip", "TooltipText" }, // Control { "Hseparation", "HSeparation" }, // Theme { "IterationsPerSecond", "PhysicsTicksPerSecond" }, // Engine { "InvertEnable", "InvertEnabled" }, // Polygon2D diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index cce71d9508..a17a759c17 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1362,7 +1362,7 @@ void ProjectList::create_project_item_control(int p_index) { hb->connect("draw", callable_mp(this, &ProjectList::_panel_draw).bind(hb)); hb->connect("gui_input", callable_mp(this, &ProjectList::_panel_input).bind(hb)); hb->add_theme_constant_override("separation", 10 * EDSCALE); - hb->set_tooltip(item.description); + hb->set_tooltip_text(item.description); VBoxContainer *favorite_box = memnew(VBoxContainer); favorite_box->set_name("FavoriteBox"); @@ -1445,9 +1445,9 @@ void ProjectList::create_project_item_control(int p_index) { if (!item.missing) { show->connect("pressed", callable_mp(this, &ProjectList::_show_project).bind(item.path)); - show->set_tooltip(TTR("Show in File Manager")); + show->set_tooltip_text(TTR("Show in File Manager")); } else { - show->set_tooltip(TTR("Error: Project is missing on the filesystem.")); + show->set_tooltip_text(TTR("Error: Project is missing on the filesystem.")); } Label *fpath = memnew(Label(item.path)); @@ -2570,7 +2570,7 @@ ProjectManager::ProjectManager() { search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter Projects")); - search_box->set_tooltip(TTR("This field filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character.")); + search_box->set_tooltip_text(TTR("This field filters projects by name and last path component.\nTo filter projects by name and full path, the query must contain at least one `/` character.")); search_box->connect("text_changed", callable_mp(this, &ProjectManager::_on_search_term_changed)); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(search_box); @@ -2710,7 +2710,7 @@ ProjectManager::ProjectManager() { // Fade the version label to be less prominent, but still readable. version_btn->set_self_modulate(Color(1, 1, 1, 0.6)); version_btn->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); - version_btn->set_tooltip(TTR("Click to copy.")); + version_btn->set_tooltip_text(TTR("Click to copy.")); version_btn->connect("pressed", callable_mp(this, &ProjectManager::_version_button_pressed)); spacer_vb->add_child(version_btn); diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 279ed55a38..581315d512 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -518,6 +518,24 @@ void ProjectSettingsEditor::_update_action_map_editor() { action_map_editor->update_action_list(actions); } +void ProjectSettingsEditor::_update_theme() { + search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + restart_close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); + restart_container->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); + restart_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); + restart_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); + + type_box->clear(); + for (int i = 0; i < Variant::VARIANT_MAX; i++) { + if (i == Variant::NIL || i == Variant::OBJECT || i == Variant::CALLABLE || i == Variant::SIGNAL || i == Variant::RID) { + // These types can't be serialized properly, so skip them. + continue; + } + String type = Variant::get_type_name(Variant::Type(i)); + type_box->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i); + } +} + void ProjectSettingsEditor::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { @@ -529,24 +547,11 @@ void ProjectSettingsEditor::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { general_settings_inspector->edit(ps); _update_action_map_editor(); + _update_theme(); } break; case NOTIFICATION_THEME_CHANGED: { - search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); - restart_close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons"))); - restart_container->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); - restart_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons"))); - restart_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor"))); - - type_box->clear(); - for (int i = 0; i < Variant::VARIANT_MAX; i++) { - if (i == Variant::NIL || i == Variant::OBJECT || i == Variant::CALLABLE || i == Variant::SIGNAL || i == Variant::RID) { - // These types can't be serialized properly, so skip them. - continue; - } - String type = Variant::get_type_name(Variant::Type(i)); - type_box->add_icon_item(get_theme_icon(type, SNAME("EditorIcons")), type, i); - } + _update_theme(); } break; } } diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h index f01f5c1836..040d992e40 100644 --- a/editor/project_settings_editor.h +++ b/editor/project_settings_editor.h @@ -106,6 +106,7 @@ class ProjectSettingsEditor : public AcceptDialog { void _action_renamed(const String &p_old_name, const String &p_new_name); void _action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before); void _update_action_map_editor(); + void _update_theme(); protected: void _notification(int p_what); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index 84923a94a2..7b4df696b7 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -139,7 +139,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_name = memnew(Button); but_insert_name->set_text("NAME"); - but_insert_name->set_tooltip(String("${NAME}\n") + TTR("Node name.")); + but_insert_name->set_tooltip_text(String("${NAME}\n") + TTR("Node name.")); but_insert_name->set_focus_mode(Control::FOCUS_NONE); but_insert_name->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${NAME}")); but_insert_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -149,7 +149,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_parent = memnew(Button); but_insert_parent->set_text("PARENT"); - but_insert_parent->set_tooltip(String("${PARENT}\n") + TTR("Node's parent name, if available.")); + but_insert_parent->set_tooltip_text(String("${PARENT}\n") + TTR("Node's parent name, if available.")); but_insert_parent->set_focus_mode(Control::FOCUS_NONE); but_insert_parent->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${PARENT}")); but_insert_parent->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -159,7 +159,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_type = memnew(Button); but_insert_type->set_text("TYPE"); - but_insert_type->set_tooltip(String("${TYPE}\n") + TTR("Node type.")); + but_insert_type->set_tooltip_text(String("${TYPE}\n") + TTR("Node type.")); but_insert_type->set_focus_mode(Control::FOCUS_NONE); but_insert_type->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${TYPE}")); but_insert_type->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -169,7 +169,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_scene = memnew(Button); but_insert_scene->set_text("SCENE"); - but_insert_scene->set_tooltip(String("${SCENE}\n") + TTR("Current scene name.")); + but_insert_scene->set_tooltip_text(String("${SCENE}\n") + TTR("Current scene name.")); but_insert_scene->set_focus_mode(Control::FOCUS_NONE); but_insert_scene->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${SCENE}")); but_insert_scene->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -179,7 +179,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_root = memnew(Button); but_insert_root->set_text("ROOT"); - but_insert_root->set_tooltip(String("${ROOT}\n") + TTR("Root node name.")); + but_insert_root->set_tooltip_text(String("${ROOT}\n") + TTR("Root node name.")); but_insert_root->set_focus_mode(Control::FOCUS_NONE); but_insert_root->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${ROOT}")); but_insert_root->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -189,7 +189,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR but_insert_count = memnew(Button); but_insert_count->set_text("COUNTER"); - but_insert_count->set_tooltip(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options.")); + but_insert_count->set_tooltip_text(String("${COUNTER}\n") + TTR("Sequential integer counter.\nCompare counter options.")); but_insert_count->set_focus_mode(Control::FOCUS_NONE); but_insert_count->connect("pressed", callable_mp(this, &RenameDialog::_insert_text).bind("${COUNTER}")); but_insert_count->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -197,7 +197,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR chk_per_level_counter = memnew(CheckBox); chk_per_level_counter->set_text(TTR("Per-level Counter")); - chk_per_level_counter->set_tooltip(TTR("If set, the counter restarts for each group of child nodes.")); + chk_per_level_counter->set_tooltip_text(TTR("If set, the counter restarts for each group of child nodes.")); vbc_substitute->add_child(chk_per_level_counter); HBoxContainer *hbc_count_options = memnew(HBoxContainer); @@ -205,32 +205,32 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, Ref<EditorUndoR Label *lbl_count_start = memnew(Label); lbl_count_start->set_text(TTR("Start")); - lbl_count_start->set_tooltip(TTR("Initial value for the counter.")); + lbl_count_start->set_tooltip_text(TTR("Initial value for the counter.")); hbc_count_options->add_child(lbl_count_start); spn_count_start = memnew(SpinBox); - spn_count_start->set_tooltip(TTR("Initial value for the counter.")); + spn_count_start->set_tooltip_text(TTR("Initial value for the counter.")); spn_count_start->set_step(1); spn_count_start->set_min(0); hbc_count_options->add_child(spn_count_start); Label *lbl_count_step = memnew(Label); lbl_count_step->set_text(TTR("Step")); - lbl_count_step->set_tooltip(TTR("Amount by which counter is incremented for each node.")); + lbl_count_step->set_tooltip_text(TTR("Amount by which counter is incremented for each node.")); hbc_count_options->add_child(lbl_count_step); spn_count_step = memnew(SpinBox); - spn_count_step->set_tooltip(TTR("Amount by which counter is incremented for each node.")); + spn_count_step->set_tooltip_text(TTR("Amount by which counter is incremented for each node.")); spn_count_step->set_step(1); hbc_count_options->add_child(spn_count_step); Label *lbl_count_padding = memnew(Label); lbl_count_padding->set_text(TTR("Padding")); - lbl_count_padding->set_tooltip(TTR("Minimum number of digits for the counter.\nMissing digits are padded with leading zeros.")); + lbl_count_padding->set_tooltip_text(TTR("Minimum number of digits for the counter.\nMissing digits are padded with leading zeros.")); hbc_count_options->add_child(lbl_count_padding); spn_count_padding = memnew(SpinBox); - spn_count_padding->set_tooltip(TTR("Minimum number of digits for the counter.\nMissing digits are padded with leading zeros.")); + spn_count_padding->set_tooltip_text(TTR("Minimum number of digits for the counter.\nMissing digits are padded with leading zeros.")); spn_count_padding->set_step(1); hbc_count_options->add_child(spn_count_padding); diff --git a/editor/scene_create_dialog.cpp b/editor/scene_create_dialog.cpp index 30a41eea7a..94a5c07709 100644 --- a/editor/scene_create_dialog.cpp +++ b/editor/scene_create_dialog.cpp @@ -46,6 +46,7 @@ void SceneCreateDialog::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { select_node_button->set_icon(get_theme_icon(SNAME("ClassList"), SNAME("EditorIcons"))); node_type_2d->set_icon(get_theme_icon(SNAME("Node2D"), SNAME("EditorIcons"))); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 9f80119c35..c7c713fc67 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1230,7 +1230,7 @@ void SceneTreeDock::_notification(int p_what) { node_shortcuts_toggle->set_name("NodeShortcutsToggle"); node_shortcuts_toggle->set_icon(get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons"))); node_shortcuts_toggle->set_toggle_mode(true); - node_shortcuts_toggle->set_tooltip(TTR("Switch to Favorite Nodes")); + node_shortcuts_toggle->set_tooltip_text(TTR("Switch to Favorite Nodes")); node_shortcuts_toggle->set_pressed(EDITOR_GET("_use_favorites_root_selection")); node_shortcuts_toggle->set_anchors_and_offsets_preset(Control::PRESET_CENTER_RIGHT); node_shortcuts_toggle->connect("pressed", callable_mp(this, &SceneTreeDock::_update_create_root_dialog)); @@ -3397,14 +3397,14 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_add = memnew(Button); button_add->set_flat(true); button_add->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_NEW, false)); - button_add->set_tooltip(TTR("Add/Create a New Node.")); + button_add->set_tooltip_text(TTR("Add/Create a New Node.")); button_add->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node")); filter_hbc->add_child(button_add); button_instance = memnew(Button); button_instance->set_flat(true); button_instance->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_INSTANTIATE, false)); - button_instance->set_tooltip(TTR("Instantiate a scene file as a Node. Creates an inherited scene if no root node exists.")); + button_instance->set_tooltip_text(TTR("Instantiate a scene file as a Node. Creates an inherited scene if no root node exists.")); button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instance_scene")); filter_hbc->add_child(button_instance); @@ -3419,7 +3419,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_create_script = memnew(Button); button_create_script->set_flat(true); button_create_script->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_ATTACH_SCRIPT, false)); - button_create_script->set_tooltip(TTR("Attach a new or existing script to the selected node.")); + button_create_script->set_tooltip_text(TTR("Attach a new or existing script to the selected node.")); button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(button_create_script); button_create_script->hide(); @@ -3427,7 +3427,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_detach_script = memnew(Button); button_detach_script->set_flat(true); button_detach_script->connect("pressed", callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_DETACH_SCRIPT, false)); - button_detach_script->set_tooltip(TTR("Detach the script from the selected node.")); + button_detach_script->set_tooltip_text(TTR("Detach the script from the selected node.")); button_detach_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/detach_script")); filter_hbc->add_child(button_detach_script); button_detach_script->hide(); @@ -3450,7 +3450,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec edit_remote->set_h_size_flags(SIZE_EXPAND_FILL); edit_remote->set_text(TTR("Remote")); edit_remote->set_toggle_mode(true); - edit_remote->set_tooltip(TTR("If selected, the Remote scene tree dock will cause the project to stutter every time it updates.\nSwitch back to the Local scene tree dock to improve performance.")); + edit_remote->set_tooltip_text(TTR("If selected, the Remote scene tree dock will cause the project to stutter every time it updates.\nSwitch back to the Local scene tree dock to improve performance.")); edit_remote->connect("pressed", callable_mp(this, &SceneTreeDock::_remote_tree_selected)); edit_local = memnew(Button); diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 7b0c68fb6b..00fd0c3aac 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -1345,6 +1345,10 @@ void SceneTreeDialog::popup_scenetree_dialog() { popup_centered_clamped(Size2(350, 700) * EDSCALE); } +void SceneTreeDialog::_update_theme() { + filter->set_right_icon(tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); +} + void SceneTreeDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_VISIBILITY_CHANGED: { @@ -1355,10 +1359,11 @@ void SceneTreeDialog::_notification(int p_what) { case NOTIFICATION_ENTER_TREE: { connect("confirmed", callable_mp(this, &SceneTreeDialog::_select)); + _update_theme(); } break; case NOTIFICATION_THEME_CHANGED: { - filter->set_right_icon(tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons"))); + _update_theme(); } break; case NOTIFICATION_EXIT_TREE: { diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h index f3ca0347ea..0c13ad96cd 100644 --- a/editor/scene_tree_editor.h +++ b/editor/scene_tree_editor.h @@ -179,6 +179,7 @@ class SceneTreeDialog : public ConfirmationDialog { void _cancel(); void _selected_changed(); void _filter_changed(const String &p_filter); + void _update_theme(); protected: void _notification(int p_what); diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 28790f2711..15e992ce18 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -120,8 +120,9 @@ void ScriptCreateDialog::_notification(int p_what) { } else { language_menu->select(default_language); } - } break; + [[fallthrough]]; + } case NOTIFICATION_THEME_CHANGED: { for (int i = 0; i < ScriptServer::get_language_count(); i++) { Ref<Texture2D> language_icon = get_theme_icon(ScriptServer::get_language(i)->get_type(), SNAME("EditorIcons")); diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp index fc7fff325c..8c4a231e8a 100644 --- a/editor/shader_create_dialog.cpp +++ b/editor/shader_create_dialog.cpp @@ -47,6 +47,8 @@ enum ShaderType { void ShaderCreateDialog::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: { + _update_theme(); + String last_lang = EditorSettings::get_singleton()->get_project_metadata("shader_setup", "last_selected_language", ""); if (!last_lang.is_empty()) { for (int i = 0; i < type_menu->get_item_count(); i++) { @@ -65,25 +67,29 @@ void ShaderCreateDialog::_notification(int p_what) { } break; case NOTIFICATION_THEME_CHANGED: { - Ref<Texture2D> shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons")); - if (shader_icon.is_valid()) { - type_menu->set_item_icon(0, shader_icon); - } + _update_theme(); + } break; + } +} - Ref<Texture2D> visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons")); - if (visual_shader_icon.is_valid()) { - type_menu->set_item_icon(1, visual_shader_icon); - } +void ShaderCreateDialog::_update_theme() { + Ref<Texture2D> shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons")); + if (shader_icon.is_valid()) { + type_menu->set_item_icon(0, shader_icon); + } - Ref<Texture2D> include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")); - if (include_icon.is_valid()) { - type_menu->set_item_icon(2, include_icon); - } + Ref<Texture2D> visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons")); + if (visual_shader_icon.is_valid()) { + type_menu->set_item_icon(1, visual_shader_icon); + } - path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); - status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); - } break; + Ref<Texture2D> include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons")); + if (include_icon.is_valid()) { + type_menu->set_item_icon(2, include_icon); } + + path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons"))); + status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree"))); } void ShaderCreateDialog::_update_language_info() { diff --git a/editor/shader_create_dialog.h b/editor/shader_create_dialog.h index 9496d0ce9e..9ba655369b 100644 --- a/editor/shader_create_dialog.h +++ b/editor/shader_create_dialog.h @@ -98,6 +98,7 @@ class ShaderCreateDialog : public ConfirmationDialog { void _update_dialog(); protected: + void _update_theme(); void _notification(int p_what); static void _bind_methods(); |