diff --git a/doc/classes/EditorProperty.xml b/doc/classes/EditorProperty.xml index cf8296841d..aea0a21892 100644 --- a/doc/classes/EditorProperty.xml +++ b/doc/classes/EditorProperty.xml @@ -118,6 +118,7 @@ Used by the inspector, set to [code]true[/code] when the property is drawn with the editor theme's warning color. This is used for editable children's properties. + Used by the inspector, set to [code]true[/code] when the property can add keys for animation. diff --git a/doc/classes/EditorSettings.xml b/doc/classes/EditorSettings.xml index 5a765d56f8..bc86d9e1c5 100644 --- a/doc/classes/EditorSettings.xml +++ b/doc/classes/EditorSettings.xml @@ -233,6 +233,9 @@ The tint intensity to use for the subresources background in the Inspector dock. The tint is used to distinguish between different subresources in the inspector. Higher values result in a more noticeable background color difference. + + If [code]true[/code], accessibility related warnings are displayed alongside other configuration warnings. + If [code]true[/code], when a node is deleted with animation tracks referencing it, a confirmation dialog appears before the tracks are deleted. The dialog will appear even when using the "Delete (No Confirm)" shortcut. diff --git a/editor/action_map_editor.cpp b/editor/action_map_editor.cpp index b830c71c61..2958ffc23b 100644 --- a/editor/action_map_editor.cpp +++ b/editor/action_map_editor.cpp @@ -257,6 +257,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); action_tree->set_drag_preview(label); + get_viewport()->gui_set_drag_description(vformat(RTR("Action %s"), name)); + Dictionary drag_data; if (selected->has_meta("__action")) { @@ -267,6 +269,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from drag_data["input_type"] = "event"; } + drag_data["source"] = selected->get_instance_id(); + action_tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN); return drag_data; @@ -278,9 +282,11 @@ bool ActionMapEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d return false; } + TreeItem *source = Object::cast_to(ObjectDB::get_instance(d["source"].operator ObjectID())); TreeItem *selected = action_tree->get_selected(); - TreeItem *item = action_tree->get_item_at_position(p_point); - if (!selected || !item || item == selected) { + + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position(p_point); + if (!selected || !item || item == source) { return false; } @@ -303,13 +309,13 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, } TreeItem *selected = action_tree->get_selected(); - TreeItem *target = action_tree->get_item_at_position(p_point); - bool drop_above = action_tree->get_drop_section_at_position(p_point) == -1; - + TreeItem *target = (p_point == Vector2(INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position(p_point); if (!target) { return; } + bool drop_above = ((p_point == Vector2(INFINITY, INFINITY)) ? action_tree->get_drop_section_at_position(action_tree->get_item_rect(target).position) : action_tree->get_drop_section_at_position(p_point)) == -1; + Dictionary d = p_data; if (d["input_type"] == "action") { // Change action order. @@ -501,8 +507,8 @@ void ActionMapEditor::update_action_list(const Vector &p_action_info } // Third Column - Buttons - event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Edit")), BUTTON_EDIT_EVENT, false, TTR("Edit Event")); - event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Remove")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event")); + event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Edit")), BUTTON_EDIT_EVENT, false, TTR("Edit Event"), TTR("Edit Event")); + event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Remove")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event"), TTR("Remove Event")); event_item->set_button_color(2, 0, Color(1, 1, 1, 0.75)); event_item->set_button_color(2, 1, Color(1, 1, 1, 0.75)); } @@ -543,6 +549,7 @@ ActionMapEditor::ActionMapEditor() { action_list_search = memnew(LineEdit); action_list_search->set_h_size_flags(Control::SIZE_EXPAND_FILL); action_list_search->set_placeholder(TTR("Filter by Name")); + action_list_search->set_accessibility_name(TTRC("Filter by Name")); action_list_search->set_clear_button_enabled(true); action_list_search->connect(SceneStringName(text_changed), callable_mp(this, &ActionMapEditor::_search_term_updated)); top_hbox->add_child(action_list_search); @@ -550,6 +557,7 @@ ActionMapEditor::ActionMapEditor() { action_list_search_by_event = memnew(EventListenerLineEdit); action_list_search_by_event->set_h_size_flags(Control::SIZE_EXPAND_FILL); action_list_search_by_event->set_stretch_ratio(0.75); + action_list_search_by_event->set_accessibility_name(TTRC("Action Event")); action_list_search_by_event->connect("event_changed", callable_mp(this, &ActionMapEditor::_search_by_event)); action_list_search_by_event->connect(SceneStringName(focus_entered), callable_mp(this, &ActionMapEditor::_on_filter_focused)); action_list_search_by_event->connect(SceneStringName(focus_exited), callable_mp(this, &ActionMapEditor::_on_filter_unfocused)); @@ -569,6 +577,7 @@ ActionMapEditor::ActionMapEditor() { add_edit = memnew(LineEdit); add_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_edit->set_placeholder(TTR("Add New Action")); + add_edit->set_accessibility_name(TTRC("Add New Action")); add_edit->set_clear_button_enabled(true); add_edit->set_keep_editing_on_text_submit(true); add_edit->connect(SceneStringName(text_changed), callable_mp(this, &ActionMapEditor::_add_edit_text_changed)); @@ -597,6 +606,7 @@ ActionMapEditor::ActionMapEditor() { // Action Editor Tree action_tree = memnew(Tree); action_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); + action_tree->set_accessibility_name(TTRC("Action Map")); action_tree->set_columns(3); action_tree->set_hide_root(true); action_tree->set_column_titles_visible(true); diff --git a/editor/add_metadata_dialog.cpp b/editor/add_metadata_dialog.cpp index b9136d2f00..921df2919c 100644 --- a/editor/add_metadata_dialog.cpp +++ b/editor/add_metadata_dialog.cpp @@ -41,11 +41,13 @@ AddMetadataDialog::AddMetadataDialog() { hbc->add_child(memnew(Label(TTR("Name:")))); add_meta_name = memnew(LineEdit); + add_meta_name->set_accessibility_name(TTRC("Name:")); add_meta_name->set_custom_minimum_size(Size2(200 * EDSCALE, 1)); hbc->add_child(add_meta_name); hbc->add_child(memnew(Label(TTR("Type:")))); add_meta_type = memnew(OptionButton); + add_meta_type->set_accessibility_name(TTRC("Type:")); hbc->add_child(add_meta_type); diff --git a/editor/animation_bezier_editor.cpp b/editor/animation_bezier_editor.cpp index 240ea71791..7e21797484 100644 --- a/editor/animation_bezier_editor.cpp +++ b/editor/animation_bezier_editor.cpp @@ -245,6 +245,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) { selected_icon = get_editor_theme_icon(SNAME("KeyBezierSelected")); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation bezier track editor"))); + } break; + case NOTIFICATION_DRAW: { if (animation.is_null()) { return; diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index a2b24ffab3..8380e56f16 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -1485,6 +1485,15 @@ void AnimationTimelineEdit::_notification(int p_what) { len_hb->set_size(Size2(get_buttons_width(), get_size().height)); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation timeline editor"))); + } break; + case NOTIFICATION_DRAW: { int key_range = get_size().width - get_buttons_width() - get_name_limit(); @@ -2008,10 +2017,12 @@ AnimationTimelineEdit::AnimationTimelineEdit() { expander->set_h_size_flags(SIZE_EXPAND_FILL); expander->set_mouse_filter(MOUSE_FILTER_IGNORE); len_hb->add_child(expander); + time_icon = memnew(TextureRect); time_icon->set_v_size_flags(SIZE_SHRINK_CENTER); time_icon->set_tooltip_text(TTR("Animation length (seconds)")); len_hb->add_child(time_icon); + length = memnew(EditorSpinSlider); length->set_min(SECOND_DECIMAL); length->set_max(36000); @@ -2020,11 +2031,14 @@ AnimationTimelineEdit::AnimationTimelineEdit() { length->set_custom_minimum_size(Vector2(70 * EDSCALE, 0)); length->set_hide_slider(true); length->set_tooltip_text(TTR("Animation length (seconds)")); + length->set_accessibility_name(TTRC("Animation length")); length->connect(SceneStringName(value_changed), callable_mp(this, &AnimationTimelineEdit::_anim_length_changed)); len_hb->add_child(length); + loop = memnew(Button); loop->set_flat(true); loop->set_tooltip_text(TTR("Animation Looping")); + loop->set_accessibility_name(TTRC("Animation Looping")); loop->connect(SceneStringName(pressed), callable_mp(this, &AnimationTimelineEdit::_anim_loop_pressed)); loop->set_toggle_mode(true); len_hb->add_child(loop); @@ -2056,6 +2070,15 @@ void AnimationTrackEdit::_notification(int p_what) { selected_icon = get_editor_theme_icon(SNAME("KeySelected")); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation track editor"))); + } break; + case NOTIFICATION_DRAW: { if (animation.is_null()) { return; @@ -3604,6 +3627,15 @@ void AnimationTrackEditGroup::_notification(int p_what) { icon_size = Vector2(1, 1) * get_theme_constant(SNAME("class_icon_size"), EditorStringName(Editor)); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation track group"))); + } break; + case NOTIFICATION_DRAW: { const Ref font = get_theme_font(SceneStringName(font), SNAME("Label")); const int font_size = get_theme_font_size(SceneStringName(font_size), SNAME("Label")); @@ -7674,6 +7706,7 @@ AnimationTrackEditor::AnimationTrackEditor() { bezier_edit_icon->set_toggle_mode(true); bezier_edit_icon->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_toggle_bezier_edit)); bezier_edit_icon->set_tooltip_text(TTR("Toggle between the bezier curve editor and track editor.")); + bezier_edit_icon->set_accessibility_name(TTRC("Bezier Curve Editor")); bottom_hf->add_child(bezier_edit_icon); @@ -7692,6 +7725,7 @@ AnimationTrackEditor::AnimationTrackEditor() { selected_filter->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); // Same function works the same. selected_filter->set_toggle_mode(true); selected_filter->set_tooltip_text(TTR("Only show tracks from nodes selected in tree.")); + selected_filter->set_accessibility_name(TTRC("Show Tracks from Selected Nodes")); bottom_hf->add_child(selected_filter); @@ -7700,6 +7734,7 @@ AnimationTrackEditor::AnimationTrackEditor() { view_group->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_view_group_toggle)); view_group->set_toggle_mode(true); view_group->set_tooltip_text(TTR("Group tracks by node or display them as plain list.")); + view_group->set_accessibility_name(TTRC("Group Tracks by Node")); bottom_hf->add_child(view_group); bottom_hf->add_child(memnew(VSeparator)); @@ -7711,6 +7746,7 @@ AnimationTrackEditor::AnimationTrackEditor() { snap_timeline->set_toggle_mode(true); snap_timeline->set_pressed(false); snap_timeline->set_tooltip_text(TTR("Apply snapping to timeline cursor.")); + snap_timeline->set_accessibility_name(TTRC("Apply Snapping to Cursor")); snap_keys = memnew(Button); snap_keys->set_flat(true); @@ -7719,6 +7755,7 @@ AnimationTrackEditor::AnimationTrackEditor() { snap_keys->set_toggle_mode(true); snap_keys->set_pressed(true); snap_keys->set_tooltip_text(TTR("Apply snapping to selected key(s).")); + snap_keys->set_accessibility_name(TTRC("Apply Snapping to Selected Key")); fps_compat = memnew(Button); fps_compat->set_flat(true); @@ -7727,6 +7764,7 @@ AnimationTrackEditor::AnimationTrackEditor() { fps_compat->set_toggle_mode(true); fps_compat->set_pressed(true); fps_compat->set_tooltip_text(TTR("Apply snapping to the nearest integer FPS.")); + fps_compat->set_accessibility_name(TTRC("Apply Snapping to Nearest Integer FPS")); fps_compat->connect(SceneStringName(toggled), callable_mp(this, &AnimationTrackEditor::_update_fps_compat_mode)); nearest_fps_label = memnew(Label); @@ -7740,6 +7778,7 @@ AnimationTrackEditor::AnimationTrackEditor() { step->set_hide_slider(true); step->set_custom_minimum_size(Size2(100, 0) * EDSCALE); step->set_tooltip_text(TTR("Animation step value.")); + step->set_accessibility_name(TTRC("Animation Step Value")); bottom_hf->add_child(step); step->connect(SceneStringName(value_changed), callable_mp(this, &AnimationTrackEditor::_update_step)); step->set_read_only(true); @@ -7747,6 +7786,7 @@ AnimationTrackEditor::AnimationTrackEditor() { snap_mode = memnew(OptionButton); snap_mode->add_item(TTR("Seconds")); snap_mode->add_item(TTR("FPS")); + snap_mode->set_accessibility_name(TTRC("Snap Mode")); snap_mode->set_disabled(true); bottom_hf->add_child(snap_mode); snap_mode->connect(SceneStringName(item_selected), callable_mp(this, &AnimationTrackEditor::_snap_mode_changed)); @@ -7764,6 +7804,7 @@ AnimationTrackEditor::AnimationTrackEditor() { zoom->set_value(1.0); zoom->set_custom_minimum_size(Size2(200, 0) * EDSCALE); zoom->set_v_size_flags(SIZE_SHRINK_CENTER); + zoom->set_accessibility_name(TTRC("Zoom")); zoom_hb->add_child(zoom); bottom_hf->add_child(zoom_hb); timeline->set_zoom(zoom); @@ -7774,6 +7815,7 @@ AnimationTrackEditor::AnimationTrackEditor() { auto_fit->set_flat(true); auto_fit->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit)); auto_fit->set_shortcut(ED_GET_SHORTCUT("animation_editor/auto_fit")); + auto_fit->set_accessibility_name(TTRC("Auto Fit")); bottom_hf->add_child(auto_fit); auto_fit_bezier = memnew(Button); @@ -7781,6 +7823,7 @@ AnimationTrackEditor::AnimationTrackEditor() { auto_fit_bezier->set_visible(false); auto_fit_bezier->connect(SceneStringName(pressed), callable_mp(this, &AnimationTrackEditor::_auto_fit_bezier)); auto_fit_bezier->set_shortcut(ED_GET_SHORTCUT("animation_editor/auto_fit")); + auto_fit_bezier->set_accessibility_name(TTRC("Auto Fit Bezier")); bottom_hf->add_child(auto_fit_bezier); edit = memnew(MenuButton); @@ -7789,6 +7832,7 @@ AnimationTrackEditor::AnimationTrackEditor() { edit->set_flat(false); edit->set_disabled(true); edit->set_tooltip_text(TTR("Animation properties.")); + edit->set_accessibility_name(TTRC("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(); @@ -7833,10 +7877,12 @@ AnimationTrackEditor::AnimationTrackEditor() { prop_selector = memnew(PropertySelector); add_child(prop_selector); prop_selector->connect("selected", callable_mp(this, &AnimationTrackEditor::_new_track_property_selected)); + prop_selector->set_accessibility_name(TTRC("Track Property")); method_selector = memnew(PropertySelector); add_child(method_selector); method_selector->connect("selected", callable_mp(this, &AnimationTrackEditor::_add_method_key)); + method_selector->set_accessibility_name(TTRC("Method Key")); insert_confirm = memnew(ConfirmationDialog); add_child(insert_confirm); @@ -7881,18 +7927,21 @@ AnimationTrackEditor::AnimationTrackEditor() { optimize_velocity_error->set_min(0.001); optimize_velocity_error->set_step(0.001); optimize_velocity_error->set_value(0.01); + optimize_velocity_error->set_accessibility_name(TTRC("Max Velocity Error")); optimize_vb->add_margin_child(TTR("Max Velocity Error:"), optimize_velocity_error); optimize_angular_error = memnew(SpinBox); optimize_angular_error->set_max(1.0); optimize_angular_error->set_min(0.001); optimize_angular_error->set_step(0.001); optimize_angular_error->set_value(0.01); + optimize_angular_error->set_accessibility_name(TTRC("Max Angular Error")); optimize_vb->add_margin_child(TTR("Max Angular Error:"), optimize_angular_error); optimize_precision_error = memnew(SpinBox); optimize_precision_error->set_max(6); optimize_precision_error->set_min(1); optimize_precision_error->set_step(1); optimize_precision_error->set_value(3); + optimize_precision_error->set_accessibility_name(TTRC("Max Precision Error")); optimize_vb->add_margin_child(TTR("Max Precision Error:"), optimize_precision_error); optimize_dialog->set_ok_button_text(TTR("Optimize")); @@ -7943,6 +7992,7 @@ AnimationTrackEditor::AnimationTrackEditor() { scale->set_max(99999); scale->set_step(0.001); scale->set_select_all_on_focus(true); + scale->set_accessibility_name(TTRC("Scale Ratio")); vbc->add_margin_child(TTR("Scale Ratio:"), scale); scale_dialog->connect(SceneStringName(confirmed), callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed).bind(EDIT_SCALE_CONFIRM), CONNECT_DEFERRED); add_child(scale_dialog); @@ -7958,6 +8008,7 @@ AnimationTrackEditor::AnimationTrackEditor() { ease_grid->set_columns(2); ease_dialog->add_child(ease_grid); transition_selection = memnew(OptionButton); + transition_selection->set_accessibility_name(TTRC("Transition Type")); transition_selection->add_item(TTR("Linear", "Transition Type"), Tween::TRANS_LINEAR); transition_selection->add_item(TTR("Sine", "Transition Type"), Tween::TRANS_SINE); transition_selection->add_item(TTR("Quint", "Transition Type"), Tween::TRANS_QUINT); @@ -7973,6 +8024,7 @@ AnimationTrackEditor::AnimationTrackEditor() { transition_selection->select(Tween::TRANS_LINEAR); // Default transition_selection->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); // Translation context is needed. ease_selection = memnew(OptionButton); + ease_selection->set_accessibility_name(TTRC("Ease Type")); ease_selection->add_item(TTR("In", "Ease Type"), Tween::EASE_IN); ease_selection->add_item(TTR("Out", "Ease Type"), Tween::EASE_OUT); ease_selection->add_item(TTR("InOut", "Ease Type"), Tween::EASE_IN_OUT); @@ -7984,6 +8036,7 @@ AnimationTrackEditor::AnimationTrackEditor() { ease_fps->set_max(999); ease_fps->set_step(FPS_DECIMAL); ease_fps->set_value(30); // Default + ease_fps->set_accessibility_name(TTRC("FPS")); ease_grid->add_child(memnew(Label(TTR("Transition Type:")))); ease_grid->add_child(transition_selection); ease_grid->add_child(memnew(Label(TTR("Ease Type:")))); @@ -8000,12 +8053,16 @@ AnimationTrackEditor::AnimationTrackEditor() { bake_grid->set_columns(2); bake_dialog->add_child(bake_grid); bake_trs = memnew(CheckBox); + bake_trs->set_accessibility_name(TTRC("3D Pos/Rot/Scl Track")); bake_trs->set_pressed(true); bake_blendshape = memnew(CheckBox); + bake_blendshape->set_accessibility_name(TTRC("Blendshape Track")); bake_blendshape->set_pressed(true); bake_value = memnew(CheckBox); + bake_value->set_accessibility_name(TTRC("Value Track")); bake_value->set_pressed(true); bake_fps = memnew(SpinBox); + bake_fps->set_accessibility_name(TTRC("FPS")); bake_fps->set_min(FPS_DECIMAL); bake_fps->set_max(999); bake_fps->set_step(FPS_DECIMAL); @@ -8033,6 +8090,7 @@ AnimationTrackEditor::AnimationTrackEditor() { track_copy_vbox->add_child(select_all_button); track_copy_select = memnew(Tree); + track_copy_select->set_accessibility_name(TTRC("Copy Selection")); track_copy_select->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); track_copy_select->set_h_size_flags(SIZE_EXPAND_FILL); track_copy_select->set_v_size_flags(SIZE_EXPAND_FILL); @@ -8369,6 +8427,15 @@ void AnimationMarkerEdit::_notification(int p_what) { selected_icon = get_editor_theme_icon(SNAME("MarkerSelected")); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation marker editor"))); + } break; + case NOTIFICATION_DRAW: { if (animation.is_null()) { return; diff --git a/editor/code_editor.cpp b/editor/code_editor.cpp index f9e397e05f..38e1e869c0 100644 --- a/editor/code_editor.cpp +++ b/editor/code_editor.cpp @@ -123,6 +123,7 @@ GotoLinePopup::GotoLinePopup() { line_input->set_select_all_on_focus(true); line_input->connect(SceneStringName(text_changed), callable_mp(this, &GotoLinePopup::_goto_line).unbind(1)); line_input->connect(SceneStringName(text_submitted), callable_mp(this, &GotoLinePopup::_submit).unbind(1)); + line_input->set_accessibility_name(TTRC("Line Number")); vbc->add_child(line_input); } @@ -753,6 +754,7 @@ void FindReplaceBar::_bind_methods() { FindReplaceBar::FindReplaceBar() { toggle_replace_button = memnew(Button); add_child(toggle_replace_button); + toggle_replace_button->set_accessibility_name(TTRC("Replace Mode")); toggle_replace_button->set_flat(true); toggle_replace_button->set_focus_mode(FOCUS_NONE); toggle_replace_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_toggle_replace_pressed)); @@ -784,6 +786,7 @@ FindReplaceBar::FindReplaceBar() { vbc_lineedit->add_child(search_text); search_text->set_placeholder(TTR("Find")); search_text->set_tooltip_text(TTR("Find")); + search_text->set_accessibility_name(TTRC("Find")); search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); search_text->connect(SceneStringName(text_changed), callable_mp(this, &FindReplaceBar::_search_text_changed)); search_text->connect(SceneStringName(text_submitted), callable_mp(this, &FindReplaceBar::_search_text_submitted)); @@ -795,6 +798,7 @@ FindReplaceBar::FindReplaceBar() { find_prev = memnew(Button); find_prev->set_flat(true); find_prev->set_tooltip_text(TTR("Previous Match")); + find_prev->set_accessibility_name(TTRC("Previous Match")); hbc_button_search->add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); find_prev->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::search_prev)); @@ -802,6 +806,7 @@ FindReplaceBar::FindReplaceBar() { find_next = memnew(Button); find_next->set_flat(true); find_next->set_tooltip_text(TTR("Next Match")); + find_next->set_accessibility_name(TTRC("Next Match")); hbc_button_search->add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); find_next->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::search_next)); @@ -823,6 +828,7 @@ FindReplaceBar::FindReplaceBar() { vbc_lineedit->add_child(replace_text); replace_text->set_placeholder(TTR("Replace")); replace_text->set_tooltip_text(TTR("Replace")); + replace_text->set_accessibility_name(TTRC("Replace")); replace_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); replace_text->connect(SceneStringName(text_submitted), callable_mp(this, &FindReplaceBar::_replace_text_submitted)); @@ -845,6 +851,7 @@ FindReplaceBar::FindReplaceBar() { hide_button = memnew(TextureButton); add_child(hide_button); hide_button->set_tooltip_text(TTR("Hide")); + hide_button->set_accessibility_name(TTRC("Hide")); hide_button->set_focus_mode(FOCUS_NONE); hide_button->connect(SceneStringName(pressed), callable_mp(this, &FindReplaceBar::_hide_bar)); hide_button->set_v_size_flags(SIZE_SHRINK_CENTER); @@ -1872,6 +1879,7 @@ CodeTextEditor::CodeTextEditor() { toggle_scripts_button->set_flat(true); toggle_scripts_button->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_toggle_scripts_pressed)); + toggle_scripts_button->set_accessibility_name(TTRC("Scripts")); status_bar->add_child(toggle_scripts_button); toggle_scripts_button->hide(); @@ -1896,6 +1904,7 @@ CodeTextEditor::CodeTextEditor() { error_button->set_default_cursor_shape(CURSOR_POINTING_HAND); error_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_error_button_pressed)); error_button->set_tooltip_text(TTR("Errors")); + error_button->set_accessibility_name(TTRC("Errors")); // Warnings warning_button = memnew(Button); @@ -1905,6 +1914,7 @@ CodeTextEditor::CodeTextEditor() { warning_button->set_default_cursor_shape(CURSOR_POINTING_HAND); warning_button->connect(SceneStringName(pressed), callable_mp(this, &CodeTextEditor::_warning_button_pressed)); warning_button->set_tooltip_text(TTR("Warnings")); + warning_button->set_accessibility_name(TTRC("Warnings")); status_bar->add_child(memnew(VSeparator)); @@ -1918,6 +1928,7 @@ CodeTextEditor::CodeTextEditor() { // TRANSLATORS: The placeholders are keyboard shortcuts. The first one is in the form of "Ctrl+"/"Cmd+". vformat(TTR("%sMouse wheel, %s/%s: Finetune\n%s: Reset"), keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL), ED_GET_SHORTCUT("script_editor/zoom_in")->get_as_text(), ED_GET_SHORTCUT("script_editor/zoom_out")->get_as_text(), ED_GET_SHORTCUT("script_editor/reset_zoom")->get_as_text())); zoom_button->set_text("100 %"); + zoom_button->set_accessibility_name(TTRC("Zoom Factor")); PopupMenu *zoom_menu = zoom_button->get_popup(); constexpr int preset_count = std::size(ZOOM_FACTOR_PRESETS); @@ -1937,6 +1948,7 @@ CodeTextEditor::CodeTextEditor() { 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_text(TTR("Line and column numbers.")); + line_and_col_txt->set_accessibility_name(TTRC("Line and Column Numbers")); line_and_col_txt->set_mouse_filter(MOUSE_FILTER_STOP); status_bar->add_child(memnew(VSeparator)); @@ -1946,6 +1958,7 @@ CodeTextEditor::CodeTextEditor() { status_bar->add_child(indentation_txt); indentation_txt->set_v_size_flags(SIZE_EXPAND | SIZE_SHRINK_CENTER); indentation_txt->set_tooltip_text(TTR("Indentation")); + indentation_txt->set_accessibility_name(TTRC("Indentation")); indentation_txt->set_mouse_filter(MOUSE_FILTER_STOP); text_editor->connect(SceneStringName(gui_input), callable_mp(this, &CodeTextEditor::_text_editor_gui_input)); diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 23c7484476..b787667d82 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -736,6 +736,7 @@ ConnectDialog::ConnectDialog() { vbc_left->set_custom_minimum_size(Vector2(400 * EDSCALE, 0)); from_signal = memnew(LineEdit); + from_signal->set_accessibility_name(TTRC("From Signal")); vbc_left->add_margin_child(TTR("From Signal:"), from_signal); from_signal->set_editable(false); @@ -754,6 +755,7 @@ ConnectDialog::ConnectDialog() { hbc_filter->add_child(filter_nodes); filter_nodes->set_h_size_flags(Control::SIZE_FILL | Control::SIZE_EXPAND); filter_nodes->set_placeholder(TTR("Filter Nodes")); + filter_nodes->set_accessibility_name(TTRC("Filter Nodes")); filter_nodes->set_clear_button_enabled(true); filter_nodes->connect(SceneStringName(text_changed), callable_mp(tree, &SceneTreeEditor::set_filter)); @@ -786,11 +788,13 @@ ConnectDialog::ConnectDialog() { method_search = memnew(LineEdit); method_vbc->add_child(method_search); method_search->set_placeholder(TTR("Filter Methods")); + method_search->set_accessibility_name(TTRC("Filter Methods")); method_search->set_clear_button_enabled(true); method_search->connect(SceneStringName(text_changed), callable_mp(this, &ConnectDialog::_update_method_tree).unbind(1)); method_tree = memnew(Tree); method_vbc->add_child(method_tree); + method_tree->set_accessibility_name(TTRC("Methods")); method_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); method_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); method_tree->set_hide_root(true); @@ -824,6 +828,7 @@ ConnectDialog::ConnectDialog() { HBoxContainer *add_bind_hb = memnew(HBoxContainer); type_list = memnew(OptionButton); + type_list->set_accessibility_name(TTRC("Type")); type_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); add_bind_hb->add_child(type_list); for (int i = 0; i < Variant::VARIANT_MAX; i++) { @@ -851,12 +856,14 @@ ConnectDialog::ConnectDialog() { vbc_right->add_margin_child(TTR("Add Extra Call Argument:"), add_bind_hb); bind_editor = memnew(EditorInspector); + bind_editor->set_accessibility_name(TTRC("Extra Call Arguments")); bind_controls.push_back(bind_editor); vbc_right->add_margin_child(TTR("Extra Call Arguments:"), bind_editor, true); unbind_count = memnew(SpinBox); unbind_count->set_tooltip_text(TTR("Allows to drop arguments sent by signal emitter.")); + unbind_count->set_accessibility_name(TTRC("Unbind Signal Arguments")); unbind_count->connect(SceneStringName(value_changed), callable_mp(this, &ConnectDialog::_unbind_count_changed)); vbc_right->add_margin_child(TTR("Unbind Signal Arguments:"), unbind_count); @@ -865,6 +872,7 @@ ConnectDialog::ConnectDialog() { vbc_left->add_margin_child(TTR("Receiver Method:"), hbc_method); dst_method = memnew(LineEdit); + dst_method->set_accessibility_name(TTRC("Receiver Method")); dst_method->set_h_size_flags(Control::SIZE_EXPAND_FILL); dst_method->connect(SceneStringName(text_changed), callable_mp(method_tree, &Tree::deselect_all).unbind(1)); hbc_method->add_child(dst_method); @@ -1291,11 +1299,14 @@ void ConnectionsDock::_slot_menu_about_to_popup() { } void ConnectionsDock::_tree_gui_input(const Ref &p_event) { + TreeItem *item = nullptr; + Point2 item_pos; + const Ref &key = p_event; if (key.is_valid() && key->is_pressed() && !key->is_echo()) { if (ED_IS_SHORTCUT("connections_editor/disconnect", p_event)) { - TreeItem *item = tree->get_selected(); + item = tree->get_selected(); if (item && _get_item_type(*item) == TREE_ITEM_TYPE_CONNECTION) { Connection connection = item->get_metadata(0); _disconnect(connection); @@ -1313,22 +1324,32 @@ void ConnectionsDock::_tree_gui_input(const Ref &p_event) { return; } } + if (key.is_valid() && key->is_pressed() && key->is_action("ui_menu", true)) { + item = tree->get_selected(); + if (!item) { + return; + } + item_pos = tree->get_item_rect(item).position; + } // Handle RMB press. const Ref &mb_event = p_event; if (mb_event.is_valid() && mb_event->is_pressed() && mb_event->get_button_index() == MouseButton::RIGHT) { - TreeItem *item = tree->get_item_at_position(mb_event->get_position()); + item = tree->get_item_at_position(mb_event->get_position()); if (!item) { return; } + item_pos = mb_event->get_position(); + } + if (item) { if (item->is_selectable(0)) { // Update selection now, before `about_to_popup` signal. Needed for SIGNAL and CONNECTION context menus. tree->set_selected(item); } - Vector2 screen_position = tree->get_screen_position() + mb_event->get_position(); + Vector2 screen_position = tree->get_screen_position() + item_pos; switch (_get_item_type(*item)) { case TREE_ITEM_TYPE_ROOT: @@ -1601,11 +1622,13 @@ ConnectionsDock::ConnectionsDock() { search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_placeholder(TTR("Filter Signals")); + search_box->set_accessibility_name(TTRC("Filter Signals")); search_box->set_clear_button_enabled(true); search_box->connect(SceneStringName(text_changed), callable_mp(this, &ConnectionsDock::_filter_changed)); vbc->add_child(search_box); tree = memnew(ConnectionsDockTree); + tree->set_accessibility_name(TTRC("Connections")); tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); tree->set_columns(1); tree->set_select_mode(Tree::SELECT_ROW); @@ -1616,6 +1639,7 @@ ConnectionsDock::ConnectionsDock() { tree->set_allow_rmb_select(true); connect_button = memnew(Button); + connect_button->set_accessibility_name(TTRC("Connect")); HBoxContainer *hb = memnew(HBoxContainer); vbc->add_child(hb); hb->add_spacer(); diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp index 0e75ec45b7..55b5524c6e 100644 --- a/editor/create_dialog.cpp +++ b/editor/create_dialog.cpp @@ -635,7 +635,7 @@ void CreateDialog::_favorite_activated() { } Variant CreateDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - TreeItem *ti = favorites->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? favorites->get_selected() : favorites->get_item_at_position(p_point); if (ti) { Dictionary d; d["type"] = "create_favorite_drag"; @@ -667,13 +667,13 @@ bool CreateDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data void CreateDialog::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { Dictionary d = p_data; - TreeItem *ti = favorites->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? favorites->get_selected() : favorites->get_item_at_position(p_point); if (!ti) { return; } String drop_at = ti->get_text(0); - int ds = favorites->get_drop_section_at_position(p_point); + int ds = (p_point == Vector2(INFINITY, INFINITY)) ? favorites->get_drop_section_at_position(favorites->get_item_rect(ti).position) : favorites->get_drop_section_at_position(p_point); int drop_idx = favorite_list.find(drop_at); if (drop_idx < 0) { @@ -787,6 +787,7 @@ CreateDialog::CreateDialog() { vsc->add_child(fav_vb); favorites = memnew(Tree); + favorites->set_accessibility_name(TTRC("Favorites")); favorites->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); favorites->set_hide_root(true); favorites->set_hide_folding(true); @@ -804,6 +805,7 @@ CreateDialog::CreateDialog() { rec_vb->set_v_size_flags(Control::SIZE_EXPAND_FILL); recent = memnew(ItemList); + recent->set_accessibility_name(TTRC("Recent")); recent->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); rec_vb->add_margin_child(TTR("Recent:"), recent, true); recent->set_allow_reselect(true); @@ -818,6 +820,7 @@ CreateDialog::CreateDialog() { hsc->add_child(vbc); search_box = memnew(LineEdit); + search_box->set_accessibility_name(TTRC("Search")); search_box->set_clear_button_enabled(true); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->connect(SceneStringName(text_changed), callable_mp(this, &CreateDialog::_text_changed)); @@ -829,11 +832,13 @@ CreateDialog::CreateDialog() { favorite = memnew(Button); favorite->set_toggle_mode(true); favorite->set_tooltip_text(TTR("(Un)favorite selected item.")); + favorite->set_accessibility_name(TTRC("(Un)favorite")); favorite->connect(SceneStringName(pressed), callable_mp(this, &CreateDialog::_favorite_toggled)); search_hb->add_child(favorite); vbc->add_margin_child(TTR("Search:"), search_hb); search_options = memnew(Tree); + search_options->set_accessibility_name(TTRC("Matches")); search_options->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); search_options->connect("item_activated", callable_mp(this, &CreateDialog::_confirmed)); search_options->connect("cell_selected", callable_mp(this, &CreateDialog::_item_selected)); @@ -841,6 +846,7 @@ CreateDialog::CreateDialog() { vbc->add_margin_child(TTR("Matches:"), search_options, true); help_bit = memnew(EditorHelpBit); + help_bit->set_accessibility_name(TTRC("Description")); help_bit->set_content_height_limits(80 * EDSCALE, 80 * EDSCALE); help_bit->connect("request_hide", callable_mp(this, &CreateDialog::_hide_requested)); vbc->add_margin_child(TTR("Description:"), help_bit); diff --git a/editor/debugger/editor_expression_evaluator.cpp b/editor/debugger/editor_expression_evaluator.cpp index 950dd0b868..2c6a6df68a 100644 --- a/editor/debugger/editor_expression_evaluator.cpp +++ b/editor/debugger/editor_expression_evaluator.cpp @@ -110,6 +110,7 @@ EditorExpressionEvaluator::EditorExpressionEvaluator() { expression_input = memnew(LineEdit); expression_input->set_h_size_flags(Control::SIZE_EXPAND_FILL); expression_input->set_placeholder(TTR("Expression to evaluate")); + expression_input->set_accessibility_name(TTRC("Expression")); expression_input->set_clear_button_enabled(true); expression_input->connect(SceneStringName(text_submitted), callable_mp(this, &EditorExpressionEvaluator::_evaluate).unbind(1)); expression_input->connect(SceneStringName(text_changed), callable_mp(this, &EditorExpressionEvaluator::_on_expression_input_changed)); diff --git a/editor/debugger/editor_profiler.cpp b/editor/debugger/editor_profiler.cpp index 53793f3525..741c2cfa8d 100644 --- a/editor/debugger/editor_profiler.cpp +++ b/editor/debugger/editor_profiler.cpp @@ -694,6 +694,7 @@ EditorProfiler::EditorProfiler() { hb_measure->add_child(memnew(Label(TTR("Measure:")))); display_mode = memnew(OptionButton); + display_mode->set_accessibility_name(TTRC("Measure")); display_mode->add_item(TTR("Frame Time (ms)")); display_mode->add_item(TTR("Average Time (ms)")); display_mode->add_item(TTR("Frame %")); @@ -709,6 +710,7 @@ EditorProfiler::EditorProfiler() { hb_time->add_child(memnew(Label(TTR("Time:")))); display_time = memnew(OptionButton); + display_time->set_accessibility_name(TTRC("Time")); // TRANSLATORS: This is an option in the profiler to display the time spent in a function, including the time spent in other functions called by that function. display_time->add_item(TTR("Inclusive")); // TRANSLATORS: This is an option in the profiler to display the time spent in a function, exincluding the time spent in other functions called by that function. @@ -731,6 +733,7 @@ EditorProfiler::EditorProfiler() { hb_frame->add_child(memnew(Label(TTR("Frame #:")))); cursor_metric_edit = memnew(SpinBox); + cursor_metric_edit->set_accessibility_name(TTRC("Frame")); cursor_metric_edit->set_h_size_flags(SIZE_FILL); cursor_metric_edit->set_value(0); cursor_metric_edit->set_editable(false); diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index e6c43ffe19..1f41ee2b64 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -778,6 +778,7 @@ EditorVisualProfiler::EditorVisualProfiler() { hb_measure->add_child(memnew(Label(TTR("Measure:")))); display_mode = memnew(OptionButton); + display_mode->set_accessibility_name(TTRC("Measure")); display_mode->add_item(TTR("Frame Time (ms)")); display_mode->add_item(TTR("Frame %")); display_mode->connect(SceneStringName(item_selected), callable_mp(this, &EditorVisualProfiler::_combo_changed)); @@ -801,6 +802,7 @@ EditorVisualProfiler::EditorVisualProfiler() { hb_frame->add_child(memnew(Label(TTR("Frame #:")))); cursor_metric_edit = memnew(SpinBox); + cursor_metric_edit->set_accessibility_name(TTRC("Frame")); cursor_metric_edit->set_h_size_flags(SIZE_FILL); hb_frame->add_child(cursor_metric_edit); cursor_metric_edit->connect(SceneStringName(value_changed), callable_mp(this, &EditorVisualProfiler::_cursor_metric_changed)); diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index 44cc7986c7..6efe1be8d3 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1957,11 +1957,13 @@ ScriptEditorDebugger::ScriptEditorDebugger() { skip_breakpoints->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(skip_breakpoints); skip_breakpoints->set_tooltip_text(TTR("Skip Breakpoints")); + skip_breakpoints->set_accessibility_name(TTRC("Skip Breakpoints")); skip_breakpoints->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_skip_breakpoints)); ignore_error_breaks = memnew(Button); ignore_error_breaks->set_flat(true); ignore_error_breaks->set_tooltip_text(TTR("Ignore Error Breaks")); + ignore_error_breaks->set_accessibility_name(TTRC("Ignore Error Breaks")); hbc->add_child(ignore_error_breaks); ignore_error_breaks->connect("pressed", callable_mp(this, &ScriptEditorDebugger::debug_ignore_error_breaks)); @@ -1971,6 +1973,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { copy->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(copy); copy->set_tooltip_text(TTR("Copy Error")); + copy->set_accessibility_name(TTRC("Copy Error")); copy->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_copy)); hbc->add_child(memnew(VSeparator)); @@ -1979,6 +1982,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { step->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(step); step->set_tooltip_text(TTR("Step Into")); + step->set_accessibility_name(TTRC("Step Into")); step->set_shortcut(ED_GET_SHORTCUT("debugger/step_into")); step->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_step)); @@ -1986,6 +1990,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { next->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(next); next->set_tooltip_text(TTR("Step Over")); + next->set_accessibility_name(TTRC("Step Over")); next->set_shortcut(ED_GET_SHORTCUT("debugger/step_over")); next->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_next)); @@ -1995,6 +2000,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { dobreak->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(dobreak); dobreak->set_tooltip_text(TTR("Break")); + dobreak->set_accessibility_name(TTRC("Break")); dobreak->set_shortcut(ED_GET_SHORTCUT("debugger/break")); dobreak->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_break)); @@ -2002,6 +2008,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { docontinue->set_theme_type_variation(SceneStringName(FlatButton)); hbc->add_child(docontinue); docontinue->set_tooltip_text(TTR("Continue")); + docontinue->set_accessibility_name(TTRC("Continue")); docontinue->set_shortcut(ED_GET_SHORTCUT("debugger/continue")); docontinue->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::debug_continue)); @@ -2050,6 +2057,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { search = memnew(LineEdit); search->set_h_size_flags(Control::SIZE_EXPAND_FILL); search->set_placeholder(TTR("Filter Stack Variables")); + search->set_accessibility_name(TTRC("Filter Stack Variables")); search->set_clear_button_enabled(true); tools_hb->add_child(search); @@ -2184,14 +2192,17 @@ ScriptEditorDebugger::ScriptEditorDebugger() { vmem_hb->add_child(memnew(Label(TTR("Total:") + " "))); vmem_total = memnew(LineEdit); vmem_total->set_editable(false); + vmem_total->set_accessibility_name(TTRC("Video RAM Total")); vmem_total->set_custom_minimum_size(Size2(100, 0) * EDSCALE); vmem_hb->add_child(vmem_total); vmem_refresh = memnew(Button); + vmem_refresh->set_accessibility_name(TTRC("Refresh Video RAM")); vmem_refresh->set_theme_type_variation(SceneStringName(FlatButton)); vmem_hb->add_child(vmem_refresh); vmem_export = memnew(Button); vmem_export->set_theme_type_variation(SceneStringName(FlatButton)); vmem_export->set_tooltip_text(TTR("Export list to a CSV file")); + vmem_export->set_accessibility_name(TTRC("Export to CSV")); vmem_hb->add_child(vmem_export); vmem_vb->add_child(vmem_hb); vmem_refresh->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditorDebugger::_video_mem_request)); @@ -2235,11 +2246,13 @@ ScriptEditorDebugger::ScriptEditorDebugger() { misc->add_child(info_left); clicked_ctrl = memnew(LineEdit); clicked_ctrl->set_editable(false); + clicked_ctrl->set_accessibility_name(TTRC("Clicked Control")); clicked_ctrl->set_h_size_flags(SIZE_EXPAND_FILL); info_left->add_child(memnew(Label(TTR("Clicked Control:")))); info_left->add_child(clicked_ctrl); clicked_ctrl_type = memnew(LineEdit); clicked_ctrl_type->set_editable(false); + clicked_ctrl_type->set_accessibility_name(TTRC("Clicked Control Type")); info_left->add_child(memnew(Label(TTR("Clicked Control Type:")))); info_left->add_child(clicked_ctrl_type); @@ -2247,6 +2260,7 @@ ScriptEditorDebugger::ScriptEditorDebugger() { live_edit_root = memnew(LineEdit); live_edit_root->set_editable(false); live_edit_root->set_h_size_flags(SIZE_EXPAND_FILL); + live_edit_root->set_accessibility_name(TTRC("Live Edit Root")); { HBoxContainer *lehb = memnew(HBoxContainer); diff --git a/editor/dependency_editor.cpp b/editor/dependency_editor.cpp index a962a4b559..e818205233 100644 --- a/editor/dependency_editor.cpp +++ b/editor/dependency_editor.cpp @@ -678,6 +678,7 @@ DependencyRemoveDialog::DependencyRemoveDialog() { files_to_delete_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); files_to_delete_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); files_to_delete_list->set_custom_minimum_size(Size2(0, 94) * EDSCALE); + files_to_delete_list->set_accessibility_name(TTRC("Files to be Deleted")); vb->add_child(files_to_delete_list); vb_owners = memnew(VBoxContainer); @@ -694,6 +695,7 @@ DependencyRemoveDialog::DependencyRemoveDialog() { owners->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); owners->set_hide_root(true); owners->set_custom_minimum_size(Size2(0, 94) * EDSCALE); + owners->set_accessibility_name(TTRC("Dependencies")); vb_owners->add_child(owners); owners->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/directory_create_dialog.cpp b/editor/directory_create_dialog.cpp index 43c85134be..69198a3757 100644 --- a/editor/directory_create_dialog.cpp +++ b/editor/directory_create_dialog.cpp @@ -166,6 +166,7 @@ DirectoryCreateDialog::DirectoryCreateDialog() { vb->add_child(name_label); dir_path = memnew(LineEdit); + dir_path->set_accessibility_name(TTRC("Name")); vb->add_child(dir_path); register_text_enter(dir_path); diff --git a/editor/editor_asset_installer.cpp b/editor/editor_asset_installer.cpp index 5035900fe8..26393e03d3 100644 --- a/editor/editor_asset_installer.cpp +++ b/editor/editor_asset_installer.cpp @@ -684,6 +684,7 @@ EditorAssetInstaller::EditorAssetInstaller() { show_source_files_button = memnew(Button); show_source_files_button->set_toggle_mode(true); show_source_files_button->set_tooltip_text(TTR("Open the list of the asset contents and select which files to install.")); + show_source_files_button->set_accessibility_name(TTRC("Show Asset Contents")); remapping_tools->add_child(show_source_files_button); show_source_files_button->connect(SceneStringName(toggled), callable_mp(this, &EditorAssetInstaller::_toggle_source_tree).bind(false)); @@ -708,6 +709,7 @@ EditorAssetInstaller::EditorAssetInstaller() { asset_conflicts_label->set_text(TTR("No files conflict with your project")); remapping_tools->add_child(asset_conflicts_label); asset_conflicts_link = memnew(LinkButton); + asset_conflicts_link->set_accessibility_name(TTRC("Show Conflicting Files")); asset_conflicts_link->set_theme_type_variation("HeaderSmallLink"); asset_conflicts_link->set_v_size_flags(Control::SIZE_SHRINK_CENTER); asset_conflicts_link->set_tooltip_text(TTR("Show contents of the asset and conflicting files.")); @@ -732,6 +734,7 @@ EditorAssetInstaller::EditorAssetInstaller() { source_tree_vb->add_child(source_tree_label); source_tree = memnew(Tree); + source_tree->set_accessibility_name(TTRC("Source Files")); source_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); source_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); source_tree->connect("item_edited", callable_mp(this, &EditorAssetInstaller::_item_checked_cbk)); @@ -748,6 +751,7 @@ EditorAssetInstaller::EditorAssetInstaller() { destination_tree_vb->add_child(destination_tree_label); destination_tree = memnew(Tree); + destination_tree->set_accessibility_name(TTRC("Destination Files")); destination_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); destination_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); destination_tree->connect("item_edited", callable_mp(this, &EditorAssetInstaller::_item_checked_cbk)); diff --git a/editor/editor_audio_buses.cpp b/editor/editor_audio_buses.cpp index a5ffac21d4..b7054fe461 100644 --- a/editor/editor_audio_buses.cpp +++ b/editor/editor_audio_buses.cpp @@ -130,6 +130,14 @@ void EditorAudioBus::_notification(int p_what) { set_process(true); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Audio bus editor"))); + } break; + case NOTIFICATION_DRAW: { if (is_master) { draw_style_box(get_theme_stylebox(SNAME("disabled"), SNAME("Button")), Rect2(Vector2(), get_size())); @@ -583,6 +591,15 @@ void EditorAudioBus::gui_input(const Ref &p_event) { bus_popup->reset_size(); bus_popup->popup(); } + + Ref k = p_event; + if (k.is_valid() && k->is_pressed() && k->is_action("ui_menu", true)) { + bus_popup->set_position(get_screen_position()); + bus_popup->reset_size(); + bus_popup->popup(); + + accept_event(); + } } void EditorAudioBus::_effects_gui_input(Ref p_event) { @@ -619,7 +636,7 @@ Variant EditorAudioBus::get_drag_data(const Point2 &p_point) { p->set_modulate(Color(1, 1, 1, 0.7)); p->add_theme_style_override(SceneStringName(panel), get_theme_stylebox(SNAME("focus"), SNAME("Button"))); p->set_size(get_size()); - p->set_position(-p_point); + p->set_position((p_point == Vector2(INFINITY, INFINITY)) ? Vector2() : -p_point); set_drag_preview(c); Dictionary d; d["type"] = "move_audio_bus"; @@ -652,7 +669,7 @@ void EditorAudioBus::drop_data(const Point2 &p_point, const Variant &p_data) { } Variant EditorAudioBus::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - TreeItem *item = effects->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? effects->get_selected() : effects->get_item_at_position(p_point); if (!item) { return Variant(); } @@ -681,7 +698,7 @@ bool EditorAudioBus::can_drop_data_fw(const Point2 &p_point, const Variant &p_da return false; } - TreeItem *item = effects->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? effects->get_selected() : effects->get_item_at_position(p_point); if (!item) { return false; } @@ -694,11 +711,11 @@ bool EditorAudioBus::can_drop_data_fw(const Point2 &p_point, const Variant &p_da void EditorAudioBus::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { Dictionary d = p_data; - TreeItem *item = effects->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? effects->get_selected() : effects->get_item_at_position(p_point); if (!item) { return; } - int pos = effects->get_drop_section_at_position(p_point); + int pos = (p_point == Vector2(INFINITY, INFINITY)) ? effects->get_drop_section_at_position(effects->get_item_rect(item).position) : effects->get_drop_section_at_position(p_point); Variant md = item->get_metadata(0); int paste_at; @@ -815,6 +832,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { set_v_size_flags(SIZE_EXPAND_FILL); track_name = memnew(LineEdit); + track_name->set_accessibility_name(TTRC("Track Name")); track_name->connect(SceneStringName(text_submitted), callable_mp(this, &EditorAudioBus::_name_changed)); track_name->connect(SceneStringName(focus_exited), callable_mp(this, &EditorAudioBus::_name_focus_exit)); vb->add_child(track_name); @@ -825,6 +843,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { solo->set_theme_type_variation(SceneStringName(FlatButton)); solo->set_toggle_mode(true); solo->set_tooltip_text(TTR("Solo")); + solo->set_accessibility_name(TTRC("Solo")); solo->set_focus_mode(FOCUS_NONE); solo->connect(SceneStringName(pressed), callable_mp(this, &EditorAudioBus::_solo_toggled)); hbc->add_child(solo); @@ -832,6 +851,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { mute->set_theme_type_variation(SceneStringName(FlatButton)); mute->set_toggle_mode(true); mute->set_tooltip_text(TTR("Mute")); + mute->set_accessibility_name(TTRC("Mute")); mute->set_focus_mode(FOCUS_NONE); mute->connect(SceneStringName(pressed), callable_mp(this, &EditorAudioBus::_mute_toggled)); hbc->add_child(mute); @@ -839,6 +859,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { bypass->set_theme_type_variation(SceneStringName(FlatButton)); bypass->set_toggle_mode(true); bypass->set_tooltip_text(TTR("Bypass")); + bypass->set_accessibility_name(TTRC("Bypass")); bypass->set_focus_mode(FOCUS_NONE); bypass->connect(SceneStringName(pressed), callable_mp(this, &EditorAudioBus::_bypass_toggled)); hbc->add_child(bypass); @@ -886,6 +907,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { slider->set_max(1.0); slider->set_step(0.0001); slider->set_clip_contents(false); + slider->set_accessibility_name(TTRC("Volume")); audio_value_preview_box = memnew(Panel); slider->add_child(audio_value_preview_box); @@ -922,6 +944,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { channel[i].vu_l->set_min(-80); channel[i].vu_l->set_max(24); channel[i].vu_l->set_step(0.1); + channel[i].vu_l->set_accessibility_name(vformat(TTR("Channel %d, Left VU"), i)); channel[i].vu_r = memnew(TextureProgressBar); channel[i].vu_r->set_fill_mode(TextureProgressBar::FILL_BOTTOM_TO_TOP); @@ -929,6 +952,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { channel[i].vu_r->set_min(-80); channel[i].vu_r->set_max(24); channel[i].vu_r->set_step(0.1); + channel[i].vu_r->set_accessibility_name(vformat(TTR("Channel %d, Right VU"), i)); channel[i].peak_l = 0.0f; channel[i].peak_r = 0.0f; @@ -944,6 +968,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { hb->add_child(scale); effects = memnew(Tree); + effects->set_accessibility_name(TTRC("Effects")); effects->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); effects->set_hide_root(true); effects->set_custom_minimum_size(Size2(0, 80) * EDSCALE); @@ -963,6 +988,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { effects->connect(SceneStringName(gui_input), callable_mp(this, &EditorAudioBus::_effects_gui_input)); send = memnew(OptionButton); + send->set_accessibility_name(TTRC("Send")); send->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); send->set_clip_text(true); send->connect(SceneStringName(item_selected), callable_mp(this, &EditorAudioBus::_send_selected)); @@ -992,6 +1018,7 @@ EditorAudioBus::EditorAudioBus(EditorAudioBuses *p_buses, bool p_is_master) { bus_options->set_h_size_flags(SIZE_SHRINK_END); bus_options->set_anchor(SIDE_RIGHT, 0.0); bus_options->set_tooltip_text(TTR("Bus Options")); + bus_options->set_accessibility_name(TTRC("Bus Options")); hbc->add_child(bus_options); bus_popup = bus_options->get_popup(); diff --git a/editor/editor_autoload_settings.cpp b/editor/editor_autoload_settings.cpp index f1430c5483..cb5a9d0cc2 100644 --- a/editor/editor_autoload_settings.cpp +++ b/editor/editor_autoload_settings.cpp @@ -659,13 +659,13 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia } if (drop_data.has("type")) { - TreeItem *ti = tree->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!ti) { return false; } - int section = tree->get_drop_section_at_position(p_point); + int section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point); return section >= -1; } @@ -674,13 +674,13 @@ bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Varia } void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) { - TreeItem *ti = tree->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!ti) { return; } - int section = tree->get_drop_section_at_position(p_point); + int section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point); if (section < -1) { return; @@ -901,6 +901,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { autoload_add_path = memnew(LineEdit); hbc->add_child(autoload_add_path); + autoload_add_path->set_accessibility_name(TTRC("Autoload Path")); autoload_add_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); autoload_add_path->set_clear_button_enabled(true); autoload_add_path->set_placeholder(vformat(TTR("Set path or press \"%s\" to create a script."), TTR("Add"))); @@ -908,6 +909,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { browse_button = memnew(Button); hbc->add_child(browse_button); + browse_button->set_accessibility_name(TTRC("Select Autoload Path")); browse_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAutoloadSettings::_browse_autoload_add_path)); file_dialog = memnew(EditorFileDialog); @@ -925,6 +927,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { hbc->add_child(l); autoload_add_name = memnew(LineEdit); + autoload_add_name->set_accessibility_name(TTRC("Node Name")); autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL); autoload_add_name->connect(SceneStringName(text_submitted), callable_mp(this, &EditorAutoloadSettings::_autoload_text_submitted)); autoload_add_name->connect(SceneStringName(text_changed), callable_mp(this, &EditorAutoloadSettings::_autoload_text_changed)); @@ -938,6 +941,7 @@ EditorAutoloadSettings::EditorAutoloadSettings() { hbc->add_child(add_autoload); tree = memnew(Tree); + tree->set_accessibility_name(TTRC("Autoloads")); tree->set_hide_root(true); tree->set_select_mode(Tree::SELECT_MULTI); tree->set_allow_reselect(true); diff --git a/editor/editor_build_profile.cpp b/editor/editor_build_profile.cpp index ebb8e9ebb5..75b67fa78d 100644 --- a/editor/editor_build_profile.cpp +++ b/editor/editor_build_profile.cpp @@ -808,6 +808,7 @@ EditorBuildProfileManager::EditorBuildProfileManager() { HBoxContainer *path_hbc = memnew(HBoxContainer); profile_path = memnew(LineEdit); path_hbc->add_child(profile_path); + profile_path->set_accessibility_name(TTRC("Profile Path")); profile_path->set_editable(true); profile_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -880,6 +881,7 @@ EditorBuildProfileManager::EditorBuildProfileManager() { export_profile->set_access(EditorFileDialog::ACCESS_FILESYSTEM); force_detect_classes = memnew(LineEdit); + force_detect_classes->set_accessibility_name(TTRC("Forced Classes")); main_vbc->add_margin_child(TTR("Forced Classes on Detect:"), force_detect_classes); force_detect_classes->connect(SceneStringName(text_changed), callable_mp(this, &EditorBuildProfileManager::_force_detect_classes_changed)); diff --git a/editor/editor_command_palette.cpp b/editor/editor_command_palette.cpp index 76e90d46db..9adff60d01 100644 --- a/editor/editor_command_palette.cpp +++ b/editor/editor_command_palette.cpp @@ -344,6 +344,7 @@ EditorCommandPalette::EditorCommandPalette() { command_search_box = memnew(LineEdit); command_search_box->set_placeholder(TTR("Filter Commands")); + command_search_box->set_accessibility_name(TTRC("Filter Commands")); command_search_box->connect(SceneStringName(gui_input), callable_mp(this, &EditorCommandPalette::_sbox_input)); command_search_box->connect(SceneStringName(text_changed), callable_mp(this, &EditorCommandPalette::_update_command_search)); command_search_box->set_v_size_flags(Control::SIZE_EXPAND_FILL); diff --git a/editor/editor_dock_manager.cpp b/editor/editor_dock_manager.cpp index 308301eaf3..ca99cb6cf0 100644 --- a/editor/editor_dock_manager.cpp +++ b/editor/editor_dock_manager.cpp @@ -1092,6 +1092,7 @@ DockContextPopup::DockContextPopup() { HBoxContainer *header_hb = memnew(HBoxContainer); tab_move_left_button = memnew(Button); + tab_move_left_button->set_accessibility_name(TTRC("Move Tab Left")); tab_move_left_button->set_flat(true); tab_move_left_button->set_focus_mode(Control::FOCUS_NONE); tab_move_left_button->connect(SceneStringName(pressed), callable_mp(this, &DockContextPopup::_tab_move_left)); @@ -1104,6 +1105,7 @@ DockContextPopup::DockContextPopup() { header_hb->add_child(position_label); tab_move_right_button = memnew(Button); + tab_move_right_button->set_accessibility_name(TTRC("Move Tab Right")); tab_move_right_button->set_flat(true); tab_move_right_button->set_focus_mode(Control::FOCUS_NONE); tab_move_right_button->connect(SceneStringName(pressed), callable_mp(this, &DockContextPopup::_tab_move_right)); diff --git a/editor/editor_feature_profile.cpp b/editor/editor_feature_profile.cpp index ed6bfbc3c4..81fdf08168 100644 --- a/editor/editor_feature_profile.cpp +++ b/editor/editor_feature_profile.cpp @@ -924,6 +924,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { HBoxContainer *name_hbc = memnew(HBoxContainer); current_profile_name = memnew(LineEdit); name_hbc->add_child(current_profile_name); + current_profile_name->set_accessibility_name(TTRC("Current Profile")); current_profile_name->set_text(TTR("(none)")); current_profile_name->set_editable(false); current_profile_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -938,6 +939,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { HBoxContainer *profiles_hbc = memnew(HBoxContainer); profile_list = memnew(OptionButton); + profile_list->set_accessibility_name(TTRC("Profiles")); profile_list->set_h_size_flags(Control::SIZE_EXPAND_FILL); profile_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); profiles_hbc->add_child(profile_list); @@ -1031,6 +1033,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() { new_profile_name = memnew(LineEdit); new_profile_vb->add_child(new_profile_name); new_profile_name->set_custom_minimum_size(Size2(300 * EDSCALE, 1)); + new_profile_name->set_accessibility_name(TTRC("Profile Name")); add_child(new_profile_dialog); new_profile_dialog->connect(SceneStringName(confirmed), callable_mp(this, &EditorFeatureProfileManager::_create_new_profile)); new_profile_dialog->register_text_enter(new_profile_name); diff --git a/editor/editor_help.cpp b/editor/editor_help.cpp index 54fee4e46f..f1181044d1 100644 --- a/editor/editor_help.cpp +++ b/editor/editor_help.cpp @@ -3358,6 +3358,7 @@ EditorHelp::EditorHelp() { status_bar->set_custom_minimum_size(Size2(0, 24 * EDSCALE)); toggle_scripts_button = memnew(Button); + toggle_scripts_button->set_accessibility_name(TTRC("Scripts")); toggle_scripts_button->set_flat(true); toggle_scripts_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelp::_toggle_scripts_pressed)); status_bar->add_child(toggle_scripts_button); @@ -4744,6 +4745,7 @@ EditorHelpHighlighter::~EditorHelpHighlighter() { FindBar::FindBar() { search_text = memnew(LineEdit); + search_text->set_accessibility_name(TTRC("Search help")); add_child(search_text); search_text->set_keep_editing_on_text_submit(true); search_text->set_custom_minimum_size(Size2(100 * EDSCALE, 0)); @@ -4756,12 +4758,14 @@ FindBar::FindBar() { matches_label->hide(); find_prev = memnew(Button); + find_prev->set_accessibility_name(TTRC("Find Previous")); find_prev->set_flat(true); add_child(find_prev); find_prev->set_focus_mode(FOCUS_NONE); find_prev->connect(SceneStringName(pressed), callable_mp(this, &FindBar::search_prev)); find_next = memnew(Button); + find_next->set_accessibility_name(TTRC("Find Next")); find_next->set_flat(true); add_child(find_next); find_next->set_focus_mode(FOCUS_NONE); @@ -4773,6 +4777,7 @@ FindBar::FindBar() { hide_button = memnew(TextureButton); add_child(hide_button); + hide_button->set_accessibility_name(TTRC("Hide")); hide_button->set_focus_mode(FOCUS_NONE); hide_button->set_ignore_texture_size(true); hide_button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED); diff --git a/editor/editor_help_search.cpp b/editor/editor_help_search.cpp index 3845d4b8af..72d8758933 100644 --- a/editor/editor_help_search.cpp +++ b/editor/editor_help_search.cpp @@ -328,6 +328,7 @@ EditorHelpSearch::EditorHelpSearch() { vbox->add_child(hbox); search_box = memnew(LineEdit); + search_box->set_accessibility_name(TTRC("Search")); search_box->set_custom_minimum_size(Size2(200, 0) * EDSCALE); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_clear_button_enabled(true); @@ -339,6 +340,7 @@ EditorHelpSearch::EditorHelpSearch() { case_sensitive_button = memnew(Button); case_sensitive_button->set_theme_type_variation(SceneStringName(FlatButton)); case_sensitive_button->set_tooltip_text(TTR("Case Sensitive")); + case_sensitive_button->set_accessibility_name(TTRC("Case Sensitive")); case_sensitive_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelpSearch::_update_results)); case_sensitive_button->set_toggle_mode(true); case_sensitive_button->set_focus_mode(Control::FOCUS_NONE); @@ -347,6 +349,7 @@ EditorHelpSearch::EditorHelpSearch() { hierarchy_button = memnew(Button); hierarchy_button->set_theme_type_variation(SceneStringName(FlatButton)); hierarchy_button->set_tooltip_text(TTR("Show Hierarchy")); + hierarchy_button->set_accessibility_name(TTRC("Show Hierarchy")); hierarchy_button->connect(SceneStringName(pressed), callable_mp(this, &EditorHelpSearch::_update_results)); hierarchy_button->set_toggle_mode(true); hierarchy_button->set_pressed(true); @@ -354,6 +357,7 @@ EditorHelpSearch::EditorHelpSearch() { hbox->add_child(hierarchy_button); filter_combo = memnew(OptionButton); + filter_combo->set_accessibility_name(TTRC("Filter")); filter_combo->set_custom_minimum_size(Size2(200, 0) * EDSCALE); filter_combo->set_stretch_ratio(0); // Fixed width. filter_combo->add_item(TTR("Display All"), SEARCH_ALL); @@ -372,6 +376,7 @@ EditorHelpSearch::EditorHelpSearch() { // Create the results tree. results_tree = memnew(Tree); + results_tree->set_accessibility_name(TTRC("Search Results")); results_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); results_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL); results_tree->set_columns(2); diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index 45a7080375..43a90616b7 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -253,6 +253,25 @@ void EditorProperty::emit_changed(const StringName &p_property, const Variant &p void EditorProperty::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON); + + DisplayServer::get_singleton()->accessibility_update_set_name(ae, vformat(TTR("Property: %s"), label)); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, vformat(TTR("Property: %s"), label)); + + DisplayServer::get_singleton()->accessibility_update_set_popup_type(ae, DisplayServer::AccessibilityPopupType::POPUP_MENU); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &EditorProperty::_accessibility_action_menu)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_CLICK, callable_mp(this, &EditorProperty::_accessibility_action_click)); + + DisplayServer::get_singleton()->accessibility_update_set_flag(ae, DisplayServer::AccessibilityFlags::FLAG_READONLY, read_only); + if (checkable) { + DisplayServer::get_singleton()->accessibility_update_set_checked(ae, checked); + } + } break; + case NOTIFICATION_SORT_CHILDREN: { Size2 size = get_size(); Rect2 rect; @@ -401,6 +420,11 @@ void EditorProperty::_notification(int p_what) { draw_style_box(bg_stylebox, bottom_child_rect); } + Ref focus_sb = get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)); + if (focus_sb.is_valid() && has_focus()) { + draw_style_box(focus_sb, Rect2(Vector2(), get_size())); + } + Color color; if (draw_warning || draw_prop_warning) { color = get_theme_color(is_read_only() ? SNAME("readonly_warning_color") : SNAME("warning_color")); @@ -1031,6 +1055,22 @@ void EditorProperty::gui_input(const Ref &p_event) { } } +void EditorProperty::_accessibility_action_click(const Variant &p_data) { + select(); + if (checkable) { + checked = !checked; + queue_redraw(); + emit_signal(SNAME("property_checked"), property, checked); + } +} + +void EditorProperty::_accessibility_action_menu(const Variant &p_data) { + _update_popup(); + menu->set_position(get_screen_position()); + menu->reset_size(); + menu->popup(); +} + void EditorProperty::shortcut_input(const Ref &p_event) { if (!selected || !p_event->is_pressed()) { return; @@ -1268,6 +1308,19 @@ void EditorProperty::menu_option(int p_option) { emit_signal(SNAME("property_pinned"), property, !pinned); queue_redraw(); } break; + case MENU_DELETE: { + accept_event(); + emit_signal(SNAME("property_deleted"), property); + } break; + case MENU_REVERT_VALUE: { + accept_event(); + get_viewport()->gui_release_focus(); + bool is_valid_revert = false; + Variant revert_value = EditorPropertyRevert::get_property_revert_value(object, property, &is_valid_revert); + ERR_FAIL_COND(!is_valid_revert); + emit_changed(_get_revert_property(), revert_value); + update_property(); + } break; case MENU_OPEN_DOCUMENTATION: { ScriptEditor::get_singleton()->goto_help(doc_path); EditorNode::get_singleton()->get_editor_main_screen()->select(EditorMainScreen::EDITOR_SCRIPT); @@ -1361,6 +1414,8 @@ void EditorProperty::_bind_methods() { } EditorProperty::EditorProperty() { + set_focus_mode(FOCUS_ACCESSIBILITY); + object = nullptr; split_ratio = 0.5; text_size = 0; @@ -1411,7 +1466,15 @@ void EditorProperty::_update_popup() { } menu->set_item_tooltip(menu->get_item_index(MENU_PIN_VALUE), TTR("Pinning a value forces it to be saved even if it's equal to the default.")); } - + if (deletable || can_revert) { + menu->add_separator(); + if (deletable) { + menu->add_icon_item(get_editor_theme_icon(SNAME("Remove")), TTR("Delete Property"), MENU_PIN_VALUE); + } + if (can_revert) { + menu->add_icon_item(get_editor_theme_icon(SNAME("Reload")), TTR("Revert Value"), MENU_REVERT_VALUE); + } + } if (!doc_path.is_empty()) { menu->add_separator(); menu->add_icon_item(get_editor_theme_icon(SNAME("Help")), TTR("Open Documentation"), MENU_OPEN_DOCUMENTATION); @@ -1490,6 +1553,19 @@ void EditorInspectorPlugin::_bind_methods() { void EditorInspectorCategory::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON); + + DisplayServer::get_singleton()->accessibility_update_set_name(ae, vformat(TTR("Category: %s"), label)); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, vformat(TTR("Category: %s"), label)); + + DisplayServer::get_singleton()->accessibility_update_set_popup_type(ae, DisplayServer::AccessibilityPopupType::POPUP_MENU); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &EditorInspectorCategory::_accessibility_action_menu)); + } break; + case NOTIFICATION_THEME_CHANGED: { if (menu) { if (is_favorite) { @@ -1504,6 +1580,11 @@ void EditorInspectorCategory::_notification(int p_what) { draw_style_box(sb, Rect2(Vector2(), get_size())); + Ref focus_sb = get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)); + if (focus_sb.is_valid() && has_focus()) { + draw_style_box(focus_sb, Rect2(Vector2(), get_size())); + } + Ref font = get_theme_font(SNAME("bold"), EditorStringName(EditorFonts)); int font_size = get_theme_font_size(SNAME("bold_size"), EditorStringName(EditorFonts)); @@ -1543,6 +1624,22 @@ void EditorInspectorCategory::_notification(int p_what) { } } +void EditorInspectorCategory::_accessibility_action_menu(const Variant &p_data) { + if (!is_favorite) { + if (!menu) { + menu = memnew(PopupMenu); + menu->add_icon_item(get_editor_theme_icon(SNAME("Help")), TTR("Open Documentation"), MENU_OPEN_DOCS); + add_child(menu); + menu->connect(SceneStringName(id_pressed), callable_mp(this, &EditorInspectorCategory::_handle_menu_option)); + } + menu->set_item_disabled(menu->get_item_index(MENU_OPEN_DOCS), !EditorHelp::get_doc_data()->class_list.has(doc_class_name)); + } + + menu->set_position(get_screen_position()); + menu->reset_size(); + menu->popup(); +} + Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) const { // If it's not a doc tooltip, fallback to the default one. if (doc_class_name.is_empty()) { @@ -1613,6 +1710,10 @@ void EditorInspectorCategory::gui_input(const Ref &p_event) { menu->popup(); } +EditorInspectorCategory::EditorInspectorCategory() { + set_focus_mode(FOCUS_ACCESSIBILITY); +} + //////////////////////////////////////////////// //////////////////////////////////////////////// @@ -1656,6 +1757,18 @@ int EditorInspectorSection::_get_header_height() { void EditorInspectorSection::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON); + + DisplayServer::get_singleton()->accessibility_update_set_name(ae, vformat(TTR("Section: %s"), label)); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, vformat(TTR("Section: %s"), label)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_COLLAPSE, callable_mp(this, &EditorInspectorSection::_accessibility_action_collapse)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_EXPAND, callable_mp(this, &EditorInspectorSection::_accessibility_action_expand)); + } break; + case NOTIFICATION_THEME_CHANGED: { update_minimum_size(); bg_color = get_theme_color(SNAME("prop_subsection"), EditorStringName(Editor)); @@ -1719,6 +1832,12 @@ void EditorInspectorSection::_notification(int p_what) { } draw_rect(header_rect, c); + // Draw focus. + Ref focus_sb = get_theme_stylebox(SNAME("Focus"), EditorStringName(EditorStyles)); + if (focus_sb.is_valid() && has_focus()) { + draw_style_box(focus_sb, Rect2(Vector2(), get_size())); + } + // Draw header title, folding arrow and count of revertable properties. { int outer_margin = Math::round(2 * EDSCALE); @@ -1885,6 +2004,20 @@ void EditorInspectorSection::gui_input(const Ref &p_event) { return; } + Ref k = p_event; + if (k.is_valid() && k->is_pressed()) { + if (k->is_action("ui_accept", true)) { + accept_event(); + + bool should_unfold = !object->editor_is_section_unfolded(section); + if (should_unfold) { + unfold(); + } else { + fold(); + } + } + } + Ref mb = p_event; if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) { if (object->editor_is_section_unfolded(section)) { @@ -1925,6 +2058,14 @@ VBoxContainer *EditorInspectorSection::get_vbox() { return vbox; } +void EditorInspectorSection::_accessibility_action_collapse(const Variant &p_data) { + fold(); +} + +void EditorInspectorSection::_accessibility_action_expand(const Variant &p_data) { + unfold(); +} + void EditorInspectorSection::unfold() { if (!foldable) { return; @@ -1986,6 +2127,8 @@ void EditorInspectorSection::_bind_methods() { } EditorInspectorSection::EditorInspectorSection() { + set_focus_mode(FOCUS_ACCESSIBILITY); + vbox = memnew(VBoxContainer); dropping_unfold_timer = memnew(Timer); @@ -2099,6 +2242,18 @@ void EditorInspectorArray::_panel_draw(int p_index) { } } +void EditorInspectorArray::_panel_gui_focus(int p_index) { + array_elements[p_index].panel->queue_redraw(); + selected = p_index; +} + +void EditorInspectorArray::_panel_gui_unfocus(int p_index) { + array_elements[p_index].panel->queue_redraw(); + if (selected == p_index) { + selected = -1; + } +} + void EditorInspectorArray::_panel_gui_input(Ref p_event, int p_index) { ERR_FAIL_INDEX(p_index, (int)array_elements.size()); @@ -2130,6 +2285,15 @@ void EditorInspectorArray::_panel_gui_input(Ref p_event, int p_index } } +void EditorInspectorArray::show_menu(int p_index, const Vector2 &p_offset) { + popup_array_index_pressed = begin_array_index + p_index; + rmb_popup->set_item_disabled(OPTION_MOVE_UP, popup_array_index_pressed == 0); + rmb_popup->set_item_disabled(OPTION_MOVE_DOWN, popup_array_index_pressed == count - 1); + rmb_popup->set_position(get_screen_position() + p_offset); + rmb_popup->reset_size(); + rmb_popup->popup(); +} + void EditorInspectorArray::_move_element(int p_element_index, int p_to_pos) { String action_name; if (p_element_index < 0) { @@ -2490,16 +2654,20 @@ void EditorInspectorArray::_setup() { ArrayElement &ae = array_elements[i]; // Panel and its hbox. - ae.panel = memnew(PanelContainer); + ae.panel = memnew(ArrayPanelContainer); ae.panel->set_focus_mode(FOCUS_ALL); ae.panel->set_mouse_filter(MOUSE_FILTER_PASS); SET_DRAG_FORWARDING_GCD(ae.panel, EditorInspectorArray); int element_position = begin_array_index + i; + String ae_name = vformat(TTR("Element %d: %s%d*"), element_position, array_element_prefix, element_position); + ae.panel->set_meta("index", element_position); - ae.panel->set_tooltip_text(vformat(TTR("Element %d: %s%d*"), element_position, array_element_prefix, element_position)); - ae.panel->connect(SceneStringName(focus_entered), callable_mp((CanvasItem *)ae.panel, &PanelContainer::queue_redraw)); - ae.panel->connect(SceneStringName(focus_exited), callable_mp((CanvasItem *)ae.panel, &PanelContainer::queue_redraw)); + ae.panel->set_meta("name", ae_name); + ae.panel->set_meta("element", this); + ae.panel->set_tooltip_text(ae_name); + ae.panel->connect(SceneStringName(focus_entered), callable_mp(this, &EditorInspectorArray::_panel_gui_focus).bind(i)); + ae.panel->connect(SceneStringName(focus_exited), callable_mp(this, &EditorInspectorArray::_panel_gui_unfocus).bind(i)); ae.panel->connect(SceneStringName(draw), callable_mp(this, &EditorInspectorArray::_panel_draw).bind(i)); ae.panel->connect(SceneStringName(gui_input), callable_mp(this, &EditorInspectorArray::_panel_gui_input).bind(i)); ae.panel->add_theme_style_override(SceneStringName(panel), i % 2 ? odd_style : even_style); @@ -2532,6 +2700,7 @@ void EditorInspectorArray::_setup() { if (element_position > 0) { ae.move_up = memnew(Button); + ae.move_up->set_accessibility_name(TTRC("Move Up")); ae.move_up->set_button_icon(get_editor_theme_icon(SNAME("MoveUp"))); ae.move_up->connect(SceneStringName(pressed), callable_mp(this, &EditorInspectorArray::_move_element).bind(element_position, element_position - 1)); move_vbox->add_child(ae.move_up); @@ -2548,6 +2717,7 @@ void EditorInspectorArray::_setup() { if (element_position < count - 1) { ae.move_down = memnew(Button); + ae.move_down->set_accessibility_name(TTRC("Move Down")); ae.move_down->set_button_icon(get_editor_theme_icon(SNAME("MoveDown"))); ae.move_down->connect(SceneStringName(pressed), callable_mp(this, &EditorInspectorArray::_move_element).bind(element_position, element_position + 2)); move_vbox->add_child(ae.move_down); @@ -2572,6 +2742,7 @@ void EditorInspectorArray::_setup() { if (!unresizable) { ae.erase = memnew(Button); + ae.erase->set_accessibility_name(TTRC("Remove")); ae.erase->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); ae.erase->set_v_size_flags(SIZE_SHRINK_CENTER); ae.erase->connect(SceneStringName(pressed), callable_mp(this, &EditorInspectorArray::_remove_item).bind(element_position)); @@ -2612,7 +2783,7 @@ void EditorInspectorArray::drop_data_fw(const Point2 &p_point, const Variant &p_ Dictionary dict = p_data; int to_drop = dict["index"]; - int drop_position = _drop_position(); + int drop_position = (p_point == Vector2(INFINITY, INFINITY)) ? selected : _drop_position(); if (drop_position < 0) { return; } @@ -2630,7 +2801,7 @@ bool EditorInspectorArray::can_drop_data_fw(const Point2 &p_point, const Variant return false; } Dictionary dict = p_data; - int drop_position = _drop_position(); + int drop_position = (p_point == Vector2(INFINITY, INFINITY)) ? selected : _drop_position(); if (!dict.has("type") || dict["type"] != "property_array_element" || String(dict["property_array_prefix"]) != array_element_prefix || drop_position < 0) { return false; } @@ -2642,8 +2813,45 @@ bool EditorInspectorArray::can_drop_data_fw(const Point2 &p_point, const Variant return drop_array_index != moved_array_index && drop_array_index - 1 != moved_array_index; } +void ArrayPanelContainer::_accessibility_action_menu(const Variant &p_data) { + EditorInspectorArray *el = Object::cast_to(get_meta("element")); + if (el) { + int index = get_meta("index"); + el->show_menu(index, Vector2()); + } +} + +void ArrayPanelContainer::_notification(int p_what) { + switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_BUTTON); + + DisplayServer::get_singleton()->accessibility_update_set_name(ae, get_meta("text")); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, get_meta("text")); + + DisplayServer::get_singleton()->accessibility_update_set_popup_type(ae, DisplayServer::AccessibilityPopupType::POPUP_MENU); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SHOW_CONTEXT_MENU, callable_mp(this, &ArrayPanelContainer::_accessibility_action_menu)); + } break; + } +} + +ArrayPanelContainer::ArrayPanelContainer() { + set_focus_mode(FOCUS_ACCESSIBILITY); +} + void EditorInspectorArray::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_name(ae, vformat(TTR("Array: %s"), get_label())); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, vformat(TTR("Array: %s"), get_label())); + } break; + case NOTIFICATION_ENTER_TREE: case NOTIFICATION_THEME_CHANGED: { Color color = get_theme_color(SNAME("dark_color_1"), EditorStringName(Editor)); @@ -2747,6 +2955,7 @@ EditorInspectorArray::EditorInspectorArray(bool p_read_only) { even_style.instantiate(); rmb_popup = memnew(PopupMenu); + rmb_popup->set_accessibility_name(TTRC("Move")); rmb_popup->add_item(TTR("Move Up"), OPTION_MOVE_UP); rmb_popup->add_item(TTR("Move Down"), OPTION_MOVE_DOWN); rmb_popup->add_separator(); @@ -2784,6 +2993,7 @@ EditorInspectorArray::EditorInspectorArray(bool p_read_only) { resize_dialog->add_child(resize_dialog_vbox); new_size_spin_box = memnew(SpinBox); + new_size_spin_box->set_accessibility_name(TTRC("Size")); new_size_spin_box->set_max(16384); new_size_spin_box->connect(SceneStringName(value_changed), callable_mp(this, &EditorInspectorArray::_new_size_spin_box_value_changed)); new_size_spin_box->get_line_edit()->connect(SceneStringName(text_submitted), callable_mp(this, &EditorInspectorArray::_new_size_spin_box_text_submitted)); @@ -2859,16 +3069,19 @@ EditorPaginator::EditorPaginator() { set_alignment(ALIGNMENT_CENTER); first_page_button = memnew(Button); + first_page_button->set_accessibility_name(TTRC("First Page")); first_page_button->set_flat(true); first_page_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPaginator::_first_page_button_pressed)); add_child(first_page_button); prev_page_button = memnew(Button); + prev_page_button->set_accessibility_name(TTRC("Previuos Page")); prev_page_button->set_flat(true); prev_page_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPaginator::_prev_page_button_pressed)); add_child(prev_page_button); page_line_edit = memnew(LineEdit); + page_line_edit->set_accessibility_name(TTRC("Page")); page_line_edit->connect(SceneStringName(text_submitted), callable_mp(this, &EditorPaginator::_page_line_edit_text_submitted)); page_line_edit->add_theme_constant_override("minimum_character_width", 2); add_child(page_line_edit); @@ -2877,11 +3090,13 @@ EditorPaginator::EditorPaginator() { add_child(page_count_label); next_page_button = memnew(Button); + prev_page_button->set_accessibility_name(TTRC("Next Page")); next_page_button->set_flat(true); next_page_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPaginator::_next_page_button_pressed)); add_child(next_page_button); last_page_button = memnew(Button); + last_page_button->set_accessibility_name(TTRC("Last Page")); last_page_button->set_flat(true); last_page_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPaginator::_last_page_button_pressed)); add_child(last_page_button); diff --git a/editor/editor_inspector.h b/editor/editor_inspector.h index 866dad40cb..be47809c4b 100644 --- a/editor/editor_inspector.h +++ b/editor/editor_inspector.h @@ -66,6 +66,8 @@ public: MENU_COPY_PROPERTY_PATH, MENU_FAVORITE_PROPERTY, MENU_PIN_VALUE, + MENU_DELETE, + MENU_REVERT_VALUE, MENU_OPEN_DOCUMENTATION, }; @@ -158,6 +160,9 @@ protected: void _update_property_bg(); + void _accessibility_action_menu(const Variant &p_data); + void _accessibility_action_click(const Variant &p_data); + public: void emit_changed(const StringName &p_property, const Variant &p_value, const StringName &p_field = StringName(), bool p_changing = false); @@ -314,11 +319,15 @@ protected: void _notification(int p_what); virtual void gui_input(const Ref &p_event) override; + void _accessibility_action_menu(const Variant &p_data); + public: void set_as_favorite(EditorInspector *p_for_inspector); virtual Size2 get_minimum_size() const override; virtual Control *make_custom_tooltip(const String &p_text) const override; + + EditorInspectorCategory(); }; class EditorInspectorSection : public Container { @@ -349,11 +358,15 @@ protected: static void _bind_methods(); virtual void gui_input(const Ref &p_event) override; + void _accessibility_action_collapse(const Variant &p_data); + void _accessibility_action_expand(const Variant &p_data); + public: virtual Size2 get_minimum_size() const override; void setup(const String &p_section, const String &p_label, Object *p_object, const Color &p_bg_color, bool p_foldable, int p_indent_depth = 0, int p_level = 1); String get_section() const; + String get_label() const { return label; } VBoxContainer *get_vbox(); void unfold(); void fold(); @@ -367,6 +380,18 @@ public: ~EditorInspectorSection(); }; +class ArrayPanelContainer : public PanelContainer { + GDCLASS(ArrayPanelContainer, PanelContainer); + +protected: + void _notification(int p_what); + + void _accessibility_action_menu(const Variant &p_data); + +public: + ArrayPanelContainer(); +}; + class EditorInspectorArray : public EditorInspectorSection { GDCLASS(EditorInspectorArray, EditorInspectorSection); @@ -380,6 +405,7 @@ class EditorInspectorArray : public EditorInspectorSection { String swap_method; int count = 0; + int selected = -1; VBoxContainer *elements_vbox = nullptr; @@ -443,6 +469,8 @@ class EditorInspectorArray : public EditorInspectorSection { void _panel_draw(int p_index); void _panel_gui_input(Ref p_event, int p_index); + void _panel_gui_focus(int p_index); + void _panel_gui_unfocus(int p_index); void _move_element(int p_element_index, int p_to_pos); void _clear_array(); void _resize_array(int p_size); @@ -471,6 +499,8 @@ public: void setup_with_count_property(Object *p_object, const String &p_label, const StringName &p_count_property, const StringName &p_array_element_prefix, int p_page, const Color &p_bg_color, bool p_foldable, bool p_movable = true, bool p_is_const = false, bool p_numbered = false, int p_page_length = 5, const String &p_add_item_text = "", const String &p_swap_method = ""); VBoxContainer *get_vbox(int p_index); + void show_menu(int p_index, const Vector2 &p_offset); + EditorInspectorArray(bool p_read_only); }; diff --git a/editor/editor_layouts_dialog.cpp b/editor/editor_layouts_dialog.cpp index 6032605684..0ba5fb1f94 100644 --- a/editor/editor_layouts_dialog.cpp +++ b/editor/editor_layouts_dialog.cpp @@ -128,6 +128,7 @@ EditorLayoutsDialog::EditorLayoutsDialog() { name = memnew(LineEdit); makevb->add_child(name); name->set_placeholder(TTR("Or enter new layout name")); + name->set_accessibility_name(TTRC("Layout Name")); name->set_offset(SIDE_TOP, 5); name->set_anchor_and_offset(SIDE_LEFT, Control::ANCHOR_BEGIN, 5); name->set_anchor_and_offset(SIDE_RIGHT, Control::ANCHOR_END, -5); diff --git a/editor/editor_locale_dialog.cpp b/editor/editor_locale_dialog.cpp index c36792c9e3..006211207f 100644 --- a/editor/editor_locale_dialog.cpp +++ b/editor/editor_locale_dialog.cpp @@ -396,6 +396,7 @@ EditorLocaleDialog::EditorLocaleDialog() { HBoxContainer *hb_filter = memnew(HBoxContainer); { filter_mode = memnew(OptionButton); + filter_mode->set_accessibility_name(TTRC("Locale Filter")); filter_mode->add_item(TTR("Show All Locales"), SHOW_ALL_LOCALES); filter_mode->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter_mode->add_item(TTR("Show Selected Locales Only"), SHOW_ONLY_SELECTED_LOCALES); @@ -434,6 +435,7 @@ EditorLocaleDialog::EditorLocaleDialog() { } { lang_list = memnew(Tree); + lang_list->set_accessibility_name(TTRC("Language")); lang_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); lang_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); lang_list->connect("cell_selected", callable_mp(this, &EditorLocaleDialog::_item_selected)); @@ -454,6 +456,7 @@ EditorLocaleDialog::EditorLocaleDialog() { } { script_list = memnew(Tree); + script_list->set_accessibility_name(TTR("Script", "Locale")); script_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); script_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); script_list->connect("cell_selected", callable_mp(this, &EditorLocaleDialog::_item_selected)); @@ -473,6 +476,7 @@ EditorLocaleDialog::EditorLocaleDialog() { } { cnt_list = memnew(Tree); + cnt_list->set_accessibility_name(TTRC("Country")); cnt_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); cnt_list->set_v_size_flags(Control::SIZE_EXPAND_FILL); cnt_list->connect("cell_selected", callable_mp(this, &EditorLocaleDialog::_item_selected)); @@ -499,7 +503,7 @@ EditorLocaleDialog::EditorLocaleDialog() { { lang_code = memnew(LineEdit); lang_code->set_max_length(3); - lang_code->set_tooltip_text("Language"); + lang_code->set_accessibility_name("Language"); vb_language->add_child(lang_code); } hb_locale->add_child(vb_language); @@ -516,7 +520,7 @@ EditorLocaleDialog::EditorLocaleDialog() { { script_code = memnew(LineEdit); script_code->set_max_length(4); - script_code->set_tooltip_text("Script"); + script_code->set_accessibility_name("Script"); vb_script->add_child(script_code); } hb_locale->add_child(vb_script); @@ -549,7 +553,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_text("Variant"); + variant_code->set_accessibility_name("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 d33bd6a931..9a76b24ea8 100644 --- a/editor/editor_log.cpp +++ b/editor/editor_log.cpp @@ -466,6 +466,7 @@ EditorLog::EditorLog() { search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_placeholder(TTR("Filter Messages")); + search_box->set_accessibility_name(TTRC("Filter Messages")); search_box->set_clear_button_enabled(true); search_box->set_visible(true); search_box->connect(SceneStringName(text_changed), callable_mp(this, &EditorLog::_search_changed)); @@ -481,6 +482,7 @@ EditorLog::EditorLog() { // Clear. clear_button = memnew(Button); + clear_button->set_accessibility_name(TTRC("Clear Log")); clear_button->set_theme_type_variation(SceneStringName(FlatButton)); clear_button->set_focus_mode(FOCUS_NONE); clear_button->set_shortcut(ED_SHORTCUT("editor/clear_output", TTRC("Clear Output"), KeyModifierMask::CMD_OR_CTRL | KeyModifierMask::ALT | Key::K)); @@ -489,6 +491,7 @@ EditorLog::EditorLog() { // Copy. copy_button = memnew(Button); + copy_button->set_accessibility_name(TTRC("Copy Selection")); copy_button->set_theme_type_variation(SceneStringName(FlatButton)); copy_button->set_focus_mode(FOCUS_NONE); copy_button->set_shortcut(ED_SHORTCUT("editor/copy_output", TTRC("Copy Selection"), KeyModifierMask::CMD_OR_CTRL | Key::C)); @@ -509,6 +512,7 @@ EditorLog::EditorLog() { collapse_button->set_theme_type_variation(SceneStringName(FlatButton)); collapse_button->set_focus_mode(FOCUS_NONE); collapse_button->set_tooltip_text(TTR("Collapse duplicate messages into one log entry. Shows number of occurrences.")); + collapse_button->set_accessibility_name(TTRC("Collapse Duplicate Messages")); collapse_button->set_toggle_mode(true); collapse_button->set_pressed(false); collapse_button->connect(SceneStringName(toggled), callable_mp(this, &EditorLog::_set_collapse)); @@ -516,6 +520,7 @@ EditorLog::EditorLog() { // Show Search. show_search_button = memnew(Button); + show_search_button->set_accessibility_name(TTRC("Show Search")); show_search_button->set_theme_type_variation(SceneStringName(FlatButton)); show_search_button->set_focus_mode(FOCUS_NONE); show_search_button->set_toggle_mode(true); @@ -529,23 +534,23 @@ EditorLog::EditorLog() { vb_right->add_child(memnew(HSeparator)); LogFilter *std_filter = memnew(LogFilter(MSG_TYPE_STD)); - std_filter->initialize_button(TTR("Toggle visibility of standard output messages."), callable_mp(this, &EditorLog::_set_filter_active)); + std_filter->initialize_button(TTRC("Standard Messages"), TTRC("Toggle visibility of standard output messages."), callable_mp(this, &EditorLog::_set_filter_active)); vb_right->add_child(std_filter->toggle_button); type_filter_map.insert(MSG_TYPE_STD, std_filter); type_filter_map.insert(MSG_TYPE_STD_RICH, std_filter); LogFilter *error_filter = memnew(LogFilter(MSG_TYPE_ERROR)); - error_filter->initialize_button(TTR("Toggle visibility of errors."), callable_mp(this, &EditorLog::_set_filter_active)); + error_filter->initialize_button(TTRC("Errors"), TTRC("Toggle visibility of errors."), callable_mp(this, &EditorLog::_set_filter_active)); vb_right->add_child(error_filter->toggle_button); type_filter_map.insert(MSG_TYPE_ERROR, error_filter); LogFilter *warning_filter = memnew(LogFilter(MSG_TYPE_WARNING)); - warning_filter->initialize_button(TTR("Toggle visibility of warnings."), callable_mp(this, &EditorLog::_set_filter_active)); + warning_filter->initialize_button(TTRC("Warnings"), TTRC("Toggle visibility of warnings."), callable_mp(this, &EditorLog::_set_filter_active)); vb_right->add_child(warning_filter->toggle_button); type_filter_map.insert(MSG_TYPE_WARNING, warning_filter); LogFilter *editor_filter = memnew(LogFilter(MSG_TYPE_EDITOR)); - editor_filter->initialize_button(TTR("Toggle visibility of editor messages."), callable_mp(this, &EditorLog::_set_filter_active)); + editor_filter->initialize_button(TTRC("Editor Messages"), TTRC("Toggle visibility of editor messages."), callable_mp(this, &EditorLog::_set_filter_active)); vb_right->add_child(editor_filter->toggle_button); type_filter_map.insert(MSG_TYPE_EDITOR, editor_filter); diff --git a/editor/editor_log.h b/editor/editor_log.h index 3ec3dd796a..498357f5ba 100644 --- a/editor/editor_log.h +++ b/editor/editor_log.h @@ -87,12 +87,13 @@ private: MessageType type; Button *toggle_button = nullptr; - void initialize_button(const String &p_tooltip, Callable p_toggled_callback) { + void initialize_button(const String &p_name, const String &p_tooltip, Callable p_toggled_callback) { toggle_button = memnew(Button); toggle_button->set_toggle_mode(true); toggle_button->set_pressed(true); toggle_button->set_text(itos(message_count)); - toggle_button->set_tooltip_text(TTR(p_tooltip)); + toggle_button->set_accessibility_name(TTRGET(p_name)); + toggle_button->set_tooltip_text(TTRGET(p_tooltip)); toggle_button->set_focus_mode(FOCUS_NONE); // When toggled call the callback and pass the MessageType this button is for. toggle_button->connect(SceneStringName(toggled), p_toggled_callback.bind(type)); diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index b0d21c58dc..a8697b0b1e 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -7506,6 +7506,7 @@ EditorNode::EditorNode() { ED_SHORTCUT_AND_COMMAND("editor/toggle_last_opened_bottom_panel", TTRC("Toggle Last Opened Bottom Panel"), KeyModifierMask::CMD_OR_CTRL | Key::J); distraction_free->set_shortcut(ED_GET_SHORTCUT("editor/distraction_free_mode")); distraction_free->set_tooltip_text(TTRC("Toggle distraction-free mode.")); + distraction_free->set_accessibility_name(TTRC("Distraction-free Mode")); distraction_free->set_toggle_mode(true); scene_tabs->add_extra_button(distraction_free); distraction_free->connect(SceneStringName(pressed), callable_mp(this, &EditorNode::_toggle_distraction_free_mode)); @@ -7831,6 +7832,7 @@ EditorNode::EditorNode() { renderer->set_fit_to_longest_item(false); renderer->set_focus_mode(Control::FOCUS_NONE); renderer->set_tooltip_text(TTR("Choose a rendering method.\n\nNotes:\n- On mobile platforms, the Mobile rendering method is used if Forward+ is selected here.\n- On the web platform, the Compatibility rendering method is always used.")); + renderer->set_accessibility_name(TTRC("Rendering Method")); right_menu_hb->add_child(renderer); @@ -7888,6 +7890,7 @@ EditorNode::EditorNode() { right_menu_hb->add_child(update_spinner); update_spinner->set_button_icon(theme->get_icon(SNAME("Progress1"), EditorStringName(EditorIcons))); update_spinner->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &EditorNode::_menu_option)); + update_spinner->set_accessibility_name(TTRC("Update Mode")); PopupMenu *p = update_spinner->get_popup(); p->add_radio_check_item(TTR("Update Continuously"), SPINNER_UPDATE_CONTINUOUSLY); p->add_radio_check_item(TTR("Update When Changed"), SPINNER_UPDATE_WHEN_CHANGED); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index 22ca6299c3..68c54de2b8 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -236,6 +236,7 @@ EditorPropertyMultilineText::EditorPropertyMultilineText(bool p_expression) { hb->add_child(text); text->set_h_size_flags(SIZE_EXPAND_FILL); open_big_text = memnew(Button); + open_big_text->set_accessibility_name(TTRC("Open Text Edit Dialog")); open_big_text->set_flat(true); open_big_text->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyMultilineText::_open_big_text)); hb->add_child(open_big_text); @@ -373,6 +374,7 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { hb->add_child(edit_custom_layout); option_button = memnew(OptionButton); + option_button->set_accessibility_name(TTRC("Enum Options")); option_button->set_h_size_flags(SIZE_EXPAND_FILL); option_button->set_clip_text(true); option_button->set_flat(true); @@ -381,22 +383,26 @@ EditorPropertyTextEnum::EditorPropertyTextEnum() { option_button->connect(SceneStringName(item_selected), callable_mp(this, &EditorPropertyTextEnum::_option_selected)); edit_button = memnew(Button); + edit_button->set_accessibility_name(TTRC("Edit")); edit_button->set_flat(true); edit_button->hide(); default_layout->add_child(edit_button); edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_edit_custom_value)); custom_value_edit = memnew(LineEdit); + custom_value_edit->set_accessibility_name(TTRC("Custom Value")); custom_value_edit->set_h_size_flags(SIZE_EXPAND_FILL); edit_custom_layout->add_child(custom_value_edit); custom_value_edit->connect(SceneStringName(text_submitted), callable_mp(this, &EditorPropertyTextEnum::_custom_value_submitted)); accept_button = memnew(Button); + accept_button->set_accessibility_name(TTRC("Accept Custom Value Edit")); accept_button->set_flat(true); edit_custom_layout->add_child(accept_button); accept_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_custom_value_accepted)); cancel_button = memnew(Button); + cancel_button->set_accessibility_name(TTRC("Cancel Custom Value Edit")); cancel_button->set_flat(true); edit_custom_layout->add_child(cancel_button); cancel_button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyTextEnum::_custom_value_canceled)); @@ -453,12 +459,14 @@ EditorPropertyLocale::EditorPropertyLocale() { HBoxContainer *locale_hb = memnew(HBoxContainer); add_child(locale_hb); locale = memnew(LineEdit); + locale->set_accessibility_name(TTRC("Locale")); locale_hb->add_child(locale); locale->connect(SceneStringName(text_submitted), callable_mp(this, &EditorPropertyLocale::_locale_selected)); locale->connect(SceneStringName(focus_exited), callable_mp(this, &EditorPropertyLocale::_locale_focus_exited)); locale->set_h_size_flags(SIZE_EXPAND_FILL); locale_edit = memnew(Button); + locale_edit->set_accessibility_name(TTRC("Edit")); locale_edit->set_clip_text(true); locale_hb->add_child(locale_edit); add_focusable(locale); @@ -606,6 +614,7 @@ EditorPropertyPath::EditorPropertyPath() { HBoxContainer *path_hb = memnew(HBoxContainer); add_child(path_hb); path = memnew(LineEdit); + path->set_accessibility_name(TTRC("Path")); SET_DRAG_FORWARDING_CDU(path, EditorPropertyPath); path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); path_hb->add_child(path); @@ -614,6 +623,7 @@ EditorPropertyPath::EditorPropertyPath() { path->set_h_size_flags(SIZE_EXPAND_FILL); path_edit = memnew(Button); + path_edit->set_accessibility_name(TTRC("Edit")); path_edit->set_clip_text(true); path_hb->add_child(path_edit); add_focusable(path); @@ -993,6 +1003,15 @@ void EditorPropertyLayersGrid::gui_input(const Ref &p_ev) { void EditorPropertyLayersGrid::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Layers grid property editor"))); + } break; + case NOTIFICATION_DRAW: { Size2 grid_size = get_grid_size(); grid_size.x = get_size().x; @@ -1300,6 +1319,7 @@ EditorPropertyLayers::EditorPropertyLayers() { hb->add_child(grid); button = memnew(TextureButton); + button->set_accessibility_name(TTRC("Layers")); button->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED); button->set_toggle_mode(true); button->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyLayers::_button_pressed)); @@ -1391,6 +1411,7 @@ void EditorPropertyObjectID::setup(const String &p_base_type) { EditorPropertyObjectID::EditorPropertyObjectID() { edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); add_child(edit); add_focusable(edit); edit->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); @@ -1416,6 +1437,7 @@ void EditorPropertySignal::update_property() { EditorPropertySignal::EditorPropertySignal() { edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); add_child(edit); add_focusable(edit); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertySignal::_edit_pressed)); @@ -1435,6 +1457,7 @@ void EditorPropertyCallable::update_property() { EditorPropertyCallable::EditorPropertyCallable() { edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); add_child(edit); add_focusable(edit); } @@ -1766,6 +1789,7 @@ EditorPropertyRect2::EditorPropertyRect2(bool p_force_wide) { for (int i = 0; i < 4; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); if (grid) { @@ -1860,6 +1884,7 @@ EditorPropertyRect2i::EditorPropertyRect2i(bool p_force_wide) { for (int i = 0; i < 4; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); if (grid) { @@ -1951,6 +1976,7 @@ EditorPropertyPlane::EditorPropertyPlane(bool p_force_wide) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_flat(true); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); bc->add_child(spin[i]); add_focusable(spin[i]); spin[i]->connect(SceneStringName(value_changed), callable_mp(this, &EditorPropertyPlane::_value_changed).bind(desc[i])); @@ -2121,6 +2147,7 @@ EditorPropertyQuaternion::EditorPropertyQuaternion() { spin[i] = memnew(EditorSpinSlider); spin[i]->set_flat(true); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); default_layout->add_child(spin[i]); add_focusable(spin[i]); spin[i]->connect(SceneStringName(value_changed), callable_mp(this, &EditorPropertyQuaternion::_value_changed).bind(desc[i])); @@ -2148,6 +2175,7 @@ EditorPropertyQuaternion::EditorPropertyQuaternion() { euler[i] = memnew(EditorSpinSlider); euler[i]->set_flat(true); euler[i]->set_label(desc[i]); + euler[i]->set_accessibility_name(vformat(TTR("Temporary Euler %s"), desc[i])); edit_custom_layout->add_child(euler[i]); add_focusable(euler[i]); euler[i]->connect(SceneStringName(value_changed), callable_mp(this, &EditorPropertyQuaternion::_custom_value_changed)); @@ -2157,6 +2185,7 @@ EditorPropertyQuaternion::EditorPropertyQuaternion() { } edit_button = memnew(Button); + edit_button->set_accessibility_name(TTRC("Edit")); edit_button->set_flat(true); edit_button->set_toggle_mode(true); default_layout->add_child(edit_button); @@ -2231,6 +2260,7 @@ EditorPropertyAABB::EditorPropertyAABB() { for (int i = 0; i < 6; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); g->add_child(spin[i]); @@ -2311,6 +2341,7 @@ EditorPropertyTransform2D::EditorPropertyTransform2D(bool p_include_origin) { for (int i = 0; i < 6; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); if (p_include_origin || i % 3 != 2) { g->add_child(spin[i]); @@ -2393,6 +2424,7 @@ EditorPropertyBasis::EditorPropertyBasis() { for (int i = 0; i < 9; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); @@ -2482,6 +2514,7 @@ EditorPropertyTransform3D::EditorPropertyTransform3D() { for (int i = 0; i < 12; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); @@ -2579,6 +2612,7 @@ EditorPropertyProjection::EditorPropertyProjection() { for (int i = 0; i < 16; i++) { spin[i] = memnew(EditorSpinSlider); spin[i]->set_label(desc[i]); + spin[i]->set_accessibility_name(desc[i]); spin[i]->set_flat(true); g->add_child(spin[i]); spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); @@ -2964,6 +2998,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() { hbc->add_theme_constant_override("separation", 0); add_child(hbc); assign = memnew(Button); + assign->set_accessibility_name(TTRC("Assign Node")); assign->set_flat(true); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); @@ -2986,6 +3021,7 @@ EditorPropertyNodePath::EditorPropertyNodePath() { menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &EditorPropertyNodePath::_menu_option)); edit = memnew(LineEdit); + edit->set_accessibility_name(TTRC("Node Path")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->hide(); edit->connect(SceneStringName(focus_exited), callable_mp(this, &EditorPropertyNodePath::_accept_text)); diff --git a/editor/editor_properties_array_dict.cpp b/editor/editor_properties_array_dict.cpp index f8f2112036..b10bd99237 100644 --- a/editor/editor_properties_array_dict.cpp +++ b/editor/editor_properties_array_dict.cpp @@ -305,6 +305,7 @@ void EditorPropertyArray::_create_new_property_slot() { HBoxContainer *hbox = memnew(HBoxContainer); Button *reorder_button = memnew(Button); + reorder_button->set_accessibility_name(TTRC("Reorder")); reorder_button->set_button_icon(get_editor_theme_icon(SNAME("TripleBar"))); reorder_button->set_default_cursor_shape(Control::CURSOR_MOVE); reorder_button->set_disabled(is_read_only()); @@ -320,12 +321,14 @@ void EditorPropertyArray::_create_new_property_slot() { if (is_untyped_array) { Button *edit_btn = memnew(Button); + edit_btn->set_accessibility_name(TTRC("Edit")); edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit"))); edit_btn->set_disabled(is_read_only()); edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_change_type).bind(edit_btn, idx)); hbox->add_child(edit_btn); } else { Button *remove_btn = memnew(Button); + remove_btn->set_accessibility_name(TTRC("Remove")); remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); remove_btn->set_disabled(is_read_only()); remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_remove_pressed).bind(idx)); @@ -444,6 +447,7 @@ void EditorPropertyArray::update_property() { size_slider->set_editing_integer(true); size_slider->set_h_size_flags(SIZE_EXPAND_FILL); size_slider->set_read_only(is_read_only()); + size_slider->set_accessibility_name(TTRC("Size")); size_slider->connect(SceneStringName(value_changed), callable_mp(this, &EditorPropertyArray::_length_changed)); hbox->add_child(size_slider); @@ -457,6 +461,7 @@ void EditorPropertyArray::update_property() { button_add_item->connect(SceneStringName(draw), callable_mp(this, &EditorPropertyArray::_button_add_item_draw)); SET_DRAG_FORWARDING_CD(button_add_item, EditorPropertyArray); button_add_item->set_disabled(is_read_only()); + button_add_item->set_accessibility_name(TTRC("Add")); vbox->add_child(button_add_item); paginator = memnew(EditorPaginator); @@ -955,6 +960,7 @@ EditorPropertyArray::EditorPropertyArray() { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyArray::_edit_pressed)); @@ -1068,12 +1074,14 @@ void EditorPropertyDictionary::_create_new_property_slot(int p_idx) { if (is_untyped_dict) { Button *edit_btn = memnew(Button); + edit_btn->set_accessibility_name(TTRC("Edit")); edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Edit"))); edit_btn->set_disabled(is_read_only()); edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_change_type).bind(edit_btn, slots.size())); hbox->add_child(edit_btn); } else if (p_idx >= 0) { Button *remove_btn = memnew(Button); + remove_btn->set_accessibility_name(TTRC("Remove")); remove_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); remove_btn->set_disabled(is_read_only()); remove_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_remove_pressed).bind(slots.size())); @@ -1288,6 +1296,7 @@ void EditorPropertyDictionary::update_property() { button_add_item = EditorInspector::create_inspector_action_button(TTR("Add Key/Value Pair")); button_add_item->set_button_icon(get_theme_icon(SNAME("Add"), EditorStringName(EditorIcons))); button_add_item->set_disabled(is_read_only()); + button_add_item->set_accessibility_name(TTRC("Add")); button_add_item->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_add_key_value)); add_vbox->add_child(button_add_item); } @@ -1482,6 +1491,7 @@ EditorPropertyDictionary::EditorPropertyDictionary() { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyDictionary::_edit_pressed)); @@ -1637,6 +1647,7 @@ void EditorPropertyLocalizableString::update_property() { hbox->add_child(prop); prop->set_h_size_flags(SIZE_EXPAND_FILL); Button *edit_btn = memnew(Button); + edit_btn->set_accessibility_name(TTRC("Remove Translation")); edit_btn->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); hbox->add_child(edit_btn); edit_btn->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyLocalizableString::_remove_item).bind(edit_btn, remove_index)); @@ -1646,6 +1657,7 @@ void EditorPropertyLocalizableString::update_property() { if (page_index == max_page) { button_add_item = EditorInspector::create_inspector_action_button(TTR("Add Translation")); + button_add_item->set_accessibility_name(TTRC("Add Translation")); button_add_item->set_button_icon(get_editor_theme_icon(SNAME("Add"))); button_add_item->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyLocalizableString::_add_locale_popup)); property_vbox->add_child(button_add_item); @@ -1702,6 +1714,7 @@ EditorPropertyLocalizableString::EditorPropertyLocalizableString() { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyLocalizableString::_edit_pressed)); diff --git a/editor/editor_properties_vector.cpp b/editor/editor_properties_vector.cpp index 0ec7cf518a..0cd0fdd8b3 100644 --- a/editor/editor_properties_vector.cpp +++ b/editor/editor_properties_vector.cpp @@ -222,6 +222,7 @@ EditorPropertyVectorN::EditorPropertyVectorN(Variant::Type p_type, bool p_force_ bc->add_child(spin[i]); spin[i]->set_flat(true); spin[i]->set_label(String(COMPONENT_LABELS[i])); + spin[i]->set_accessibility_name(String(COMPONENT_LABELS[i])); if (horizontal) { spin[i]->set_h_size_flags(SIZE_EXPAND_FILL); } @@ -238,6 +239,7 @@ EditorPropertyVectorN::EditorPropertyVectorN(Variant::Type p_type, bool p_force_ linked->set_toggle_mode(true); linked->set_stretch_mode(TextureButton::STRETCH_KEEP_CENTERED); linked->set_tooltip_text(TTR("Lock/Unlock Component Ratio")); + linked->set_accessibility_name(TTRC("Lock/Unlock Component Ratio")); linked->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyVectorN::_update_ratio)); linked->connect(SceneStringName(toggled), callable_mp(this, &EditorPropertyVectorN::_store_link)); hb->add_child(linked); diff --git a/editor/editor_resource_picker.cpp b/editor/editor_resource_picker.cpp index 846bf46e5b..21ccb078e1 100644 --- a/editor/editor_resource_picker.cpp +++ b/editor/editor_resource_picker.cpp @@ -398,6 +398,7 @@ void EditorResourcePicker::_edit_menu_cbk(int p_which) { vb->add_child(label); duplicate_resources_tree = memnew(Tree); + duplicate_resources_tree->set_accessibility_name(TTRC("Duplicate resources")); duplicate_resources_tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); vb->add_child(duplicate_resources_tree); duplicate_resources_tree->set_columns(2); @@ -1103,6 +1104,7 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) { assign_button = memnew(Button); assign_button->set_flat(true); assign_button->set_h_size_flags(SIZE_EXPAND_FILL); + assign_button->set_accessibility_name(TTRC("Assign Resource")); assign_button->set_expand_icon(true); assign_button->set_clip_text(true); assign_button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); @@ -1127,8 +1129,9 @@ EditorResourcePicker::EditorResourcePicker(bool p_hide_assign_button_controls) { edit_button->set_flat(false); edit_button->set_toggle_mode(true); edit_button->set_action_mode(BaseButton::ACTION_MODE_BUTTON_PRESS); - edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_update_menu)); + edit_button->set_accessibility_name(TTRC("Edit")); add_child(edit_button); + edit_button->connect(SceneStringName(pressed), callable_mp(this, &EditorResourcePicker::_update_menu)); edit_button->connect(SceneStringName(gui_input), callable_mp(this, &EditorResourcePicker::_button_input)); add_theme_constant_override("separation", 0); diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp index 5f237943c7..91cbe4edbd 100644 --- a/editor/editor_run_native.cpp +++ b/editor/editor_run_native.cpp @@ -201,6 +201,7 @@ EditorRunNative::EditorRunNative() { remote_debug->set_theme_type_variation("RunBarButton"); remote_debug->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &EditorRunNative::start_run_native)); remote_debug->set_tooltip_text(TTR("Remote Deploy")); + remote_debug->set_accessibility_name(TTRC("Remote Deploy")); remote_debug->set_disabled(true); add_child(remote_debug); diff --git a/editor/editor_settings.cpp b/editor/editor_settings.cpp index 0a29314400..44d01dc5d9 100644 --- a/editor/editor_settings.cpp +++ b/editor/editor_settings.cpp @@ -661,6 +661,7 @@ void EditorSettings::_load_defaults(Ref p_extra_config) { _initial_set("docks/scene_tree/auto_expand_to_selected", true); _initial_set("docks/scene_tree/center_node_on_reparent", false); _initial_set("docks/scene_tree/hide_filtered_out_parents", true); + _initial_set("docks/scene_tree/accessibility_warnings", false); // FileSystem EDITOR_SETTING(Variant::INT, PROPERTY_HINT_RANGE, "docks/filesystem/thumbnail_size", 64, "32,128,16") diff --git a/editor/editor_settings_dialog.cpp b/editor/editor_settings_dialog.cpp index 658e733d3a..d497bfab5d 100644 --- a/editor/editor_settings_dialog.cpp +++ b/editor/editor_settings_dialog.cpp @@ -759,7 +759,7 @@ Variant EditorSettingsDialog::get_drag_data_fw(const Point2 &p_point, Control *p bool EditorSettingsDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { TreeItem *selected = shortcuts->get_selected(); - TreeItem *item = shortcuts->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? shortcuts->get_selected() : shortcuts->get_item_at_position(p_point); if (!selected || !item || item == selected || (String)item->get_meta("type", "") != "event") { return false; } @@ -778,7 +778,7 @@ void EditorSettingsDialog::drop_data_fw(const Point2 &p_point, const Variant &p_ } TreeItem *selected = shortcuts->get_selected(); - TreeItem *target = shortcuts->get_item_at_position(p_point); + TreeItem *target = (p_point == Vector2(INFINITY, INFINITY)) ? shortcuts->get_selected() : shortcuts->get_item_at_position(p_point); if (!target) { return; @@ -901,6 +901,7 @@ EditorSettingsDialog::EditorSettingsDialog() { search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter Settings")); + search_box->set_accessibility_name(TTRC("Filter Settings")); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hbc->add_child(search_box); @@ -936,6 +937,7 @@ EditorSettingsDialog::EditorSettingsDialog() { restart_hb->add_child(restart_button); restart_button->set_text(TTR("Save & Restart")); restart_close_button = memnew(Button); + restart_close_button->set_accessibility_name(TTRC("Close")); restart_close_button->set_flat(true); restart_close_button->connect(SceneStringName(pressed), callable_mp(this, &EditorSettingsDialog::_editor_restart_close)); restart_hb->add_child(restart_close_button); @@ -954,6 +956,7 @@ EditorSettingsDialog::EditorSettingsDialog() { shortcut_search_box = memnew(LineEdit); shortcut_search_box->set_placeholder(TTR("Filter by Name")); + shortcut_search_box->set_accessibility_name(TTRC("Filter by Name")); shortcut_search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); top_hbox->add_child(shortcut_search_box); shortcut_search_box->connect(SceneStringName(text_changed), callable_mp(this, &EditorSettingsDialog::_filter_shortcuts)); @@ -975,6 +978,7 @@ EditorSettingsDialog::EditorSettingsDialog() { top_hbox->add_child(clear_all_search); shortcuts = memnew(Tree); + shortcuts->set_accessibility_name(TTRC("Shortcuts")); shortcuts->set_v_size_flags(Control::SIZE_EXPAND_FILL); shortcuts->set_columns(2); shortcuts->set_hide_root(true); diff --git a/editor/engine_update_label.cpp b/editor/engine_update_label.cpp index b03d1d8d34..831459cdcb 100644 --- a/editor/engine_update_label.cpp +++ b/editor/engine_update_label.cpp @@ -184,17 +184,20 @@ void EngineUpdateLabel::_set_status(UpdateStatus p_status) { } else { _set_message(TTR("Update checks disabled."), theme_cache.disabled_color); } + set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_OFF); set_tooltip_text(""); break; } case UpdateStatus::ERROR: { set_disabled(false); + set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE); set_tooltip_text(TTR("An error has occurred. Click to try again.")); } break; case UpdateStatus::UPDATE_AVAILABLE: { set_disabled(false); + set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_POLITE); set_tooltip_text(TTR("Click to open download page.")); } break; diff --git a/editor/event_listener_line_edit.cpp b/editor/event_listener_line_edit.cpp index a6b30233fc..c8151ed9f9 100644 --- a/editor/event_listener_line_edit.cpp +++ b/editor/event_listener_line_edit.cpp @@ -162,8 +162,26 @@ void EventListenerLineEdit::gui_input(const Ref &p_event) { return; } + // Allow releasing focus by holding "ui_cancel" action. + bool accept_release = false; + uint64_t hold_to_unfocus_timeout = 3000; + if (p_event->is_action_pressed(SNAME("ui_cancel"), true, true)) { + if ((OS::get_singleton()->get_ticks_msec() - hold_next) < hold_to_unfocus_timeout) { + hold_next = 0; + Control *next = find_next_valid_focus(); + next->grab_focus(); + } else { + hold_next = OS::get_singleton()->get_ticks_msec(); + } + accept_event(); + return; + } else if (p_event->is_action_released(SNAME("ui_cancel"), true)) { + accept_release = true; + } + hold_next = 0; + accept_event(); - if (!p_event->is_pressed() || p_event->is_echo() || p_event->is_match(event) || !_is_event_allowed(p_event)) { + if (!(p_event->is_pressed() || accept_release) || p_event->is_echo() || p_event->is_match(event) || !_is_event_allowed(p_event)) { return; } @@ -215,6 +233,12 @@ void EventListenerLineEdit::grab_focus() { void EventListenerLineEdit::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_extra_info(ae, vformat(TTR("Listening for Input. Hold %s to release focus."), InputMap::get_singleton()->get_action_description("ui_cancel"))); + } break; case NOTIFICATION_ENTER_TREE: { connect(SceneStringName(text_changed), callable_mp(this, &EventListenerLineEdit::_on_text_changed)); connect(SceneStringName(focus_entered), callable_mp(this, &EventListenerLineEdit::_on_focus)); diff --git a/editor/event_listener_line_edit.h b/editor/event_listener_line_edit.h index aaf987943d..ca2744162e 100644 --- a/editor/event_listener_line_edit.h +++ b/editor/event_listener_line_edit.h @@ -42,6 +42,8 @@ enum InputType { class EventListenerLineEdit : public LineEdit { GDCLASS(EventListenerLineEdit, LineEdit) + uint64_t hold_next = 0; + int allowed_input_types = INPUT_KEY | INPUT_MOUSE_BUTTON | INPUT_JOY_BUTTON | INPUT_JOY_MOTION; bool ignore_next_event = true; bool share_keycodes = false; diff --git a/editor/export/export_template_manager.cpp b/editor/export/export_template_manager.cpp index 8a5fe43ff4..71dd2f583a 100644 --- a/editor/export/export_template_manager.cpp +++ b/editor/export/export_template_manager.cpp @@ -1017,6 +1017,7 @@ ExportTemplateManager::ExportTemplateManager() { current_installed_path = memnew(LineEdit); current_installed_path->set_editable(false); current_installed_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + current_installed_path->set_accessibility_name(TTRC("Installed Path")); current_installed_hb->add_child(current_installed_path); #ifndef ANDROID_ENABLED @@ -1052,6 +1053,7 @@ ExportTemplateManager::ExportTemplateManager() { download_install_hb->add_child(mirrors_label); mirrors_list = memnew(OptionButton); + mirrors_list->set_accessibility_name(TTRC("Mirror")); mirrors_list->set_custom_minimum_size(Size2(280, 0) * EDSCALE); download_install_hb->add_child(mirrors_list); @@ -1060,6 +1062,7 @@ ExportTemplateManager::ExportTemplateManager() { request_mirrors->connect("request_completed", callable_mp(this, &ExportTemplateManager::_refresh_mirrors_completed)); mirror_options_button = memnew(MenuButton); + mirror_options_button->set_accessibility_name(TTRC("Mirror Options")); mirror_options_button->get_popup()->add_item(TTR("Open in Web Browser"), VISIT_WEB_MIRROR); mirror_options_button->get_popup()->add_item(TTR("Copy Mirror URL"), COPY_MIRROR_URL); download_install_hb->add_child(mirror_options_button); diff --git a/editor/export/project_export.cpp b/editor/export/project_export.cpp index e8b36959d7..2db79dfc2e 100644 --- a/editor/export/project_export.cpp +++ b/editor/export/project_export.cpp @@ -745,7 +745,14 @@ void ProjectExportDialog::_delete_preset_confirm() { Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_from) { if (p_from == presets) { - int pos = presets->get_item_at_position(p_point, true); + int pos = -1; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (presets->is_anything_selected()) { + pos = presets->get_selected_items()[0]; + } + } else { + pos = presets->get_item_at_position(p_point, true); + } if (pos >= 0) { Dictionary d; @@ -766,7 +773,7 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_ return d; } } else if (p_from == patches) { - TreeItem *item = patches->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? patches->get_selected() : patches->get_item_at_position(p_point); if (item) { int item_metadata = item->get_metadata(0); @@ -791,7 +798,18 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant return false; } - if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) { + int pos = -1; + bool end = true; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (presets->is_anything_selected()) { + pos = presets->get_selected_items()[0]; + } + } else { + pos = presets->get_item_at_position(p_point, true); + end = presets->is_pos_at_end_of_items(p_point); + } + + if (pos < 0 && !end) { return false; } } else if (p_from == patches) { @@ -800,7 +818,7 @@ bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant return false; } - TreeItem *item = patches->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? patches->get_selected() : patches->get_item_at_position(p_point); if (!item) { return false; } @@ -818,11 +836,22 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d int to_pos = -1; - if (presets->get_item_at_position(p_point, true) >= 0) { - to_pos = presets->get_item_at_position(p_point, true); + int pos = -1; + bool end = true; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (presets->is_anything_selected()) { + pos = presets->get_selected_items()[0]; + } + } else { + pos = presets->get_item_at_position(p_point, true); + end = presets->is_pos_at_end_of_items(p_point); } - if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point)) { + if (pos >= 0) { + to_pos = pos; + } + + if (to_pos == -1 && !end) { return; } @@ -846,14 +875,20 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d Dictionary d = p_data; int from_pos = d["patch"]; - TreeItem *item = patches->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? patches->get_selected() : patches->get_item_at_position(p_point); if (!item) { return; } int to_pos = item->get_metadata(0); - if (patches->get_drop_section_at_position(p_point) > 0) { + int pos = -1; + if (p_point == Vector2(INFINITY, INFINITY)) { + pos = patches->get_drop_section_at_position(patches->get_item_rect(item).position); + } else { + pos = patches->get_drop_section_at_position(p_point); + } + if (pos > 0) { to_pos++; } @@ -1428,11 +1463,13 @@ ProjectExportDialog::ProjectExportDialog() { presets->connect(SceneStringName(item_selected), callable_mp(this, &ProjectExportDialog::_edit_preset)); duplicate_preset = memnew(Button); duplicate_preset->set_tooltip_text(TTR("Duplicate")); + duplicate_preset->set_accessibility_name(TTRC("Duplicate")); duplicate_preset->set_flat(true); preset_hb->add_child(duplicate_preset); duplicate_preset->connect(SceneStringName(pressed), callable_mp(this, &ProjectExportDialog::_duplicate_preset)); delete_preset = memnew(Button); delete_preset->set_tooltip_text(TTR("Delete")); + delete_preset->set_accessibility_name(TTRC("Delete")); delete_preset->set_flat(true); preset_hb->add_child(delete_preset); delete_preset->connect(SceneStringName(pressed), callable_mp(this, &ProjectExportDialog::_delete_preset)); @@ -1501,6 +1538,7 @@ ProjectExportDialog::ProjectExportDialog() { resources_scroll_container->add_child(resources_vb); export_filter = memnew(OptionButton); + export_filter->set_accessibility_name(TTRC("Export Mode")); export_filter->add_item(TTR("Export all resources in the project")); export_filter->add_item(TTR("Export selected scenes (and dependencies)")); export_filter->add_item(TTR("Export selected resources (and dependencies)")); @@ -1555,12 +1593,14 @@ ProjectExportDialog::ProjectExportDialog() { file_mode_popup->connect(SceneStringName(id_pressed), callable_mp(this, &ProjectExportDialog::_set_file_export_mode)); include_filters = memnew(LineEdit); + include_filters->set_accessibility_name(TTRC("Include Filters")); resources_vb->add_margin_child( TTR("Filters to export non-resource files/folders\n(comma-separated, e.g: *.json, *.txt, docs/*)"), include_filters); include_filters->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_filter_changed)); exclude_filters = memnew(LineEdit); + exclude_filters->set_accessibility_name(TTRC("Exclude Filters")); resources_vb->add_margin_child( TTR("Filters to exclude files/folders from project\n(comma-separated, e.g: *.json, *.txt, docs/*)"), exclude_filters); @@ -1635,18 +1675,21 @@ ProjectExportDialog::ProjectExportDialog() { sec_vb->add_child(enc_directory); enc_in_filters = memnew(LineEdit); + enc_in_filters->set_accessibility_name(TTRC("Include Filters")); enc_in_filters->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_enc_filters_changed)); sec_vb->add_margin_child( TTR("Filters to include files/folders\n(comma-separated, e.g: *.tscn, *.tres, scenes/*)"), enc_in_filters); enc_ex_filters = memnew(LineEdit); + enc_ex_filters->set_accessibility_name(TTRC("Exclude Filters")); enc_ex_filters->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_enc_filters_changed)); sec_vb->add_margin_child( TTR("Filters to exclude files/folders\n(comma-separated, e.g: *.ctex, *.import, music/*)"), enc_ex_filters); script_key = memnew(LineEdit); + script_key->set_accessibility_name(TTRC("Encryption Key")); script_key->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_script_encryption_key_changed)); script_key_error = memnew(Label); script_key_error->set_text(String::utf8("• ") + TTR("Invalid Encryption Key (must be 64 hexadecimal characters long)")); @@ -1656,6 +1699,7 @@ ProjectExportDialog::ProjectExportDialog() { sections->add_child(sec_scroll_container); seed_input = memnew(LineEdit); + seed_input->set_accessibility_name(TTRC("Encryption Seed")); seed_input->connect(SceneStringName(text_changed), callable_mp(this, &ProjectExportDialog::_seed_input_changed)); sec_vb->add_margin_child(TTR("Initialization vector seed"), seed_input); @@ -1674,6 +1718,7 @@ ProjectExportDialog::ProjectExportDialog() { script_vb->set_name(TTR("Scripts")); script_mode = memnew(OptionButton); + script_mode->set_accessibility_name(TTRC("GDScript Export Mode")); script_vb->add_margin_child(TTR("GDScript Export Mode:"), script_mode); script_mode->add_item(TTR("Text (easier debugging)"), (int)EditorExportPreset::MODE_SCRIPT_TEXT); script_mode->add_item(TTR("Binary tokens (faster loading)"), (int)EditorExportPreset::MODE_SCRIPT_BINARY_TOKENS); diff --git a/editor/fbx_importer_manager.cpp b/editor/fbx_importer_manager.cpp index f612c3bd81..72806ad64a 100644 --- a/editor/fbx_importer_manager.cpp +++ b/editor/fbx_importer_manager.cpp @@ -150,6 +150,7 @@ FBXImporterManager::FBXImporterManager() { fbx_path = memnew(LineEdit); fbx_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + fbx_path->set_accessibility_name(TTRC("Path")); hb->add_child(fbx_path); fbx_path_browse = memnew(Button); fbx_path_browse->set_text(TTR("Browse")); diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 388abafc01..aea97507eb 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -2857,12 +2857,12 @@ bool FileSystemDock::can_drop_data_fw(const Point2 &p_point, const Variant &p_da } // Moving favorite around. - TreeItem *ti = tree->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!ti) { return false; } - int drop_section = tree->get_drop_section_at_position(p_point); + int drop_section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point); if (ti == favorites_item) { return (drop_section == 1); // The parent, first fav. } @@ -2935,11 +2935,11 @@ void FileSystemDock::drop_data_fw(const Point2 &p_point, const Variant &p_data, return; } // Moving favorite around. - TreeItem *ti = tree->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!ti) { return; } - int drop_section = tree->get_drop_section_at_position(p_point); + int drop_section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point); int drop_position; Vector drag_files = drag_data["files"]; @@ -3059,7 +3059,7 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori // In the file list. if (p_from == files) { - int pos = files->get_item_at_position(p_point, true); + int pos = (p_point == Vector2(INFINITY, INFINITY)) ? -1 : files->get_item_at_position(p_point, true); if (pos == -1) { target = get_current_directory(); return; @@ -3072,8 +3072,8 @@ void FileSystemDock::_get_drag_target_folder(String &target, bool &target_favori // In the tree. if (p_from == tree) { - TreeItem *ti = tree->get_item_at_position(p_point); - int section = tree->get_drop_section_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); + int section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(ti).position) : tree->get_drop_section_at_position(p_point); if (ti) { // Check the favorites first. if (ti == tree->get_root()->get_first_child() && section >= 0) { @@ -3887,6 +3887,7 @@ MenuButton *FileSystemDock::_create_file_menu_button() { button->set_flat(false); button->set_theme_type_variation("FlatMenuButton"); button->set_tooltip_text(TTRC("Sort Files")); + button->set_accessibility_name(TTRC("Sort Files")); PopupMenu *p = button->get_popup(); p->connect(SceneStringName(id_pressed), callable_mp(this, &FileSystemDock::_file_sort_popup)); @@ -4081,6 +4082,7 @@ FileSystemDock::FileSystemDock() { button_hist_prev->set_disabled(true); button_hist_prev->set_focus_mode(FOCUS_NONE); button_hist_prev->set_tooltip_text(TTRC("Go to previous selected folder/file.")); + button_hist_prev->set_accessibility_name(TTRC("Previous")); nav_hbc->add_child(button_hist_prev); button_hist_next = memnew(Button); @@ -4088,10 +4090,12 @@ FileSystemDock::FileSystemDock() { button_hist_next->set_disabled(true); button_hist_next->set_focus_mode(FOCUS_NONE); button_hist_next->set_tooltip_text(TTRC("Go to next selected folder/file.")); + button_hist_next->set_accessibility_name(TTRC("Next")); nav_hbc->add_child(button_hist_next); current_path_line_edit = memnew(LineEdit); current_path_line_edit->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); + current_path_line_edit->set_accessibility_name(TTRC("Path")); current_path_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); _set_current_path_line_edit_text(current_path); toolbar_hbc->add_child(current_path_line_edit); @@ -4100,11 +4104,13 @@ FileSystemDock::FileSystemDock() { button_toggle_display_mode->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_change_split_mode)); button_toggle_display_mode->set_focus_mode(FOCUS_NONE); button_toggle_display_mode->set_tooltip_text(TTRC("Change Split Mode")); + button_toggle_display_mode->set_accessibility_name(TTRC("Change Split Mode")); button_toggle_display_mode->set_theme_type_variation("FlatMenuButton"); toolbar_hbc->add_child(button_toggle_display_mode); button_dock_placement = memnew(Button); button_dock_placement->set_theme_type_variation("FlatMenuButton"); + button_dock_placement->set_accessibility_name(TTRC("Dock Placement")); button_dock_placement->connect(SceneStringName(pressed), callable_mp(this, &FileSystemDock::_change_bottom_dock_placement)); button_dock_placement->hide(); toolbar_hbc->add_child(button_dock_placement); @@ -4115,6 +4121,7 @@ FileSystemDock::FileSystemDock() { tree_search_box = memnew(LineEdit); tree_search_box->set_h_size_flags(SIZE_EXPAND_FILL); tree_search_box->set_placeholder(TTRC("Filter Files")); + tree_search_box->set_accessibility_name(TTRC("Filter Files")); tree_search_box->set_clear_button_enabled(true); tree_search_box->connect(SceneStringName(text_changed), callable_mp(this, &FileSystemDock::_search_changed).bind(tree_search_box)); toolbar2_hbc->add_child(tree_search_box); @@ -4137,6 +4144,7 @@ FileSystemDock::FileSystemDock() { add_child(split_box); tree = memnew(FileSystemTree); + tree->set_accessibility_name(TTRC("Directories")); tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); tree->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); @@ -4167,6 +4175,7 @@ FileSystemDock::FileSystemDock() { file_list_search_box = memnew(LineEdit); file_list_search_box->set_h_size_flags(SIZE_EXPAND_FILL); file_list_search_box->set_placeholder(TTRC("Filter Files")); + file_list_search_box->set_accessibility_name(TTRC("Filter Files")); file_list_search_box->set_clear_button_enabled(true); file_list_search_box->connect(SceneStringName(text_changed), callable_mp(this, &FileSystemDock::_search_changed).bind(file_list_search_box)); path_hb->add_child(file_list_search_box); @@ -4175,11 +4184,13 @@ FileSystemDock::FileSystemDock() { path_hb->add_child(file_list_button_sort); button_file_list_display_mode = memnew(Button); + button_file_list_display_mode->set_accessibility_name(TTRC("Display Mode")); button_file_list_display_mode->set_theme_type_variation("FlatMenuButton"); path_hb->add_child(button_file_list_display_mode); files = memnew(FileSystemList); files->set_v_size_flags(SIZE_EXPAND_FILL); + files->set_accessibility_name(TTRC("Files")); files->set_select_mode(ItemList::SELECT_MULTI); files->set_theme_type_variation("ItemListSecondary"); SET_DRAG_FORWARDING_GCD(files, FileSystemDock); @@ -4202,6 +4213,7 @@ FileSystemDock::FileSystemDock() { scanning_vb->add_child(slabel); scanning_progress = memnew(ProgressBar); + scanning_progress->set_accessibility_name(TTRC("Filesystem Scan")); scanning_vb->add_child(scanning_progress); deps_editor = memnew(DependencyEditor); diff --git a/editor/find_in_files.cpp b/editor/find_in_files.cpp index fb9c168718..bb79e0ea04 100644 --- a/editor/find_in_files.cpp +++ b/editor/find_in_files.cpp @@ -319,6 +319,7 @@ FindInFilesDialog::FindInFilesDialog() { _search_text_line_edit = memnew(LineEdit); _search_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); + _search_text_line_edit->set_accessibility_name(TTRC("Search")); _search_text_line_edit->connect(SceneStringName(text_changed), callable_mp(this, &FindInFilesDialog::_on_search_text_modified)); _search_text_line_edit->connect(SceneStringName(text_submitted), callable_mp(this, &FindInFilesDialog::_on_search_text_submitted)); gc->add_child(_search_text_line_edit); @@ -330,6 +331,7 @@ FindInFilesDialog::FindInFilesDialog() { _replace_text_line_edit = memnew(LineEdit); _replace_text_line_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); + _replace_text_line_edit->set_accessibility_name(TTRC("Replace")); _replace_text_line_edit->connect(SceneStringName(text_submitted), callable_mp(this, &FindInFilesDialog::_on_replace_text_submitted)); _replace_text_line_edit->hide(); gc->add_child(_replace_text_line_edit); @@ -366,6 +368,7 @@ FindInFilesDialog::FindInFilesDialog() { hbc->add_child(_folder_line_edit); Button *folder_button = memnew(Button); + folder_button->set_accessibility_name(TTRC("Select Folder")); folder_button->set_text("..."); folder_button->connect(SceneStringName(pressed), callable_mp(this, &FindInFilesDialog::_on_folder_button_pressed)); hbc->add_child(folder_button); @@ -622,6 +625,7 @@ FindInFilesPanel::FindInFilesPanel() { } _results_display = memnew(Tree); + _results_display->set_accessibility_name(TTRC("Search Results")); _results_display->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); _results_display->set_v_size_flags(SIZE_EXPAND_FILL); _results_display->connect(SceneStringName(item_selected), callable_mp(this, &FindInFilesPanel::_on_result_selected)); @@ -644,6 +648,7 @@ FindInFilesPanel::FindInFilesPanel() { _replace_container->add_child(replace_label); _replace_line_edit = memnew(LineEdit); + _replace_line_edit->set_accessibility_name(TTRC("Replace")); _replace_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); _replace_line_edit->connect(SceneStringName(text_changed), callable_mp(this, &FindInFilesPanel::_on_replace_text_changed)); _replace_container->add_child(_replace_line_edit); diff --git a/editor/group_settings_editor.cpp b/editor/group_settings_editor.cpp index b7482cdfff..33d2981961 100644 --- a/editor/group_settings_editor.cpp +++ b/editor/group_settings_editor.cpp @@ -499,6 +499,7 @@ GroupSettingsEditor::GroupSettingsEditor() { group_name = memnew(LineEdit); group_name->set_h_size_flags(SIZE_EXPAND_FILL); group_name->set_clear_button_enabled(true); + group_name->set_accessibility_name(TTRC("Group Name")); group_name->connect(SceneStringName(text_changed), callable_mp(this, &GroupSettingsEditor::_group_name_text_changed)); group_name->connect(SceneStringName(text_submitted), callable_mp(this, &GroupSettingsEditor::_text_submitted)); hbc->add_child(group_name); @@ -509,6 +510,7 @@ GroupSettingsEditor::GroupSettingsEditor() { group_description = memnew(LineEdit); group_description->set_clear_button_enabled(true); + group_description->set_accessibility_name(TTRC("Group Description")); group_description->set_h_size_flags(SIZE_EXPAND_FILL); group_description->connect(SceneStringName(text_submitted), callable_mp(this, &GroupSettingsEditor::_text_submitted)); hbc->add_child(group_description); diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp index 756f09e97b..3534f16554 100644 --- a/editor/groups_editor.cpp +++ b/editor/groups_editor.cpp @@ -633,6 +633,7 @@ void GroupsEditor::_show_add_group_dialog() { add_group_name = memnew(LineEdit); add_group_name->set_custom_minimum_size(Size2(200 * EDSCALE, 0)); add_group_name->set_h_size_flags(SIZE_EXPAND_FILL); + add_group_name->set_accessibility_name(TTRC("Name")); hbc->add_child(add_group_name); global_group_button = memnew(CheckButton); @@ -646,6 +647,7 @@ void GroupsEditor::_show_add_group_dialog() { add_group_description = memnew(LineEdit); add_group_description->set_h_size_flags(SIZE_EXPAND_FILL); add_group_description->set_editable(false); + add_group_description->set_accessibility_name(TTRC("Description")); gc->add_child(add_group_description); global_group_button->connect(SceneStringName(toggled), callable_mp(add_group_description, &LineEdit::set_editable)); @@ -841,6 +843,7 @@ GroupsEditor::GroupsEditor() { add = memnew(Button); add->set_theme_type_variation("FlatMenuButton"); + add->set_accessibility_name(TTRC("Add Group")); add->set_tooltip_text(TTR("Add a new group.")); add->connect(SceneStringName(pressed), callable_mp(this, &GroupsEditor::_show_add_group_dialog)); hbc->add_child(add); @@ -848,6 +851,7 @@ GroupsEditor::GroupsEditor() { filter = memnew(LineEdit); filter->set_clear_button_enabled(true); filter->set_placeholder(TTR("Filter Groups")); + filter->set_accessibility_name(TTRC("Filter Groups")); filter->set_h_size_flags(SIZE_EXPAND_FILL); filter->connect(SceneStringName(text_changed), callable_mp(this, &GroupsEditor::_update_tree).unbind(1)); hbc->add_child(filter); diff --git a/editor/gui/editor_bottom_panel.cpp b/editor/gui/editor_bottom_panel.cpp index e984f196fb..f0e3bef091 100644 --- a/editor/gui/editor_bottom_panel.cpp +++ b/editor/gui/editor_bottom_panel.cpp @@ -307,6 +307,7 @@ EditorBottomPanel::EditorBottomPanel() { left_button = memnew(Button); left_button->set_tooltip_text(TTR("Scroll Left\nHold Ctrl to scroll to the begin.\nHold Shift to scroll one page.")); + left_button->set_accessibility_name(TTRC("Scroll Left")); left_button->set_theme_type_variation("BottomPanelButton"); left_button->set_focus_mode(Control::FOCUS_NONE); left_button->connect(SceneStringName(pressed), callable_mp(this, &EditorBottomPanel::_scroll).bind(false)); @@ -323,6 +324,7 @@ EditorBottomPanel::EditorBottomPanel() { right_button = memnew(Button); right_button->set_tooltip_text(TTR("Scroll Right\nHold Ctrl to scroll to the end.\nHold Shift to scroll one page.")); + right_button->set_accessibility_name(TTRC("Scroll Right")); right_button->set_theme_type_variation("BottomPanelButton"); right_button->set_focus_mode(Control::FOCUS_NONE); right_button->connect(SceneStringName(pressed), callable_mp(this, &EditorBottomPanel::_scroll).bind(true)); @@ -354,6 +356,7 @@ EditorBottomPanel::EditorBottomPanel() { pin_button->set_theme_type_variation("FlatMenuButton"); pin_button->set_toggle_mode(true); pin_button->set_tooltip_text(TTR("Pin Bottom Panel Switching")); + pin_button->set_accessibility_name(TTRC("Pin Bottom Panel")); pin_button->connect(SceneStringName(toggled), callable_mp(this, &EditorBottomPanel::_pin_button_toggled)); expand_button = memnew(Button); @@ -361,6 +364,7 @@ EditorBottomPanel::EditorBottomPanel() { expand_button->hide(); expand_button->set_theme_type_variation("FlatMenuButton"); expand_button->set_toggle_mode(true); + expand_button->set_accessibility_name(TTRC("Expand Bottom Panel")); expand_button->set_shortcut(ED_SHORTCUT_AND_COMMAND("editor/bottom_panel_expand", TTRC("Expand Bottom Panel"), KeyModifierMask::SHIFT | Key::F12)); expand_button->connect(SceneStringName(toggled), callable_mp(this, &EditorBottomPanel::_expand_button_toggled)); } diff --git a/editor/gui/editor_file_dialog.cpp b/editor/gui/editor_file_dialog.cpp index f7db59d50a..1a8c7def04 100644 --- a/editor/gui/editor_file_dialog.cpp +++ b/editor/gui/editor_file_dialog.cpp @@ -2048,6 +2048,7 @@ void EditorFileDialog::_update_option_controls() { for (const EditorFileDialog::Option &opt : options) { if (opt.values.is_empty()) { CheckBox *cb = memnew(CheckBox); + cb->set_accessibility_name(opt.name); cb->set_pressed(opt.default_idx); cb->set_text(opt.name); flow_checkbox_options->add_child(cb); @@ -2056,12 +2057,14 @@ void EditorFileDialog::_update_option_controls() { } else { Label *lbl = memnew(Label); lbl->set_text(opt.name); + lbl->set_focus_mode(Control::FOCUS_NONE); grid_select_options->add_child(lbl); OptionButton *ob = memnew(OptionButton); for (const String &val : opt.values) { ob->add_item(val); } + ob->set_accessibility_name(opt.name); ob->select(opt.default_idx); grid_select_options->add_child(ob); ob->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_option_changed_item_selected).bind(opt.name)); @@ -2401,12 +2404,15 @@ EditorFileDialog::EditorFileDialog() { dir_prev = memnew(Button); dir_prev->set_theme_type_variation(SceneStringName(FlatButton)); + dir_prev->set_accessibility_name(TTRC("Previous")); dir_prev->set_tooltip_text(TTR("Go to previous folder.")); dir_next = memnew(Button); dir_next->set_theme_type_variation(SceneStringName(FlatButton)); + dir_next->set_accessibility_name(TTRC("Next")); dir_next->set_tooltip_text(TTR("Go to next folder.")); dir_up = memnew(Button); dir_up->set_theme_type_variation(SceneStringName(FlatButton)); + dir_up->set_accessibility_name(TTRC("Parent Folder")); dir_up->set_tooltip_text(TTR("Go to parent folder.")); pathhb->add_child(dir_prev); @@ -2418,6 +2424,7 @@ EditorFileDialog::EditorFileDialog() { dir_up->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::_go_up)); Label *l = memnew(Label(TTR("Path:"))); + l->set_focus_mode(Control::FOCUS_NONE); l->set_theme_type_variation("HeaderSmall"); pathhb->add_child(l); @@ -2426,10 +2433,12 @@ EditorFileDialog::EditorFileDialog() { dir = memnew(LineEdit); dir->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); + dir->set_accessibility_name(TTRC("Directory Path")); pathhb->add_child(dir); refresh = memnew(Button); refresh->set_theme_type_variation(SceneStringName(FlatButton)); + refresh->set_accessibility_name(TTRC("Refresh Files")); refresh->set_tooltip_text(TTR("Refresh files.")); refresh->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::update_file_list)); pathhb->add_child(refresh); @@ -2437,6 +2446,7 @@ EditorFileDialog::EditorFileDialog() { favorite = memnew(Button); favorite->set_theme_type_variation(SceneStringName(FlatButton)); favorite->set_toggle_mode(true); + favorite->set_accessibility_name(TTRC("(Un)favorite Folder")); favorite->set_tooltip_text(TTR("(Un)favorite current folder.")); favorite->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::_favorite_pressed)); pathhb->add_child(favorite); @@ -2446,6 +2456,7 @@ EditorFileDialog::EditorFileDialog() { drives = memnew(OptionButton); drives->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_select_drive)); + drives->set_accessibility_name(TTRC("Current Drive")); pathhb->add_child(drives); makedir_sep = memnew(VSeparator); @@ -2453,6 +2464,7 @@ EditorFileDialog::EditorFileDialog() { makedir = memnew(Button); makedir->set_theme_type_variation(SceneStringName(FlatButton)); + makedir->set_accessibility_name(TTRC("Create Folder")); makedir->set_tooltip_text(TTR("Create a new folder.")); makedir->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::_make_dir)); pathhb->add_child(makedir); @@ -2488,16 +2500,19 @@ EditorFileDialog::EditorFileDialog() { fav_vb->add_child(fav_hb); l = memnew(Label(TTR("Favorites:"))); + l->set_focus_mode(Control::FOCUS_NONE); l->set_theme_type_variation("HeaderSmall"); fav_hb->add_child(l); fav_hb->add_spacer(); fav_up = memnew(Button); fav_up->set_theme_type_variation(SceneStringName(FlatButton)); + fav_up->set_accessibility_name(TTRC("Move Up")); fav_hb->add_child(fav_up); fav_up->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::_favorite_move_up)); fav_down = memnew(Button); fav_down->set_theme_type_variation(SceneStringName(FlatButton)); + fav_down->set_accessibility_name(TTRC("Move Down")); fav_hb->add_child(fav_down); fav_down->connect(SceneStringName(pressed), callable_mp(this, &EditorFileDialog::_favorite_move_down)); @@ -2506,6 +2521,7 @@ EditorFileDialog::EditorFileDialog() { fav_vb->add_child(favorites); favorites->set_v_size_flags(Control::SIZE_EXPAND_FILL); favorites->set_theme_type_variation("ItemListSecondary"); + favorites->set_accessibility_name(TTRC("Favorites")); favorites->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_favorite_selected)); VBoxContainer *rec_vb = memnew(VBoxContainer); @@ -2516,6 +2532,7 @@ EditorFileDialog::EditorFileDialog() { recent->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); recent->set_allow_reselect(true); recent->set_theme_type_variation("ItemListSecondary"); + recent->set_accessibility_name(TTRC("Recent")); rec_vb->add_margin_child(TTR("Recent:"), recent, true); recent->connect(SceneStringName(item_selected), callable_mp(this, &EditorFileDialog::_recent_selected)); @@ -2534,6 +2551,7 @@ EditorFileDialog::EditorFileDialog() { lower_hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); l = memnew(Label(TTR("Directories & Files:"))); + l->set_focus_mode(Control::FOCUS_NONE); l->set_theme_type_variation("HeaderSmall"); l->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -2543,6 +2561,7 @@ EditorFileDialog::EditorFileDialog() { show_hidden->set_theme_type_variation(SceneStringName(FlatButton)); show_hidden->set_toggle_mode(true); show_hidden->set_pressed(is_showing_hidden_files()); + show_hidden->set_accessibility_name(TTRC("Show Hidden Files")); show_hidden->set_tooltip_text(TTR("Toggle the visibility of hidden files.")); show_hidden->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::set_show_hidden_files)); lower_hb->add_child(show_hidden); @@ -2558,6 +2577,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_accessibility_name(TTRC("View as Thumbnails")); mode_thumbnails->set_tooltip_text(TTR("View items as a grid of thumbnails.")); lower_hb->add_child(mode_thumbnails); @@ -2567,6 +2587,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_accessibility_name(TTRC("View as List")); mode_list->set_tooltip_text(TTR("View items as a list.")); lower_hb->add_child(mode_list); @@ -2576,12 +2597,14 @@ EditorFileDialog::EditorFileDialog() { file_sort_button->set_flat(false); file_sort_button->set_theme_type_variation("FlatMenuButton"); file_sort_button->set_tooltip_text(TTR("Sort files")); + file_sort_button->set_accessibility_name(TTRC("Sort Files")); show_search_filter_button = memnew(Button); show_search_filter_button->set_theme_type_variation(SceneStringName(FlatButton)); show_search_filter_button->set_toggle_mode(true); show_search_filter_button->set_pressed(false); show_search_filter_button->set_tooltip_text(TTR("Toggle the visibility of the filter for file names.")); + show_search_filter_button->set_accessibility_name(TTRC("Show Search Filters")); show_search_filter_button->connect(SceneStringName(toggled), callable_mp(this, &EditorFileDialog::set_show_search_filter)); lower_hb->add_child(show_search_filter_button); @@ -2607,6 +2630,7 @@ EditorFileDialog::EditorFileDialog() { item_list->connect("item_clicked", callable_mp(this, &EditorFileDialog::_item_list_item_rmb_clicked)); item_list->connect("empty_clicked", callable_mp(this, &EditorFileDialog::_item_list_empty_clicked)); item_list->set_allow_rmb_select(true); + item_list->set_accessibility_name(TTRC("Directories and Files")); list_vb->add_child(item_list); @@ -2629,6 +2653,7 @@ EditorFileDialog::EditorFileDialog() { filter_box = memnew(LineEdit); filter_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter_box->set_placeholder(TTR("Filter")); + filter_box->set_accessibility_name(TTRC("Filename Filter")); filter_hb->add_child(filter_box); filter_hb->set_visible(false); item_vb->add_child(filter_hb); @@ -2636,6 +2661,7 @@ EditorFileDialog::EditorFileDialog() { file_box = memnew(HBoxContainer); l = memnew(Label(TTR("File:"))); + l->set_focus_mode(Control::FOCUS_NONE); l->set_theme_type_variation("HeaderSmall"); file_box->add_child(l); @@ -2643,11 +2669,13 @@ EditorFileDialog::EditorFileDialog() { file->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); file->set_stretch_ratio(4); file->set_h_size_flags(Control::SIZE_EXPAND_FILL); + file->set_accessibility_name(TTRC("File Name")); file_box->add_child(file); filter = memnew(OptionButton); filter->set_stretch_ratio(3); filter->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter->set_clip_text(true); // Too many extensions overflow it. + filter->set_accessibility_name(TTRC("File Type Filter")); file_box->add_child(filter); file_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); item_vb->add_child(file_box); @@ -2685,6 +2713,7 @@ EditorFileDialog::EditorFileDialog() { makedirname = memnew(LineEdit); makedirname->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); + makedirname->set_accessibility_name(TTRC("Name")); makevb->add_margin_child(TTR("Name:"), makedirname); add_child(makedialog); makedialog->register_text_enter(makedirname); diff --git a/editor/gui/editor_quick_open_dialog.cpp b/editor/gui/editor_quick_open_dialog.cpp index e95e15176f..01d49b4ea1 100644 --- a/editor/gui/editor_quick_open_dialog.cpp +++ b/editor/gui/editor_quick_open_dialog.cpp @@ -115,6 +115,7 @@ EditorQuickOpenDialog::EditorQuickOpenDialog() { search_box = memnew(LineEdit); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_box->set_placeholder(TTR("Search files...")); + search_box->set_accessibility_name(TTRC("Search")); search_box->set_clear_button_enabled(true); mc->add_child(search_box); } @@ -278,6 +279,7 @@ QuickOpenResultContainer::QuickOpenResultContainer() { bottom_bar->add_child(vsep); display_mode_toggle = memnew(Button); + display_mode_toggle->set_accessibility_name(TTRC("Display Mode")); style_button(display_mode_toggle); display_mode_toggle->connect(SceneStringName(pressed), callable_mp(this, &QuickOpenResultContainer::_toggle_display_mode)); bottom_bar->add_child(display_mode_toggle); diff --git a/editor/gui/editor_run_bar.cpp b/editor/gui/editor_run_bar.cpp index 9a1223322f..96c49f287a 100644 --- a/editor/gui/editor_run_bar.cpp +++ b/editor/gui/editor_run_bar.cpp @@ -530,6 +530,7 @@ EditorRunBar::EditorRunBar() { recovery_mode_reload_button->set_theme_type_variation("RunBarButton"); recovery_mode_reload_button->set_focus_mode(Control::FOCUS_NONE); recovery_mode_reload_button->set_tooltip_text(TTR("Disable recovery mode and reload the project.")); + recovery_mode_reload_button->set_accessibility_name(TTRC("Disable Recovery Mode")); recovery_mode_reload_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::recovery_mode_reload_project)); recovery_mode_panel = memnew(PanelContainer); @@ -552,6 +553,7 @@ EditorRunBar::EditorRunBar() { play_button->set_toggle_mode(true); play_button->set_focus_mode(Control::FOCUS_NONE); play_button->set_tooltip_text(TTRC("Run the project's default scene.")); + play_button->set_accessibility_name(TTRC("Run Default Scene")); play_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::play_main_scene).bind(false)); ED_SHORTCUT_AND_COMMAND("editor/run_project", TTRC("Run Project"), Key::F5); @@ -564,6 +566,7 @@ EditorRunBar::EditorRunBar() { pause_button->set_toggle_mode(true); pause_button->set_focus_mode(Control::FOCUS_NONE); pause_button->set_tooltip_text(TTRC("Pause the running project's execution for debugging.")); + pause_button->set_accessibility_name(TTRC("Pause")); pause_button->set_disabled(true); ED_SHORTCUT("editor/pause_running_project", TTRC("Pause Running Project"), Key::F7); @@ -575,6 +578,7 @@ EditorRunBar::EditorRunBar() { stop_button->set_theme_type_variation("RunBarButton"); stop_button->set_focus_mode(Control::FOCUS_NONE); stop_button->set_tooltip_text(TTRC("Stop the currently running project.")); + stop_button->set_accessibility_name(TTRC("Stop")); stop_button->set_disabled(true); stop_button->connect(SceneStringName(pressed), callable_mp(this, &EditorRunBar::stop_playing)); @@ -614,6 +618,7 @@ EditorRunBar::EditorRunBar() { play_scene_button->set_theme_type_variation("RunBarButton"); play_scene_button->set_focus_mode(Control::FOCUS_NONE); play_scene_button->set_tooltip_text(TTRC("Run the currently edited scene.")); + play_scene_button->set_accessibility_name(TTRC("Run Edited Scene")); ED_SHORTCUT_AND_COMMAND("editor/run_current_scene", TTRC("Run Current Scene"), Key::F6); ED_SHORTCUT_OVERRIDE("editor/run_current_scene", "macos", KeyModifierMask::META | Key::R); @@ -635,6 +640,7 @@ EditorRunBar::EditorRunBar() { play_custom_scene_button->set_theme_type_variation("RunBarButton"); play_custom_scene_button->set_focus_mode(Control::FOCUS_NONE); play_custom_scene_button->set_tooltip_text(TTRC("Run a specific scene.")); + play_custom_scene_button->set_accessibility_name(TTRC("Run Specific Scene")); ED_SHORTCUT_AND_COMMAND("editor/run_specific_scene", TTRC("Run Specific Scene"), KeyModifierMask::CTRL | KeyModifierMask::SHIFT | Key::F5); ED_SHORTCUT_OVERRIDE("editor/run_specific_scene", "macos", KeyModifierMask::META | KeyModifierMask::SHIFT | Key::R); @@ -650,5 +656,6 @@ EditorRunBar::EditorRunBar() { write_movie_button->set_pressed(false); write_movie_button->set_focus_mode(Control::FOCUS_NONE); 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.")); + write_movie_button->set_accessibility_name(TTRC("Enable Movie Maker Mode")); write_movie_button->connect(SceneStringName(toggled), callable_mp(this, &EditorRunBar::_write_movie_toggled)); } diff --git a/editor/gui/editor_scene_tabs.cpp b/editor/gui/editor_scene_tabs.cpp index 01343c334d..cbbba20a56 100644 --- a/editor/gui/editor_scene_tabs.cpp +++ b/editor/gui/editor_scene_tabs.cpp @@ -442,6 +442,7 @@ EditorSceneTabs::EditorSceneTabs() { scene_tab_add = memnew(Button); scene_tab_add->set_flat(true); scene_tab_add->set_tooltip_text(TTR("Add a new scene.")); + scene_tab_add->set_accessibility_name(TTRC("Add Scene")); scene_tabs->add_child(scene_tab_add); scene_tab_add->connect(SceneStringName(pressed), callable_mp(EditorNode::get_singleton(), &EditorNode::trigger_menu_option).bind(EditorNode::FILE_NEW_SCENE, false)); diff --git a/editor/gui/editor_toaster.cpp b/editor/gui/editor_toaster.cpp index a05f8f5d39..e4707b40b8 100644 --- a/editor/gui/editor_toaster.cpp +++ b/editor/gui/editor_toaster.cpp @@ -374,11 +374,13 @@ Control *EditorToaster::popup(Control *p_control, Severity p_severity, double p_ // Add buttons. if (p_time > 0.0) { Button *copy_button = memnew(Button); + copy_button->set_accessibility_name(TTRC("Copy")); copy_button->set_flat(true); copy_button->connect(SceneStringName(pressed), callable_mp(this, &EditorToaster::copy).bind(panel)); hbox_container->add_child(copy_button); Button *close_button = memnew(Button); + close_button->set_accessibility_name(TTRC("Close")); close_button->set_flat(true); close_button->connect(SceneStringName(pressed), callable_mp(this, &EditorToaster::instant_close).bind(panel)); hbox_container->add_child(close_button); @@ -572,6 +574,7 @@ EditorToaster::EditorToaster() { // Main button. main_button = memnew(Button); + main_button->set_accessibility_name(TTRC("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); @@ -588,6 +591,7 @@ EditorToaster::EditorToaster() { add_child(disable_notifications_panel); disable_notifications_button = memnew(Button); + disable_notifications_button->set_accessibility_name(TTRC("Silence Notifications")); disable_notifications_button->set_tooltip_text(TTR("Silence the notifications.")); disable_notifications_button->set_flat(true); disable_notifications_button->connect(SceneStringName(pressed), callable_mp(this, &EditorToaster::_set_notifications_enabled).bind(false)); diff --git a/editor/gui/editor_zoom_widget.cpp b/editor/gui/editor_zoom_widget.cpp index 085a87333c..ccf1bd1884 100644 --- a/editor/gui/editor_zoom_widget.cpp +++ b/editor/gui/editor_zoom_widget.cpp @@ -187,6 +187,7 @@ void EditorZoomWidget::set_shortcut_context(Node *p_node) const { EditorZoomWidget::EditorZoomWidget() { // Zoom buttons zoom_minus = memnew(Button); + zoom_minus->set_accessibility_name(TTRC("Zoom Out")); zoom_minus->set_flat(true); zoom_minus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_minus", TTRC("Zoom Out"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::MINUS), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_SUBTRACT) })); zoom_minus->set_shortcut_context(this); @@ -196,6 +197,7 @@ EditorZoomWidget::EditorZoomWidget() { zoom_reset = memnew(Button); zoom_reset->set_flat(true); + zoom_reset->set_accessibility_name(TTRC("Reset Zoom")); Ref empty_stylebox = memnew(StyleBoxEmpty); zoom_reset->add_theme_style_override(CoreStringName(normal), empty_stylebox); @@ -216,6 +218,7 @@ EditorZoomWidget::EditorZoomWidget() { zoom_reset->connect(SceneStringName(pressed), callable_mp(this, &EditorZoomWidget::_button_zoom_reset)); zoom_plus = memnew(Button); + zoom_plus->set_accessibility_name(TTRC("Zoom In")); zoom_plus->set_flat(true); zoom_plus->set_shortcut(ED_SHORTCUT_ARRAY("canvas_item_editor/zoom_plus", TTRC("Zoom In"), { int32_t(KeyModifierMask::CMD_OR_CTRL | Key::EQUAL), int32_t(KeyModifierMask::CMD_OR_CTRL | Key::KP_ADD) })); zoom_plus->set_shortcut_context(this); diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index de1100f115..7f1b0a9fcd 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -77,6 +77,12 @@ PackedStringArray SceneTreeEditor::_get_node_configuration_warnings(Node *p_node return warnings; } +PackedStringArray SceneTreeEditor::_get_node_accessibility_configuration_warnings(Node *p_node) { + PackedStringArray warnings = p_node->get_accessibility_configuration_warnings(); + + return warnings; +} + void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_id, MouseButton p_button) { if (p_button != MouseButton::LEFT) { return; @@ -151,8 +157,10 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i } undo_redo->commit_action(); } else if (p_id == BUTTON_WARNING) { - const PackedStringArray warnings = _get_node_configuration_warnings(n); - + PackedStringArray warnings = _get_node_configuration_warnings(n); + if (accessibility_warnings) { + warnings.append_array(_get_node_accessibility_configuration_warnings(n)); + } if (warnings.is_empty()) { return; } @@ -473,7 +481,11 @@ void SceneTreeEditor::_update_node(Node *p_node, TreeItem *p_item, bool p_part_o } if (can_rename) { // TODO Should be can edit.. - const PackedStringArray warnings = _get_node_configuration_warnings(p_node); + PackedStringArray warnings = _get_node_configuration_warnings(p_node); + if (accessibility_warnings) { + warnings.append_array(_get_node_accessibility_configuration_warnings(p_node)); + } + const int num_warnings = warnings.size(); if (num_warnings > 0) { StringName warning_icon; @@ -1852,12 +1864,12 @@ bool SceneTreeEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d return false; } - TreeItem *item = tree->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!item) { return false; } - int section = tree->get_drop_section_at_position(p_point); + int section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(item).position) : tree->get_drop_section_at_position(p_point); if (section < -1 || (section == -1 && !item->get_parent())) { return false; } @@ -1941,11 +1953,11 @@ void SceneTreeEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, return; } - TreeItem *item = tree->get_item_at_position(p_point); + TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!item) { return; } - int section = tree->get_drop_section_at_position(p_point); + int section = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_drop_section_at_position(tree->get_item_rect(item).position) : tree->get_drop_section_at_position(p_point); if (section < -1) { return; } @@ -2035,6 +2047,13 @@ void SceneTreeEditor::set_hide_filtered_out_parents(bool p_hide, bool p_update_s } } +void SceneTreeEditor::set_accessibility_warnings(bool p_enable, bool p_update_settings) { + if (p_update_settings) { + EditorSettings::get_singleton()->set("docks/scene_tree/accessibility_warnings", p_enable); + } + accessibility_warnings = p_enable; +} + void SceneTreeEditor::set_connect_to_script_mode(bool p_enable) { connect_to_script_mode = p_enable; _update_tree(); diff --git a/editor/gui/scene_tree_editor.h b/editor/gui/scene_tree_editor.h index 0cc18223e1..d7eda45d3b 100644 --- a/editor/gui/scene_tree_editor.h +++ b/editor/gui/scene_tree_editor.h @@ -127,6 +127,7 @@ class SceneTreeEditor : public Control { bool auto_expand_selected = true; bool hide_filtered_out_parents = false; + bool accessibility_warnings = false; bool connect_to_script_mode = false; bool connecting_signal = false; bool update_when_invisible = true; @@ -136,6 +137,7 @@ class SceneTreeEditor : public Control { void _compute_hash(Node *p_node, uint64_t &hash); void _reset(); PackedStringArray _get_node_configuration_warnings(Node *p_node); + PackedStringArray _get_node_accessibility_configuration_warnings(Node *p_node); void _update_node_path(Node *p_node, bool p_recursive = true); void _update_node_subtree(Node *p_node, TreeItem *p_parent, bool p_force = false); @@ -248,6 +250,7 @@ public: void set_auto_expand_selected(bool p_auto, bool p_update_settings); void set_hide_filtered_out_parents(bool p_hide, bool p_update_settings); + void set_accessibility_warnings(bool p_enable, bool p_update_settings); void set_connect_to_script_mode(bool p_enable); void set_connecting_signal(bool p_enable); void set_update_when_invisible(bool p_enable); diff --git a/editor/gui/touch_actions_panel.cpp b/editor/gui/touch_actions_panel.cpp index ba61bb3e16..bc6576e519 100644 --- a/editor/gui/touch_actions_panel.cpp +++ b/editor/gui/touch_actions_panel.cpp @@ -81,11 +81,12 @@ void TouchActionsPanel::_simulate_key_press(Key p_keycode) { Input::get_singleton()->parse_input_event(event); } -Button *TouchActionsPanel::_add_new_action_button(const String &p_shortcut, Key p_keycode) { +Button *TouchActionsPanel::_add_new_action_button(const String &p_shortcut, const String &p_name, Key p_keycode) { Button *action_button = memnew(Button); action_button->set_focus_mode(Control::FOCUS_NONE); action_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER); action_button->set_v_size_flags(Control::SIZE_SHRINK_CENTER); + action_button->set_accessibility_name(p_name); if (p_keycode == Key::NONE) { action_button->connect(SceneStringName(pressed), callable_mp(this, &TouchActionsPanel::_simulate_editor_shortcut).bind(p_shortcut)); } else { @@ -154,6 +155,7 @@ TouchActionsPanel::TouchActionsPanel() { box->add_child(drag_handle); layout_toggle_button = memnew(Button); + layout_toggle_button->set_accessibility_name(TTRC("Switch Layout")); layout_toggle_button->set_focus_mode(Control::FOCUS_NONE); layout_toggle_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER); layout_toggle_button->set_v_size_flags(Control::SIZE_SHRINK_CENTER); @@ -162,6 +164,7 @@ TouchActionsPanel::TouchActionsPanel() { lock_panel_button = memnew(Button); lock_panel_button->set_toggle_mode(true); + lock_panel_button->set_accessibility_name(TTRC("Lock Panel")); lock_panel_button->set_focus_mode(Control::FOCUS_NONE); lock_panel_button->set_h_size_flags(Control::SIZE_SHRINK_CENTER); lock_panel_button->set_v_size_flags(Control::SIZE_SHRINK_CENTER); @@ -174,8 +177,8 @@ TouchActionsPanel::TouchActionsPanel() { box->add_child(separator); // Add action buttons. - save_button = _add_new_action_button("editor/save_scene"); - delete_button = _add_new_action_button("", Key::KEY_DELETE); - undo_button = _add_new_action_button("ui_undo"); - redo_button = _add_new_action_button("ui_redo"); + save_button = _add_new_action_button("editor/save_scene", TTR("Save")); + delete_button = _add_new_action_button("", TTR("Delete"), Key::KEY_DELETE); + undo_button = _add_new_action_button("ui_undo", TTR("Undo")); + redo_button = _add_new_action_button("ui_redo", TTR("Redo")); } diff --git a/editor/gui/touch_actions_panel.h b/editor/gui/touch_actions_panel.h index ddb637b1dc..8fde9f8af5 100644 --- a/editor/gui/touch_actions_panel.h +++ b/editor/gui/touch_actions_panel.h @@ -61,7 +61,7 @@ private: void _on_drag_handle_gui_input(const Ref &p_event); void _switch_layout(); void _lock_panel_toggled(bool p_pressed); - Button *_add_new_action_button(const String &p_shortcut, Key p_keycode = Key::NONE); + Button *_add_new_action_button(const String &p_shortcut, const String &p_name, Key p_keycode = Key::NONE); void _hardware_keyboard_connected(bool p_connected); diff --git a/editor/import/3d/scene_import_settings.cpp b/editor/import/3d/scene_import_settings.cpp index 609835385b..0beeb3f7f6 100644 --- a/editor/import/3d/scene_import_settings.cpp +++ b/editor/import/3d/scene_import_settings.cpp @@ -1724,6 +1724,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { animation_play_button = memnew(Button); animation_hbox->add_child(animation_play_button); animation_play_button->set_flat(true); + animation_play_button->set_accessibility_name(TTRC("Play")); animation_play_button->set_focus_mode(Control::FOCUS_NONE); animation_play_button->set_shortcut(ED_SHORTCUT("scene_import_settings/play_selected_animation", TTRC("Selected Animation Play/Pause"), Key::SPACE)); animation_play_button->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_play_animation)); @@ -1731,6 +1732,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { animation_stop_button = memnew(Button); animation_hbox->add_child(animation_stop_button); animation_stop_button->set_flat(true); + animation_stop_button->set_accessibility_name(TTRC("Stop")); animation_stop_button->set_focus_mode(Control::FOCUS_NONE); animation_stop_button->set_tooltip_text(TTR("Selected Animation Stop")); animation_stop_button->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_stop_current_animation)); @@ -1743,6 +1745,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { animation_slider->set_step(1.0 / 100.0); animation_slider->set_value_no_signal(0.0); animation_slider->set_focus_mode(Control::FOCUS_NONE); + animation_slider->set_accessibility_name(TTRC("Animation")); animation_slider->connect(SceneStringName(value_changed), callable_mp(this, &SceneImportSettingsDialog::_animation_slider_value_changed)); animation_toggle_skeleton_visibility = memnew(Button); @@ -1751,6 +1754,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { animation_toggle_skeleton_visibility->set_theme_type_variation("FlatButton"); animation_toggle_skeleton_visibility->set_focus_mode(Control::FOCUS_NONE); animation_toggle_skeleton_visibility->set_tooltip_text(TTR("Toggle Animation Skeleton Visibility")); + animation_toggle_skeleton_visibility->set_accessibility_name(TTRC("Skeleton Visibility")); animation_toggle_skeleton_visibility->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_animation_update_skeleton_visibility)); @@ -1771,6 +1775,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { light_rotate_switch->set_toggle_mode(true); light_rotate_switch->set_pressed(true); light_rotate_switch->set_tooltip_text(TTR("Rotate Lights With Model")); + light_rotate_switch->set_accessibility_name(TTRC("Rotate Lights With Model")); light_rotate_switch->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_on_light_rotate_switch_pressed)); vb_light->add_child(light_rotate_switch); @@ -1779,6 +1784,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { light_1_switch->set_toggle_mode(true); light_1_switch->set_pressed(true); light_1_switch->set_tooltip_text(TTR("Primary Light")); + light_1_switch->set_accessibility_name(TTRC("Primary Light")); light_1_switch->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_on_light_1_switch_pressed)); vb_light->add_child(light_1_switch); @@ -1787,6 +1793,7 @@ SceneImportSettingsDialog::SceneImportSettingsDialog() { light_2_switch->set_toggle_mode(true); light_2_switch->set_pressed(true); light_2_switch->set_tooltip_text(TTR("Secondary Light")); + light_2_switch->set_accessibility_name(TTRC("Secondary Light")); light_2_switch->connect(SceneStringName(pressed), callable_mp(this, &SceneImportSettingsDialog::_on_light_2_switch_pressed)); vb_light->add_child(light_2_switch); diff --git a/editor/import/audio_stream_import_settings.cpp b/editor/import/audio_stream_import_settings.cpp index 34ebfff739..3c6e2d4279 100644 --- a/editor/import/audio_stream_import_settings.cpp +++ b/editor/import/audio_stream_import_settings.cpp @@ -536,12 +536,14 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { loop_hb->add_theme_constant_override("separation", 4 * EDSCALE); loop = memnew(CheckBox); loop->set_text(TTR("Enable")); + loop->set_accessibility_name(TTRC("Enable looping")); loop->set_tooltip_text(TTR("Enable looping.")); loop->connect(SceneStringName(toggled), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1)); loop_hb->add_child(loop); loop_hb->add_spacer(); loop_hb->add_child(memnew(Label(TTR("Offset:")))); loop_offset = memnew(SpinBox); + loop_offset->set_accessibility_name(TTRC("Loop Offset")); loop_offset->set_max(10000); loop_offset->set_step(0.001); loop_offset->set_suffix("sec"); @@ -559,6 +561,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { bpm_edit = memnew(SpinBox); bpm_edit->set_max(400); bpm_edit->set_step(0.01); + bpm_edit->set_accessibility_name(TTRC("BPM")); 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(SceneStringName(value_changed), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1)); interactive_hb->add_child(bpm_edit); @@ -570,6 +573,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { beats_edit = memnew(SpinBox); 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->set_accessibility_name(TTRC("Beat Count")); beats_edit->connect(SceneStringName(value_changed), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1)); interactive_hb->add_child(beats_edit); bar_beats_label = memnew(Label(TTR("Bar Beats:"))); @@ -578,6 +582,7 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { 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->set_accessibility_name(TTRC("Bar Beats")); bar_beats_edit->connect(SceneStringName(value_changed), callable_mp(this, &AudioStreamImportSettingsDialog::_settings_changed).unbind(1)); interactive_hb->add_child(bar_beats_edit); main_vbox->add_margin_child(TTR("Music Playback:"), interactive_hb); @@ -605,10 +610,13 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { HBoxContainer *zoom_hbox = memnew(HBoxContainer); zoom_bar = memnew(HScrollBar); zoom_in = memnew(Button); + zoom_in->set_accessibility_name(TTRC("Zoom In")); zoom_in->set_flat(true); zoom_reset = memnew(Button); + zoom_reset->set_accessibility_name(TTRC("Reset Zoom")); zoom_reset->set_flat(true); zoom_out = memnew(Button); + zoom_out->set_accessibility_name(TTRC("Zoom Out")); zoom_out->set_flat(true); zoom_hbox->add_child(zoom_bar); zoom_bar->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -634,12 +642,14 @@ AudioStreamImportSettingsDialog::AudioStreamImportSettingsDialog() { vbox->add_child(hbox); _play_button = memnew(Button); + _play_button->set_accessibility_name(TTRC("Play")); _play_button->set_flat(true); hbox->add_child(_play_button); _play_button->set_focus_mode(Control::FOCUS_NONE); _play_button->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamImportSettingsDialog::_play)); _stop_button = memnew(Button); + _stop_button->set_accessibility_name(TTRC("Stop")); _stop_button->set_flat(true); hbox->add_child(_stop_button); _stop_button->set_focus_mode(Control::FOCUS_NONE); diff --git a/editor/import/dynamic_font_import_settings.cpp b/editor/import/dynamic_font_import_settings.cpp index 06dc5398e7..23c02b40a2 100644 --- a/editor/import/dynamic_font_import_settings.cpp +++ b/editor/import/dynamic_font_import_settings.cpp @@ -1444,7 +1444,8 @@ DynamicFontImportSettingsDialog::DynamicFontImportSettingsDialog() { page2_hb_vars->add_child(label_vars); add_var = memnew(Button); - add_var->set_tooltip_text(TTR("Add configuration")); + add_var->set_tooltip_text(TTR("Add new font variation configuration.")); + add_var->set_accessibility_name(TTRC("Add Configuration")); page2_hb_vars->add_child(add_var); add_var->connect(SceneStringName(pressed), callable_mp(this, &DynamicFontImportSettingsDialog::_variation_add)); diff --git a/editor/import/resource_importer_shader_file.cpp b/editor/import/resource_importer_shader_file.cpp index 3846717b2a..6cfca20a05 100644 --- a/editor/import/resource_importer_shader_file.cpp +++ b/editor/import/resource_importer_shader_file.cpp @@ -91,6 +91,7 @@ static String _include_function(const String &p_path, void *userpointer) { Error ResourceImporterShaderFile::import(ResourceUID::ID p_source_id, const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { /* STEP 1, Read shader code */ ERR_FAIL_COND_V_EDMSG((OS::get_singleton()->get_current_rendering_method() == "gl_compatibility"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when using the Compatibility renderer. Please switch to the Forward+ or Mobile renderer to use custom shaders."); + ERR_FAIL_COND_V_EDMSG((OS::get_singleton()->get_current_rendering_method() == "dummy"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when using the Dummy renderer. Please switch to the Forward+ or Mobile renderer to use custom shaders."); ERR_FAIL_COND_V_EDMSG((DisplayServer::get_singleton()->get_name() == "headless"), ERR_UNAVAILABLE, "Cannot import custom .glsl shaders when running in headless mode."); Error err; diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 6c8571369a..2188d68aa5 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -763,6 +763,7 @@ ImportDock::ImportDock() { import_as->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); import_as->set_h_size_flags(SIZE_EXPAND_FILL); import_as->connect(SceneStringName(item_selected), callable_mp(this, &ImportDock::_importer_selected)); + import_as->set_accessibility_name(TTRC("Import As")); hb->add_child(import_as); import_as->set_h_size_flags(SIZE_EXPAND_FILL); preset = memnew(MenuButton); diff --git a/editor/input_event_configuration_dialog.cpp b/editor/input_event_configuration_dialog.cpp index 41a41e68f0..84168e1142 100644 --- a/editor/input_event_configuration_dialog.cpp +++ b/editor/input_event_configuration_dialog.cpp @@ -668,6 +668,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { input_list_search = memnew(LineEdit); input_list_search->set_h_size_flags(Control::SIZE_EXPAND_FILL); input_list_search->set_placeholder(TTR("Filter Inputs")); + input_list_search->set_accessibility_name(TTRC("Filter Inputs")); input_list_search->set_clear_button_enabled(true); input_list_search->connect(SceneStringName(text_changed), callable_mp(this, &InputEventConfigurationDialog::_search_term_updated)); manual_vbox->add_child(input_list_search); @@ -708,6 +709,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { device_id_option->add_item(EventListenerLineEdit::get_device_string(i)); } device_id_option->connect(SceneStringName(item_selected), callable_mp(this, &InputEventConfigurationDialog::_device_selection_changed)); + device_id_option->set_accessibility_name(TTRC("Device")); _set_current_device(InputMap::ALL_DEVICES); device_container->add_child(device_id_option); @@ -762,6 +764,7 @@ InputEventConfigurationDialog::InputEventConfigurationDialog() { key_location->add_item(TTR("Left"), (int)KeyLocation::LEFT); key_location->add_item(TTR("Right"), (int)KeyLocation::RIGHT); key_location->connect(SceneStringName(item_selected), callable_mp(this, &InputEventConfigurationDialog::_key_location_selected)); + key_location->set_accessibility_name(TTRC("Location")); location_container->add_child(key_location); additional_options_container->add_child(location_container); diff --git a/editor/inspector_dock.cpp b/editor/inspector_dock.cpp index 3178bab6d9..a94afbf550 100644 --- a/editor/inspector_dock.cpp +++ b/editor/inspector_dock.cpp @@ -689,6 +689,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_new_button = memnew(Button); resource_new_button->set_theme_type_variation("FlatMenuButton"); resource_new_button->set_tooltip_text(TTRC("Create a new resource in memory and edit it.")); + resource_new_button->set_accessibility_name(TTRC("New Resource")); general_options_hb->add_child(resource_new_button); resource_new_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_new_resource)); resource_new_button->set_focus_mode(Control::FOCUS_NONE); @@ -696,6 +697,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_load_button = memnew(Button); resource_load_button->set_theme_type_variation("FlatMenuButton"); resource_load_button->set_tooltip_text(TTRC("Load an existing resource from disk and edit it.")); + resource_load_button->set_accessibility_name(TTRC("Load Resource")); general_options_hb->add_child(resource_load_button); resource_load_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_open_resource_selector)); resource_load_button->set_focus_mode(Control::FOCUS_NONE); @@ -704,6 +706,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_save_button->set_flat(false); resource_save_button->set_theme_type_variation("FlatMenuButton"); resource_save_button->set_tooltip_text(TTRC("Save the currently edited resource.")); + resource_save_button->set_accessibility_name(TTRC("Save Resource")); general_options_hb->add_child(resource_save_button); resource_save_button->get_popup()->add_item(TTRC("Save"), RESOURCE_SAVE); resource_save_button->get_popup()->add_item(TTRC("Save As..."), RESOURCE_SAVE_AS); @@ -715,6 +718,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { resource_extra_button->set_flat(false); resource_extra_button->set_theme_type_variation("FlatMenuButton"); resource_extra_button->set_tooltip_text(TTRC("Extra resource options.")); + resource_extra_button->set_accessibility_name(TTRC("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_shortcut(ED_SHORTCUT("property_editor/paste_resource", TTRC("Edit Resource from Clipboard")), RESOURCE_EDIT_CLIPBOARD); @@ -732,6 +736,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { backward_button->set_flat(true); general_options_hb->add_child(backward_button); backward_button->set_tooltip_text(TTRC("Go to previous edited object in history.")); + backward_button->set_accessibility_name(TTRC("Previous Edited Object")); backward_button->set_disabled(true); backward_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_edit_back)); @@ -739,6 +744,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { forward_button->set_flat(true); general_options_hb->add_child(forward_button); forward_button->set_tooltip_text(TTRC("Go to next edited object in history.")); + forward_button->set_accessibility_name(TTRC("Next Edited Object")); forward_button->set_disabled(true); forward_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_edit_forward)); @@ -747,6 +753,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { history_menu->set_flat(false); history_menu->set_theme_type_variation("FlatMenuButton"); history_menu->set_tooltip_text(TTRC("History of recently edited objects.")); + history_menu->set_accessibility_name(TTRC("Edit History")); general_options_hb->add_child(history_menu); history_menu->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_history)); history_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_select_history)); @@ -761,6 +768,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { open_docs_button->set_theme_type_variation("FlatMenuButton"); open_docs_button->set_disabled(true); open_docs_button->set_tooltip_text(TTRC("Open documentation for this object.")); + open_docs_button->set_accessibility_name(TTRC("Open Documentation")); open_docs_button->set_shortcut(ED_SHORTCUT("property_editor/open_help", TTRC("Open Documentation"))); subresource_hb->add_child(open_docs_button); open_docs_button->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_menu_option).bind(OBJECT_REQUEST_HELP)); @@ -776,6 +784,7 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { search = memnew(LineEdit); search->set_h_size_flags(Control::SIZE_EXPAND_FILL); search->set_placeholder(TTRC("Filter Properties")); + search->set_accessibility_name(TTRC("Filter Properties")); search->set_clear_button_enabled(true); property_tools_hb->add_child(search); @@ -784,12 +793,14 @@ InspectorDock::InspectorDock(EditorData &p_editor_data) { object_menu->set_theme_type_variation("FlatMenuButton"); property_tools_hb->add_child(object_menu); object_menu->set_tooltip_text(TTRC("Manage object properties.")); + object_menu->set_accessibility_name(TTRC("Object Properties")); object_menu->get_popup()->connect("about_to_popup", callable_mp(this, &InspectorDock::_prepare_menu)); object_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &InspectorDock::_menu_option)); info = memnew(Button); add_child(info); info->set_clip_text(true); + info->set_accessibility_name(TTRC("Information")); info->hide(); info->connect(SceneStringName(pressed), callable_mp(this, &InspectorDock::_info_pressed)); diff --git a/editor/plugins/abstract_polygon_2d_editor.cpp b/editor/plugins/abstract_polygon_2d_editor.cpp index 6cdfb08e7f..3d5ffa0c0e 100644 --- a/editor/plugins/abstract_polygon_2d_editor.cpp +++ b/editor/plugins/abstract_polygon_2d_editor.cpp @@ -737,18 +737,21 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(bool p_wip_destructive) { button_create = memnew(Button); button_create->set_theme_type_variation(SceneStringName(FlatButton)); + button_create->set_accessibility_name(TTRC("Create Polygon Points")); add_child(button_create); button_create->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_CREATE)); button_create->set_toggle_mode(true); button_edit = memnew(Button); button_edit->set_theme_type_variation(SceneStringName(FlatButton)); + button_edit->set_accessibility_name(TTRC("Edit Polygon Points")); add_child(button_edit); button_edit->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_EDIT)); button_edit->set_toggle_mode(true); button_delete = memnew(Button); button_delete->set_theme_type_variation(SceneStringName(FlatButton)); + button_delete->set_accessibility_name(TTRC("Delete Polygon Points")); add_child(button_delete); button_delete->connect(SceneStringName(pressed), callable_mp(this, &AbstractPolygon2DEditor::_menu_option).bind(MODE_DELETE)); button_delete->set_toggle_mode(true); diff --git a/editor/plugins/animation_blend_space_1d_editor.cpp b/editor/plugins/animation_blend_space_1d_editor.cpp index 80c7e605cf..407a9bec97 100644 --- a/editor/plugins/animation_blend_space_1d_editor.cpp +++ b/editor/plugins/animation_blend_space_1d_editor.cpp @@ -667,6 +667,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip_text(TTR("Set the blending position within the space")); + tool_blend->set_accessibility_name(TTRC("Set Blending Position")); tool_blend->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); @@ -675,6 +676,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB.")); + tool_select->set_accessibility_name(TTRC("Edit Points")); tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); @@ -683,6 +685,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip_text(TTR("Create points.")); + tool_create->set_accessibility_name(TTRC("Create Points")); tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_tool_switch).bind(1)); tool_erase_sep = memnew(VSeparator); @@ -691,6 +694,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { tool_erase->set_theme_type_variation(SceneStringName(FlatButton)); top_hb->add_child(tool_erase); tool_erase->set_tooltip_text(TTR("Erase points.")); + tool_erase->set_accessibility_name(TTRC("Erase Points")); tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_erase_selected)); top_hb->add_child(memnew(VSeparator)); @@ -701,6 +705,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip_text(TTR("Enable snap and show grid.")); + snap->set_accessibility_name(TTRC("Snap to Grid")); snap->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_snap_toggled)); snap_value = memnew(SpinBox); @@ -708,6 +713,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { snap_value->set_min(0.01); snap_value->set_step(0.01); snap_value->set_max(1000); + snap_value->set_accessibility_name(TTRC("Grid Step")); top_hb->add_child(memnew(VSeparator)); top_hb->add_child(memnew(Label(TTR("Sync:")))); @@ -732,6 +738,7 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { edit_value->set_min(-1000); edit_value->set_max(1000); edit_value->set_step(0.01); + edit_value->set_accessibility_name(TTRC("Blend Value")); edit_value->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace1DEditor::_edit_point_pos)); open_editor = memnew(Button); @@ -768,14 +775,17 @@ AnimationNodeBlendSpace1DEditor::AnimationNodeBlendSpace1DEditor() { min_value->set_min(-10000); min_value->set_max(0); min_value->set_step(0.01); + min_value->set_accessibility_name(TTRC("Min")); max_value = memnew(SpinBox); max_value->set_min(0.01); max_value->set_max(10000); max_value->set_step(0.01); + max_value->set_accessibility_name(TTRC("Max")); label_value = memnew(LineEdit); label_value->set_expand_to_text_length_enabled(true); + label_value->set_accessibility_name(TTRC("Value")); // now add diff --git a/editor/plugins/animation_blend_space_2d_editor.cpp b/editor/plugins/animation_blend_space_2d_editor.cpp index 34586b9ba2..5dde9d52a0 100644 --- a/editor/plugins/animation_blend_space_2d_editor.cpp +++ b/editor/plugins/animation_blend_space_2d_editor.cpp @@ -886,6 +886,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(tool_blend); tool_blend->set_pressed(true); tool_blend->set_tooltip_text(TTR("Set the blending position within the space")); + tool_blend->set_accessibility_name(TTRC("Set Blending Position")); tool_blend->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(3)); tool_select = memnew(Button); @@ -894,6 +895,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_select->set_button_group(bg); top_hb->add_child(tool_select); tool_select->set_tooltip_text(TTR("Select and move points, create points with RMB.")); + tool_select->set_accessibility_name(TTRC("Edit Points")); tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(0)); tool_create = memnew(Button); @@ -902,6 +904,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_create->set_button_group(bg); top_hb->add_child(tool_create); tool_create->set_tooltip_text(TTR("Create points.")); + tool_create->set_accessibility_name(TTRC("Create Points")); tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(1)); tool_triangle = memnew(Button); @@ -910,6 +913,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_triangle->set_button_group(bg); top_hb->add_child(tool_triangle); tool_triangle->set_tooltip_text(TTR("Create triangles by connecting points.")); + tool_triangle->set_accessibility_name(TTRC("Create Triangles")); tool_triangle->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_tool_switch).bind(2)); tool_erase_sep = memnew(VSeparator); @@ -918,6 +922,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { tool_erase->set_theme_type_variation(SceneStringName(FlatButton)); top_hb->add_child(tool_erase); tool_erase->set_tooltip_text(TTR("Erase points and triangles.")); + tool_erase->set_accessibility_name(TTRC("Erase Points")); tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_erase_selected)); tool_erase->set_disabled(true); @@ -929,6 +934,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { auto_triangles->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_auto_triangles_toggled)); auto_triangles->set_toggle_mode(true); auto_triangles->set_tooltip_text(TTR("Generate blend triangles automatically (instead of manually)")); + auto_triangles->set_accessibility_name(TTRC("Generate Triangles")); top_hb->add_child(memnew(VSeparator)); @@ -938,6 +944,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { top_hb->add_child(snap); snap->set_pressed(true); snap->set_tooltip_text(TTR("Enable snap and show grid.")); + snap->set_accessibility_name(TTRC("Snap to Grid")); snap->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_snap_toggled)); snap_x = memnew(SpinBox); @@ -946,6 +953,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { snap_x->set_min(0.01); snap_x->set_step(0.01); snap_x->set_max(1000); + snap_x->set_accessibility_name(TTRC("Grid X Step")); snap_y = memnew(SpinBox); top_hb->add_child(snap_y); @@ -953,6 +961,7 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { snap_y->set_min(0.01); snap_y->set_step(0.01); snap_y->set_max(1000); + snap_y->set_accessibility_name(TTRC("Grid Y Step")); top_hb->add_child(memnew(VSeparator)); @@ -977,12 +986,14 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { edit_x->set_min(-1000); edit_x->set_step(0.01); edit_x->set_max(1000); + edit_x->set_accessibility_name(TTRC("Blend X Value")); edit_x->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos)); edit_y = memnew(SpinBox); edit_hb->add_child(edit_y); edit_y->set_min(-1000); edit_y->set_step(0.01); edit_y->set_max(1000); + edit_y->set_accessibility_name(TTRC("Blend X Value")); edit_y->connect(SceneStringName(value_changed), callable_mp(this, &AnimationNodeBlendSpace2DEditor::_edit_point_pos)); open_editor = memnew(Button); edit_hb->add_child(open_editor); @@ -1004,13 +1015,16 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { main_grid->add_child(left_vbox); left_vbox->set_v_size_flags(SIZE_EXPAND_FILL); max_y_value = memnew(SpinBox); + max_y_value->set_accessibility_name(TTRC("Max Y")); left_vbox->add_child(max_y_value); left_vbox->add_spacer(); label_y = memnew(LineEdit); + label_y->set_accessibility_name(TTRC("Y Value")); left_vbox->add_child(label_y); label_y->set_expand_to_text_length_enabled(true); left_vbox->add_spacer(); min_y_value = memnew(SpinBox); + min_y_value->set_accessibility_name(TTRC("Min Y")); left_vbox->add_child(min_y_value); max_y_value->set_max(10000); @@ -1040,13 +1054,16 @@ AnimationNodeBlendSpace2DEditor::AnimationNodeBlendSpace2DEditor() { main_grid->add_child(bottom_vbox); bottom_vbox->set_h_size_flags(SIZE_EXPAND_FILL); min_x_value = memnew(SpinBox); + min_x_value->set_accessibility_name(TTRC("Min X")); bottom_vbox->add_child(min_x_value); bottom_vbox->add_spacer(); label_x = memnew(LineEdit); + label_y->set_accessibility_name(TTRC("X Value")); bottom_vbox->add_child(label_x); label_x->set_expand_to_text_length_enabled(true); bottom_vbox->add_spacer(); max_x_value = memnew(SpinBox); + max_x_value->set_accessibility_name(TTRC("Max Y")); bottom_vbox->add_child(max_x_value); max_x_value->set_max(10000); diff --git a/editor/plugins/animation_blend_tree_editor_plugin.cpp b/editor/plugins/animation_blend_tree_editor_plugin.cpp index b69ef298ba..137dffc031 100644 --- a/editor/plugins/animation_blend_tree_editor_plugin.cpp +++ b/editor/plugins/animation_blend_tree_editor_plugin.cpp @@ -176,6 +176,7 @@ void AnimationNodeBlendTreeEditor::update_graph() { delete_button->set_flat(true); delete_button->set_focus_mode(FOCUS_NONE); delete_button->set_button_icon(get_editor_theme_icon(SNAME("Close"))); + delete_button->set_accessibility_name(TTRC("Delete")); delete_button->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeBlendTreeEditor::_delete_node_request).bind(E), CONNECT_DEFERRED); node->get_titlebar_hbox()->add_child(delete_button); } @@ -1406,6 +1407,7 @@ AnimationNodeAnimationEditorDialog::AnimationNodeAnimationEditorDialog() { label_start->set_stretch_ratio(1); select_start = memnew(OptionButton); select_start->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + select_start->set_accessibility_name(TTRC("Start Marker")); grid->add_child(select_start); select_start->set_h_size_flags(Control::SIZE_EXPAND_FILL); select_start->set_stretch_ratio(2); @@ -1416,6 +1418,7 @@ AnimationNodeAnimationEditorDialog::AnimationNodeAnimationEditorDialog() { label_end->set_stretch_ratio(1); select_end = memnew(OptionButton); select_end->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + select_end->set_accessibility_name(TTRC("End Marker")); grid->add_child(select_end); select_end->set_h_size_flags(Control::SIZE_EXPAND_FILL); select_end->set_stretch_ratio(2); diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index ae10f0af9a..8495d98103 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -2019,26 +2019,31 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug play_bw_from = memnew(Button); play_bw_from->set_theme_type_variation(SceneStringName(FlatButton)); play_bw_from->set_tooltip_text(TTR("Play Animation Backwards")); + play_bw_from->set_accessibility_name(TTRC("Play Backwards")); playback_container->add_child(play_bw_from); play_bw = memnew(Button); play_bw->set_theme_type_variation(SceneStringName(FlatButton)); play_bw->set_tooltip_text(TTR("Play Animation Backwards from End")); + play_bw->set_accessibility_name(TTRC("Play Backwards from End")); playback_container->add_child(play_bw); stop = memnew(Button); stop->set_theme_type_variation(SceneStringName(FlatButton)); stop->set_tooltip_text(TTR("Pause/Stop Animation")); + stop->set_accessibility_name(TTRC("Pause/Stop")); playback_container->add_child(stop); play = memnew(Button); play->set_theme_type_variation(SceneStringName(FlatButton)); play->set_tooltip_text(TTR("Play Animation from Start")); + play->set_accessibility_name(TTRC("Play from Start")); playback_container->add_child(play); play_from = memnew(Button); play_from->set_theme_type_variation(SceneStringName(FlatButton)); play_from->set_tooltip_text(TTR("Play Animation")); + play_from->set_accessibility_name(TTRC("Play")); playback_container->add_child(play_from); frame = memnew(SpinBox); @@ -2047,6 +2052,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug frame->set_stretch_ratio(2); frame->set_step(0.0001); frame->set_tooltip_text(TTR("Animation position (in seconds).")); + frame->set_accessibility_name(TTRC("Frame")); hb->add_child(memnew(VSeparator)); @@ -2055,6 +2061,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug scale->set_h_size_flags(SIZE_EXPAND_FILL); scale->set_stretch_ratio(1); scale->set_tooltip_text(TTR("Scale animation playback globally for the node.")); + scale->set_accessibility_name(TTRC("Scale")); scale->hide(); delete_dialog = memnew(ConfirmationDialog); @@ -2082,6 +2089,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug animation = memnew(OptionButton); hb->add_child(animation); + animation->set_accessibility_name(TTRC("Animation")); animation->set_h_size_flags(SIZE_EXPAND_FILL); animation->set_tooltip_text(TTR("Display list of animations in player.")); animation->set_clip_text(true); @@ -2091,6 +2099,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug autoplay->set_theme_type_variation(SceneStringName(FlatButton)); hb->add_child(autoplay); autoplay->set_tooltip_text(TTR("Autoplay on Load")); + autoplay->set_accessibility_name(TTRC("Autoplay on Load")); hb->add_child(memnew(VSeparator)); @@ -2103,10 +2112,12 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug onion_toggle->set_theme_type_variation(SceneStringName(FlatButton)); onion_toggle->set_toggle_mode(true); onion_toggle->set_tooltip_text(TTR("Enable Onion Skinning")); + onion_toggle->set_accessibility_name(TTRC("Onion Skinning")); onion_toggle->connect(SceneStringName(pressed), callable_mp(this, &AnimationPlayerEditor::_onion_skinning_menu).bind(ONION_SKINNING_ENABLE)); hb->add_child(onion_toggle); onion_skinning = memnew(MenuButton); + onion_skinning->set_accessibility_name(TTRC("Onion Skinning Options")); onion_skinning->set_flat(false); onion_skinning->set_theme_type_variation("FlatMenuButton"); onion_skinning->set_tooltip_text(TTR("Onion Skinning Options")); @@ -2133,6 +2144,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug pin->set_theme_type_variation(SceneStringName(FlatButton)); pin->set_toggle_mode(true); pin->set_tooltip_text(TTR("Pin AnimationPlayer")); + pin->set_accessibility_name(TTRC("Pin AnimationPlayer")); hb->add_child(pin); pin->connect(SceneStringName(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 aa886d9a86..adaf70bf82 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -1814,6 +1814,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_select->set_button_group(bg); tool_select->set_pressed(true); 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->set_accessibility_name(TTRC("Edit Nodes")); tool_select->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_create = memnew(Button); @@ -1822,6 +1823,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_create->set_toggle_mode(true); tool_create->set_button_group(bg); tool_create->set_tooltip_text(TTR("Create new nodes.")); + tool_create->set_accessibility_name(TTRC("Create Nodes")); tool_create->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); tool_connect = memnew(Button); @@ -1830,6 +1832,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_connect->set_toggle_mode(true); tool_connect->set_button_group(bg); tool_connect->set_tooltip_text(TTR("Connect nodes.")); + tool_connect->set_accessibility_name(TTRC("Connect Nodes")); tool_connect->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_update_mode), CONNECT_DEFERRED); // Context-sensitive selection tools: @@ -1842,6 +1845,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { tool_erase->set_tooltip_text(TTR("Remove selected node or transition.")); tool_erase->connect(SceneStringName(pressed), callable_mp(this, &AnimationNodeStateMachineEditor::_erase_selected).bind(false)); tool_erase->set_disabled(true); + tool_erase->set_accessibility_name(TTRC("Erase")); selection_tools_hb->add_child(tool_erase); transition_tools_hb = memnew(HBoxContainer); @@ -1857,6 +1861,7 @@ AnimationNodeStateMachineEditor::AnimationNodeStateMachineEditor() { auto_advance->set_tooltip_text(TTR("New Transitions Should Auto Advance")); auto_advance->set_toggle_mode(true); auto_advance->set_pressed(true); + auto_advance->set_accessibility_name(TTRC("Transitions Auto Advance")); transition_tools_hb->add_child(auto_advance); // diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp index 74a4d354ec..394622ac99 100644 --- a/editor/plugins/asset_library_editor_plugin.cpp +++ b/editor/plugins/asset_library_editor_plugin.cpp @@ -136,6 +136,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { add_child(hb); icon = memnew(TextureButton); + icon->set_accessibility_name(TTRC("Open asset details")); icon->set_custom_minimum_size(Size2(64, 64) * EDSCALE); hb->add_child(icon); @@ -145,11 +146,13 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { vb->set_h_size_flags(Control::SIZE_EXPAND_FILL); title = memnew(LinkButton); + title->set_accessibility_name(TTRC("Title")); title->set_auto_translate_mode(AutoTranslateMode::AUTO_TRANSLATE_MODE_DISABLED); title->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); vb->add_child(title); category = memnew(LinkButton); + category->set_accessibility_name(TTRC("Category")); category->set_underline_mode(LinkButton::UNDERLINE_MODE_ON_HOVER); vb->add_child(category); @@ -159,6 +162,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { author = memnew(LinkButton); author->set_tooltip_text(TTR("Author")); + author->set_accessibility_name(TTRC("Author")); author_price_hbox->add_child(author); author_price_hbox->add_child(memnew(HSeparator)); @@ -184,6 +188,7 @@ EditorAssetLibraryItem::EditorAssetLibraryItem(bool p_clickable) { price = memnew(Label); price->add_theme_style_override(CoreStringName(normal), label_margin); price->set_tooltip_text(TTR("License")); + price->set_accessibility_name(TTRC("License")); price->set_mouse_filter(MOUSE_FILTER_PASS); author_price_hbox->add_child(price); @@ -579,6 +584,7 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() { dismiss_button = memnew(TextureButton); dismiss_button->connect(SceneStringName(pressed), callable_mp(this, &EditorAssetLibraryItemDownload::_close)); + dismiss_button->set_accessibility_name(TTRC("Close")); title_hb->add_child(dismiss_button); title->set_clip_text(true); diff --git a/editor/plugins/audio_stream_editor_plugin.cpp b/editor/plugins/audio_stream_editor_plugin.cpp index 814cb3d263..44b9c42563 100644 --- a/editor/plugins/audio_stream_editor_plugin.cpp +++ b/editor/plugins/audio_stream_editor_plugin.cpp @@ -246,12 +246,14 @@ AudioStreamEditor::AudioStreamEditor() { _play_button->set_focus_mode(Control::FOCUS_NONE); _play_button->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamEditor::_play)); _play_button->set_shortcut(ED_SHORTCUT("audio_stream_editor/audio_preview_play_pause", TTRC("Audio Preview Play/Pause"), Key::SPACE)); + _play_button->set_accessibility_name(TTRC("Play")); _stop_button = memnew(Button); hbox->add_child(_stop_button); _stop_button->set_flat(true); _stop_button->set_focus_mode(Control::FOCUS_NONE); _stop_button->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamEditor::_stop)); + _stop_button->set_accessibility_name(TTRC("Stop")); _current_label = memnew(Label); _current_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT); diff --git a/editor/plugins/bone_map_editor_plugin.cpp b/editor/plugins/bone_map_editor_plugin.cpp index 01b149d24f..1f73920ad9 100644 --- a/editor/plugins/bone_map_editor_plugin.cpp +++ b/editor/plugins/bone_map_editor_plugin.cpp @@ -291,6 +291,7 @@ void BoneMapper::create_editor() { clear_mapping_button = memnew(Button); clear_mapping_button->set_button_icon(get_editor_theme_icon(SNAME("Clear"))); clear_mapping_button->set_tooltip_text(TTR("Clear mappings in current group.")); + clear_mapping_button->set_accessibility_name(TTRC("Clear Mappings")); clear_mapping_button->connect(SceneStringName(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 fc1dc981ad..011d561d59 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -118,6 +118,7 @@ public: grid_offset_x->set_suffix("px"); grid_offset_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_offset_x->set_select_all_on_focus(true); + grid_offset_x->set_accessibility_name(TTRC("X Offset")); child_container->add_child(grid_offset_x); grid_offset_y = memnew(SpinBox); @@ -128,6 +129,7 @@ public: grid_offset_y->set_suffix("px"); grid_offset_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_offset_y->set_select_all_on_focus(true); + grid_offset_y->set_accessibility_name(TTRC("Y Offset")); child_container->add_child(grid_offset_y); label = memnew(Label); @@ -142,6 +144,7 @@ public: grid_step_x->set_suffix("px"); grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_step_x->set_select_all_on_focus(true); + grid_step_x->set_accessibility_name(TTRC("X Step")); child_container->add_child(grid_step_x); grid_step_y = memnew(SpinBox); @@ -151,6 +154,7 @@ public: grid_step_y->set_suffix("px"); grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid_step_y->set_select_all_on_focus(true); + grid_step_y->set_accessibility_name(TTRC("X Step")); child_container->add_child(grid_step_y); label = memnew(Label); @@ -166,6 +170,7 @@ public: primary_grid_step_x->set_suffix("steps"); primary_grid_step_x->set_h_size_flags(Control::SIZE_EXPAND_FILL); primary_grid_step_x->set_select_all_on_focus(true); + primary_grid_step_x->set_accessibility_name(TTRC("X Primary Step")); child_container->add_child(primary_grid_step_x); primary_grid_step_y = memnew(SpinBox); @@ -176,6 +181,7 @@ public: primary_grid_step_y->set_suffix("steps"); primary_grid_step_y->set_h_size_flags(Control::SIZE_EXPAND_FILL); primary_grid_step_y->set_select_all_on_focus(true); + primary_grid_step_y->set_accessibility_name(TTRC("Y Primary Step")); child_container->add_child(primary_grid_step_y); container->add_child(memnew(HSeparator)); @@ -197,6 +203,7 @@ public: rotation_offset->set_suffix("deg"); rotation_offset->set_h_size_flags(Control::SIZE_EXPAND_FILL); rotation_offset->set_select_all_on_focus(true); + rotation_offset->set_accessibility_name(TTRC("Rotation Offset")); child_container->add_child(rotation_offset); label = memnew(Label); @@ -210,6 +217,7 @@ public: rotation_step->set_suffix("deg"); rotation_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); rotation_step->set_select_all_on_focus(true); + rotation_step->set_accessibility_name(TTRC("Rotation Step")); child_container->add_child(rotation_step); container->add_child(memnew(HSeparator)); @@ -229,6 +237,7 @@ public: scale_step->set_h_size_flags(Control::SIZE_EXPAND_FILL); scale_step->set_step(0.01f); scale_step->set_select_all_on_focus(true); + scale_step->set_accessibility_name(TTRC("Scale Step")); child_container->add_child(scale_step); } @@ -4128,6 +4137,15 @@ void CanvasItemEditor::_notification(int p_what) { ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &CanvasItemEditor::_project_settings_changed)); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Canvas item editor"))); + } break; + case NOTIFICATION_PROCESS: { // Update the viewport if the canvas_item changes List selection = _get_edited_canvas_items(true); @@ -5360,6 +5378,7 @@ CanvasItemEditor::CanvasItemEditor() { controls_hb->add_child(button_center_view); button_center_view->set_flat(true); button_center_view->set_tooltip_text(TTR("Center View")); + button_center_view->set_accessibility_name(TTRC("Center View")); button_center_view->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(VIEW_CENTER_TO_SELECTION)); zoom_widget = memnew(EditorZoomWidget); @@ -5402,6 +5421,7 @@ CanvasItemEditor::CanvasItemEditor() { select_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/select_mode", TTRC("Select Mode"), Key::Q)); select_button->set_shortcut_context(this); select_button->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+Drag: Move selected node.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + 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" + TTR("(Available in all modes.)") + "\n" + TTR("RMB: Add node at position clicked.")); + select_button->set_accessibility_name(TTRC("Select Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5413,6 +5433,7 @@ CanvasItemEditor::CanvasItemEditor() { move_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/move_mode", TTRC("Move Mode"), Key::W)); move_button->set_shortcut_context(this); move_button->set_tooltip_text(TTRC("Move Mode")); + move_button->set_accessibility_name(TTRC("Move Mode")); rotate_button = memnew(Button); rotate_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5422,6 +5443,7 @@ CanvasItemEditor::CanvasItemEditor() { rotate_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/rotate_mode", TTRC("Rotate Mode"), Key::E)); rotate_button->set_shortcut_context(this); rotate_button->set_tooltip_text(TTRC("Rotate Mode")); + rotate_button->set_accessibility_name(TTRC("Rotate Mode")); scale_button = memnew(Button); scale_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5431,6 +5453,7 @@ CanvasItemEditor::CanvasItemEditor() { scale_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/scale_mode", TTRC("Scale Mode"), Key::S)); scale_button->set_shortcut_context(this); scale_button->set_tooltip_text(TTRC("Shift: Scale proportionally.")); + scale_button->set_accessibility_name(TTRC("Scale Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5440,6 +5463,7 @@ CanvasItemEditor::CanvasItemEditor() { list_select_button->set_toggle_mode(true); list_select_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_LIST_SELECT)); list_select_button->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.")); + list_select_button->set_accessibility_name(TTRC("List Selectable Nodes")); pivot_button = memnew(Button); pivot_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5447,6 +5471,7 @@ CanvasItemEditor::CanvasItemEditor() { pivot_button->set_toggle_mode(true); pivot_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_button_tool_select).bind(TOOL_EDIT_PIVOT)); pivot_button->set_tooltip_text(TTR("Click to change object's pivot.") + "\n" + TTR("Shift: Set temporary pivot.") + "\n" + TTR("Click this button while holding Shift to put the temporary pivot in the center of the selected nodes.")); + pivot_button->set_accessibility_name(TTRC("Change Pivot")); pan_button = memnew(Button); pan_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5456,6 +5481,7 @@ CanvasItemEditor::CanvasItemEditor() { pan_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/pan_mode", TTRC("Pan Mode"), Key::G)); pan_button->set_shortcut_context(this); pan_button->set_tooltip_text(TTRC("You can also use Pan View shortcut (Space by default) to pan in any mode.")); + pan_button->set_accessibility_name(TTRC("Pan View")); ruler_button = memnew(Button); ruler_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5465,6 +5491,7 @@ CanvasItemEditor::CanvasItemEditor() { ruler_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/ruler_mode", TTRC("Ruler Mode"), Key::R)); ruler_button->set_shortcut_context(this); ruler_button->set_tooltip_text(TTRC("Ruler Mode")); + ruler_button->set_accessibility_name(TTRC("Ruler Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -5476,6 +5503,7 @@ CanvasItemEditor::CanvasItemEditor() { smart_snap_button->set_tooltip_text(TTRC("Toggle smart snapping.")); smart_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_smart_snap", TTRC("Use Smart Snap"), KeyModifierMask::SHIFT | Key::S)); smart_snap_button->set_shortcut_context(this); + smart_snap_button->set_accessibility_name(TTRC("Smart Snap")); grid_snap_button = memnew(Button); grid_snap_button->set_theme_type_variation(SceneStringName(FlatButton)); @@ -5485,6 +5513,7 @@ CanvasItemEditor::CanvasItemEditor() { grid_snap_button->set_tooltip_text(TTRC("Toggle grid snapping.")); grid_snap_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/use_grid_snap", TTRC("Use Grid Snap"), KeyModifierMask::SHIFT | Key::G)); grid_snap_button->set_shortcut_context(this); + grid_snap_button->set_accessibility_name(TTRC("Grid Snap")); snap_config_menu = memnew(MenuButton); snap_config_menu->set_flat(false); @@ -5494,6 +5523,7 @@ CanvasItemEditor::CanvasItemEditor() { snap_config_menu->set_h_size_flags(SIZE_SHRINK_END); snap_config_menu->set_tooltip_text(TTR("Snapping Options")); snap_config_menu->set_switch_on_hover(true); + snap_config_menu->set_accessibility_name(TTRC("Snapping Options")); PopupMenu *p = snap_config_menu->get_popup(); p->connect(SceneStringName(id_pressed), callable_mp(this, &CanvasItemEditor::_popup_callback)); @@ -5521,6 +5551,7 @@ CanvasItemEditor::CanvasItemEditor() { lock_button = memnew(Button); lock_button->set_theme_type_variation(SceneStringName(FlatButton)); + lock_button->set_accessibility_name(TTRC("Lock")); main_menu_hbox->add_child(lock_button); lock_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(LOCK_SELECTED)); @@ -5529,6 +5560,7 @@ CanvasItemEditor::CanvasItemEditor() { lock_button->set_shortcut(ED_GET_SHORTCUT("editor/lock_selected_nodes")); unlock_button = memnew(Button); + unlock_button->set_accessibility_name(TTRC("Unlock")); unlock_button->set_theme_type_variation(SceneStringName(FlatButton)); main_menu_hbox->add_child(unlock_button); unlock_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNLOCK_SELECTED)); @@ -5537,6 +5569,7 @@ CanvasItemEditor::CanvasItemEditor() { unlock_button->set_shortcut(ED_GET_SHORTCUT("editor/unlock_selected_nodes")); group_button = memnew(Button); + group_button->set_accessibility_name(TTRC("Group")); group_button->set_theme_type_variation(SceneStringName(FlatButton)); main_menu_hbox->add_child(group_button); group_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(GROUP_SELECTED)); @@ -5545,6 +5578,7 @@ CanvasItemEditor::CanvasItemEditor() { group_button->set_shortcut(ED_GET_SHORTCUT("editor/group_selected_nodes")); ungroup_button = memnew(Button); + ungroup_button->set_accessibility_name(TTRC("Ungroup")); ungroup_button->set_theme_type_variation(SceneStringName(FlatButton)); main_menu_hbox->add_child(ungroup_button); ungroup_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(UNGROUP_SELECTED)); @@ -5561,6 +5595,7 @@ CanvasItemEditor::CanvasItemEditor() { main_menu_hbox->add_child(skeleton_menu); skeleton_menu->set_tooltip_text(TTR("Skeleton Options")); skeleton_menu->set_switch_on_hover(true); + skeleton_menu->set_accessibility_name(TTRC("Skeleton Options")); p = skeleton_menu->get_popup(); p->set_hide_on_checkable_item_selection(false); @@ -5652,6 +5687,7 @@ CanvasItemEditor::CanvasItemEditor() { key_loc_button->set_focus_mode(FOCUS_NONE); key_loc_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_POS)); key_loc_button->set_tooltip_text(TTR("Translation mask for inserting keys.")); + key_loc_button->set_accessibility_name(TTRC("Translation Mask")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -5661,6 +5697,7 @@ CanvasItemEditor::CanvasItemEditor() { key_rot_button->set_focus_mode(FOCUS_NONE); key_rot_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_ROT)); key_rot_button->set_tooltip_text(TTR("Rotation mask for inserting keys.")); + key_rot_button->set_accessibility_name(TTRC("Rotation Mask")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); @@ -5669,6 +5706,7 @@ CanvasItemEditor::CanvasItemEditor() { key_scale_button->set_focus_mode(FOCUS_NONE); key_scale_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_SCALE)); key_scale_button->set_tooltip_text(TTR("Scale mask for inserting keys.")); + key_scale_button->set_accessibility_name(TTRC("Scale Mask")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); @@ -5677,6 +5715,7 @@ CanvasItemEditor::CanvasItemEditor() { key_insert_button->connect(SceneStringName(pressed), callable_mp(this, &CanvasItemEditor::_popup_callback).bind(ANIM_INSERT_KEY)); key_insert_button->set_tooltip_text(TTRC("Insert keys (based on mask).")); key_insert_button->set_shortcut(ED_SHORTCUT("canvas_item_editor/anim_insert_key", TTRC("Insert Key"), Key::INSERT)); + key_insert_button->set_accessibility_name(TTRC("Insert Keys")); key_insert_button->set_shortcut_context(this); animation_hb->add_child(key_insert_button); @@ -5686,6 +5725,7 @@ CanvasItemEditor::CanvasItemEditor() { key_auto_insert_button->set_focus_mode(FOCUS_NONE); key_auto_insert_button->set_tooltip_text(TTRC("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", TTRC("Auto Insert Key"))); + key_auto_insert_button->set_accessibility_name(TTRC("Auto Insert Keys")); key_auto_insert_button->set_shortcut_context(this); animation_hb->add_child(key_auto_insert_button); @@ -5694,6 +5734,7 @@ CanvasItemEditor::CanvasItemEditor() { animation_menu->set_theme_type_variation("FlatMenuButton"); animation_menu->set_shortcut_context(this); animation_menu->set_tooltip_text(TTR("Animation Key and Pose Options")); + animation_menu->set_accessibility_name(TTRC("Animation Key and Pose")); animation_hb->add_child(animation_menu); animation_menu->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &CanvasItemEditor::_popup_callback)); animation_menu->set_switch_on_hover(true); @@ -6134,6 +6175,9 @@ void CanvasItemEditorViewport::_perform_drop_data() { } bool CanvasItemEditorViewport::can_drop_data(const Point2 &p_point, const Variant &p_data) const { + if (p_point == Vector2(INFINITY, INFINITY)) { + return false; + } Dictionary d = p_data; if (!d.has("type") || (String(d["type"]) != "files")) { label->hide(); @@ -6265,6 +6309,9 @@ bool CanvasItemEditorViewport::_is_any_texture_selected() const { } void CanvasItemEditorViewport::drop_data(const Point2 &p_point, const Variant &p_data) { + if (p_point == Vector2(INFINITY, INFINITY)) { + return; + } bool is_shift = Input::get_singleton()->is_key_pressed(Key::SHIFT); bool is_alt = Input::get_singleton()->is_key_pressed(Key::ALT); diff --git a/editor/plugins/control_editor_plugin.cpp b/editor/plugins/control_editor_plugin.cpp index e5fdbca33d..e146dd166d 100644 --- a/editor/plugins/control_editor_plugin.cpp +++ b/editor/plugins/control_editor_plugin.cpp @@ -552,6 +552,7 @@ void ControlEditorPresetPicker::_add_row_button(HBoxContainer *p_row, const int b->set_custom_minimum_size(Size2i(36, 36) * EDSCALE); b->set_icon_alignment(HORIZONTAL_ALIGNMENT_CENTER); b->set_tooltip_text(p_name); + b->set_accessibility_name(p_name); b->set_flat(true); p_row->add_child(b); b->connect(SceneStringName(pressed), callable_mp(this, &ControlEditorPresetPicker::_preset_button_pressed).bind(p_preset)); @@ -1085,6 +1086,7 @@ ControlEditorToolbar::ControlEditorToolbar() { anchor_mode_button->set_theme_type_variation(SceneStringName(FlatButton)); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->set_tooltip_text(TTR("When active, moving Control nodes changes their anchors instead of their offsets.")); + anchor_mode_button->set_accessibility_name(TTRC("Change Anchors")); add_child(anchor_mode_button); anchor_mode_button->connect(SceneStringName(toggled), callable_mp(this, &ControlEditorToolbar::_anchor_mode_toggled)); diff --git a/editor/plugins/curve_editor_plugin.cpp b/editor/plugins/curve_editor_plugin.cpp index aaf7c427f0..7b99546a63 100644 --- a/editor/plugins/curve_editor_plugin.cpp +++ b/editor/plugins/curve_editor_plugin.cpp @@ -128,6 +128,14 @@ void CurveEdit::_notification(int p_what) { tangent_hover_radius = Math::round(BASE_TANGENT_HOVER_RADIUS * get_theme_default_base_scale() * gizmo_scale); tangent_length = Math::round(BASE_TANGENT_LENGTH * get_theme_default_base_scale()); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Curve editor"))); + } break; case NOTIFICATION_DRAW: { _redraw(); } break; @@ -989,6 +997,7 @@ CurveEditor::CurveEditor() { snap_button = memnew(Button); snap_button->set_tooltip_text(TTR("Toggle Grid Snap")); + snap_button->set_accessibility_name(TTRC("Grid Snap")); snap_button->set_toggle_mode(true); toolbar->add_child(snap_button); snap_button->connect(SceneStringName(toggled), callable_mp(this, &CurveEditor::_set_snap_enabled)); @@ -998,6 +1007,7 @@ CurveEditor::CurveEditor() { snap_count_edit = memnew(EditorSpinSlider); snap_count_edit->set_min(2); snap_count_edit->set_max(100); + snap_count_edit->set_accessibility_name(TTRC("Snap Step")); snap_count_edit->set_value(DEFAULT_SNAP); snap_count_edit->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); toolbar->add_child(snap_count_edit); diff --git a/editor/plugins/font_config_plugin.cpp b/editor/plugins/font_config_plugin.cpp index ff11160b55..c52b96cba9 100644 --- a/editor/plugins/font_config_plugin.cpp +++ b/editor/plugins/font_config_plugin.cpp @@ -295,6 +295,7 @@ void EditorPropertyFontMetaOverride::update_property() { hbox->add_child(prop); prop->set_h_size_flags(SIZE_EXPAND_FILL); Button *remove = memnew(Button); + remove->set_accessibility_name(TTRC("Remove")); remove->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); hbox->add_child(remove); remove->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyFontMetaOverride::_remove).bind(remove, name)); @@ -349,6 +350,7 @@ EditorPropertyFontMetaOverride::EditorPropertyFontMetaOverride(bool p_script) { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyFontMetaOverride::_edit_pressed)); @@ -535,6 +537,7 @@ EditorPropertyOTVariation::EditorPropertyOTVariation() { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTVariation::_edit_pressed)); @@ -789,6 +792,7 @@ void EditorPropertyOTFeatures::update_property() { hbox->add_child(prop); prop->set_h_size_flags(SIZE_EXPAND_FILL); Button *remove = memnew(Button); + remove->set_accessibility_name(TTRC("Remove")); remove->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); hbox->add_child(remove); remove->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTFeatures::_remove).bind(remove, name_tag)); @@ -838,6 +842,7 @@ EditorPropertyOTFeatures::EditorPropertyOTFeatures() { page_length = int(EDITOR_GET("interface/inspector/max_array_dictionary_items_per_page")); edit = memnew(Button); + edit->set_accessibility_name(TTRC("Edit")); edit->set_h_size_flags(SIZE_EXPAND_FILL); edit->set_clip_text(true); edit->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyOTFeatures::_edit_pressed)); diff --git a/editor/plugins/game_view_plugin.cpp b/editor/plugins/game_view_plugin.cpp index 0bdd98321d..c6b9dee78a 100644 --- a/editor/plugins/game_view_plugin.cpp +++ b/editor/plugins/game_view_plugin.cpp @@ -926,12 +926,14 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { suspend_button->set_theme_type_variation(SceneStringName(FlatButton)); suspend_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_suspend_button_toggled)); suspend_button->set_tooltip_text(TTR("Suspend")); + suspend_button->set_accessibility_name(TTRC("Suspend")); next_frame_button = memnew(Button); main_menu_hbox->add_child(next_frame_button); next_frame_button->set_theme_type_variation(SceneStringName(FlatButton)); next_frame_button->connect(SceneStringName(pressed), callable_mp(*debugger, &GameViewDebugger::next_frame)); next_frame_button->set_tooltip_text(TTR("Next Frame")); + next_frame_button->set_accessibility_name(TTRC("Next Frame")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -968,6 +970,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { hide_selection->set_theme_type_variation(SceneStringName(FlatButton)); hide_selection->connect(SceneStringName(toggled), callable_mp(this, &GameView::_hide_selection_toggled)); hide_selection->set_tooltip_text(TTR("Toggle Selection Visibility")); + hide_selection->set_accessibility_name(TTRC("Selection Visibility")); hide_selection->set_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "hide_selection", false)); main_menu_hbox->add_child(memnew(VSeparator)); @@ -1006,6 +1009,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { camera_override_button->set_toggle_mode(true); camera_override_button->set_theme_type_variation(SceneStringName(FlatButton)); camera_override_button->set_tooltip_text(TTR("Override the in-game camera.")); + camera_override_button->set_accessibility_name(TTRC("Override In-game Camera")); camera_override_button->connect(SceneStringName(toggled), callable_mp(this, &GameView::_camera_override_button_toggled)); camera_override_menu = memnew(MenuButton); @@ -1014,6 +1018,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { camera_override_menu->set_theme_type_variation("FlatMenuButton"); camera_override_menu->set_h_size_flags(SIZE_SHRINK_END); camera_override_menu->set_tooltip_text(TTR("Camera Override Options")); + camera_override_menu->set_accessibility_name(TTRC("Camera Override Options")); _camera_override_menu_id_pressed(EditorSettings::get_singleton()->get_project_metadata("game_view", "camera_override_mode", 0)); PopupMenu *menu = camera_override_menu->get_popup(); @@ -1033,6 +1038,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { fixed_size_button->set_toggle_mode(true); fixed_size_button->set_theme_type_variation("FlatButton"); fixed_size_button->set_tooltip_text(TTR("Embedded game size is based on project settings.\nThe 'Keep Aspect' mode is used when the Game Workspace is smaller than the desired size.")); + fixed_size_button->set_accessibility_name(TTRC("Fixed Size")); fixed_size_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_FIXED)); keep_aspect_button = memnew(Button); @@ -1040,6 +1046,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { keep_aspect_button->set_toggle_mode(true); keep_aspect_button->set_theme_type_variation("FlatButton"); keep_aspect_button->set_tooltip_text(TTR("Keep the aspect ratio of the embedded game.")); + keep_aspect_button->set_accessibility_name(TTRC("Keep Aspect Ratio")); keep_aspect_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_KEEP_ASPECT)); stretch_button = memnew(Button); @@ -1047,6 +1054,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { stretch_button->set_toggle_mode(true); stretch_button->set_theme_type_variation("FlatButton"); stretch_button->set_tooltip_text(TTR("Embedded game size stretches to fit the Game Workspace.")); + stretch_button->set_accessibility_name(TTRC("Stretch")); stretch_button->connect(SceneStringName(pressed), callable_mp(this, &GameView::_size_mode_button_pressed).bind(SIZE_MODE_STRETCH)); embed_options_menu = memnew(MenuButton); @@ -1055,6 +1063,7 @@ GameView::GameView(Ref p_debugger, WindowWrapper *p_wrapper) { embed_options_menu->set_theme_type_variation("FlatMenuButton"); embed_options_menu->set_h_size_flags(SIZE_SHRINK_END); embed_options_menu->set_tooltip_text(TTR("Embedding Options")); + embed_options_menu->set_accessibility_name(TTRC("Embedding Options")); menu = embed_options_menu->get_popup(); menu->connect(SceneStringName(id_pressed), callable_mp(this, &GameView::_embed_options_menu_menu_id_pressed)); diff --git a/editor/plugins/gradient_editor_plugin.cpp b/editor/plugins/gradient_editor_plugin.cpp index ad9894a977..6dc429974e 100644 --- a/editor/plugins/gradient_editor_plugin.cpp +++ b/editor/plugins/gradient_editor_plugin.cpp @@ -544,6 +544,14 @@ void GradientEdit::_notification(int p_what) { draw_spacing = BASE_SPACING * get_theme_default_base_scale(); handle_width = BASE_HANDLE_WIDTH * get_theme_default_base_scale(); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Gradient editor"))); + } break; case NOTIFICATION_DRAW: { _redraw(); } break; @@ -630,6 +638,7 @@ GradientEditor::GradientEditor() { snap_button = memnew(Button); snap_button->set_tooltip_text(TTR("Toggle Grid Snap")); + snap_button->set_accessibility_name(TTRC("Snap to Grid")); snap_button->set_toggle_mode(true); toolbar->add_child(snap_button); snap_button->connect(SceneStringName(toggled), callable_mp(this, &GradientEditor::_set_snap_enabled)); @@ -637,6 +646,7 @@ GradientEditor::GradientEditor() { snap_count_edit = memnew(EditorSpinSlider); snap_count_edit->set_min(2); snap_count_edit->set_max(100); + snap_count_edit->set_accessibility_name(TTRC("Grid Step")); snap_count_edit->set_value(DEFAULT_SNAP); snap_count_edit->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); toolbar->add_child(snap_count_edit); diff --git a/editor/plugins/gradient_texture_2d_editor_plugin.cpp b/editor/plugins/gradient_texture_2d_editor_plugin.cpp index 65951724a1..4b3c7903a5 100644 --- a/editor/plugins/gradient_texture_2d_editor_plugin.cpp +++ b/editor/plugins/gradient_texture_2d_editor_plugin.cpp @@ -279,6 +279,7 @@ GradientTexture2DEditor::GradientTexture2DEditor() { reverse_button = memnew(Button); reverse_button->set_tooltip_text(TTR("Swap Gradient Fill Points")); + reverse_button->set_accessibility_name(TTRC("Swap Gradient Fill Points")); toolbar->add_child(reverse_button); reverse_button->connect(SceneStringName(pressed), callable_mp(this, &GradientTexture2DEditor::_reverse_button_pressed)); @@ -286,6 +287,7 @@ GradientTexture2DEditor::GradientTexture2DEditor() { snap_button = memnew(Button); snap_button->set_tooltip_text(TTR("Toggle Grid Snap")); + snap_button->set_accessibility_name(TTRC("Snap to Grid")); snap_button->set_toggle_mode(true); toolbar->add_child(snap_button); snap_button->connect(SceneStringName(toggled), callable_mp(this, &GradientTexture2DEditor::_set_snap_enabled)); @@ -294,6 +296,7 @@ GradientTexture2DEditor::GradientTexture2DEditor() { snap_count_edit->set_min(2); snap_count_edit->set_max(100); snap_count_edit->set_value(DEFAULT_SNAP); + snap_count_edit->set_accessibility_name(TTRC("Grid Step")); snap_count_edit->set_custom_minimum_size(Size2(65 * EDSCALE, 0)); toolbar->add_child(snap_count_edit); snap_count_edit->connect(SceneStringName(value_changed), callable_mp(this, &GradientTexture2DEditor::_set_snap_count)); diff --git a/editor/plugins/material_editor_plugin.cpp b/editor/plugins/material_editor_plugin.cpp index b17e9927ab..14c7f15251 100644 --- a/editor/plugins/material_editor_plugin.cpp +++ b/editor/plugins/material_editor_plugin.cpp @@ -310,18 +310,21 @@ MaterialEditor::MaterialEditor() { sphere_switch = memnew(Button); sphere_switch->set_theme_type_variation("PreviewLightButton"); sphere_switch->set_toggle_mode(true); + sphere_switch->set_accessibility_name(TTRC("Sphere")); vb_shape->add_child(sphere_switch); sphere_switch->connect(SceneStringName(pressed), callable_mp(this, &MaterialEditor::_on_sphere_switch_pressed)); box_switch = memnew(Button); box_switch->set_theme_type_variation("PreviewLightButton"); box_switch->set_toggle_mode(true); + box_switch->set_accessibility_name(TTRC("Box")); vb_shape->add_child(box_switch); box_switch->connect(SceneStringName(pressed), callable_mp(this, &MaterialEditor::_on_box_switch_pressed)); quad_switch = memnew(Button); quad_switch->set_theme_type_variation("PreviewLightButton"); quad_switch->set_toggle_mode(true); + quad_switch->set_accessibility_name(TTRC("Quad")); vb_shape->add_child(quad_switch); quad_switch->connect(SceneStringName(pressed), callable_mp(this, &MaterialEditor::_on_quad_switch_pressed)); @@ -334,6 +337,7 @@ MaterialEditor::MaterialEditor() { light_1_switch->set_theme_type_variation("PreviewLightButton"); light_1_switch->set_toggle_mode(true); light_1_switch->set_pressed(true); + light_1_switch->set_accessibility_name(TTRC("First Light")); vb_light->add_child(light_1_switch); light_1_switch->connect(SceneStringName(pressed), callable_mp(this, &MaterialEditor::_on_light_1_switch_pressed)); @@ -341,6 +345,7 @@ MaterialEditor::MaterialEditor() { light_2_switch->set_theme_type_variation("PreviewLightButton"); light_2_switch->set_toggle_mode(true); light_2_switch->set_pressed(true); + light_2_switch->set_accessibility_name(TTRC("Second Light")); vb_light->add_child(light_2_switch); light_2_switch->connect(SceneStringName(pressed), callable_mp(this, &MaterialEditor::_on_light_2_switch_pressed)); diff --git a/editor/plugins/mesh_editor_plugin.cpp b/editor/plugins/mesh_editor_plugin.cpp index 645dd1784e..d6e0a30bfd 100644 --- a/editor/plugins/mesh_editor_plugin.cpp +++ b/editor/plugins/mesh_editor_plugin.cpp @@ -149,6 +149,7 @@ MeshEditor::MeshEditor() { light_1_switch->set_theme_type_variation("PreviewLightButton"); light_1_switch->set_toggle_mode(true); light_1_switch->set_pressed(true); + light_1_switch->set_accessibility_name(TTRC("First Light")); vb_light->add_child(light_1_switch); light_1_switch->connect(SceneStringName(pressed), callable_mp(this, &MeshEditor::_on_light_1_switch_pressed)); @@ -156,6 +157,7 @@ MeshEditor::MeshEditor() { light_2_switch->set_theme_type_variation("PreviewLightButton"); light_2_switch->set_toggle_mode(true); light_2_switch->set_pressed(true); + light_2_switch->set_accessibility_name(TTRC("Second Light")); vb_light->add_child(light_2_switch); light_2_switch->connect(SceneStringName(pressed), callable_mp(this, &MeshEditor::_on_light_2_switch_pressed)); diff --git a/editor/plugins/mesh_instance_3d_editor_plugin.cpp b/editor/plugins/mesh_instance_3d_editor_plugin.cpp index 66179b31a4..70200f921b 100644 --- a/editor/plugins/mesh_instance_3d_editor_plugin.cpp +++ b/editor/plugins/mesh_instance_3d_editor_plugin.cpp @@ -593,6 +593,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() { //outline_dialog->set_child_rect(outline_dialog_vbc); outline_size = memnew(SpinBox); + outline_size->set_accessibility_name(TTRC("Outline Size")); outline_size->set_min(0.001); outline_size->set_max(1024); outline_size->set_step(0.001); @@ -610,10 +611,11 @@ MeshInstance3DEditor::MeshInstance3DEditor() { shape_dialog->add_child(shape_dialog_vbc); Label *l = memnew(Label); - l->set_text(TTR("Collision Shape placement")); + l->set_text(TTR("Collision Shape Placement")); shape_dialog_vbc->add_child(l); shape_placement = memnew(OptionButton); + shape_placement->set_accessibility_name(TTRC("Collision Shape Placement")); shape_placement->set_h_size_flags(SIZE_EXPAND_FILL); shape_placement->add_item(TTR("Sibling"), SHAPE_PLACEMENT_SIBLING); shape_placement->set_item_tooltip(-1, TTR("Creates collision shapes as Sibling.")); @@ -626,6 +628,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() { shape_dialog_vbc->add_child(l); shape_type = memnew(OptionButton); + shape_type->set_accessibility_name(TTRC("Collision Shape Type")); shape_type->set_h_size_flags(SIZE_EXPAND_FILL); shape_type->add_item(TTR("Trimesh"), SHAPE_TYPE_TRIMESH); shape_type->set_item_tooltip(-1, TTR("Creates a polygon-based collision shape.\nThis is the most accurate (but slowest) option for collision detection.")); diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index afee61ef40..c96c81b505 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -290,8 +290,10 @@ MultiMeshEditor::MultiMeshEditor() { surface_source = memnew(LineEdit); hbc->add_child(surface_source); surface_source->set_h_size_flags(SIZE_EXPAND_FILL); + surface_source->set_accessibility_name(TTRC("Surface Source")); Button *b = memnew(Button); hbc->add_child(b); + b->set_accessibility_name(TTRC("Browse")); b->set_text(".."); b->connect(SceneStringName(pressed), callable_mp(this, &MultiMeshEditor::_browse).bind(false)); @@ -301,13 +303,16 @@ MultiMeshEditor::MultiMeshEditor() { mesh_source = memnew(LineEdit); hbc->add_child(mesh_source); mesh_source->set_h_size_flags(SIZE_EXPAND_FILL); + mesh_source->set_accessibility_name(TTRC("Mesh Source")); b = memnew(Button); hbc->add_child(b); + b->set_accessibility_name(TTRC("Browse")); b->set_text(".."); vbc->add_margin_child(TTR("Source Mesh:"), hbc); b->connect(SceneStringName(pressed), callable_mp(this, &MultiMeshEditor::_browse).bind(true)); populate_axis = memnew(OptionButton); + populate_axis->set_accessibility_name(TTRC("Up Axis")); populate_axis->add_item(TTR("X-Axis")); populate_axis->add_item(TTR("Y-Axis")); populate_axis->add_item(TTR("Z-Axis")); @@ -317,11 +322,13 @@ MultiMeshEditor::MultiMeshEditor() { populate_rotate_random = memnew(HSlider); populate_rotate_random->set_max(1); populate_rotate_random->set_step(0.01); + populate_rotate_random->set_accessibility_name(TTRC("Random Rotation")); vbc->add_margin_child(TTR("Random Rotation:"), populate_rotate_random); populate_tilt_random = memnew(HSlider); populate_tilt_random->set_max(1); populate_tilt_random->set_step(0.01); + populate_tilt_random->set_accessibility_name(TTRC("Random Tilt")); vbc->add_margin_child(TTR("Random Tilt:"), populate_tilt_random); populate_scale_random = memnew(SpinBox); @@ -329,7 +336,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale_random->set_max(1); populate_scale_random->set_value(0); populate_scale_random->set_step(0.01); - + populate_scale_random->set_accessibility_name(TTRC("Random Scale")); vbc->add_margin_child(TTR("Random Scale:"), populate_scale_random); populate_scale = memnew(SpinBox); @@ -337,7 +344,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_scale->set_max(4096); populate_scale->set_value(1); populate_scale->set_step(0.01); - + populate_scale->set_accessibility_name(TTRC("Scale")); vbc->add_margin_child(TTR("Scale:"), populate_scale); populate_amount = memnew(SpinBox); @@ -347,6 +354,7 @@ MultiMeshEditor::MultiMeshEditor() { populate_amount->set_min(1); populate_amount->set_max(65536); populate_amount->set_value(128); + populate_amount->set_accessibility_name(TTRC("Amount")); vbc->add_margin_child(TTR("Amount:"), populate_amount); populate_dialog->set_ok_button_text(TTR("Populate")); diff --git a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp index 3505e66aa0..48df1eb1a4 100644 --- a/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp +++ b/editor/plugins/navigation_obstacle_3d_editor_plugin.cpp @@ -830,12 +830,14 @@ NavigationObstacle3DEditorPlugin::NavigationObstacle3DEditorPlugin() { button_create->set_theme_type_variation(SceneStringName(FlatButton)); obstacle_editor->add_child(button_create); button_create->set_tooltip_text(TTR("Add Vertex")); + button_create->set_accessibility_name(TTRC("Add Vertex")); button_create->connect(SceneStringName(pressed), callable_mp(this, &NavigationObstacle3DEditorPlugin::set_mode).bind(NavigationObstacle3DEditorPlugin::MODE_CREATE)); button_create->set_toggle_mode(true); button_create->set_button_group(bg); button_edit = memnew(Button); button_edit->set_theme_type_variation(SceneStringName(FlatButton)); + button_edit->set_accessibility_name(TTRC("Edit")); obstacle_editor->add_child(button_edit); button_edit->connect(SceneStringName(pressed), callable_mp(this, &NavigationObstacle3DEditorPlugin::set_mode).bind(NavigationObstacle3DEditorPlugin::MODE_EDIT)); button_edit->set_toggle_mode(true); @@ -843,6 +845,7 @@ NavigationObstacle3DEditorPlugin::NavigationObstacle3DEditorPlugin() { button_delete = memnew(Button); button_delete->set_theme_type_variation(SceneStringName(FlatButton)); + button_delete->set_accessibility_name(TTRC("Delete")); obstacle_editor->add_child(button_delete); button_delete->connect(SceneStringName(pressed), callable_mp(this, &NavigationObstacle3DEditorPlugin::set_mode).bind(NavigationObstacle3DEditorPlugin::MODE_DELETE)); button_delete->set_toggle_mode(true); @@ -850,12 +853,14 @@ NavigationObstacle3DEditorPlugin::NavigationObstacle3DEditorPlugin() { button_flip = memnew(Button); button_flip->set_theme_type_variation(SceneStringName(FlatButton)); + button_flip->set_accessibility_name(TTRC("Flip")); obstacle_editor->add_child(button_flip); button_flip->connect(SceneStringName(pressed), callable_mp(this, &NavigationObstacle3DEditorPlugin::set_mode).bind(NavigationObstacle3DEditorPlugin::ACTION_FLIP)); button_flip->set_toggle_mode(true); button_clear = memnew(Button); button_clear->set_theme_type_variation(SceneStringName(FlatButton)); + button_clear->set_accessibility_name(TTRC("Clear")); obstacle_editor->add_child(button_clear); button_clear->connect(SceneStringName(pressed), callable_mp(this, &NavigationObstacle3DEditorPlugin::set_mode).bind(NavigationObstacle3DEditorPlugin::ACTION_CLEAR)); button_clear->set_toggle_mode(true); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ef67c7a2a7..6d8bb9d3db 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -4909,6 +4909,9 @@ void Node3DEditorViewport::_perform_drop_data() { } bool Node3DEditorViewport::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { + if (p_point == Vector2(INFINITY, INFINITY)) { + return false; + } preview_node_viewport_pos = p_point; bool can_instantiate = false; @@ -5587,6 +5590,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p view_display_menu->set_flat(false); view_display_menu->set_h_size_flags(0); view_display_menu->set_shortcut_context(this); + view_display_menu->set_accessibility_name(TTRC("View")); vbox->add_child(view_display_menu); view_display_menu->get_popup()->set_hide_on_checkable_item_selection(false); @@ -8305,6 +8309,15 @@ void Node3DEditor::_notification(int p_what) { ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &Node3DEditor::update_all_gizmos).bind(Variant())); } break; + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + //TODO + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "3D editor"))); + } break; + case NOTIFICATION_ENTER_TREE: { _update_theme(); _register_all_gizmos(); @@ -8823,7 +8836,7 @@ void Node3DEditor::_load_default_preview_settings() { environ_sky_color->set_pick_color(Color(0.385, 0.454, 0.55)); environ_ground_color->set_pick_color(Color(0.2, 0.169, 0.133)); environ_energy->set_value_no_signal(1.0); - if (OS::get_singleton()->get_current_rendering_method() != "gl_compatibility") { + if (OS::get_singleton()->get_current_rendering_method() != "gl_compatibility" && OS::get_singleton()->get_current_rendering_method() != "dummy") { environ_glow_button->set_pressed_no_signal(true); } environ_tonemap_button->set_pressed_no_signal(true); @@ -9099,6 +9112,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_SELECT]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_select", TTRC("Select Mode"), Key::Q, true)); tool_button[TOOL_MODE_SELECT]->set_shortcut_context(this); tool_button[TOOL_MODE_SELECT]->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Rotate selected node around pivot.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.") + "\n" + TTR("(Available in all modes.)")); + tool_button[TOOL_MODE_SELECT]->set_accessibility_name(TTRC("Select Mode")); main_menu_hbox->add_child(memnew(VSeparator)); tool_button[TOOL_MODE_MOVE] = memnew(Button); @@ -9110,6 +9124,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_MOVE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_move", TTRC("Move Mode"), Key::W, true)); tool_button[TOOL_MODE_MOVE]->set_shortcut_context(this); tool_button[TOOL_MODE_MOVE]->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Use snap.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.")); + tool_button[TOOL_MODE_MOVE]->set_accessibility_name(TTRC("Move Mode")); tool_button[TOOL_MODE_ROTATE] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_MODE_ROTATE]); @@ -9119,6 +9134,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_ROTATE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_rotate", TTRC("Rotate Mode"), Key::E, true)); tool_button[TOOL_MODE_ROTATE]->set_shortcut_context(this); tool_button[TOOL_MODE_ROTATE]->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Use snap.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.")); + tool_button[TOOL_MODE_ROTATE]->set_accessibility_name(TTRC("Rotate Mode")); tool_button[TOOL_MODE_SCALE] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_MODE_SCALE]); @@ -9128,6 +9144,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_SCALE]->set_shortcut(ED_SHORTCUT("spatial_editor/tool_scale", TTRC("Scale Mode"), Key::R, true)); tool_button[TOOL_MODE_SCALE]->set_shortcut_context(this); tool_button[TOOL_MODE_SCALE]->set_tooltip_text(keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Drag: Use snap.") + "\n" + TTR("Alt+RMB: Show list of all nodes at position clicked, including locked.")); + tool_button[TOOL_MODE_SCALE]->set_accessibility_name(TTRC("Scale Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -9137,6 +9154,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_MODE_LIST_SELECT]->set_theme_type_variation(SceneStringName(FlatButton)); tool_button[TOOL_MODE_LIST_SELECT]->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_menu_item_pressed).bind(MENU_TOOL_LIST_SELECT)); tool_button[TOOL_MODE_LIST_SELECT]->set_tooltip_text(TTR("Show list of selectable nodes at position clicked.")); + tool_button[TOOL_MODE_LIST_SELECT]->set_accessibility_name(TTRC("Show List of Selectable Nodes")); tool_button[TOOL_LOCK_SELECTED] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_LOCK_SELECTED]); @@ -9145,6 +9163,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_LOCK_SELECTED]->set_tooltip_text(TTRC("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_GET_SHORTCUT("editor/lock_selected_nodes")); + tool_button[TOOL_LOCK_SELECTED]->set_accessibility_name(TTRC("Lock")); tool_button[TOOL_UNLOCK_SELECTED] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_UNLOCK_SELECTED]); @@ -9153,6 +9172,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_UNLOCK_SELECTED]->set_tooltip_text(TTRC("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_GET_SHORTCUT("editor/unlock_selected_nodes")); + tool_button[TOOL_UNLOCK_SELECTED]->set_accessibility_name(TTRC("Unlock")); tool_button[TOOL_GROUP_SELECTED] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_GROUP_SELECTED]); @@ -9161,6 +9181,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_GROUP_SELECTED]->set_tooltip_text(TTRC("Groups the selected node with its children. This selects the parent when any child node is clicked in 2D and 3D view.")); // 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_GET_SHORTCUT("editor/group_selected_nodes")); + tool_button[TOOL_GROUP_SELECTED]->set_accessibility_name(TTRC("Group")); tool_button[TOOL_UNGROUP_SELECTED] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_UNGROUP_SELECTED]); @@ -9169,6 +9190,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_UNGROUP_SELECTED]->set_tooltip_text(TTRC("Ungroups the selected node from its children. Child nodes will be individual items in 2D and 3D view.")); // 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_GET_SHORTCUT("editor/ungroup_selected_nodes")); + tool_button[TOOL_UNGROUP_SELECTED]->set_accessibility_name(TTRC("Ungroup")); tool_button[TOOL_RULER] = memnew(Button); main_menu_hbox->add_child(tool_button[TOOL_RULER]); @@ -9178,6 +9200,7 @@ Node3DEditor::Node3DEditor() { tool_button[TOOL_RULER]->set_tooltip_text(TTRC("LMB+Drag: Measure the distance between two points in 3D space.")); // Define the shortcut globally (without a context) so that it works if the Scene tree dock is currently focused. tool_button[TOOL_RULER]->set_shortcut(ED_SHORTCUT("spatial_editor/measure", TTRC("Ruler Mode"), Key::M)); + tool_button[TOOL_RULER]->set_accessibility_name(TTRC("Ruler Mode")); main_menu_hbox->add_child(memnew(VSeparator)); @@ -9188,6 +9211,7 @@ Node3DEditor::Node3DEditor() { tool_option_button[TOOL_OPT_LOCAL_COORDS]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_LOCAL_COORDS)); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut(ED_SHORTCUT("spatial_editor/local_coords", TTRC("Use Local Space"), Key::T)); tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_shortcut_context(this); + tool_option_button[TOOL_OPT_LOCAL_COORDS]->set_accessibility_name(TTRC("Use Local Space")); tool_option_button[TOOL_OPT_USE_SNAP] = memnew(Button); main_menu_hbox->add_child(tool_option_button[TOOL_OPT_USE_SNAP]); @@ -9196,11 +9220,13 @@ Node3DEditor::Node3DEditor() { tool_option_button[TOOL_OPT_USE_SNAP]->connect(SceneStringName(toggled), callable_mp(this, &Node3DEditor::_menu_item_toggled).bind(MENU_TOOL_USE_SNAP)); tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut(ED_SHORTCUT("spatial_editor/snap", TTRC("Use Snap"), Key::Y)); tool_option_button[TOOL_OPT_USE_SNAP]->set_shortcut_context(this); + tool_option_button[TOOL_OPT_USE_SNAP]->set_accessibility_name(TTRC("Use Snap")); main_menu_hbox->add_child(memnew(VSeparator)); sun_button = memnew(Button); 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_accessibility_name(TTRC("Preview Sunlight")); sun_button->set_theme_type_variation(SceneStringName(FlatButton)); sun_button->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); // Preview is enabled by default - ensure this applies on editor startup when there is no state yet. @@ -9211,6 +9237,7 @@ Node3DEditor::Node3DEditor() { environ_button = memnew(Button); 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_accessibility_name(TTRC("Preview Environment")); environ_button->set_theme_type_variation(SceneStringName(FlatButton)); environ_button->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_update_preview_environment), CONNECT_DEFERRED); // Preview is enabled by default - ensure this applies on editor startup when there is no state yet. @@ -9221,6 +9248,7 @@ Node3DEditor::Node3DEditor() { sun_environ_settings = memnew(Button); sun_environ_settings->set_tooltip_text(TTR("Edit Sun and Environment settings.")); sun_environ_settings->set_theme_type_variation(SceneStringName(FlatButton)); + sun_environ_settings->set_accessibility_name(TTRC("Edit Sun and Environment")); sun_environ_settings->connect(SceneStringName(pressed), callable_mp(this, &Node3DEditor::_sun_environ_settings_pressed)); main_menu_hbox->add_child(sun_environ_settings); @@ -9363,14 +9391,17 @@ Node3DEditor::Node3DEditor() { snap_translate = memnew(LineEdit); snap_translate->set_select_all_on_focus(true); + snap_translate->set_accessibility_name(TTRC("Translate Snap")); snap_dialog_vbc->add_margin_child(TTR("Translate Snap:"), snap_translate); snap_rotate = memnew(LineEdit); snap_rotate->set_select_all_on_focus(true); + snap_rotate->set_accessibility_name(TTRC("Rotate Snap")); snap_dialog_vbc->add_margin_child(TTR("Rotate Snap (deg.):"), snap_rotate); snap_scale = memnew(LineEdit); snap_scale->set_select_all_on_focus(true); + snap_scale->set_accessibility_name(TTRC("Scale Snap")); snap_dialog_vbc->add_margin_child(TTR("Scale Snap (%):"), snap_scale); /* SETTINGS DIALOG */ @@ -9389,12 +9420,14 @@ Node3DEditor::Node3DEditor() { settings_fov->set_value(EDITOR_GET("editors/3d/default_fov")); settings_fov->set_select_all_on_focus(true); settings_fov->set_tooltip_text(TTR("FOV is defined as a vertical value, as the editor camera always uses the Keep Height aspect mode.")); + settings_fov->set_accessibility_name(TTRC("Perspective VFOV")); settings_vbc->add_margin_child(TTR("Perspective VFOV (deg.):"), settings_fov); settings_znear = memnew(SpinBox); settings_znear->set_max(MAX_Z); settings_znear->set_min(MIN_Z); settings_znear->set_step(0.01); + settings_znear->set_accessibility_name(TTRC("View Z-Near")); settings_znear->set_value(EDITOR_GET("editors/3d/default_z_near")); settings_znear->set_select_all_on_focus(true); settings_vbc->add_margin_child(TTR("View Z-Near:"), settings_znear); @@ -9403,6 +9436,7 @@ Node3DEditor::Node3DEditor() { settings_zfar->set_max(MAX_Z); settings_zfar->set_min(MIN_Z); settings_zfar->set_step(0.1); + settings_zfar->set_accessibility_name(TTRC("View Z-Far")); settings_zfar->set_value(EDITOR_GET("editors/3d/default_z_far")); settings_zfar->set_select_all_on_focus(true); settings_vbc->add_margin_child(TTR("View Z-Far:"), settings_zfar); @@ -9468,6 +9502,7 @@ Node3DEditor::Node3DEditor() { xform_type = memnew(OptionButton); xform_type->set_h_size_flags(SIZE_EXPAND_FILL); + xform_type->set_accessibility_name(TTRC("Transform Type")); xform_type->add_item(TTR("Pre")); xform_type->add_item(TTR("Post")); xform_vbc->add_child(xform_type); diff --git a/editor/plugins/particle_process_material_editor_plugin.cpp b/editor/plugins/particle_process_material_editor_plugin.cpp index 52cc2e658b..f4db0e3daa 100644 --- a/editor/plugins/particle_process_material_editor_plugin.cpp +++ b/editor/plugins/particle_process_material_editor_plugin.cpp @@ -435,6 +435,7 @@ ParticleProcessMaterialMinMaxPropertyEditor::ParticleProcessMaterialMinMaxProper toggle_mode_button = memnew(Button); toggle_mode_button->set_toggle_mode(true); toggle_mode_button->set_tooltip_text(TTR("Toggle between minimum/maximum and base value/spread modes.")); + toggle_mode_button->set_accessibility_name(TTRC("Spread mode")); hb->add_child(toggle_mode_button); toggle_mode_button->connect(SceneStringName(toggled), callable_mp(this, &ParticleProcessMaterialMinMaxPropertyEditor::_toggle_mode)); diff --git a/editor/plugins/particles_editor_plugin.cpp b/editor/plugins/particles_editor_plugin.cpp index 156cbbd2a6..500988694c 100644 --- a/editor/plugins/particles_editor_plugin.cpp +++ b/editor/plugins/particles_editor_plugin.cpp @@ -826,6 +826,7 @@ Particles3DEditorPlugin::Particles3DEditorPlugin() { generate_aabb->add_child(genvb); generate_seconds = memnew(SpinBox); + generate_seconds->set_accessibility_name(TTRC("Generation Time")); generate_seconds->set_min(0.1); generate_seconds->set_max(25); generate_seconds->set_value(2); @@ -850,12 +851,14 @@ Particles3DEditorPlugin::Particles3DEditorPlugin() { emission_dialog->add_child(emd_vb); emission_amount = memnew(SpinBox); + emission_amount->set_accessibility_name(TTRC("Emission Points")); emission_amount->set_min(1); emission_amount->set_max(100000); emission_amount->set_value(512); emd_vb->add_margin_child(TTR("Emission Points:"), emission_amount); emission_fill = memnew(OptionButton); + emission_fill->set_accessibility_name(TTRC("Emission Source")); emission_fill->add_item(TTR("Surface Points")); emission_fill->add_item(TTR("Surface Points+Normal (Directed)")); emission_fill->add_item(TTR("Volume")); diff --git a/editor/plugins/path_2d_editor_plugin.cpp b/editor/plugins/path_2d_editor_plugin.cpp index 85d491662b..794aa1512b 100644 --- a/editor/plugins/path_2d_editor_plugin.cpp +++ b/editor/plugins/path_2d_editor_plugin.cpp @@ -722,6 +722,7 @@ Path2DEditor::Path2DEditor() { curve_edit->set_pressed(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Drag: Select Control Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Click: Add Point") + "\n" + TTR("Left Click: Split Segment (in curve)") + "\n" + TTR("Right Click: Delete Point")); + curve_edit->set_accessibility_name(TTRC("Select Points")); curve_edit->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_EDIT)); toolbar->add_child(curve_edit); @@ -730,6 +731,7 @@ Path2DEditor::Path2DEditor() { curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip_text(TTR("Select Control Points (Shift+Drag)")); + curve_edit_curve->set_accessibility_name(TTRC("Select Control Points")); curve_edit_curve->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_EDIT_CURVE)); toolbar->add_child(curve_edit_curve); @@ -738,6 +740,7 @@ Path2DEditor::Path2DEditor() { curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip_text(TTR("Add Point (in empty space)") + "\n" + TTR("Right Click: Delete Point")); + curve_create->set_accessibility_name(TTRC("Add Point")); curve_create->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_CREATE)); toolbar->add_child(curve_create); @@ -746,6 +749,7 @@ Path2DEditor::Path2DEditor() { curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip_text(TTR("Delete Point")); + curve_del->set_accessibility_name(TTRC("Delete Point")); curve_del->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_DELETE)); toolbar->add_child(curve_del); @@ -753,6 +757,7 @@ Path2DEditor::Path2DEditor() { curve_close->set_theme_type_variation(SceneStringName(FlatButton)); curve_close->set_focus_mode(Control::FOCUS_NONE); curve_close->set_tooltip_text(TTR("Close Curve")); + curve_close->set_accessibility_name(TTRC("Close Curve")); curve_close->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_mode_selected).bind(MODE_CLOSE)); toolbar->add_child(curve_close); @@ -760,6 +765,7 @@ Path2DEditor::Path2DEditor() { curve_clear_points->set_theme_type_variation(SceneStringName(FlatButton)); curve_clear_points->set_focus_mode(Control::FOCUS_NONE); curve_clear_points->set_tooltip_text(TTR("Clear Points")); + curve_clear_points->set_accessibility_name(TTRC("Clear Points")); curve_clear_points->connect(SceneStringName(pressed), callable_mp(this, &Path2DEditor::_confirm_clear_points)); toolbar->add_child(curve_clear_points); diff --git a/editor/plugins/path_3d_editor_plugin.cpp b/editor/plugins/path_3d_editor_plugin.cpp index 3ff97ca63d..22baf34069 100644 --- a/editor/plugins/path_3d_editor_plugin.cpp +++ b/editor/plugins/path_3d_editor_plugin.cpp @@ -919,6 +919,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_edit->set_toggle_mode(true); curve_edit->set_focus_mode(Control::FOCUS_NONE); curve_edit->set_tooltip_text(TTR("Select Points") + "\n" + TTR("Shift+Click: Select multiple Points") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Click: Add Point") + "\n" + TTR("Right Click: Delete Point")); + curve_edit->set_accessibility_name(TTRC("Select Points")); toolbar->add_child(curve_edit); curve_edit->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT)); @@ -927,6 +928,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_edit_curve->set_toggle_mode(true); curve_edit_curve->set_focus_mode(Control::FOCUS_NONE); curve_edit_curve->set_tooltip_text(TTR("Select Control Points") + "\n" + TTR("Shift+Click: Drag out Control Points")); + curve_edit_curve->set_accessibility_name(TTRC("Select Control Points")); toolbar->add_child(curve_edit_curve); curve_edit_curve->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT_CURVE)); @@ -935,6 +937,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_edit_tilt->set_toggle_mode(true); curve_edit_tilt->set_focus_mode(Control::FOCUS_NONE); curve_edit_tilt->set_tooltip_text(TTR("Select Tilt Handles")); + curve_edit_tilt->set_accessibility_name(TTRC("Select Tilt Handles")); toolbar->add_child(curve_edit_tilt); curve_edit_tilt->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_EDIT_TILT)); @@ -943,6 +946,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_create->set_toggle_mode(true); curve_create->set_focus_mode(Control::FOCUS_NONE); curve_create->set_tooltip_text(TTR("Add Point (in empty space)") + "\n" + TTR("Split Segment (in curve)")); + curve_create->set_accessibility_name(TTRC("Add Point")); toolbar->add_child(curve_create); curve_create->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_CREATE)); @@ -951,6 +955,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_del->set_toggle_mode(true); curve_del->set_focus_mode(Control::FOCUS_NONE); curve_del->set_tooltip_text(TTR("Delete Point")); + curve_del->set_accessibility_name(TTRC("Delete Point")); toolbar->add_child(curve_del); curve_del->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_mode_changed).bind(MODE_DELETE)); @@ -958,6 +963,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_closed->set_theme_type_variation(SceneStringName(FlatButton)); curve_closed->set_focus_mode(Control::FOCUS_NONE); curve_closed->set_tooltip_text(TTR("Close Curve")); + curve_closed->set_accessibility_name(TTRC("Close Curve")); toolbar->add_child(curve_closed); curve_closed->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_toggle_closed_curve)); @@ -965,6 +971,7 @@ Path3DEditorPlugin::Path3DEditorPlugin() { curve_clear_points->set_theme_type_variation(SceneStringName(FlatButton)); curve_clear_points->set_focus_mode(Control::FOCUS_NONE); curve_clear_points->set_tooltip_text(TTR("Clear Points")); + curve_clear_points->set_accessibility_name(TTRC("Clear Points")); curve_clear_points->connect(SceneStringName(pressed), callable_mp(this, &Path3DEditorPlugin::_confirm_clear_points)); toolbar->add_child(curve_clear_points); diff --git a/editor/plugins/plugin_config_dialog.cpp b/editor/plugins/plugin_config_dialog.cpp index d70aa30bfb..2e7f753469 100644 --- a/editor/plugins/plugin_config_dialog.cpp +++ b/editor/plugins/plugin_config_dialog.cpp @@ -224,6 +224,7 @@ PluginConfigDialog::PluginConfigDialog() { name_edit = memnew(LineEdit); name_edit->set_placeholder("MyPlugin"); name_edit->set_tooltip_text(TTR("Required. This name will be displayed in the list of plugins.")); + name_edit->set_accessibility_name(TTRC("Name")); name_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(name_edit); @@ -237,6 +238,7 @@ PluginConfigDialog::PluginConfigDialog() { subfolder_edit = memnew(LineEdit); subfolder_edit->set_placeholder("\"my_plugin\" -> res://addons/my_plugin"); subfolder_edit->set_tooltip_text(TTR("Optional. The folder name should generally use `snake_case` naming (avoid spaces and special characters).\nIf left empty, the folder will be named after the plugin name converted to `snake_case`.")); + subfolder_edit->set_accessibility_name(TTRC("Subfolder")); subfolder_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(subfolder_edit); plugin_edit_hidden_controls.push_back(subfolder_edit); @@ -249,6 +251,7 @@ PluginConfigDialog::PluginConfigDialog() { desc_edit = memnew(TextEdit); desc_edit->set_tooltip_text(TTR("Optional. This description should be kept relatively short (up to 5 lines).\nIt will display when hovering the plugin in the list of plugins.")); + desc_edit->set_accessibility_name(TTRC("Description")); desc_edit->set_custom_minimum_size(Size2(400, 80) * EDSCALE); desc_edit->set_line_wrapping_mode(TextEdit::LineWrappingMode::LINE_WRAPPING_BOUNDARY); desc_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); @@ -263,6 +266,7 @@ PluginConfigDialog::PluginConfigDialog() { author_edit = memnew(LineEdit); author_edit->set_placeholder("Godette"); + author_edit->set_accessibility_name(TTRC("Author")); author_edit->set_tooltip_text(TTR("Optional. The author's username, full name, or organization name.")); author_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(author_edit); @@ -276,6 +280,7 @@ PluginConfigDialog::PluginConfigDialog() { version_edit = memnew(LineEdit); version_edit->set_tooltip_text(TTR("Optional. A human-readable version identifier used for informational purposes only.")); version_edit->set_placeholder("1.0"); + version_edit->set_accessibility_name(TTRC("Version")); version_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(version_edit); @@ -287,6 +292,7 @@ PluginConfigDialog::PluginConfigDialog() { script_option_edit = memnew(OptionButton); script_option_edit->set_tooltip_text(TTR("Required. The scripting language to use for the script.\nNote that a plugin may use several languages at once by adding more scripts to the plugin.")); + script_option_edit->set_accessibility_name(TTRC("Scripting Language")); int default_lang = 0; for (int i = 0; i < ScriptServer::get_language_count(); i++) { ScriptLanguage *lang = ScriptServer::get_language(i); @@ -307,6 +313,7 @@ PluginConfigDialog::PluginConfigDialog() { script_edit = memnew(LineEdit); script_edit->set_tooltip_text(TTR("Optional. The name of the script file. If left empty, will default to the subfolder name.")); script_edit->set_placeholder("\"plugin.gd\" -> res://addons/my_plugin/plugin.gd"); + script_edit->set_accessibility_name(TTRC("Script")); script_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); grid->add_child(script_edit); @@ -319,6 +326,7 @@ PluginConfigDialog::PluginConfigDialog() { active_edit = memnew(CheckBox); active_edit->set_pressed(true); + active_edit->set_accessibility_name(TTRC("Active")); grid->add_child(active_edit); plugin_edit_hidden_controls.push_back(active_edit); diff --git a/editor/plugins/polygon_2d_editor_plugin.cpp b/editor/plugins/polygon_2d_editor_plugin.cpp index dbfded66bc..9848a51ece 100644 --- a/editor/plugins/polygon_2d_editor_plugin.cpp +++ b/editor/plugins/polygon_2d_editor_plugin.cpp @@ -1319,6 +1319,18 @@ Polygon2DEditor::Polygon2DEditor() { action_buttons[ACTION_PAINT_WEIGHT]->set_tooltip_text(TTR("Paint weights with specified intensity.")); action_buttons[ACTION_CLEAR_WEIGHT]->set_tooltip_text(TTR("Unpaint weights with specified intensity.")); + action_buttons[ACTION_CREATE]->set_accessibility_name(TTRC("Create Polygon")); + action_buttons[ACTION_CREATE_INTERNAL]->set_accessibility_name(TTRC("Create Internal Vertex")); + action_buttons[ACTION_REMOVE_INTERNAL]->set_accessibility_name(TTRC("Remove Internal Vertex")); + action_buttons[ACTION_EDIT_POINT]->set_accessibility_name(TTRC("Move Points")); + action_buttons[ACTION_MOVE]->set_accessibility_name(TTRC("Move Polygon")); + action_buttons[ACTION_ROTATE]->set_accessibility_name(TTRC("Rotate Polygon")); + action_buttons[ACTION_SCALE]->set_accessibility_name(TTRC("Scale Polygon")); + action_buttons[ACTION_ADD_POLYGON]->set_accessibility_name(TTRC("Create Custom Polygon")); + action_buttons[ACTION_REMOVE_POLYGON]->set_accessibility_name(TTRC("Remove Custom Polygon")); + action_buttons[ACTION_PAINT_WEIGHT]->set_accessibility_name(TTRC("Paint Weights")); + action_buttons[ACTION_CLEAR_WEIGHT]->set_accessibility_name(TTRC("Unpaint Weights")); + bone_paint_strength = memnew(HSlider); toolbar->add_child(bone_paint_strength); bone_paint_strength->set_custom_minimum_size(Size2(75 * EDSCALE, 0)); @@ -1327,6 +1339,7 @@ Polygon2DEditor::Polygon2DEditor() { bone_paint_strength->set_max(1); bone_paint_strength->set_step(0.01); bone_paint_strength->set_value(0.5); + bone_paint_strength->set_accessibility_name(TTRC("Strength")); bone_paint_radius_label = memnew(Label(TTR("Radius:"))); toolbar->add_child(bone_paint_radius_label); @@ -1337,6 +1350,7 @@ Polygon2DEditor::Polygon2DEditor() { bone_paint_radius->set_max(100); bone_paint_radius->set_step(1); bone_paint_radius->set_value(32); + bone_paint_radius->set_accessibility_name(TTRC("Radius")); HSplitContainer *uv_main_hsc = memnew(HSplitContainer); polygon_edit->add_child(uv_main_hsc); @@ -1407,6 +1421,7 @@ Polygon2DEditor::Polygon2DEditor() { sb_off_x->set_value(snap_offset.x); sb_off_x->set_suffix("px"); sb_off_x->connect(SceneStringName(value_changed), callable_mp(this, &Polygon2DEditor::_set_snap_off_x)); + sb_off_x->set_accessibility_name(TTRC("Grid Offset X")); grid_settings_vb->add_margin_child(TTR("Grid Offset X:"), sb_off_x); SpinBox *sb_off_y = memnew(SpinBox); @@ -1416,6 +1431,7 @@ Polygon2DEditor::Polygon2DEditor() { sb_off_y->set_value(snap_offset.y); sb_off_y->set_suffix("px"); sb_off_y->connect(SceneStringName(value_changed), callable_mp(this, &Polygon2DEditor::_set_snap_off_y)); + sb_off_y->set_accessibility_name(TTRC("Grid Offset Y")); grid_settings_vb->add_margin_child(TTR("Grid Offset Y:"), sb_off_y); SpinBox *sb_step_x = memnew(SpinBox); @@ -1425,6 +1441,7 @@ Polygon2DEditor::Polygon2DEditor() { sb_step_x->set_value(snap_step.x); sb_step_x->set_suffix("px"); sb_step_x->connect(SceneStringName(value_changed), callable_mp(this, &Polygon2DEditor::_set_snap_step_x)); + sb_step_x->set_accessibility_name(TTRC("Grid Step X")); grid_settings_vb->add_margin_child(TTR("Grid Step X:"), sb_step_x); SpinBox *sb_step_y = memnew(SpinBox); @@ -1434,6 +1451,7 @@ Polygon2DEditor::Polygon2DEditor() { sb_step_y->set_value(snap_step.y); sb_step_y->set_suffix("px"); sb_step_y->connect(SceneStringName(value_changed), callable_mp(this, &Polygon2DEditor::_set_snap_step_y)); + sb_step_y->set_accessibility_name(TTRC("Grid Step Y")); grid_settings_vb->add_margin_child(TTR("Grid Step Y:"), sb_step_y); zoom_widget = memnew(EditorZoomWidget); diff --git a/editor/plugins/polygon_3d_editor_plugin.cpp b/editor/plugins/polygon_3d_editor_plugin.cpp index 49fca7f7ea..ee1bdeef8d 100644 --- a/editor/plugins/polygon_3d_editor_plugin.cpp +++ b/editor/plugins/polygon_3d_editor_plugin.cpp @@ -533,6 +533,7 @@ Polygon3DEditor::Polygon3DEditor() { button_create = memnew(Button); button_create->set_theme_type_variation(SceneStringName(FlatButton)); + button_create->set_accessibility_name(TTRC("Create Polygon")); button_create->set_tooltip_text(TTRC("Create Polygon")); add_child(button_create); button_create->connect(SceneStringName(pressed), callable_mp(this, &Polygon3DEditor::_menu_option).bind(MODE_CREATE)); @@ -540,6 +541,7 @@ Polygon3DEditor::Polygon3DEditor() { button_edit = memnew(Button); button_edit->set_theme_type_variation(SceneStringName(FlatButton)); + button_edit->set_accessibility_name(TTRC("Edit Polygon")); button_edit->set_tooltip_text(TTRC("Edit Polygon")); add_child(button_edit); button_edit->connect(SceneStringName(pressed), callable_mp(this, &Polygon3DEditor::_menu_option).bind(MODE_EDIT)); diff --git a/editor/plugins/resource_preloader_editor_plugin.cpp b/editor/plugins/resource_preloader_editor_plugin.cpp index 8f11c11a5c..ec35b4f8b5 100644 --- a/editor/plugins/resource_preloader_editor_plugin.cpp +++ b/editor/plugins/resource_preloader_editor_plugin.cpp @@ -253,7 +253,7 @@ void ResourcePreloaderEditor::edit(ResourcePreloader *p_preloader) { } Variant ResourcePreloaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { - TreeItem *ti = tree->get_item_at_position(p_point); + TreeItem *ti = (p_point == Vector2(INFINITY, INFINITY)) ? tree->get_selected() : tree->get_item_at_position(p_point); if (!ti) { return Variant(); } @@ -356,6 +356,7 @@ ResourcePreloaderEditor::ResourcePreloaderEditor() { vbc->add_child(hbc); load = memnew(Button); + load->set_accessibility_name(TTRC("Load Resource")); load->set_tooltip_text(TTR("Load Resource")); hbc->add_child(load); diff --git a/editor/plugins/root_motion_editor_plugin.cpp b/editor/plugins/root_motion_editor_plugin.cpp index 9016c65008..f4bc2a81d6 100644 --- a/editor/plugins/root_motion_editor_plugin.cpp +++ b/editor/plugins/root_motion_editor_plugin.cpp @@ -196,12 +196,14 @@ EditorPropertyRootMotion::EditorPropertyRootMotion() { HBoxContainer *hbc = memnew(HBoxContainer); add_child(hbc); assign = memnew(Button); + assign->set_accessibility_name(TTRC("Assign")); assign->set_h_size_flags(SIZE_EXPAND_FILL); assign->set_clip_text(true); assign->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyRootMotion::_node_assign)); hbc->add_child(assign); clear = memnew(Button); + clear->set_accessibility_name(TTRC("Clear")); clear->connect(SceneStringName(pressed), callable_mp(this, &EditorPropertyRootMotion::_node_clear)); hbc->add_child(clear); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 01ff2aa905..ad0905ac88 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3272,7 +3272,15 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co if (se || eh) { int new_index = 0; if (script_list->get_item_count() > 0) { - new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int pos = 0; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (script_list->is_anything_selected()) { + pos = script_list->get_selected_items()[0]; + } + } else { + pos = script_list->get_item_at_position(p_point); + } + new_index = script_list->get_item_metadata(pos); } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); @@ -3292,7 +3300,15 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co if (se || eh) { int new_index = 0; if (script_list->get_item_count() > 0) { - new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int pos = 0; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (script_list->is_anything_selected()) { + pos = script_list->get_selected_items()[0]; + } + } else { + pos = script_list->get_item_at_position(p_point); + } + new_index = script_list->get_item_metadata(pos); } tab_container->move_child(node, new_index); tab_container->set_current_tab(new_index); @@ -3305,7 +3321,15 @@ void ScriptEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Co int new_index = 0; if (script_list->get_item_count() > 0) { - new_index = script_list->get_item_metadata(script_list->get_item_at_position(p_point)); + int pos = 0; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (script_list->is_anything_selected()) { + pos = script_list->get_selected_items()[0]; + } + } else { + pos = script_list->get_item_at_position(p_point); + } + new_index = script_list->get_item_metadata(pos); } int num_tabs_before = tab_container->get_tab_count(); for (int i = 0; i < files.size(); i++) { @@ -4172,6 +4196,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { filter_scripts = memnew(LineEdit); filter_scripts->set_placeholder(TTR("Filter Scripts")); + filter_scripts->set_accessibility_name(TTRC("Filter Scripts")); filter_scripts->set_clear_button_enabled(true); filter_scripts->connect(SceneStringName(text_changed), callable_mp(this, &ScriptEditor::_filter_scripts_text_changed)); scripts_vbox->add_child(filter_scripts); @@ -4211,6 +4236,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { members_overview_alphabeta_sort_button = memnew(Button); members_overview_alphabeta_sort_button->set_flat(true); + members_overview_alphabeta_sort_button->set_accessibility_name(TTRC("Alphabetical Sorting")); 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(EDITOR_GET("text_editor/script_list/sort_members_outline_alphabetically")); @@ -4220,6 +4246,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { filter_methods = memnew(LineEdit); filter_methods->set_placeholder(TTR("Filter Methods")); + filter_methods->set_accessibility_name(TTRC("Filter Methods")); filter_methods->set_clear_button_enabled(true); filter_methods->connect(SceneStringName(text_changed), callable_mp(this, &ScriptEditor::_filter_methods_text_changed)); overview_vbox->add_child(filter_methods); @@ -4366,6 +4393,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { menu_hb->add_spacer(); site_search = memnew(Button); + site_search->set_accessibility_name(TTRC("Site Search")); site_search->set_flat(true); site_search->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_menu_option).bind(SEARCH_WEBSITE)); menu_hb->add_child(site_search); @@ -4380,6 +4408,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { menu_hb->add_child(memnew(VSeparator)); script_back = memnew(Button); + script_back->set_accessibility_name(TTRC("Previous")); script_back->set_flat(true); script_back->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_history_back)); menu_hb->add_child(script_back); @@ -4387,6 +4416,7 @@ ScriptEditor::ScriptEditor(WindowWrapper *p_wrapper) { script_back->set_tooltip_text(TTR("Go to previous edited document.")); script_forward = memnew(Button); + script_forward->set_accessibility_name(TTRC("Next")); script_forward->set_flat(true); script_forward->connect(SceneStringName(pressed), callable_mp(this, &ScriptEditor::_history_forward)); menu_hb->add_child(script_forward); diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp index 72466f915a..3f1979eb7f 100644 --- a/editor/plugins/script_text_editor.cpp +++ b/editor/plugins/script_text_editor.cpp @@ -1958,7 +1958,7 @@ void ScriptTextEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data Dictionary d = p_data; CodeEdit *te = code_editor->get_text_editor(); - Point2i pos = te->get_line_column_at_pos(p_point); + Point2i pos = (p_point == Vector2(INFINITY, INFINITY)) ? Point2i(te->get_caret_line(0), te->get_caret_column(0)) : te->get_line_column_at_pos(p_point); int drop_at_line = pos.y; int drop_at_column = pos.x; int selection_index = te->get_selection_at_line_column(drop_at_line, drop_at_column); diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 71917fde08..e88985ac34 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -641,7 +641,14 @@ Variant ShaderEditorPlugin::get_drag_data_fw(const Point2 &p_point, Control *p_f return Variant(); } - int idx = shader_list->get_item_at_position(p_point); + int idx = 0; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (shader_list->is_anything_selected()) { + idx = shader_list->get_selected_items()[0]; + } + } else { + idx = shader_list->get_item_at_position(p_point); + } if (idx < 0) { return Variant(); } @@ -718,7 +725,14 @@ void ShaderEditorPlugin::drop_data_fw(const Point2 &p_point, const Variant &p_da if (String(d["type"]) == "shader_list_element") { int idx = d["shader_list_element"]; - int new_idx = shader_list->get_item_at_position(p_point); + int new_idx = 0; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (shader_list->is_anything_selected()) { + new_idx = shader_list->get_selected_items()[0]; + } + } else { + new_idx = shader_list->get_item_at_position(p_point); + } _move_shader_tab(idx, new_idx); return; } diff --git a/editor/plugins/skeleton_3d_editor_plugin.cpp b/editor/plugins/skeleton_3d_editor_plugin.cpp index 6b701251ad..496214e2f2 100644 --- a/editor/plugins/skeleton_3d_editor_plugin.cpp +++ b/editor/plugins/skeleton_3d_editor_plugin.cpp @@ -701,7 +701,7 @@ Variant Skeleton3DEditor::get_drag_data_fw(const Point2 &p_point, Control *p_fro } bool Skeleton3DEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { - TreeItem *target = joint_tree->get_item_at_position(p_point); + TreeItem *target = (p_point == Vector2(INFINITY, INFINITY)) ? joint_tree->get_selected() : joint_tree->get_item_at_position(p_point); if (!target) { return false; } @@ -729,7 +729,7 @@ void Skeleton3DEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data return; } - TreeItem *target = joint_tree->get_item_at_position(p_point); + TreeItem *target = (p_point == Vector2(INFINITY, INFINITY)) ? joint_tree->get_selected() : joint_tree->get_item_at_position(p_point); TreeItem *selected = Object::cast_to(Dictionary(p_data)["node"]); const BoneId target_boneidx = String(target->get_metadata(0)).get_slicec('/', 1).to_int(); @@ -1026,6 +1026,7 @@ void Skeleton3DEditor::create_editors() { edit_mode_button->set_toggle_mode(true); edit_mode_button->set_focus_mode(FOCUS_NONE); edit_mode_button->set_tooltip_text(TTR("Edit Mode\nShow buttons on joints.")); + edit_mode_button->set_accessibility_name(TTRC("Edit Mode")); edit_mode_button->connect(SceneStringName(toggled), callable_mp(this, &Skeleton3DEditor::edit_mode_toggled)); edit_mode = false; @@ -1047,6 +1048,7 @@ void Skeleton3DEditor::create_editors() { key_loc_button->set_pressed(false); key_loc_button->set_focus_mode(FOCUS_NONE); key_loc_button->set_tooltip_text(TTR("Translation mask for inserting keys.")); + key_loc_button->set_accessibility_name(TTRC("Translation Mask")); animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); @@ -1055,6 +1057,7 @@ void Skeleton3DEditor::create_editors() { key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); key_rot_button->set_tooltip_text(TTR("Rotation mask for inserting keys.")); + key_rot_button->set_accessibility_name(TTRC("Rotation Mask")); animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); @@ -1063,6 +1066,7 @@ void Skeleton3DEditor::create_editors() { key_scale_button->set_pressed(false); key_scale_button->set_focus_mode(FOCUS_NONE); key_scale_button->set_tooltip_text(TTR("Scale mask for inserting keys.")); + key_scale_button->set_accessibility_name(TTRC("Scale Mask")); animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); @@ -1071,6 +1075,7 @@ void Skeleton3DEditor::create_editors() { key_insert_button->connect(SceneStringName(pressed), callable_mp(this, &Skeleton3DEditor::insert_keys).bind(false)); key_insert_button->set_tooltip_text(TTRC("Insert key (based on mask) for bones with an existing track.")); key_insert_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_to_existing_tracks", TTRC("Insert Key (Existing Tracks)"), Key::INSERT)); + key_insert_button->set_accessibility_name(TTRC("Insert Key")); animation_hb->add_child(key_insert_button); key_insert_all_button = memnew(Button); @@ -1078,6 +1083,7 @@ void Skeleton3DEditor::create_editors() { key_insert_all_button->set_focus_mode(FOCUS_NONE); key_insert_all_button->connect(SceneStringName(pressed), callable_mp(this, &Skeleton3DEditor::insert_keys).bind(true)); key_insert_all_button->set_tooltip_text(TTRC("Insert key (based on mask) for all bones.")); + key_insert_all_button->set_accessibility_name(TTRC("Insert Key for All Bones")); key_insert_all_button->set_shortcut(ED_SHORTCUT("skeleton_3d_editor/insert_key_of_all_bones", TTRC("Insert Key (All Bones)"), KeyModifierMask::CMD_OR_CTRL + 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 0c9e752098..c1b966b135 100644 --- a/editor/plugins/sprite_2d_editor_plugin.cpp +++ b/editor/plugins/sprite_2d_editor_plugin.cpp @@ -633,6 +633,7 @@ Sprite2DEditor::Sprite2DEditor() { simplification->set_max(10.00); simplification->set_step(0.01); simplification->set_value(2); + simplification->set_accessibility_name(TTRC("Simplification")); hb->add_child(simplification); hb->add_spacer(); hb->add_child(memnew(Label(TTR("Shrink (Pixels):")))); @@ -641,6 +642,7 @@ Sprite2DEditor::Sprite2DEditor() { shrink_pixels->set_max(10); shrink_pixels->set_step(1); shrink_pixels->set_value(0); + shrink_pixels->set_accessibility_name(TTRC("Shrink")); hb->add_child(shrink_pixels); hb->add_spacer(); hb->add_child(memnew(Label(TTR("Grow (Pixels):")))); @@ -649,6 +651,7 @@ Sprite2DEditor::Sprite2DEditor() { grow_pixels->set_max(10); grow_pixels->set_step(1); grow_pixels->set_value(2); + grow_pixels->set_accessibility_name(TTRC("Grow")); hb->add_child(grow_pixels); hb->add_spacer(); update_preview = memnew(Button); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 1ed85b8564..c3f9619357 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1653,7 +1653,14 @@ Variant SpriteFramesEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f return false; } - int idx = frame_list->get_item_at_position(p_point, true); + int idx = -1; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (frame_list->is_anything_selected()) { + idx = frame_list->get_selected_items()[0]; + } + } else { + idx = frame_list->get_item_at_position(p_point, true); + } if (idx < 0 || idx >= frames->get_frame_count(edited_anim)) { return Variant(); @@ -1728,7 +1735,14 @@ void SpriteFramesEditor::drop_data_fw(const Point2 &p_point, const Variant &p_da return; } - int at_pos = frame_list->get_item_at_position(p_point, true); + int at_pos = -1; + if (p_point == Vector2(INFINITY, INFINITY)) { + if (frame_list->is_anything_selected()) { + at_pos = frame_list->get_selected_items()[0]; + } + } else { + at_pos = frame_list->get_item_at_position(p_point, true); + } if (String(d["type"]) == "resource" && d.has("resource")) { Ref r = d["resource"]; @@ -1946,16 +1960,19 @@ SpriteFramesEditor::SpriteFramesEditor() { add_anim = memnew(Button); add_anim->set_theme_type_variation(SceneStringName(FlatButton)); + add_anim->set_accessibility_name(TTRC("Add Animation")); hbc_animlist->add_child(add_anim); add_anim->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_animation_add)); duplicate_anim = memnew(Button); duplicate_anim->set_theme_type_variation(SceneStringName(FlatButton)); + duplicate_anim->set_accessibility_name(TTRC("Duplicate Animation")); hbc_animlist->add_child(duplicate_anim); duplicate_anim->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_animation_duplicate)); delete_anim = memnew(Button); delete_anim->set_theme_type_variation(SceneStringName(FlatButton)); + delete_anim->set_accessibility_name(TTRC("Delete Animation")); hbc_animlist->add_child(delete_anim); delete_anim->set_disabled(true); delete_anim->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_animation_remove)); @@ -1967,6 +1984,7 @@ SpriteFramesEditor::SpriteFramesEditor() { autoplay = memnew(Button); autoplay->set_theme_type_variation(SceneStringName(FlatButton)); + autoplay->set_accessibility_name(TTRC("Autoplay on Load")); autoplay->set_tooltip_text(TTR("Autoplay on Load")); autoplay_container->add_child(autoplay); @@ -1975,6 +1993,7 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_loop = memnew(Button); anim_loop->set_toggle_mode(true); anim_loop->set_theme_type_variation(SceneStringName(FlatButton)); + anim_loop->set_accessibility_name(TTRC("Animation Looping")); anim_loop->set_tooltip_text(TTR("Animation Looping")); anim_loop->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_animation_loop_changed)); hbc_animlist->add_child(anim_loop); @@ -1986,6 +2005,7 @@ SpriteFramesEditor::SpriteFramesEditor() { anim_speed->set_step(0.01); anim_speed->set_custom_arrow_step(1); anim_speed->set_tooltip_text(TTR("Animation Speed")); + anim_speed->set_accessibility_name(TTRC("Animation Speed")); anim_speed->get_line_edit()->set_expand_to_text_length_enabled(true); anim_speed->get_line_edit()->connect(SceneStringName(resized), callable_mp(this, &SpriteFramesEditor::_animation_speed_resized)); anim_speed->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_animation_speed_changed)); @@ -1995,6 +2015,7 @@ SpriteFramesEditor::SpriteFramesEditor() { sub_vb->add_child(anim_search_box); anim_search_box->set_h_size_flags(SIZE_EXPAND_FILL); anim_search_box->set_placeholder(TTR("Filter Animations")); + anim_search_box->set_accessibility_name(TTRC("Filter Animations")); anim_search_box->set_clear_button_enabled(true); anim_search_box->connect(SceneStringName(text_changed), callable_mp(this, &SpriteFramesEditor::_animation_search_text_changed)); @@ -2042,26 +2063,31 @@ SpriteFramesEditor::SpriteFramesEditor() { play_bw_from = memnew(Button); play_bw_from->set_theme_type_variation(SceneStringName(FlatButton)); play_bw_from->set_tooltip_text(TTR("Play selected animation backwards from current pos. (A)")); + play_bw_from->set_accessibility_name(TTRC("Play Backwards")); playback_container->add_child(play_bw_from); play_bw = memnew(Button); play_bw->set_theme_type_variation(SceneStringName(FlatButton)); play_bw->set_tooltip_text(TTR("Play selected animation backwards from end. (Shift+A)")); + play_bw->set_accessibility_name(TTRC("Play Backwards from End")); playback_container->add_child(play_bw); stop = memnew(Button); stop->set_theme_type_variation(SceneStringName(FlatButton)); stop->set_tooltip_text(TTR("Pause/stop animation playback. (S)")); + stop->set_accessibility_name(TTRC("Pause/Stop")); playback_container->add_child(stop); play = memnew(Button); play->set_theme_type_variation(SceneStringName(FlatButton)); play->set_tooltip_text(TTR("Play selected animation from start. (Shift+D)")); + play->set_accessibility_name(TTRC("Play from Start")); playback_container->add_child(play); play_from = memnew(Button); play_from->set_theme_type_variation(SceneStringName(FlatButton)); play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); + play_from->set_accessibility_name(TTRC("Play")); playback_container->add_child(play_from); hfc->add_child(memnew(VSeparator)); @@ -2078,44 +2104,53 @@ SpriteFramesEditor::SpriteFramesEditor() { hfc->add_child(hbc_actions); load = memnew(Button); + load->set_accessibility_name(TTRC("Load")); load->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(load); load_sheet = memnew(Button); + load_sheet->set_accessibility_name(TTRC("Load Sheet")); load_sheet->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(load_sheet); hbc_actions->add_child(memnew(VSeparator)); copy = memnew(Button); + copy->set_accessibility_name(TTRC("Copy")); copy->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(copy); paste = memnew(Button); + paste->set_accessibility_name(TTRC("Paste")); paste->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(paste); hbc_actions->add_child(memnew(VSeparator)); empty_before = memnew(Button); + empty_before->set_accessibility_name(TTRC("Empty Before")); empty_before->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(empty_before); empty_after = memnew(Button); + empty_after->set_accessibility_name(TTRC("Empty After")); empty_after->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(empty_after); hbc_actions->add_child(memnew(VSeparator)); move_up = memnew(Button); + move_up->set_accessibility_name(TTRC("Move Up")); move_up->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(move_up); move_down = memnew(Button); + move_down->set_accessibility_name(TTRC("Move Down")); move_down->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(move_down); delete_frame = memnew(Button); + delete_frame->set_accessibility_name(TTRC("Delete Frame")); delete_frame->set_theme_type_variation(SceneStringName(FlatButton)); hbc_actions->add_child(delete_frame); @@ -2137,6 +2172,7 @@ SpriteFramesEditor::SpriteFramesEditor() { frame_duration->set_allow_lesser(false); frame_duration->set_allow_greater(true); frame_duration->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_frame_duration_changed)); + frame_duration->set_accessibility_name(TTRC("Frame Duration")); hbc_frame_duration->add_child(frame_duration); // Wide empty separation control. (like BoxContainer::add_spacer()) @@ -2152,18 +2188,21 @@ SpriteFramesEditor::SpriteFramesEditor() { zoom_out->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_zoom_out)); zoom_out->set_flat(true); zoom_out->set_tooltip_text(TTRC("Zoom Out")); + zoom_out->set_accessibility_name(TTRC("Zoom Out")); hbc_zoom->add_child(zoom_out); zoom_reset = memnew(Button); zoom_reset->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_zoom_reset)); zoom_reset->set_flat(true); zoom_reset->set_tooltip_text(TTRC("Zoom Reset")); + zoom_reset->set_accessibility_name(TTRC("Reset Zoom")); hbc_zoom->add_child(zoom_reset); zoom_in = memnew(Button); zoom_in->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_zoom_in)); zoom_in->set_flat(true); zoom_in->set_tooltip_text(TTRC("Zoom In")); + zoom_in->set_accessibility_name(TTRC("Zoom In")); hbc_zoom->add_child(zoom_in); file = memnew(EditorFileDialog); @@ -2286,6 +2325,7 @@ SpriteFramesEditor::SpriteFramesEditor() { toggle_settings_button->set_theme_type_variation(SceneStringName(FlatButton)); toggle_settings_button->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_toggle_show_settings)); toggle_settings_button->set_tooltip_text(TTR("Toggle Settings Panel")); + toggle_settings_button->set_accessibility_name(TTRC("Settings Panel")); split_sheet_menu_hb->add_child(toggle_settings_button); split_sheet_vb->add_child(split_sheet_menu_hb); @@ -2324,6 +2364,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_zoom_out->set_theme_type_variation(SceneStringName(FlatButton)); split_sheet_zoom_out->set_focus_mode(FOCUS_NONE); split_sheet_zoom_out->set_tooltip_text(TTR("Zoom Out")); + split_sheet_zoom_out->set_accessibility_name(TTRC("Zoom Out")); split_sheet_zoom_out->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_out)); split_sheet_zoom_hb->add_child(split_sheet_zoom_out); @@ -2331,6 +2372,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_zoom_reset->set_theme_type_variation(SceneStringName(FlatButton)); split_sheet_zoom_reset->set_focus_mode(FOCUS_NONE); split_sheet_zoom_reset->set_tooltip_text(TTR("Zoom Reset")); + split_sheet_zoom_reset->set_accessibility_name(TTRC("Reset Zoom")); split_sheet_zoom_reset->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_reset)); split_sheet_zoom_hb->add_child(split_sheet_zoom_reset); @@ -2338,6 +2380,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_zoom_in->set_theme_type_variation(SceneStringName(FlatButton)); split_sheet_zoom_in->set_focus_mode(FOCUS_NONE); split_sheet_zoom_in->set_tooltip_text(TTR("Zoom In")); + split_sheet_zoom_in->set_accessibility_name(TTRC("Zoom In")); split_sheet_zoom_in->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_sheet_zoom_in)); split_sheet_zoom_hb->add_child(split_sheet_zoom_in); @@ -2357,6 +2400,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_h->set_max(128); split_sheet_h->set_step(1); split_sheet_h->set_select_all_on_focus(true); + split_sheet_h->set_accessibility_name(TTRC("Horizontal")); split_sheet_h_hb->add_child(split_sheet_h); split_sheet_h->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_FRAME_COUNT)); split_sheet_settings_vb->add_child(split_sheet_h_hb); @@ -2374,6 +2418,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_v->set_max(128); split_sheet_v->set_step(1); split_sheet_v->set_select_all_on_focus(true); + split_sheet_v->set_accessibility_name(TTRC("Vertical")); split_sheet_v_hb->add_child(split_sheet_v); split_sheet_v->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_FRAME_COUNT)); split_sheet_settings_vb->add_child(split_sheet_v_hb); @@ -2394,6 +2439,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_size_x->set_step(1); split_sheet_size_x->set_suffix("px"); split_sheet_size_x->set_select_all_on_focus(true); + split_sheet_size_x->set_accessibility_name(TTRC("X Size")); split_sheet_size_x->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_SIZE)); split_sheet_size_vb->add_child(split_sheet_size_x); split_sheet_size_y = memnew(SpinBox); @@ -2402,6 +2448,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_size_y->set_step(1); split_sheet_size_y->set_suffix("px"); split_sheet_size_y->set_select_all_on_focus(true); + split_sheet_size_y->set_accessibility_name(TTRC("Y Size")); split_sheet_size_y->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_SIZE)); split_sheet_size_vb->add_child(split_sheet_size_y); split_sheet_size_hb->add_child(split_sheet_size_vb); @@ -2422,6 +2469,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_sep_x->set_step(1); split_sheet_sep_x->set_suffix("px"); split_sheet_sep_x->set_select_all_on_focus(true); + split_sheet_sep_x->set_accessibility_name(TTRC("X Separation")); split_sheet_sep_x->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_USE_CURRENT)); split_sheet_sep_vb->add_child(split_sheet_sep_x); split_sheet_sep_y = memnew(SpinBox); @@ -2429,6 +2477,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_sep_y->set_step(1); split_sheet_sep_y->set_suffix("px"); split_sheet_sep_y->set_select_all_on_focus(true); + split_sheet_sep_y->set_accessibility_name(TTRC("Y Separation")); split_sheet_sep_y->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_USE_CURRENT)); split_sheet_sep_vb->add_child(split_sheet_sep_y); split_sheet_sep_hb->add_child(split_sheet_sep_vb); @@ -2449,6 +2498,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_offset_x->set_step(1); split_sheet_offset_x->set_suffix("px"); split_sheet_offset_x->set_select_all_on_focus(true); + split_sheet_offset_x->set_accessibility_name(TTRC("X Offset")); split_sheet_offset_x->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_USE_CURRENT)); split_sheet_offset_vb->add_child(split_sheet_offset_x); split_sheet_offset_y = memnew(SpinBox); @@ -2456,6 +2506,7 @@ SpriteFramesEditor::SpriteFramesEditor() { split_sheet_offset_y->set_step(1); split_sheet_offset_y->set_suffix("px"); split_sheet_offset_y->set_select_all_on_focus(true); + split_sheet_offset_y->set_accessibility_name(TTRC("Y Offset")); split_sheet_offset_y->connect(SceneStringName(value_changed), callable_mp(this, &SpriteFramesEditor::_sheet_spin_changed).bind(PARAM_USE_CURRENT)); split_sheet_offset_vb->add_child(split_sheet_offset_y); split_sheet_offset_hb->add_child(split_sheet_offset_vb); diff --git a/editor/plugins/style_box_editor_plugin.cpp b/editor/plugins/style_box_editor_plugin.cpp index 8098b9be70..b7ce74d838 100644 --- a/editor/plugins/style_box_editor_plugin.cpp +++ b/editor/plugins/style_box_editor_plugin.cpp @@ -113,6 +113,7 @@ StyleBoxPreview::StyleBoxPreview() { // This theme variation works better than the normal theme because there's no focus highlight. grid_preview->set_theme_type_variation("PreviewLightButton"); grid_preview->set_tooltip_text(TTRC("Toggle margins preview grid.")); + grid_preview->set_accessibility_name(TTRC("Margins Preview Grid")); grid_preview->set_toggle_mode(true); grid_preview->connect(SceneStringName(toggled), callable_mp(this, &StyleBoxPreview::_grid_preview_toggled)); grid_preview->set_pressed(grid_preview_enabled); diff --git a/editor/plugins/texture_region_editor_plugin.cpp b/editor/plugins/texture_region_editor_plugin.cpp index 980e739fc5..bcc55fbb28 100644 --- a/editor/plugins/texture_region_editor_plugin.cpp +++ b/editor/plugins/texture_region_editor_plugin.cpp @@ -1154,6 +1154,7 @@ TextureRegionEditor::TextureRegionEditor() { snap_mode_button = memnew(OptionButton); hb_tools->add_child(snap_mode_button); + snap_mode_button->set_accessibility_name(TTRC("Snap Mode")); snap_mode_button->add_item(TTR("None"), 0); snap_mode_button->add_item(TTR("Pixel Snap"), 1); snap_mode_button->add_item(TTR("Grid Snap"), 2); @@ -1171,12 +1172,14 @@ TextureRegionEditor::TextureRegionEditor() { sb_off_x->set_step(1); sb_off_x->set_suffix("px"); sb_off_x->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_off_x)); + sb_off_x->set_accessibility_name(TTRC("Offset X")); hb_grid->add_child(sb_off_x); sb_off_y = memnew(SpinBox); sb_off_y->set_step(1); sb_off_y->set_suffix("px"); sb_off_y->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_off_y)); + sb_off_y->set_accessibility_name(TTRC("Offset Y")); hb_grid->add_child(sb_off_y); hb_grid->add_child(memnew(VSeparator)); @@ -1187,6 +1190,7 @@ TextureRegionEditor::TextureRegionEditor() { sb_step_x->set_step(1); sb_step_x->set_suffix("px"); sb_step_x->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_step_x)); + sb_step_x->set_accessibility_name(TTRC("Step X")); hb_grid->add_child(sb_step_x); sb_step_y = memnew(SpinBox); @@ -1194,6 +1198,7 @@ TextureRegionEditor::TextureRegionEditor() { sb_step_y->set_step(1); sb_step_y->set_suffix("px"); sb_step_y->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_step_y)); + sb_step_y->set_accessibility_name(TTRC("Step Y")); hb_grid->add_child(sb_step_y); hb_grid->add_child(memnew(VSeparator)); @@ -1204,6 +1209,7 @@ TextureRegionEditor::TextureRegionEditor() { sb_sep_x->set_step(1); sb_sep_x->set_suffix("px"); sb_sep_x->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_sep_x)); + sb_sep_x->set_accessibility_name(TTRC("Separation X")); hb_grid->add_child(sb_sep_x); sb_sep_y = memnew(SpinBox); @@ -1211,6 +1217,7 @@ TextureRegionEditor::TextureRegionEditor() { sb_sep_y->set_step(1); sb_sep_y->set_suffix("px"); sb_sep_y->connect(SceneStringName(value_changed), callable_mp(this, &TextureRegionEditor::_set_snap_sep_y)); + sb_sep_y->set_accessibility_name(TTRC("Separation Y")); hb_grid->add_child(sb_sep_y); hb_grid->hide(); @@ -1249,18 +1256,21 @@ TextureRegionEditor::TextureRegionEditor() { zoom_out = memnew(Button); zoom_out->set_flat(true); zoom_out->set_tooltip_text(TTR("Zoom Out")); + zoom_out->set_accessibility_name(TTRC("Zoom Out")); zoom_out->connect(SceneStringName(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_text(TTR("Zoom Reset")); + zoom_reset->set_accessibility_name(TTRC("Reset Zoom")); zoom_reset->connect(SceneStringName(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_text(TTR("Zoom In")); + zoom_in->set_accessibility_name(TTRC("Zoom In")); zoom_in->connect(SceneStringName(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 f2e092390d..690571cd49 100644 --- a/editor/plugins/theme_editor_plugin.cpp +++ b/editor/plugins/theme_editor_plugin.cpp @@ -1957,6 +1957,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_color = memnew(Button); edit_items_add_color->set_tooltip_text(TTR("Add Color Item")); + edit_items_add_color->set_accessibility_name(TTRC("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); @@ -1964,6 +1965,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_constant = memnew(Button); edit_items_add_constant->set_tooltip_text(TTR("Add Constant Item")); + edit_items_add_constant->set_accessibility_name(TTRC("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); @@ -1971,6 +1973,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_font = memnew(Button); edit_items_add_font->set_tooltip_text(TTR("Add Font Item")); + edit_items_add_font->set_accessibility_name(TTRC("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); @@ -1978,6 +1981,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_font_size = memnew(Button); edit_items_add_font_size->set_tooltip_text(TTR("Add Font Size Item")); + edit_items_add_font_size->set_accessibility_name(TTRC("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); @@ -1985,6 +1989,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_icon = memnew(Button); edit_items_add_icon->set_tooltip_text(TTR("Add Icon Item")); + edit_items_add_icon->set_accessibility_name(TTRC("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); @@ -1992,6 +1997,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_add_stylebox = memnew(Button); edit_items_add_stylebox->set_tooltip_text(TTR("Add StyleBox Item")); + edit_items_add_stylebox->set_accessibility_name(TTRC("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); @@ -2005,6 +2011,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_remove_class = memnew(Button); edit_items_remove_class->set_tooltip_text(TTR("Remove Class Items")); + edit_items_remove_class->set_accessibility_name(TTRC("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); @@ -2012,6 +2019,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_remove_custom = memnew(Button); edit_items_remove_custom->set_tooltip_text(TTR("Remove Custom Items")); + edit_items_remove_custom->set_accessibility_name(TTRC("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); @@ -2019,6 +2027,7 @@ ThemeItemEditorDialog::ThemeItemEditorDialog(ThemeTypeEditor *p_theme_type_edito edit_items_remove_all = memnew(Button); edit_items_remove_all->set_tooltip_text(TTR("Remove All Items")); + edit_items_remove_all->set_accessibility_name(TTRC("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); @@ -2473,6 +2482,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_rename_button = memnew(Button); item_rename_button->set_button_icon(get_editor_theme_icon(SNAME("Edit"))); item_rename_button->set_tooltip_text(TTR("Rename Item")); + item_rename_button->set_accessibility_name(TTRC("Rename Item")); item_rename_button->set_flat(true); item_name_container->add_child(item_rename_button); item_rename_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_cbk).bind(p_data_type, p_item_name, item_name_container)); @@ -2480,6 +2490,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_remove_button = memnew(Button); item_remove_button->set_button_icon(get_editor_theme_icon(SNAME("Remove"))); item_remove_button->set_tooltip_text(TTR("Remove Item")); + item_remove_button->set_accessibility_name(TTRC("Remove Item")); item_remove_button->set_flat(true); item_name_container->add_child(item_remove_button); item_remove_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_remove_cbk).bind(p_data_type, p_item_name)); @@ -2487,6 +2498,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_rename_confirm_button = memnew(Button); item_rename_confirm_button->set_button_icon(get_editor_theme_icon(SNAME("ImportCheck"))); item_rename_confirm_button->set_tooltip_text(TTR("Confirm Item Rename")); + item_rename_confirm_button->set_accessibility_name(TTRC("Confirm Item Rename")); item_rename_confirm_button->set_flat(true); item_name_container->add_child(item_rename_confirm_button); item_rename_confirm_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_confirmed).bind(p_data_type, p_item_name, item_name_container)); @@ -2495,6 +2507,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_rename_cancel_button = memnew(Button); item_rename_cancel_button->set_button_icon(get_editor_theme_icon(SNAME("ImportFail"))); item_rename_cancel_button->set_tooltip_text(TTR("Cancel Item Rename")); + item_rename_cancel_button->set_accessibility_name(TTRC("Cancel Item Rename")); item_rename_cancel_button->set_flat(true); item_name_container->add_child(item_rename_cancel_button); item_rename_cancel_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_rename_canceled).bind(p_data_type, p_item_name, item_name_container)); @@ -2505,6 +2518,7 @@ HBoxContainer *ThemeTypeEditor::_create_property_control(Theme::DataType p_data_ Button *item_override_button = memnew(Button); item_override_button->set_button_icon(get_editor_theme_icon(SNAME("Add"))); item_override_button->set_tooltip_text(TTR("Override Item")); + item_override_button->set_accessibility_name(TTRC("Override Item")); item_override_button->set_flat(true); item_name_container->add_child(item_override_button); item_override_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_item_override_cbk).bind(p_data_type, p_item_name)); @@ -2714,6 +2728,7 @@ void ThemeTypeEditor::_update_type_items() { pin_leader_button->set_pressed(true); pin_leader_button->set_button_icon(get_editor_theme_icon(SNAME("Pin"))); pin_leader_button->set_tooltip_text(TTR("Unpin this StyleBox as a main style.")); + pin_leader_button->set_accessibility_name(TTRC("Unpin StyleBox")); item_control->add_child(pin_leader_button); pin_leader_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_on_unpin_leader_button_pressed)); @@ -2757,6 +2772,7 @@ void ThemeTypeEditor::_update_type_items() { pin_leader_button->set_toggle_mode(true); pin_leader_button->set_button_icon(get_editor_theme_icon(SNAME("Pin"))); 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.")); + pin_leader_button->set_accessibility_name(TTRC("Pin StyleBox as a Main Style")); item_control->add_child(pin_leader_button); pin_leader_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_on_pin_leader_button_pressed).bind(item_editor, E.key)); } else { @@ -3443,11 +3459,13 @@ ThemeTypeEditor::ThemeTypeEditor() { theme_type_list->set_h_size_flags(SIZE_EXPAND_FILL); theme_type_list->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); theme_type_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + theme_type_list->set_accessibility_name(TTRC("Type")); type_list_hb->add_child(theme_type_list); theme_type_list->connect(SceneStringName(item_selected), callable_mp(this, &ThemeTypeEditor::_list_type_selected)); add_type_button = memnew(Button); add_type_button->set_tooltip_text(TTR("Add a type from a list of available types or create a new one.")); + add_type_button->set_accessibility_name(TTRC("Add Type")); type_list_hb->add_child(add_type_button); add_type_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_add_type_button_cbk)); @@ -3510,9 +3528,11 @@ ThemeTypeEditor::ThemeTypeEditor() { type_variation_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); type_variation_edit->connect(SceneStringName(text_changed), callable_mp(this, &ThemeTypeEditor::_type_variation_changed)); type_variation_edit->connect(SceneStringName(focus_exited), callable_mp(this, &ThemeTypeEditor::_update_type_items)); + type_variation_edit->set_accessibility_name(TTRC("Base Type")); type_variation_button = memnew(Button); type_variation_hb->add_child(type_variation_button); type_variation_button->set_tooltip_text(TTR("Select the variation base type from a list of available types.")); + type_variation_button->set_accessibility_name(TTRC("Select Base Type")); type_variation_button->connect(SceneStringName(pressed), callable_mp(this, &ThemeTypeEditor::_add_type_variation_cbk)); type_variation_locked = memnew(Label); diff --git a/editor/plugins/tiles/tile_atlas_view.cpp b/editor/plugins/tiles/tile_atlas_view.cpp index cca6ffe1cf..1fb89945aa 100644 --- a/editor/plugins/tiles/tile_atlas_view.cpp +++ b/editor/plugins/tiles/tile_atlas_view.cpp @@ -650,6 +650,7 @@ TileAtlasView::TileAtlasView() { button_center_view->set_flat(true); button_center_view->set_disabled(true); button_center_view->set_tooltip_text(TTR("Center View")); + button_center_view->set_accessibility_name(TTRC("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 5a28e61765..653cb990ff 100644 --- a/editor/plugins/tiles/tile_data_editors.cpp +++ b/editor/plugins/tiles/tile_data_editors.cpp @@ -924,6 +924,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_expand->set_toggle_mode(true); button_expand->set_pressed(false); button_expand->set_tooltip_text(TTR("Expand editor")); + button_expand->set_accessibility_name(TTRC("Expand editor")); button_expand->connect(SceneStringName(toggled), callable_mp(this, &GenericTilePolygonEditor::_toggle_expand)); toolbar->add_child(button_expand); @@ -935,6 +936,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_create->set_button_group(tools_button_group); button_create->set_pressed(true); button_create->set_tooltip_text(TTR("Add polygon tool")); + button_create->set_accessibility_name(TTRC("Add Points")); toolbar->add_child(button_create); button_edit = memnew(Button); @@ -942,6 +944,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_edit->set_toggle_mode(true); button_edit->set_button_group(tools_button_group); button_edit->set_tooltip_text(TTR("Edit points tool")); + button_edit->set_accessibility_name(TTRC("Edit Points")); toolbar->add_child(button_edit); button_delete = memnew(Button); @@ -949,10 +952,12 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_delete->set_toggle_mode(true); button_delete->set_button_group(tools_button_group); button_delete->set_tooltip_text(TTR("Delete points tool")); + button_delete->set_accessibility_name(TTRC("Delete Points")); toolbar->add_child(button_delete); button_advanced_menu = memnew(MenuButton); button_advanced_menu->set_flat(false); + button_advanced_menu->set_accessibility_name(TTRC("Advanced")); button_advanced_menu->set_theme_type_variation("FlatMenuButton"); button_advanced_menu->set_toggle_mode(true); button_advanced_menu->get_popup()->add_item(TTR("Reset to default tile shape"), RESET_TO_DEFAULT_TILE, Key::F); @@ -971,6 +976,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_pixel_snap = memnew(MenuButton); toolbar->add_child(button_pixel_snap); button_pixel_snap->set_flat(false); + button_pixel_snap->set_accessibility_name(TTRC("Snap")); button_pixel_snap->set_theme_type_variation("FlatMenuButton"); button_pixel_snap->set_tooltip_text(TTR("Toggle Grid Snap")); button_pixel_snap->get_popup()->add_item(TTR("Disable Snap"), SNAP_NONE); @@ -980,6 +986,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { snap_subdivision = memnew(SpinBox); toolbar->add_child(snap_subdivision); + snap_subdivision->set_accessibility_name(TTRC("Subdivision")); snap_subdivision->get_line_edit()->add_theme_constant_override("minimum_character_width", 2); snap_subdivision->set_min(1); snap_subdivision->set_max(99); @@ -1019,6 +1026,7 @@ GenericTilePolygonEditor::GenericTilePolygonEditor() { button_center_view->connect(SceneStringName(pressed), callable_mp(this, &GenericTilePolygonEditor::_center_view)); button_center_view->set_theme_type_variation(SceneStringName(FlatButton)); button_center_view->set_tooltip_text(TTR("Center View")); + button_center_view->set_accessibility_name(TTRC("Center View")); button_center_view->set_disabled(true); root->add_child(button_center_view); @@ -2880,6 +2888,7 @@ TileDataTerrainsEditor::TileDataTerrainsEditor() { picker_button->set_theme_type_variation(SceneStringName(FlatButton)); picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/picker")); + picker_button->set_accessibility_name(TTRC("Pick")); toolbar->add_child(picker_button); // Setup diff --git a/editor/plugins/tiles/tile_map_layer_editor.cpp b/editor/plugins/tiles/tile_map_layer_editor.cpp index bfcae65e1d..4bd0ae138b 100644 --- a/editor/plugins/tiles/tile_map_layer_editor.cpp +++ b/editor/plugins/tiles/tile_map_layer_editor.cpp @@ -2219,6 +2219,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { select_tool_button->set_button_group(tool_buttons_group); select_tool_button->set_shortcut(ED_SHORTCUT("tiles_editor/selection_tool", TTRC("Selection Tool"), Key::S)); select_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar)); + select_tool_button->set_accessibility_name(TTRC("Selection Tool")); tilemap_tiles_tools_buttons->add_child(select_tool_button); viewport_shortcut_buttons.push_back(select_tool_button); @@ -2229,6 +2230,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { paint_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/paint_tool")); paint_tool_button->set_tooltip_text(TTR("Shift: Draw line.") + "\n" + keycode_get_string((Key)KeyModifierMask::CMD_OR_CTRL) + TTR("Shift: Draw rectangle.")); paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar)); + paint_tool_button->set_accessibility_name(TTRC("Paint Tool")); tilemap_tiles_tools_buttons->add_child(paint_tool_button); viewport_shortcut_buttons.push_back(paint_tool_button); @@ -2239,6 +2241,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { // TRANSLATORS: This refers to the line tool in the tilemap editor. line_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/line_tool")); line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar)); + line_tool_button->set_accessibility_name(TTRC("Line Tool")); tilemap_tiles_tools_buttons->add_child(line_tool_button); viewport_shortcut_buttons.push_back(line_tool_button); @@ -2248,6 +2251,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/rect_tool")); rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar)); + rect_tool_button->set_accessibility_name(TTRC("Rect Tool")); tilemap_tiles_tools_buttons->add_child(rect_tool_button); viewport_shortcut_buttons.push_back(rect_tool_button); @@ -2257,6 +2261,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/bucket_tool")); bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_update_toolbar)); + bucket_tool_button->set_accessibility_name(TTRC("Bucket Tool")); tilemap_tiles_tools_buttons->add_child(bucket_tool_button); toolbar->add_child(tilemap_tiles_tools_buttons); viewport_shortcut_buttons.push_back(bucket_tool_button); @@ -2276,6 +2281,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { Key key = (OS::get_singleton()->has_feature("macos") || OS::get_singleton()->has_feature("web_macos") || OS::get_singleton()->has_feature("web_ios")) ? Key::META : Key::CTRL; picker_button->set_tooltip_text(vformat(TTR("Alternatively hold %s with other tools to pick tile."), find_keycode_name(key))); picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); + picker_button->set_accessibility_name(TTRC("Pick")); tools_settings->add_child(picker_button); viewport_shortcut_buttons.push_back(picker_button); @@ -2286,6 +2292,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { erase_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/eraser")); erase_button->set_tooltip_text(TTRC("Alternatively use RMB to erase tiles.")); erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); + erase_button->set_accessibility_name(TTRC("Erase")); tools_settings->add_child(erase_button); viewport_shortcut_buttons.push_back(erase_button); @@ -2299,6 +2306,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { transform_button_rotate_left->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_left", TTRC("Rotate Tile Left"), Key::Z)); transform_toolbar->add_child(transform_button_rotate_left); transform_button_rotate_left->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_LEFT)); + transform_button_rotate_left->set_accessibility_name(TTRC("Rotate Tile Left")); viewport_shortcut_buttons.push_back(transform_button_rotate_left); transform_button_rotate_right = memnew(Button); @@ -2306,6 +2314,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { transform_button_rotate_right->set_shortcut(ED_SHORTCUT("tiles_editor/rotate_tile_right", TTRC("Rotate Tile Right"), Key::X)); transform_toolbar->add_child(transform_button_rotate_right); transform_button_rotate_right->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_ROTATE_RIGHT)); + transform_button_rotate_right->set_accessibility_name(TTRC("Rotate Tile Right")); viewport_shortcut_buttons.push_back(transform_button_rotate_right); transform_button_flip_h = memnew(Button); @@ -2313,6 +2322,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { transform_button_flip_h->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_horizontal", TTRC("Flip Tile Horizontally"), Key::C)); transform_toolbar->add_child(transform_button_flip_h); transform_button_flip_h->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_H)); + transform_button_flip_h->set_accessibility_name(TTRC("Flip Tile Horizontally")); viewport_shortcut_buttons.push_back(transform_button_flip_h); transform_button_flip_v = memnew(Button); @@ -2320,6 +2330,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { transform_button_flip_v->set_shortcut(ED_SHORTCUT("tiles_editor/flip_tile_vertical", TTRC("Flip Tile Vertically"), Key::V)); transform_toolbar->add_child(transform_button_flip_v); transform_button_flip_v->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_apply_transform).bind(TRANSFORM_FLIP_V)); + transform_button_flip_v->set_accessibility_name(TTRC("Flip Tile Vertically")); viewport_shortcut_buttons.push_back(transform_button_flip_v); // Separator 2. @@ -2339,6 +2350,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { random_tile_toggle->set_toggle_mode(true); random_tile_toggle->set_tooltip_text(TTR("Place Random Tile")); random_tile_toggle->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_random_tile_checkbox_toggled)); + random_tile_toggle->set_accessibility_name(TTRC("Place Random Tile")); tools_settings->add_child(random_tile_toggle); // Random tile scattering. @@ -2356,6 +2368,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { scatter_spinbox->set_tooltip_text(TTR("Modifies the chance 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(SceneStringName(value_changed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_on_scattering_spinbox_changed)); + scatter_spinbox->set_accessibility_name(TTRC("Scattering")); scatter_controls_container->add_child(scatter_spinbox); tools_settings->add_child(scatter_controls_container); @@ -2404,6 +2417,7 @@ TileMapLayerEditorTilesPlugin::TileMapLayerEditorTilesPlugin() { source_sort_button->set_flat(false); source_sort_button->set_theme_type_variation("FlatMenuButton"); source_sort_button->set_tooltip_text(TTR("Sort sources")); + source_sort_button->set_accessibility_name(TTRC("Sort sources")); PopupMenu *p = source_sort_button->get_popup(); p->connect(SceneStringName(id_pressed), callable_mp(this, &TileMapLayerEditorTilesPlugin::_set_source_sort)); @@ -3571,6 +3585,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { paint_tool_button->set_pressed(true); paint_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/paint_tool")); paint_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar)); + paint_tool_button->set_accessibility_name(TTRC("Paint Tool")); tilemap_tiles_tools_buttons->add_child(paint_tool_button); viewport_shortcut_buttons.push_back(paint_tool_button); @@ -3580,6 +3595,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { line_tool_button->set_button_group(tool_buttons_group); line_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/line_tool")); line_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar)); + line_tool_button->set_accessibility_name(TTRC("Line Tool")); tilemap_tiles_tools_buttons->add_child(line_tool_button); viewport_shortcut_buttons.push_back(line_tool_button); @@ -3589,6 +3605,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { rect_tool_button->set_button_group(tool_buttons_group); rect_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/rect_tool")); rect_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar)); + rect_tool_button->set_accessibility_name(TTRC("Rect Tool")); tilemap_tiles_tools_buttons->add_child(rect_tool_button); viewport_shortcut_buttons.push_back(rect_tool_button); @@ -3598,6 +3615,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { bucket_tool_button->set_button_group(tool_buttons_group); bucket_tool_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/bucket_tool")); bucket_tool_button->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditorTerrainsPlugin::_update_toolbar)); + bucket_tool_button->set_accessibility_name(TTRC("Bucket Tool")); tilemap_tiles_tools_buttons->add_child(bucket_tool_button); viewport_shortcut_buttons.push_back(bucket_tool_button); @@ -3616,6 +3634,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { picker_button->set_toggle_mode(true); picker_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/picker")); picker_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); + picker_button->set_accessibility_name(TTRC("Pick")); tools_settings->add_child(picker_button); viewport_shortcut_buttons.push_back(picker_button); @@ -3625,6 +3644,7 @@ TileMapLayerEditorTerrainsPlugin::TileMapLayerEditorTerrainsPlugin() { erase_button->set_toggle_mode(true); erase_button->set_shortcut(ED_GET_SHORTCUT("tiles_editor/eraser")); erase_button->connect(SceneStringName(pressed), callable_mp(CanvasItemEditor::get_singleton(), &CanvasItemEditor::update_viewport)); + erase_button->set_accessibility_name(TTRC("Erase")); tools_settings->add_child(erase_button); viewport_shortcut_buttons.push_back(erase_button); @@ -4476,18 +4496,21 @@ TileMapLayerEditor::TileMapLayerEditor() { layers_selection_button->set_text_overrun_behavior(TextServer::OVERRUN_TRIM_ELLIPSIS); layers_selection_button->set_tooltip_text(TTR("TileMap Layers")); layers_selection_button->connect(SceneStringName(item_selected), callable_mp(this, &TileMapLayerEditor::_layers_selection_item_selected)); + layers_selection_button->set_accessibility_name(TTRC("TileMap Layers")); layer_selection_hbox->add_child(layers_selection_button); select_previous_layer = memnew(Button); select_previous_layer->set_theme_type_variation(SceneStringName(FlatButton)); select_previous_layer->set_tooltip_text(TTR("Select previous layer")); select_previous_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_previous_layer_pressed)); + select_previous_layer->set_accessibility_name(TTRC("Previous")); layer_selection_hbox->add_child(select_previous_layer); select_next_layer = memnew(Button); select_next_layer->set_theme_type_variation(SceneStringName(FlatButton)); select_next_layer->set_tooltip_text(TTR("Select next layer")); select_next_layer->connect(SceneStringName(pressed), callable_mp(this, &TileMapLayerEditor::_select_next_layer_pressed)); + select_next_layer->set_accessibility_name(TTRC("Next")); layer_selection_hbox->add_child(select_next_layer); select_all_layers = memnew(Button); @@ -4503,6 +4526,7 @@ TileMapLayerEditor::TileMapLayerEditor() { toggle_highlight_selected_layer_button->set_toggle_mode(true); toggle_highlight_selected_layer_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_highlight_selected_layer_button_toggled)); toggle_highlight_selected_layer_button->set_tooltip_text(TTR("Highlight Selected TileMap Layer")); + toggle_highlight_selected_layer_button->set_accessibility_name(TTRC("Highlight Selected TileMap Layer")); tile_map_toolbar->add_child(toggle_highlight_selected_layer_button); tile_map_toolbar->add_child(memnew(VSeparator)); @@ -4513,11 +4537,13 @@ TileMapLayerEditor::TileMapLayerEditor() { toggle_grid_button->set_toggle_mode(true); toggle_grid_button->set_tooltip_text(TTR("Toggle grid visibility.")); toggle_grid_button->connect(SceneStringName(toggled), callable_mp(this, &TileMapLayerEditor::_on_grid_toggled)); + toggle_grid_button->set_accessibility_name(TTRC("Grid")); tile_map_toolbar->add_child(toggle_grid_button); // Advanced settings menu button. advanced_menu_button = memnew(MenuButton); advanced_menu_button->set_flat(false); + advanced_menu_button->set_accessibility_name(TTRC("Advanced")); advanced_menu_button->set_theme_type_variation(SceneStringName(FlatButton)); advanced_menu_button->get_popup()->add_item(TTR("Automatically Replace Tiles with Proxies"), ADVANCED_MENU_REPLACE_WITH_PROXIES); advanced_menu_button->get_popup()->add_item(TTR("Extract TileMap layers as individual TileMapLayer nodes"), ADVANCED_MENU_EXTRACT_TILE_MAP_LAYERS); diff --git a/editor/plugins/tiles/tile_set_editor.cpp b/editor/plugins/tiles/tile_set_editor.cpp index bcef4508cb..e30527efaf 100644 --- a/editor/plugins/tiles/tile_set_editor.cpp +++ b/editor/plugins/tiles/tile_set_editor.cpp @@ -846,6 +846,7 @@ TileSetEditor::TileSetEditor() { source_sort_button->set_flat(false); source_sort_button->set_theme_type_variation(SceneStringName(FlatButton)); source_sort_button->set_tooltip_text(TTR("Sort Sources")); + source_sort_button->set_accessibility_name(TTRC("Sort Sources")); PopupMenu *p = source_sort_button->get_popup(); p->connect(SceneStringName(id_pressed), callable_mp(this, &TileSetEditor::_set_source_sort)); @@ -896,6 +897,7 @@ TileSetEditor::TileSetEditor() { sources_advanced_menu_button->get_popup()->add_item(TTR("Open Atlas Merging Tool")); sources_advanced_menu_button->get_popup()->add_item(TTR("Manage Tile Proxies")); sources_advanced_menu_button->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &TileSetEditor::_sources_advanced_menu_id_pressed)); + sources_advanced_menu_button->set_accessibility_name(TTRC("Advanced")); sources_bottom_actions->add_child(sources_advanced_menu_button); sources_bottom_actions->add_child(source_sort_button); 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 a48ebbc08b..06b7be6c98 100644 --- a/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp +++ b/editor/plugins/tiles/tile_set_scenes_collection_source_editor.cpp @@ -573,12 +573,14 @@ TileSetScenesCollectionSourceEditor::TileSetScenesCollectionSourceEditor() { scene_tile_add_button = memnew(Button); scene_tile_add_button->set_theme_type_variation(SceneStringName(FlatButton)); scene_tile_add_button->connect(SceneStringName(pressed), callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_add_pressed)); + scene_tile_add_button->set_accessibility_name(TTRC("Add")); scenes_bottom_actions->add_child(scene_tile_add_button); scene_tile_delete_button = memnew(Button); scene_tile_delete_button->set_theme_type_variation(SceneStringName(FlatButton)); scene_tile_delete_button->set_disabled(true); scene_tile_delete_button->connect(SceneStringName(pressed), callable_mp(this, &TileSetScenesCollectionSourceEditor::_source_delete_pressed)); + scene_tile_delete_button->set_accessibility_name(TTRC("Delete")); scenes_bottom_actions->add_child(scene_tile_delete_button); EditorInspector::add_inspector_plugin(memnew(TileSourceInspectorPlugin)); diff --git a/editor/plugins/version_control_editor_plugin.cpp b/editor/plugins/version_control_editor_plugin.cpp index b42ab330a7..ecf7eafe59 100644 --- a/editor/plugins/version_control_editor_plugin.cpp +++ b/editor/plugins/version_control_editor_plugin.cpp @@ -1067,6 +1067,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_ssh_public_key_path = memnew(LineEdit); set_up_ssh_public_key_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + set_up_ssh_public_key_path->set_accessibility_name(TTRC("SSH Public Key Path")); set_up_ssh_public_key_path->set_text(EDITOR_GET("version_control/ssh_public_key_path")); set_up_ssh_public_key_path->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_set_up_warning)); set_up_ssh_public_key_input_hbc->add_child(set_up_ssh_public_key_path); @@ -1083,6 +1084,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { select_public_path_button->set_button_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon("Folder")); select_public_path_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_popup_file_dialog).bind(set_up_ssh_public_key_file_dialog)); select_public_path_button->set_tooltip_text(TTR("Select SSH public key path")); + select_public_path_button->set_accessibility_name(TTRC("Select SSH public key path")); set_up_ssh_public_key_input_hbc->add_child(select_public_path_button); HBoxContainer *set_up_ssh_private_key_input = memnew(HBoxContainer); @@ -1102,6 +1104,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_ssh_private_key_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); set_up_ssh_private_key_path->set_text(EDITOR_GET("version_control/ssh_private_key_path")); set_up_ssh_private_key_path->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_set_up_warning)); + set_up_ssh_private_key_path->set_accessibility_name(TTRC("SSH Private Key Path")); set_up_ssh_private_key_input_hbc->add_child(set_up_ssh_private_key_path); set_up_ssh_private_key_file_dialog = memnew(FileDialog); @@ -1116,6 +1119,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { select_private_path_button->set_button_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon("Folder")); select_private_path_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_popup_file_dialog).bind(set_up_ssh_private_key_file_dialog)); select_private_path_button->set_tooltip_text(TTR("Select SSH private key path")); + select_private_path_button->set_accessibility_name(TTRC("Select SSH private key path")); set_up_ssh_private_key_input_hbc->add_child(select_private_path_button); HBoxContainer *set_up_ssh_passphrase_input = memnew(HBoxContainer); @@ -1131,6 +1135,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { set_up_ssh_passphrase->set_h_size_flags(Control::SIZE_EXPAND_FILL); set_up_ssh_passphrase->set_secret(true); set_up_ssh_passphrase->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_set_up_warning)); + set_up_ssh_passphrase->set_accessibility_name(TTRC("SSH Passphrase")); set_up_ssh_passphrase_input->add_child(set_up_ssh_passphrase); set_up_warning_text = memnew(Label); @@ -1156,6 +1161,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { unstage_title->add_child(unstage_label); refresh_button = memnew(Button); + refresh_button->set_accessibility_name(TTRC("Detect new changes")); refresh_button->set_tooltip_text(TTR("Detect new changes")); refresh_button->set_theme_type_variation(SceneStringName(FlatButton)); refresh_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons))); @@ -1177,6 +1183,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { discard_all_confirm->get_ok_button()->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_discard_all)); discard_all_button = memnew(Button); + discard_all_button->set_accessibility_name(TTRC("Discard all changes")); discard_all_button->set_tooltip_text(TTR("Discard all changes")); discard_all_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Close"), EditorStringName(EditorIcons))); discard_all_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_confirm_discard_all)); @@ -1184,6 +1191,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { unstage_title->add_child(discard_all_button); stage_all_button = memnew(Button); + stage_all_button->set_accessibility_name(TTRC("Stage all changes")); stage_all_button->set_theme_type_variation(SceneStringName(FlatButton)); stage_all_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons))); stage_all_button->set_tooltip_text(TTR("Stage all changes")); @@ -1214,6 +1222,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { stage_title->add_child(stage_label); unstage_all_button = memnew(Button); + unstage_all_button->set_accessibility_name(TTRC("Unstage all changes")); unstage_all_button->set_theme_type_variation(SceneStringName(FlatButton)); unstage_all_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons))); unstage_all_button->set_tooltip_text(TTR("Unstage all changes")); @@ -1245,6 +1254,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_area->add_child(commit_label); commit_message = memnew(TextEdit); + commit_message->set_accessibility_name(TTRC("Commit Message")); commit_message->set_h_size_flags(Control::SIZE_EXPAND_FILL); commit_message->set_h_grow_direction(Control::GrowDirection::GROW_DIRECTION_BEGIN); commit_message->set_v_grow_direction(Control::GrowDirection::GROW_DIRECTION_END); @@ -1273,6 +1283,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { commit_list_hbc->add_child(commit_list_label); commit_list_size_button = memnew(OptionButton); + commit_list_size_button->set_accessibility_name(TTRC("Commit list size")); commit_list_size_button->set_tooltip_text(TTR("Commit list size")); commit_list_size_button->add_item("10"); commit_list_size_button->set_item_metadata(0, 10); @@ -1305,6 +1316,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { version_commit_dock->add_child(menu_bar); branch_select = memnew(OptionButton); + branch_select->set_accessibility_name(TTRC("Branches")); branch_select->set_tooltip_text(TTR("Branches")); branch_select->set_h_size_flags(Control::SIZE_EXPAND_FILL); branch_select->set_clip_text(true); @@ -1346,11 +1358,13 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { branch_create_hbc->add_child(branch_create_name_label); branch_create_name_input = memnew(LineEdit); + branch_create_name_input->set_accessibility_name(TTRC("Branch Name")); branch_create_name_input->set_h_size_flags(Control::SIZE_EXPAND_FILL); branch_create_name_input->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_branch_create_button)); branch_create_hbc->add_child(branch_create_name_input); remote_select = memnew(OptionButton); + remote_select->set_accessibility_name(TTRC("Remote")); remote_select->set_tooltip_text(TTR("Remotes")); remote_select->set_h_size_flags(Control::SIZE_EXPAND_FILL); remote_select->set_clip_text(true); @@ -1392,6 +1406,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { remote_create_name_hbc->add_child(remote_create_name_label); remote_create_name_input = memnew(LineEdit); + remote_create_name_input->set_accessibility_name(TTRC("Remote Name")); remote_create_name_input->set_h_size_flags(Control::SIZE_EXPAND_FILL); remote_create_name_input->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_remote_create_button)); remote_create_name_hbc->add_child(remote_create_name_input); @@ -1406,12 +1421,14 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { remote_create_hbc->add_child(remote_create_url_label); remote_create_url_input = memnew(LineEdit); + remote_create_url_input->set_accessibility_name(TTRC("Remote URL")); remote_create_url_input->set_h_size_flags(Control::SIZE_EXPAND_FILL); remote_create_url_input->connect(SceneStringName(text_changed), callable_mp(this, &VersionControlEditorPlugin::_update_remote_create_button)); remote_create_hbc->add_child(remote_create_url_input); fetch_button = memnew(Button); fetch_button->set_theme_type_variation(SceneStringName(FlatButton)); + fetch_button->set_accessibility_name(TTRC("Fetch")); fetch_button->set_tooltip_text(TTR("Fetch")); fetch_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons))); fetch_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_fetch)); @@ -1419,6 +1436,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { pull_button = memnew(Button); pull_button->set_theme_type_variation(SceneStringName(FlatButton)); + pull_button->set_accessibility_name(TTRC("Pull")); pull_button->set_tooltip_text(TTR("Pull")); pull_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons))); pull_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_pull)); @@ -1426,6 +1444,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { push_button = memnew(Button); push_button->set_theme_type_variation(SceneStringName(FlatButton)); + push_button->set_accessibility_name(TTRC("Push")); push_button->set_tooltip_text(TTR("Push")); push_button->set_button_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons))); push_button->connect(SceneStringName(pressed), callable_mp(this, &VersionControlEditorPlugin::_push)); @@ -1492,6 +1511,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() { diff_heading->add_child(view); diff_view_type_select = memnew(OptionButton); + diff_view_type_select->set_accessibility_name(TTRC("View")); diff_view_type_select->add_item(TTR("Split"), DIFF_VIEW_TYPE_SPLIT); diff_view_type_select->add_item(TTR("Unified"), DIFF_VIEW_TYPE_UNIFIED); diff_view_type_select->connect(SceneStringName(item_selected), callable_mp(this, &VersionControlEditorPlugin::_display_diff)); diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 4f6336de8a..9db24d4885 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -1212,6 +1212,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool if (valid_right) { if (expanded_port_counter == 0 && vsnode->is_output_port_expandable(i)) { TextureButton *expand = memnew(TextureButton); + expand->set_accessibility_name(TTRC("Expand output port")); expand->set_toggle_mode(true); expand->set_texture_normal(editor->get_editor_theme_icon(SNAME("GuiTreeArrowRight"))); expand->set_texture_pressed(editor->get_editor_theme_icon(SNAME("GuiTreeArrowDown"))); @@ -1222,6 +1223,7 @@ void VisualShaderGraphPlugin::add_node(VisualShader::Type p_type, int p_id, bool } if (vsnode->has_output_port_preview(i) && port_right != VisualShaderNode::PORT_TYPE_TRANSFORM && port_right != VisualShaderNode::PORT_TYPE_SAMPLER) { TextureButton *preview = memnew(TextureButton); + preview->set_accessibility_name(TTRC("Select preview port")); preview->set_toggle_mode(true); preview->set_texture_normal(editor->get_editor_theme_icon(SNAME("GuiVisibilityHidden"))); preview->set_texture_pressed(editor->get_editor_theme_icon(SNAME("GuiVisibilityVisible"))); @@ -6121,6 +6123,10 @@ void VisualShaderEditor::_connection_menu_id_pressed(int p_idx) { } Variant VisualShaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from) { + if (p_point == Vector2(INFINITY, INFINITY)) { + return Variant(); + } + if (p_from == members) { TreeItem *it = members->get_item_at_position(p_point); if (!it) { @@ -6146,6 +6152,10 @@ Variant VisualShaderEditor::get_drag_data_fw(const Point2 &p_point, Control *p_f } bool VisualShaderEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const { + if (p_point == Vector2(INFINITY, INFINITY)) { + return false; + } + if (p_from == graph) { Dictionary d = p_data; @@ -6161,6 +6171,10 @@ bool VisualShaderEditor::can_drop_data_fw(const Point2 &p_point, const Variant & } void VisualShaderEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) { + if (p_point == Vector2(INFINITY, INFINITY)) { + return; + } + if (p_from == graph) { Dictionary d = p_data; @@ -6746,6 +6760,7 @@ VisualShaderEditor::VisualShaderEditor() { preview_tools = memnew(MenuButton); filter_hbox->add_child(preview_tools); preview_tools->set_tooltip_text(TTR("Options")); + preview_tools->set_accessibility_name(TTRC("Options")); preview_tools->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &VisualShaderEditor::_preview_tools_menu_option)); preview_tools->get_popup()->add_item(TTR("Copy Parameters From Material"), COPY_PARAMS_FROM_MATERIAL); preview_tools->get_popup()->add_item(TTR("Paste Parameters To Material"), PASTE_PARAMS_TO_MATERIAL); @@ -6795,10 +6810,12 @@ VisualShaderEditor::VisualShaderEditor() { node_filter->connect(SceneStringName(gui_input), callable_mp(this, &VisualShaderEditor::_sbox_input)); node_filter->set_h_size_flags(SIZE_EXPAND_FILL); node_filter->set_placeholder(TTR("Search")); + node_filter->set_accessibility_name(TTRC("Search")); tools = memnew(MenuButton); filter_hb->add_child(tools); tools->set_tooltip_text(TTR("Options")); + tools->set_accessibility_name(TTRC("Options")); tools->get_popup()->connect(SceneStringName(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); @@ -6874,6 +6891,7 @@ VisualShaderEditor::VisualShaderEditor() { varying_type->add_item("Vector4"); varying_type->add_item("Boolean"); varying_type->add_item("Transform"); + varying_type->set_accessibility_name(TTRC("Varying Type")); varying_type->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_varying_type_changed)); varying_name = memnew(LineEdit); @@ -6887,6 +6905,7 @@ VisualShaderEditor::VisualShaderEditor() { hb->add_child(varying_mode); varying_mode->add_item("Vertex -> [Fragment, Light]"); varying_mode->add_item("Fragment -> Light"); + varying_mode->set_accessibility_name(TTRC("Varying Mode")); varying_mode->connect(SceneStringName(item_selected), callable_mp(this, &VisualShaderEditor::_varying_mode_changed)); varying_error_label = memnew(Label); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 16c3721060..19f4293b09 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1294,6 +1294,8 @@ ProjectManager::ProjectManager() { title_bar_logo = memnew(Button); title_bar_logo->set_flat(true); + title_bar_logo->set_tooltip_text(TTR("About Godot")); + title_bar_logo->set_accessibility_name(TTRC("About Godot")); left_hbox->add_child(title_bar_logo); title_bar_logo->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_show_about)); @@ -1374,12 +1376,14 @@ ProjectManager::ProjectManager() { hb->add_child(scan_btn); loading_label = memnew(Label(TTR("Loading, please wait..."))); + loading_label->set_accessibility_live(DisplayServer::AccessibilityLiveMode::LIVE_ASSERTIVE); loading_label->set_h_size_flags(Control::SIZE_EXPAND_FILL); loading_label->hide(); hb->add_child(loading_label); search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter Projects")); + search_box->set_accessibility_name(TTRC("Filter Projects")); 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->set_clear_button_enabled(true); search_box->connect(SceneStringName(text_changed), callable_mp(this, &ProjectManager::_on_search_term_changed)); @@ -1387,14 +1391,16 @@ ProjectManager::ProjectManager() { search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(search_box); - Label *sort_label = memnew(Label); + sort_label = memnew(Label); sort_label->set_text(TTR("Sort:")); + sort_label->set_focus_mode(Control::FOCUS_NONE); hb->add_child(sort_label); filter_option = memnew(OptionButton); filter_option->set_clip_text(true); filter_option->set_h_size_flags(Control::SIZE_EXPAND_FILL); filter_option->set_stretch_ratio(0.3); + filter_option->set_accessibility_name(TTRC("Sort")); filter_option->connect(SceneStringName(item_selected), callable_mp(this, &ProjectManager::_on_order_option_changed)); hb->add_child(filter_option); @@ -1493,6 +1499,7 @@ ProjectManager::ProjectManager() { open_btn_container->add_child(memnew(VSeparator)); open_options_btn = memnew(Button); + open_options_btn->set_accessibility_name(TTRC("Options")); open_options_btn->set_icon_alignment(HorizontalAlignment::HORIZONTAL_ALIGNMENT_CENTER); open_options_btn->connect(SceneStringName(pressed), callable_mp(this, &ProjectManager::_open_options_popup)); open_btn_container->add_child(open_options_btn); @@ -1520,6 +1527,7 @@ ProjectManager::ProjectManager() { manage_tags_btn = memnew(Button); manage_tags_btn->set_text(TTR("Manage Tags")); + manage_tags_btn->set_shortcut(ED_SHORTCUT("project_manager/project_tags", TTR("Manage Tags"), KeyModifierMask::CMD_OR_CTRL | Key::T)); project_list_sidebar->add_child(manage_tags_btn); erase_btn = memnew(Button); @@ -1713,6 +1721,7 @@ ProjectManager::ProjectManager() { new_tag_name = memnew(LineEdit); tag_vb->add_child(new_tag_name); + new_tag_name->set_accessibility_name(TTRC("New Tag Name")); new_tag_name->connect(SceneStringName(text_changed), callable_mp(this, &ProjectManager::_set_new_tag_name)); new_tag_name->connect(SceneStringName(text_submitted), callable_mp(this, &ProjectManager::_create_new_tag).unbind(1)); create_tag_dialog->connect("about_to_popup", callable_mp(new_tag_name, &LineEdit::clear)); @@ -1722,6 +1731,7 @@ ProjectManager::ProjectManager() { tag_vb->add_child(tag_error); create_tag_btn = memnew(Button); + create_tag_btn->set_accessibility_name(TTRC("Create Tag")); all_tags->add_child(create_tag_btn); create_tag_btn->connect(SceneStringName(pressed), callable_mp((Window *)create_tag_dialog, &Window::popup_centered).bind(Vector2i(500, 0) * EDSCALE)); } diff --git a/editor/project_manager.h b/editor/project_manager.h index 088bbc9e25..841ee6e988 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -138,6 +138,7 @@ class ProjectManager : public Control { LineEdit *search_box = nullptr; Label *loading_label = nullptr; + Label *sort_label = nullptr; OptionButton *filter_option = nullptr; PanelContainer *project_list_panel = nullptr; diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index a2aca19803..07ad4e9fa9 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -921,6 +921,7 @@ ProjectDialog::ProjectDialog() { project_path = memnew(LineEdit); project_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + project_path->set_accessibility_name(TTRC("Project Path")); project_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); pphb->add_child(project_path); @@ -936,6 +937,7 @@ ProjectDialog::ProjectDialog() { install_path = memnew(LineEdit); install_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + install_path->set_accessibility_name(TTRC("Install Path")); install_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE); iphb->add_child(install_path); diff --git a/editor/project_manager/project_list.cpp b/editor/project_manager/project_list.cpp index 839bf58524..590115e18b 100644 --- a/editor/project_manager/project_list.cpp +++ b/editor/project_manager/project_list.cpp @@ -49,6 +49,10 @@ #include "scene/gui/texture_rect.h" #include "scene/resources/image_texture.h" +const char *ProjectList::SIGNAL_LIST_CHANGED = "list_changed"; +const char *ProjectList::SIGNAL_SELECTION_CHANGED = "selection_changed"; +const char *ProjectList::SIGNAL_PROJECT_ASK_OPEN = "project_ask_open"; + void ProjectListItemControl::_notification(int p_what) { switch (p_what) { case NOTIFICATION_THEME_CHANGED: { @@ -81,11 +85,47 @@ void ProjectListItemControl::_notification(int p_what) { case NOTIFICATION_MOUSE_ENTER: { is_hovering = true; queue_redraw(); + queue_accessibility_update(); } break; case NOTIFICATION_MOUSE_EXIT: { is_hovering = false; queue_redraw(); + queue_accessibility_update(); + } break; + + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_LIST_BOX_OPTION); + DisplayServer::get_singleton()->accessibility_update_set_name(ae, TTR("Project") + " " + project_title->get_text()); + DisplayServer::get_singleton()->accessibility_update_set_value(ae, project_title->get_text()); + + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_CLICK, callable_mp(this, &ProjectListItemControl::_accessibility_action_open)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_INTO_VIEW, callable_mp(this, &ProjectListItemControl::_accessibility_action_scroll_into_view)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_FOCUS, callable_mp(this, &ProjectListItemControl::_accessibility_action_focus)); + DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_BLUR, callable_mp(this, &ProjectListItemControl::_accessibility_action_blur)); + + ProjectList *pl = get_list(); + if (pl) { + DisplayServer::get_singleton()->accessibility_update_set_list_item_index(ae, pl->get_index(this)); + } + DisplayServer::get_singleton()->accessibility_update_set_list_item_level(ae, 0); + DisplayServer::get_singleton()->accessibility_update_set_list_item_selected(ae, is_selected); + } break; + + case NOTIFICATION_FOCUS_ENTER: { + ProjectList *pl = get_list(); + if (pl) { + int idx = pl->get_index(this); + if (idx >= 0) { + pl->ensure_project_visible(idx); + pl->select_project(idx); + + pl->emit_signal(SNAME(ProjectList::SIGNAL_SELECTION_CHANGED)); + } + } } break; case NOTIFICATION_DRAW: { @@ -101,6 +141,53 @@ void ProjectListItemControl::_notification(int p_what) { } } +ProjectList *ProjectListItemControl::get_list() const { + if (!is_inside_tree()) { + return nullptr; + } + ProjectList *pl = Object::cast_to(get_parent()->get_parent()); + return pl; +} + +void ProjectListItemControl::_accessibility_action_scroll_into_view(const Variant &p_data) { + ProjectList *pl = get_list(); + if (pl) { + int idx = pl->get_index(this); + if (idx >= 0) { + pl->ensure_project_visible(idx); + } + } +} + +void ProjectListItemControl::_accessibility_action_open(const Variant &p_data) { + ProjectList *pl = get_list(); + if (pl && !pl->project_opening_initiated) { + pl->emit_signal(SNAME(ProjectList::SIGNAL_PROJECT_ASK_OPEN)); + } +} + +void ProjectListItemControl::_accessibility_action_focus(const Variant &p_data) { + ProjectList *pl = get_list(); + if (pl) { + int idx = pl->get_index(this); + if (idx >= 0) { + pl->ensure_project_visible(idx); + pl->select_project(idx); + } + } +} + +void ProjectListItemControl::_accessibility_action_blur(const Variant &p_data) { + ProjectList *pl = get_list(); + if (pl) { + int idx = pl->get_index(this); + if (idx >= 0) { + pl->ensure_project_visible(idx); + pl->deselect_project(idx); + } + } +} + void ProjectListItemControl::_favorite_button_pressed() { emit_signal(SNAME("favorite_pressed")); } @@ -111,10 +198,14 @@ void ProjectListItemControl::_explore_button_pressed() { void ProjectListItemControl::set_project_title(const String &p_title) { project_title->set_text(p_title); + project_title->set_accessibility_name(TTRC("Project Name")); + queue_accessibility_update(); } void ProjectListItemControl::set_project_path(const String &p_path) { project_path->set_text(p_path); + project_path->set_accessibility_name(TTRC("Project Path")); + queue_accessibility_update(); } void ProjectListItemControl::set_tags(const PackedStringArray &p_tags, ProjectList *p_parent_list) { @@ -172,6 +263,8 @@ void ProjectListItemControl::set_unsupported_features(PackedStringArray p_featur return; } project_version->set_tooltip_text(tooltip_text); + project_unsupported_features->set_focus_mode(FOCUS_ACCESSIBILITY); + project_unsupported_features->set_accessibility_name(tooltip_text); project_unsupported_features->set_tooltip_text(tooltip_text); project_unsupported_features->show(); } else { @@ -186,6 +279,7 @@ bool ProjectListItemControl::should_load_project_icon() const { void ProjectListItemControl::set_selected(bool p_selected) { is_selected = p_selected; queue_redraw(); + queue_accessibility_update(); } void ProjectListItemControl::set_is_favorite(bool p_favorite) { @@ -236,6 +330,8 @@ ProjectListItemControl::ProjectListItemControl() { favorite_button = memnew(TextureButton); favorite_button->set_name("FavoriteButton"); + favorite_button->set_tooltip_text(TTR("Add to favorites")); + favorite_button->set_accessibility_name(TTRC("Add to favorites")); // This makes the project's "hover" style display correctly when hovering the favorite icon. favorite_button->set_mouse_filter(MOUSE_FILTER_PASS); favorite_box->add_child(favorite_button); @@ -283,6 +379,8 @@ ProjectListItemControl::ProjectListItemControl() { explore_button = memnew(Button); explore_button->set_name("ExploreButton"); + explore_button->set_tooltip_text(TTR("Open in file manager")); + explore_button->set_accessibility_name(TTRC("Open in file manager")); explore_button->set_flat(true); path_hb->add_child(explore_button); explore_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectListItemControl::_explore_button_pressed)); @@ -343,10 +441,6 @@ struct ProjectListComparator { } }; -const char *ProjectList::SIGNAL_LIST_CHANGED = "list_changed"; -const char *ProjectList::SIGNAL_SELECTION_CHANGED = "selection_changed"; -const char *ProjectList::SIGNAL_PROJECT_ASK_OPEN = "project_ask_open"; - // Helpers. bool ProjectList::project_feature_looks_like_version(const String &p_feature) { @@ -376,6 +470,15 @@ void ProjectList::_notification(int p_what) { } } } break; + + case NOTIFICATION_ACCESSIBILITY_UPDATE: { + RID ae = get_accessibility_element(); + ERR_FAIL_COND(ae.is_null()); + + DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_LIST_BOX); + DisplayServer::get_singleton()->accessibility_update_set_list_item_count(ae, _projects.size()); + DisplayServer::get_singleton()->accessibility_update_set_flag(ae, DisplayServer::AccessibilityFlags::FLAG_MULTISELECTABLE, false); + } } } @@ -635,6 +738,7 @@ void ProjectList::update_project_list() { set_v_scroll(0); emit_signal(SNAME(SIGNAL_LIST_CHANGED)); + queue_accessibility_update(); } void ProjectList::sort_projects() { @@ -699,6 +803,7 @@ void ProjectList::sort_projects() { // Rewind the coroutine because order of projects changed _update_icons_async(); update_dock_menu(); + queue_accessibility_update(); } int ProjectList::get_project_count() const { @@ -789,6 +894,7 @@ void ProjectList::add_project(const String &dir_path, bool favorite) { if (!_config.has_section(dir_path)) { _config.set_value(dir_path, "favorite", favorite); } + queue_accessibility_update(); } void ProjectList::set_project_version(const String &p_project_path, int p_version) { @@ -848,6 +954,15 @@ int ProjectList::refresh_project(const String &dir_path) { return index; } +int ProjectList::get_index(const ProjectListItemControl *p_control) const { + for (int i = 0; i < _projects.size(); ++i) { + if (_projects[i].control == p_control) { + return i; + } + } + return -1; +} + void ProjectList::ensure_project_visible(int p_index) { const Item &item = _projects[p_index]; ensure_control_visible(item.control); @@ -915,6 +1030,7 @@ void ProjectList::_remove_project(int p_index, bool p_update_config) { // Not actually saving the file, in case you are doing more changes to settings } + queue_accessibility_update(); update_dock_menu(); } @@ -996,18 +1112,21 @@ void ProjectList::_clear_project_selection() { for (int i = 0; i < previous_selected_items.size(); ++i) { previous_selected_items[i].control->set_selected(false); } + queue_accessibility_update(); } void ProjectList::_select_project_nocheck(int p_index) { Item &item = _projects.write[p_index]; _selected_project_paths.insert(item.path); item.control->set_selected(true); + queue_accessibility_update(); } void ProjectList::_deselect_project_nocheck(int p_index) { Item &item = _projects.write[p_index]; _selected_project_paths.erase(item.path); item.control->set_selected(false); + queue_accessibility_update(); } inline void _sort_project_range(int &a, int &b) { @@ -1033,6 +1152,10 @@ void ProjectList::select_project(int p_index) { _select_project_nocheck(p_index); } +void ProjectList::deselect_project(int p_index) { + _deselect_project_nocheck(p_index); +} + void ProjectList::select_first_visible_project() { _clear_project_selection(); diff --git a/editor/project_manager/project_list.h b/editor/project_manager/project_list.h index 265660a53b..552ea11b94 100644 --- a/editor/project_manager/project_list.h +++ b/editor/project_manager/project_list.h @@ -64,6 +64,13 @@ class ProjectListItemControl : public HBoxContainer { void _favorite_button_pressed(); void _explore_button_pressed(); + ProjectList *get_list() const; + + void _accessibility_action_open(const Variant &p_data); + void _accessibility_action_scroll_into_view(const Variant &p_data); + void _accessibility_action_focus(const Variant &p_data); + void _accessibility_action_blur(const Variant &p_data); + protected: void _notification(int p_what); static void _bind_methods(); @@ -91,6 +98,7 @@ class ProjectList : public ScrollContainer { GDCLASS(ProjectList, ScrollContainer) friend class ProjectManager; + friend class ProjectListItemControl; public: enum FilterOption { @@ -258,10 +266,12 @@ public: void set_project_version(const String &p_project_path, int version); int refresh_project(const String &dir_path); void ensure_project_visible(int p_index); + int get_index(const ProjectListItemControl *p_control) const; // Project list selection. void select_project(int p_index); + void deselect_project(int p_index); void select_first_visible_project(); Vector get_selected_projects() const; const HashSet &get_selected_project_keys() const; diff --git a/editor/project_manager/project_tag.cpp b/editor/project_manager/project_tag.cpp index fe4e5999ff..8b36d41bff 100644 --- a/editor/project_manager/project_tag.cpp +++ b/editor/project_manager/project_tag.cpp @@ -68,7 +68,8 @@ ProjectTag::ProjectTag(const String &p_text, bool p_display_close) { add_child(button); button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); button->set_text(p_text.capitalize()); - button->set_focus_mode(FOCUS_NONE); + button->set_focus_mode(FOCUS_ACCESSIBILITY); + button->set_accessibility_name(vformat(TTR("Project Tag: %s"), p_text)); button->set_icon_alignment(HORIZONTAL_ALIGNMENT_RIGHT); button->set_theme_type_variation(SNAME("ProjectTagButton")); } diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp index 91d0dbe739..db5113fa70 100644 --- a/editor/project_settings_editor.cpp +++ b/editor/project_settings_editor.cpp @@ -659,6 +659,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { search_box = memnew(LineEdit); search_box->set_placeholder(TTR("Filter Settings")); + search_box->set_accessibility_name(TTRC("Filter Settings")); search_box->set_clear_button_enabled(true); search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); search_bar->add_child(search_box); @@ -672,17 +673,20 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { property_box = memnew(LineEdit); property_box->set_placeholder(TTR("Select a Setting or Type its Name")); + property_box->set_accessibility_name(TTRC("Setting Name")); property_box->set_h_size_flags(Control::SIZE_EXPAND_FILL); property_box->connect(SceneStringName(text_changed), callable_mp(this, &ProjectSettingsEditor::_property_box_changed)); custom_properties->add_child(property_box); feature_box = memnew(OptionButton); feature_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE); + feature_box->set_accessibility_name(TTRC("Feature")); feature_box->connect(SceneStringName(item_selected), callable_mp(this, &ProjectSettingsEditor::_feature_selected)); custom_properties->add_child(feature_box); type_box = memnew(OptionButton); type_box->set_custom_minimum_size(Size2(120, 0) * EDSCALE); + type_box->set_accessibility_name(TTRC("Type")); custom_properties->add_child(type_box); add_button = memnew(Button); @@ -731,6 +735,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) { restart_close_button = memnew(Button); restart_close_button->set_flat(true); restart_close_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectSettingsEditor::_editor_restart_close)); + restart_close_button->set_accessibility_name(TTRC("Close")); restart_hb->add_child(restart_close_button); action_map_editor = memnew(ActionMapEditor); diff --git a/editor/rename_dialog.cpp b/editor/rename_dialog.cpp index e334c63fba..153d663691 100644 --- a/editor/rename_dialog.cpp +++ b/editor/rename_dialog.cpp @@ -69,6 +69,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { lne_search = memnew(LineEdit); lne_search->set_name("lne_search"); + lne_search->set_accessibility_name(TTRC("Search")); lne_search->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *lbl_replace = memnew(Label); @@ -76,6 +77,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { lne_replace = memnew(LineEdit); lne_replace->set_name("lne_replace"); + lne_replace->set_accessibility_name(TTRC("Replace")); lne_replace->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_main->add_child(lbl_search); @@ -90,6 +92,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { lne_prefix = memnew(LineEdit); lne_prefix->set_name("lne_prefix"); + lne_prefix->set_accessibility_name(TTRC("Prefix")); lne_prefix->set_h_size_flags(Control::SIZE_EXPAND_FILL); Label *lbl_suffix = memnew(Label); @@ -97,6 +100,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { lne_suffix = memnew(LineEdit); lne_suffix->set_name("lne_suffix"); + lne_prefix->set_accessibility_name(TTRC("Suffix")); lne_suffix->set_h_size_flags(Control::SIZE_EXPAND_FILL); grd_main->add_child(lbl_prefix); @@ -209,6 +213,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { spn_count_start = memnew(SpinBox); spn_count_start->set_tooltip_text(TTR("Initial value for the counter.")); + spn_count_start->set_accessibility_name(TTRC("Counter Initial Value")); spn_count_start->set_step(1); spn_count_start->set_min(0); hbc_count_options->add_child(spn_count_start); @@ -220,6 +225,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { spn_count_step = memnew(SpinBox); spn_count_step->set_tooltip_text(TTR("Amount by which counter is incremented for each node.")); + spn_count_step->set_accessibility_name(TTRC("Counter Step")); spn_count_step->set_step(1); hbc_count_options->add_child(spn_count_step); @@ -230,6 +236,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { spn_count_padding = memnew(SpinBox); 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_accessibility_name(TTRC("Minimum Number of Digits")); spn_count_padding->set_step(1); hbc_count_options->add_child(spn_count_padding); @@ -254,6 +261,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { hbc_style->add_child(lbl_style); opt_style = memnew(OptionButton); + opt_style->set_accessibility_name(TTRC("Style")); opt_style->add_item(TTR("Keep")); opt_style->add_item(TTR("PascalCase to snake_case")); opt_style->add_item(TTR("snake_case to PascalCase")); @@ -269,6 +277,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor) { hbc_case->add_child(lbl_case); opt_case = memnew(OptionButton); + opt_case->set_accessibility_name(TTRC("Case")); opt_case->add_item(TTR("Keep")); opt_case->add_item(TTR("To Lowercase")); opt_case->add_item(TTR("To Uppercase")); diff --git a/editor/run_instances_dialog.cpp b/editor/run_instances_dialog.cpp index 2811ada541..1e2d598c73 100644 --- a/editor/run_instances_dialog.cpp +++ b/editor/run_instances_dialog.cpp @@ -339,6 +339,7 @@ RunInstancesDialog::RunInstancesDialog() { instance_count->set_min(1); instance_count->set_max(20); instance_count->set_value(EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_instance_count", stored_data.size())); + instance_count->set_accessibility_name(TTRC("Number of Instances")); args_gc->add_child(instance_count); instance_count->connect(SceneStringName(value_changed), callable_mp(this, &RunInstancesDialog::_start_instance_timer).unbind(1)); @@ -349,6 +350,7 @@ RunInstancesDialog::RunInstancesDialog() { main_args_edit = memnew(LineEdit); main_args_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); main_args_edit->set_placeholder(TTR("Space-separated arguments, example: host player1 blue")); + main_args_edit->set_accessibility_name(TTRC("Launch Arguments")); args_gc->add_child(main_args_edit); _fetch_main_args(); ProjectSettings::get_singleton()->connect("settings_changed", callable_mp(this, &RunInstancesDialog::_fetch_main_args)); @@ -358,6 +360,7 @@ RunInstancesDialog::RunInstancesDialog() { main_features_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); main_features_edit->set_placeholder(TTR("Comma-separated tags, example: demo, steam, event")); main_features_edit->set_text(EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_main_feature_tags", "")); + main_features_edit->set_accessibility_name(TTRC("Feature Tags")); args_gc->add_child(main_features_edit); main_features_edit->connect(SceneStringName(text_changed), callable_mp(this, &RunInstancesDialog::_start_main_timer).unbind(1)); diff --git a/editor/scene_create_dialog.cpp b/editor/scene_create_dialog.cpp index 971735760b..24ad3064e9 100644 --- a/editor/scene_create_dialog.cpp +++ b/editor/scene_create_dialog.cpp @@ -226,6 +226,7 @@ SceneCreateDialog::SceneCreateDialog() { node_type_other = memnew(CheckBox); hb->add_child(node_type_other); + node_type_other->set_accessibility_name(TTRC("Other Type")); node_type_other->set_button_group(node_type_group); node_type_other->set_meta(type_meta, ROOT_OTHER); @@ -234,12 +235,14 @@ SceneCreateDialog::SceneCreateDialog() { spacing->set_custom_minimum_size(Size2(4 * EDSCALE, 0)); other_type_display = memnew(LineEdit); + other_type_display->set_accessibility_name(TTRC("Other Type")); hb->add_child(other_type_display); other_type_display->set_h_size_flags(Control::SIZE_EXPAND_FILL); other_type_display->set_editable(false); other_type_display->set_text("Node"); select_node_button = memnew(Button); + select_node_button->set_accessibility_name(TTRC("Select Node")); hb->add_child(select_node_button); select_node_button->connect(SceneStringName(pressed), callable_mp(this, &SceneCreateDialog::browse_types)); } @@ -253,6 +256,7 @@ SceneCreateDialog::SceneCreateDialog() { scene_name_edit = memnew(LineEdit); hb->add_child(scene_name_edit); + scene_name_edit->set_accessibility_name(TTRC("Scene Name:")); scene_name_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL); scene_name_edit->connect(SceneStringName(text_submitted), callable_mp(this, &SceneCreateDialog::accept_create).unbind(1)); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 651f434973..21317593c1 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1249,6 +1249,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { case TOOL_HIDE_FILTERED_OUT_PARENTS: { scene_tree->set_hide_filtered_out_parents(!EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), true); } break; + case TOOL_ACCESSIBILITY_WARNINGS: { + scene_tree->set_accessibility_warnings(!EDITOR_GET("docks/scene_tree/accessibility_warnings"), true); + } break; case TOOL_SCENE_EDITABLE_CHILDREN: { if (!profile_allow_editing) { break; @@ -1617,6 +1620,7 @@ void SceneTreeDock::_notification(int p_what) { node_shortcuts_toggle = memnew(Button); node_shortcuts_toggle->set_flat(true); + node_shortcuts_toggle->set_accessibility_name(TTRC("Favorite Nodes")); node_shortcuts_toggle->set_button_icon(get_editor_theme_icon(SNAME("Favorites"))); node_shortcuts_toggle->set_toggle_mode(true); node_shortcuts_toggle->set_tooltip_text(TTR("Toggle the display of favorite nodes.")); @@ -1679,6 +1683,7 @@ void SceneTreeDock::_notification(int p_what) { clear_inherit_confirm->connect(SceneStringName(confirmed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_SCENE_CLEAR_INHERITANCE_CONFIRM, false)); scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); scene_tree->set_hide_filtered_out_parents(EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), false); + scene_tree->set_accessibility_warnings(EDITOR_GET("docks/scene_tree/accessibility_warnings"), false); } break; case NOTIFICATION_EXIT_TREE: { @@ -1689,6 +1694,7 @@ void SceneTreeDock::_notification(int p_what) { if (EditorSettings::get_singleton()->check_changed_settings_in_group("docks/scene_tree")) { scene_tree->set_auto_expand_selected(EDITOR_GET("docks/scene_tree/auto_expand_to_selected"), false); scene_tree->set_hide_filtered_out_parents(EDITOR_GET("docks/scene_tree/hide_filtered_out_parents"), false); + scene_tree->set_accessibility_warnings(EDITOR_GET("docks/scene_tree/accessibility_warnings"), false); } } break; @@ -3981,6 +3987,9 @@ void SceneTreeDock::_update_tree_menu() { tree_menu->set_item_checked(-1, EDITOR_GET("docks/scene_tree/hide_filtered_out_parents")); tree_menu->add_separator(); + tree_menu->add_check_item(TTR("Show Accessibility Warnings"), TOOL_ACCESSIBILITY_WARNINGS); + tree_menu->set_item_checked(tree_menu->get_item_index(TOOL_ACCESSIBILITY_WARNINGS), EDITOR_GET("docks/scene_tree/accessibility_warnings")); + PopupMenu *resource_list = memnew(PopupMenu); resource_list->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); resource_list->connect("about_to_popup", callable_mp(this, &SceneTreeDock::_list_all_subresources).bind(resource_list)); @@ -4674,6 +4683,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_add->set_theme_type_variation("FlatMenuButton"); button_add->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_NEW, false)); button_add->set_tooltip_text(TTRC("Add/Create a New Node.")); + button_add->set_accessibility_name(TTRC("Add/Create")); button_add->set_shortcut(ED_GET_SHORTCUT("scene_tree/add_child_node")); filter_hbc->add_child(button_add); @@ -4681,6 +4691,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_instance->set_theme_type_variation("FlatMenuButton"); button_instance->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_INSTANTIATE, false)); button_instance->set_tooltip_text(TTRC("Instantiate a scene file as a Node. Creates an inherited scene if no root node exists.")); + button_instance->set_accessibility_name(TTRC("Instantiate Scene File")); button_instance->set_shortcut(ED_GET_SHORTCUT("scene_tree/instantiate_scene")); filter_hbc->add_child(button_instance); vbc->add_child(filter_hbc); @@ -4689,6 +4700,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec filter = memnew(LineEdit); filter->set_h_size_flags(SIZE_EXPAND_FILL); filter->set_placeholder(TTR("Filter: name, t:type, g:group")); + filter->set_accessibility_name(TTRC("Filter")); filter->set_tooltip_text(TTR("Filter nodes by entering a part of their name, type (if prefixed with \"type:\" or \"t:\")\nor group (if prefixed with \"group:\" or \"g:\"). Filtering is case-insensitive.")); filter_hbc->add_child(filter); filter->add_theme_constant_override("minimum_character_width", 0); @@ -4706,6 +4718,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_create_script->set_theme_type_variation("FlatMenuButton"); button_create_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_ATTACH_SCRIPT, false)); button_create_script->set_tooltip_text(TTRC("Attach a new or existing script to the selected node.")); + button_create_script->set_accessibility_name(TTRC("Attach Script")); button_create_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/attach_script")); filter_hbc->add_child(button_create_script); button_create_script->hide(); @@ -4714,6 +4727,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_detach_script->set_theme_type_variation("FlatMenuButton"); button_detach_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_DETACH_SCRIPT, false)); button_detach_script->set_tooltip_text(TTRC("Detach the script from the selected node.")); + button_detach_script->set_accessibility_name(TTRC("Detach Script")); button_detach_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/detach_script")); filter_hbc->add_child(button_detach_script); button_detach_script->hide(); @@ -4722,6 +4736,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_extend_script->set_flat(true); button_extend_script->connect(SceneStringName(pressed), callable_mp(this, &SceneTreeDock::_tool_selected).bind(TOOL_EXTEND_SCRIPT, false)); button_extend_script->set_tooltip_text(TTRC("Extend the script of the selected node.")); + button_extend_script->set_accessibility_name(TTRC("Extend Script")); button_extend_script->set_shortcut(ED_GET_SHORTCUT("scene_tree/extend_script")); filter_hbc->add_child(button_extend_script); button_extend_script->hide(); @@ -4730,6 +4745,7 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec button_tree_menu->set_flat(false); button_tree_menu->set_theme_type_variation("FlatMenuButton"); button_tree_menu->set_tooltip_text(TTR("Extra scene options.")); + button_tree_menu->set_accessibility_name(TTRC("Scene Options")); button_tree_menu->connect("about_to_popup", callable_mp(this, &SceneTreeDock::_update_tree_menu)); filter_hbc->add_child(button_tree_menu); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index 164d971b7d..8968d33b8c 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -88,6 +88,7 @@ class SceneTreeDock : public VBoxContainer { TOOL_CREATE_FAVORITE, TOOL_CENTER_PARENT, TOOL_HIDE_FILTERED_OUT_PARENTS, + TOOL_ACCESSIBILITY_WARNINGS, }; enum { diff --git a/editor/script_create_dialog.cpp b/editor/script_create_dialog.cpp index 4850b4cc1e..2bb12e7390 100644 --- a/editor/script_create_dialog.cpp +++ b/editor/script_create_dialog.cpp @@ -874,6 +874,7 @@ ScriptCreateDialog::ScriptCreateDialog() { language_menu->set_custom_minimum_size(Size2(350, 0) * EDSCALE); language_menu->set_expand_icon(true); language_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL); + language_menu->set_accessibility_name(TTRC("Language")); gc->add_child(memnew(Label(TTR("Language:")))); gc->add_child(language_menu); @@ -898,14 +899,17 @@ ScriptCreateDialog::ScriptCreateDialog() { HBoxContainer *hb = memnew(HBoxContainer); hb->set_h_size_flags(Control::SIZE_EXPAND_FILL); parent_name = memnew(LineEdit); + parent_name->set_accessibility_name(TTRC("Parent Name")); parent_name->connect(SceneStringName(text_changed), callable_mp(this, &ScriptCreateDialog::_parent_name_changed)); parent_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(parent_name); register_text_enter(parent_name); parent_search_button = memnew(Button); + parent_search_button->set_accessibility_name(TTRC("Search Parent")); parent_search_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_class_in_tree)); hb->add_child(parent_search_button); parent_browse_button = memnew(Button); + parent_browse_button->set_accessibility_name(TTRC("Select Parent")); parent_browse_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_path).bind(true, false)); hb->add_child(parent_browse_button); gc->add_child(memnew(Label(TTR("Inherits:")))); @@ -918,6 +922,7 @@ ScriptCreateDialog::ScriptCreateDialog() { use_templates = memnew(CheckBox); use_templates->set_pressed(is_using_templates); + use_templates->set_accessibility_name(TTRC("Use Template")); use_templates->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_use_template_pressed)); template_hb->add_child(use_templates); @@ -925,6 +930,7 @@ ScriptCreateDialog::ScriptCreateDialog() { template_menu = memnew(OptionButton); template_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + template_menu->set_accessibility_name(TTRC("Template")); template_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL); template_menu->connect(SceneStringName(item_selected), callable_mp(this, &ScriptCreateDialog::_template_changed)); template_hb->add_child(template_menu); @@ -935,6 +941,7 @@ ScriptCreateDialog::ScriptCreateDialog() { built_in = memnew(CheckBox); built_in->set_text(TTR("On")); + built_in->set_accessibility_name(TTRC("Built-in Script")); built_in->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_built_in_pressed)); gc->add_child(memnew(Label(TTR("Built-in Script:")))); gc->add_child(built_in); @@ -944,11 +951,13 @@ ScriptCreateDialog::ScriptCreateDialog() { hb = memnew(HBoxContainer); hb->connect(SceneStringName(sort_children), callable_mp(this, &ScriptCreateDialog::_path_hbox_sorted)); file_path = memnew(LineEdit); + file_path->set_accessibility_name(TTRC("File Path")); file_path->connect(SceneStringName(text_changed), callable_mp(this, &ScriptCreateDialog::_path_changed)); file_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); hb->add_child(file_path); register_text_enter(file_path); path_button = memnew(Button); + path_button->set_accessibility_name(TTRC("Select File")); path_button->connect(SceneStringName(pressed), callable_mp(this, &ScriptCreateDialog::_browse_path).bind(false, true)); hb->add_child(path_button); Label *label = memnew(Label(TTR("Path:"))); @@ -961,6 +970,7 @@ ScriptCreateDialog::ScriptCreateDialog() { built_in_name = memnew(LineEdit); built_in_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); + built_in_name->set_accessibility_name(TTRC("Name")); register_text_enter(built_in_name); label = memnew(Label(TTR("Name:"))); gc->add_child(label); diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp index 684208f64a..f3d59b8579 100644 --- a/editor/shader_create_dialog.cpp +++ b/editor/shader_create_dialog.cpp @@ -573,6 +573,7 @@ ShaderCreateDialog::ShaderCreateDialog() { type_menu = memnew(OptionButton); type_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + type_menu->set_accessibility_name(TTRC("Type")); type_menu->set_custom_minimum_size(Size2(250, 0) * EDSCALE); type_menu->set_h_size_flags(Control::SIZE_EXPAND_FILL); gc->add_child(memnew(Label(TTR("Type:")))); @@ -614,6 +615,7 @@ ShaderCreateDialog::ShaderCreateDialog() { mode_menu = memnew(OptionButton); mode_menu->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); + mode_menu->set_accessibility_name(TTRC("Mode")); for (const String &type_name : ShaderTypes::get_singleton()->get_types_list()) { mode_menu->add_item(type_name.capitalize()); } @@ -624,6 +626,7 @@ ShaderCreateDialog::ShaderCreateDialog() { // Templates. template_menu = memnew(OptionButton); + template_menu->set_accessibility_name(TTRC("Template")); gc->add_child(memnew(Label(TTR("Template:")))); gc->add_child(template_menu); template_menu->connect(SceneStringName(item_selected), callable_mp(this, &ShaderCreateDialog::_template_changed)); @@ -632,6 +635,7 @@ ShaderCreateDialog::ShaderCreateDialog() { internal = memnew(CheckBox); internal->set_text(TTR("On")); + internal->set_accessibility_name(TTRC("Built-in Shader")); internal->connect(SceneStringName(toggled), callable_mp(this, &ShaderCreateDialog::_built_in_toggled)); gc->add_child(memnew(Label(TTR("Built-in Shader:")))); gc->add_child(internal); @@ -647,6 +651,7 @@ ShaderCreateDialog::ShaderCreateDialog() { hb->add_child(file_path); register_text_enter(file_path); path_button = memnew(Button); + path_button->set_accessibility_name(TTRC("Select")); path_button->connect(SceneStringName(pressed), callable_mp(this, &ShaderCreateDialog::_browse_path)); hb->add_child(path_button); gc->add_child(memnew(Label(TTR("Path:")))); diff --git a/editor/themes/editor_theme_manager.cpp b/editor/themes/editor_theme_manager.cpp index 6bfe8816f9..6c7363de60 100644 --- a/editor/themes/editor_theme_manager.cpp +++ b/editor/themes/editor_theme_manager.cpp @@ -1480,6 +1480,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // Label. p_theme->set_stylebox(CoreStringName(normal), "Label", p_config.base_empty_style); + p_theme->set_stylebox("focus", "Label", p_config.button_style_focus); p_theme->set_color(SceneStringName(font_color), "Label", p_config.font_color); p_theme->set_color("font_shadow_color", "Label", Color(0, 0, 0, 0)); @@ -1546,6 +1547,7 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the // GraphEdit. p_theme->set_stylebox(SceneStringName(panel), "GraphEdit", p_config.tree_panel_style); + p_theme->set_stylebox("panel_focus", "GraphEdit", p_config.button_style_focus); p_theme->set_stylebox("menu_panel", "GraphEdit", make_flat_stylebox(p_config.dark_color_1 * Color(1, 1, 1, 0.6), 4, 2, 4, 2, 3)); float grid_base_brightness = p_config.dark_theme ? 1.0 : 0.0; @@ -1677,9 +1679,11 @@ void EditorThemeManager::_populate_standard_styles(const Ref &p_the p_theme->set_stylebox(SceneStringName(panel), "GraphNode", gn_panel_style); p_theme->set_stylebox("panel_selected", "GraphNode", gn_panel_selected_style); + p_theme->set_stylebox("panel_focus", "GraphNode", p_config.button_style_focus); p_theme->set_stylebox("titlebar", "GraphNode", gn_titlebar_style); p_theme->set_stylebox("titlebar_selected", "GraphNode", gn_titlebar_selected_style); p_theme->set_stylebox("slot", "GraphNode", gn_slot_style); + p_theme->set_stylebox("slot_selected", "GraphNode", p_config.button_style_focus); p_theme->set_color("resizer_color", "GraphNode", gn_decoration_color); diff --git a/modules/gltf/editor/editor_scene_importer_blend.cpp b/modules/gltf/editor/editor_scene_importer_blend.cpp index d56a3be738..c55b9ba20f 100644 --- a/modules/gltf/editor/editor_scene_importer_blend.cpp +++ b/modules/gltf/editor/editor_scene_importer_blend.cpp @@ -515,6 +515,7 @@ bool EditorFileSystemImportFormatSupportQueryBlend::query() { blender_path = memnew(LineEdit); blender_path->set_h_size_flags(Control::SIZE_EXPAND_FILL); + blender_path->set_accessibility_name(TTRC("Path")); hb->add_child(blender_path); blender_path_browse = memnew(Button); diff --git a/modules/gridmap/editor/grid_map_editor_plugin.cpp b/modules/gridmap/editor/grid_map_editor_plugin.cpp index b1f0cfd3f6..bcd46b5491 100644 --- a/modules/gridmap/editor/grid_map_editor_plugin.cpp +++ b/modules/gridmap/editor/grid_map_editor_plugin.cpp @@ -1365,6 +1365,7 @@ GridMapEditor::GridMapEditor() { settings_pick_distance->set_min(500.0f); settings_pick_distance->set_step(1.0f); settings_pick_distance->set_value(EDITOR_GET("editors/grid_map/pick_distance")); + settings_pick_distance->set_accessibility_name(TTRC("Pick Distance")); settings_vbc->add_margin_child(TTR("Pick Distance:"), settings_pick_distance); options->get_popup()->connect(SceneStringName(id_pressed), callable_mp(this, &GridMapEditor::_menu_option)); @@ -1382,6 +1383,7 @@ GridMapEditor::GridMapEditor() { transform_mode_button->set_toggle_mode(true); transform_mode_button->set_button_group(mode_buttons_group); transform_mode_button->set_shortcut(ED_SHORTCUT("grid_map/transform_tool", TTRC("Transform"), Key::T, true)); + transform_mode_button->set_accessibility_name(TTRC("Transform")); transform_mode_button->connect(SceneStringName(toggled), callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1)); mode_buttons->add_child(transform_mode_button); @@ -1394,6 +1396,7 @@ GridMapEditor::GridMapEditor() { select_mode_button->set_toggle_mode(true); select_mode_button->set_button_group(mode_buttons_group); select_mode_button->set_shortcut(ED_SHORTCUT("grid_map/selection_tool", TTRC("Selection"), Key::Q, true)); + select_mode_button->set_accessibility_name(TTRC("Select")); select_mode_button->connect(SceneStringName(toggled), callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1)); mode_buttons->add_child(select_mode_button); @@ -1404,6 +1407,7 @@ GridMapEditor::GridMapEditor() { erase_mode_button->set_toggle_mode(true); erase_mode_button->set_button_group(mode_buttons_group); erase_mode_button->set_shortcut(ED_SHORTCUT("grid_map/erase_tool", TTRC("Erase"), Key::W, true)); + erase_mode_button->set_accessibility_name(TTRC("Erase")); mode_buttons->add_child(erase_mode_button); erase_mode_button->connect(SceneStringName(toggled), callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1)); @@ -1414,6 +1418,7 @@ GridMapEditor::GridMapEditor() { paint_mode_button->set_toggle_mode(true); paint_mode_button->set_button_group(mode_buttons_group); paint_mode_button->set_shortcut(ED_SHORTCUT("grid_map/paint_tool", TTRC("Paint"), Key::E, true)); + paint_mode_button->set_accessibility_name(TTRC("Paint")); paint_mode_button->connect(SceneStringName(toggled), callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1)); mode_buttons->add_child(paint_mode_button); @@ -1424,6 +1429,7 @@ GridMapEditor::GridMapEditor() { pick_mode_button->set_toggle_mode(true); pick_mode_button->set_button_group(mode_buttons_group); pick_mode_button->set_shortcut(ED_SHORTCUT("grid_map/pick_tool", TTRC("Pick"), Key::R, true)); + pick_mode_button->set_accessibility_name(TTRC("Pick")); pick_mode_button->connect(SceneStringName(toggled), callable_mp(this, &GridMapEditor::_on_tool_mode_changed).unbind(1)); mode_buttons->add_child(pick_mode_button); @@ -1438,6 +1444,7 @@ GridMapEditor::GridMapEditor() { fill_action_button = memnew(Button); fill_action_button->set_theme_type_variation(SceneStringName(FlatButton)); fill_action_button->set_shortcut(ED_SHORTCUT("grid_map/fill_tool", TTRC("Fill"), Key::Z, true)); + fill_action_button->set_accessibility_name(TTRC("Fill")); fill_action_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_FILL)); action_buttons->add_child(fill_action_button); @@ -1446,6 +1453,7 @@ GridMapEditor::GridMapEditor() { move_action_button = memnew(Button); move_action_button->set_theme_type_variation(SceneStringName(FlatButton)); move_action_button->set_shortcut(ED_SHORTCUT("grid_map/move_tool", TTRC("Move"), Key::X, true)); + fill_action_button->set_accessibility_name(TTRC("Move")); move_action_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_CUT)); action_buttons->add_child(move_action_button); @@ -1454,6 +1462,7 @@ GridMapEditor::GridMapEditor() { duplicate_action_button = memnew(Button); duplicate_action_button->set_theme_type_variation(SceneStringName(FlatButton)); duplicate_action_button->set_shortcut(ED_SHORTCUT("grid_map/duplicate_tool", TTRC("Duplicate"), Key::C, true)); + duplicate_action_button->set_accessibility_name(TTRC("Duplicate")); duplicate_action_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_DUPLICATE)); action_buttons->add_child(duplicate_action_button); @@ -1462,6 +1471,7 @@ GridMapEditor::GridMapEditor() { delete_action_button = memnew(Button); delete_action_button->set_theme_type_variation(SceneStringName(FlatButton)); delete_action_button->set_shortcut(ED_SHORTCUT("grid_map/delete_tool", TTRC("Delete"), Key::V, true)); + delete_action_button->set_accessibility_name(TTRC("Delete")); delete_action_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_SELECTION_CLEAR)); action_buttons->add_child(delete_action_button); @@ -1476,6 +1486,7 @@ GridMapEditor::GridMapEditor() { rotate_x_button = memnew(Button); rotate_x_button->set_theme_type_variation(SceneStringName(FlatButton)); rotate_x_button->set_shortcut(ED_SHORTCUT("grid_map/cursor_rotate_x", TTRC("Cursor Rotate X"), Key::A, true)); + rotate_x_button->set_accessibility_name(TTRC("Rotate X")); rotate_x_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_CURSOR_ROTATE_X)); rotation_buttons->add_child(rotate_x_button); @@ -1484,6 +1495,7 @@ GridMapEditor::GridMapEditor() { rotate_y_button = memnew(Button); rotate_y_button->set_theme_type_variation(SceneStringName(FlatButton)); rotate_y_button->set_shortcut(ED_SHORTCUT("grid_map/cursor_rotate_y", TTRC("Cursor Rotate Y"), Key::S, true)); + rotate_y_button->set_accessibility_name(TTRC("Rotate Y")); rotate_y_button->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_menu_option).bind(MENU_OPTION_CURSOR_ROTATE_Y)); rotation_buttons->add_child(rotate_y_button); @@ -1507,6 +1519,7 @@ GridMapEditor::GridMapEditor() { floor->set_min(-32767); floor->set_max(32767); floor->set_step(1); + floor->set_accessibility_name(TTRC("Grid Floor")); floor->set_tooltip_text( vformat(TTR("Change Grid Floor:\nPrevious Plane (%s)\nNext Plane (%s)"), ED_GET_SHORTCUT("grid_map/previous_floor")->get_as_text(), @@ -1521,6 +1534,7 @@ GridMapEditor::GridMapEditor() { search_box = memnew(LineEdit); search_box->add_theme_constant_override("minimum_character_width", 10); search_box->set_placeholder(TTR("Filter Meshes")); + search_box->set_accessibility_name(TTRC("Filter Meshes")); search_box->set_clear_button_enabled(true); toolbar->add_child(search_box); search_box->connect(SceneStringName(text_changed), callable_mp(this, &GridMapEditor::_text_changed)); @@ -1537,6 +1551,7 @@ GridMapEditor::GridMapEditor() { mode_thumbnail = memnew(Button); mode_thumbnail->set_theme_type_variation(SceneStringName(FlatButton)); mode_thumbnail->set_toggle_mode(true); + mode_thumbnail->set_accessibility_name(TTRC("View as Thumbnails")); mode_thumbnail->set_pressed(true); toolbar->add_child(mode_thumbnail); mode_thumbnail->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_set_display_mode).bind(DISPLAY_THUMBNAIL)); @@ -1544,6 +1559,7 @@ GridMapEditor::GridMapEditor() { mode_list = memnew(Button); mode_list->set_theme_type_variation(SceneStringName(FlatButton)); mode_list->set_toggle_mode(true); + mode_list->set_accessibility_name(TTRC("View as List")); mode_list->set_pressed(false); toolbar->add_child(mode_list); mode_list->connect(SceneStringName(pressed), callable_mp(this, &GridMapEditor::_set_display_mode).bind(DISPLAY_LIST)); diff --git a/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp b/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp index 71a2fcd2f9..36d2913d8b 100644 --- a/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp +++ b/modules/interactive_music/editor/audio_stream_interactive_editor_plugin.cpp @@ -341,6 +341,7 @@ AudioStreamInteractiveTransitionEditor::AudioStreamInteractiveTransitionEditor() transition_enabled = memnew(CheckBox); transition_enabled->set_text(TTR("Enabled")); + transition_enabled->set_accessibility_name(TTRC("Use Transition")); edit_vb->add_margin_child(TTR("Use Transition:"), transition_enabled); transition_enabled->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited)); @@ -350,6 +351,7 @@ AudioStreamInteractiveTransitionEditor::AudioStreamInteractiveTransitionEditor() transition_from->add_item(TTR("Next Beat"), AudioStreamInteractive::TRANSITION_FROM_TIME_NEXT_BEAT); transition_from->add_item(TTR("Next Bar"), AudioStreamInteractive::TRANSITION_FROM_TIME_NEXT_BAR); transition_from->add_item(TTR("Clip End"), AudioStreamInteractive::TRANSITION_FROM_TIME_END); + transition_from->set_accessibility_name(TTRC("Transition From")); transition_from->connect(SceneStringName(item_selected), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited).unbind(1)); @@ -358,25 +360,30 @@ AudioStreamInteractiveTransitionEditor::AudioStreamInteractiveTransitionEditor() transition_to->add_item(TTR("Same Position"), AudioStreamInteractive::TRANSITION_TO_TIME_SAME_POSITION); transition_to->add_item(TTR("Clip Start"), AudioStreamInteractive::TRANSITION_TO_TIME_START); transition_to->add_item(TTR("Prev Position"), AudioStreamInteractive::TRANSITION_TO_TIME_PREVIOUS_POSITION); + transition_to->set_accessibility_name(TTRC("Transition To")); transition_to->connect(SceneStringName(item_selected), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited).unbind(1)); fade_mode = memnew(OptionButton); edit_vb->add_margin_child(TTR("Fade Mode:"), fade_mode); fade_mode->connect(SceneStringName(item_selected), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited).unbind(1)); + fade_mode->set_accessibility_name(TTRC("Fade Mode")); fade_beats = memnew(SpinBox); edit_vb->add_margin_child(TTR("Fade Beats:"), fade_beats); fade_beats->set_max(16); fade_beats->set_step(0.1); fade_beats->connect(SceneStringName(value_changed), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited).unbind(1)); + fade_beats->set_accessibility_name(TTRC("Fade Beats")); filler_clip = memnew(OptionButton); edit_vb->add_margin_child(TTR("Filler Clip:"), filler_clip); filler_clip->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED); filler_clip->connect(SceneStringName(item_selected), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited).unbind(1)); + filler_clip->set_accessibility_name(TTRC("Filler Clip")); hold_previous = memnew(CheckBox); hold_previous->set_text(TTR("Enabled")); + hold_previous->set_accessibility_name(TTRC("Hold Previous")); hold_previous->connect(SceneStringName(pressed), callable_mp(this, &AudioStreamInteractiveTransitionEditor::_edited)); edit_vb->add_margin_child(TTR("Hold Previous:"), hold_previous); diff --git a/modules/multiplayer/editor/editor_network_profiler.cpp b/modules/multiplayer/editor/editor_network_profiler.cpp index 5a2611adde..0c0f5a45d1 100644 --- a/modules/multiplayer/editor/editor_network_profiler.cpp +++ b/modules/multiplayer/editor/editor_network_profiler.cpp @@ -339,6 +339,7 @@ EditorNetworkProfiler::EditorNetworkProfiler() { incoming_bandwidth_text->set_editable(false); incoming_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE); incoming_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT); + incoming_bandwidth_text->set_accessibility_name(TTRC("Incoming Bandwidth")); hb->add_child(incoming_bandwidth_text); Control *down_up_spacer = memnew(Control); @@ -354,6 +355,7 @@ EditorNetworkProfiler::EditorNetworkProfiler() { outgoing_bandwidth_text->set_editable(false); outgoing_bandwidth_text->set_custom_minimum_size(Size2(120, 0) * EDSCALE); outgoing_bandwidth_text->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT); + outgoing_bandwidth_text->set_accessibility_name(TTRC("Outgoing Bandwidth")); hb->add_child(outgoing_bandwidth_text); // Set initial texts in the incoming/outgoing bandwidth labels diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index e861acc83f..797d2cf320 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -234,6 +234,7 @@ ReplicationEditor::ReplicationEditor() { np_line_edit = memnew(LineEdit); np_line_edit->set_placeholder(":property"); + np_line_edit->set_accessibility_name(TTRC("Path")); np_line_edit->set_h_size_flags(SIZE_EXPAND_FILL); np_line_edit->connect(SceneStringName(text_submitted), callable_mp(this, &ReplicationEditor::_np_text_submitted)); hb->add_child(np_line_edit); @@ -251,6 +252,7 @@ ReplicationEditor::ReplicationEditor() { pin->set_theme_type_variation(SceneStringName(FlatButton)); pin->set_toggle_mode(true); pin->set_tooltip_text(TTR("Pin replication editor")); + pin->set_accessibility_name(TTRC("Pin")); hb->add_child(pin); tree = memnew(Tree); diff --git a/modules/openxr/editor/openxr_action_editor.cpp b/modules/openxr/editor/openxr_action_editor.cpp index cca814a4e8..b4bb6d2f43 100644 --- a/modules/openxr/editor/openxr_action_editor.cpp +++ b/modules/openxr/editor/openxr_action_editor.cpp @@ -137,6 +137,7 @@ OpenXRActionEditor::OpenXRActionEditor(Ref p_action) { action_name->set_tooltip_text(TTR("Internal name of the action. Some XR runtimes don't allow spaces or special characters.")); action_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0)); action_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionEditor::_on_action_name_changed)); + action_name->set_accessibility_name(TTRC("Action Name")); add_child(action_name); action_localized_name = memnew(LineEdit); @@ -145,6 +146,7 @@ OpenXRActionEditor::OpenXRActionEditor(Ref p_action) { action_localized_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0)); action_localized_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); action_localized_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionEditor::_on_action_localized_name_changed)); + action_localized_name->set_accessibility_name(TTRC("Action Localized Name")); add_child(action_localized_name); action_type_button = memnew(OptionButton); @@ -154,6 +156,7 @@ OpenXRActionEditor::OpenXRActionEditor(Ref p_action) { action_type_button->add_item("Vector2", OpenXRAction::OPENXR_ACTION_VECTOR2); action_type_button->add_item("Pose", OpenXRAction::OPENXR_ACTION_POSE); action_type_button->add_item("Haptic", OpenXRAction::OPENXR_ACTION_HAPTIC); + action_type_button->set_accessibility_name(TTRC("Action Type")); action_type_button->select(int(action->get_action_type())); action_type_button->set_custom_minimum_size(Size2(100.0 * EDSCALE, 0.0)); action_type_button->connect(SceneStringName(item_selected), callable_mp(this, &OpenXRActionEditor::_on_item_selected)); @@ -163,6 +166,7 @@ OpenXRActionEditor::OpenXRActionEditor(Ref p_action) { rem_action = memnew(Button); rem_action->set_tooltip_text(TTR("Remove action")); + rem_action->set_accessibility_name(TTRC("Remove action")); rem_action->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionEditor::_on_remove_action)); rem_action->set_flat(true); add_child(rem_action); diff --git a/modules/openxr/editor/openxr_action_set_editor.cpp b/modules/openxr/editor/openxr_action_set_editor.cpp index c26255d73b..06c5d48d15 100644 --- a/modules/openxr/editor/openxr_action_set_editor.cpp +++ b/modules/openxr/editor/openxr_action_set_editor.cpp @@ -231,6 +231,7 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref p_action_map, fold_btn = memnew(Button); fold_btn->set_v_size_flags(Control::SIZE_SHRINK_BEGIN); fold_btn->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_toggle_expand)); + fold_btn->set_accessibility_name(TTRC("Fold")); fold_btn->set_flat(true); panel_hb->add_child(fold_btn); @@ -247,6 +248,7 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref p_action_map, action_set_name->set_tooltip_text(TTR("Internal name of the action. Some XR runtimes don't allow spaces or special characters.")); action_set_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0)); action_set_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_name_changed)); + action_set_name->set_accessibility_name(TTRC("Action Set Name")); action_set_hb->add_child(action_set_name); action_set_localized_name = memnew(LineEdit); @@ -255,6 +257,7 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref p_action_map, action_set_localized_name->set_custom_minimum_size(Size2(150.0 * EDSCALE, 0.0)); action_set_localized_name->set_h_size_flags(Control::SIZE_EXPAND_FILL); action_set_localized_name->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_localized_name_changed)); + action_set_localized_name->set_accessibility_name(TTRC("Action Set Localized Name")); action_set_hb->add_child(action_set_localized_name); action_set_priority = memnew(TextEdit); @@ -262,17 +265,20 @@ OpenXRActionSetEditor::OpenXRActionSetEditor(Ref p_action_map, action_set_priority->set_tooltip_text(TTR("Priority of the action set. If multiple action sets bind to the same input, the action set with the highest priority will be updated.")); action_set_priority->set_custom_minimum_size(Size2(50.0 * EDSCALE, 0.0)); action_set_priority->connect(SceneStringName(text_changed), callable_mp(this, &OpenXRActionSetEditor::_on_action_set_priority_changed)); + action_set_priority->set_accessibility_name(TTRC("Action Set Priority")); action_set_hb->add_child(action_set_priority); add_action = memnew(Button); add_action->set_tooltip_text(TTR("Add action.")); add_action->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_add_action)); + add_action->set_accessibility_name(TTRC("Add")); add_action->set_flat(true); action_set_hb->add_child(add_action); rem_action_set = memnew(Button); rem_action_set->set_tooltip_text(TTR("Remove action set.")); rem_action_set->connect(SceneStringName(pressed), callable_mp(this, &OpenXRActionSetEditor::_on_remove_action_set)); + rem_action_set->set_accessibility_name(TTRC("Remove")); rem_action_set->set_flat(true); action_set_hb->add_child(rem_action_set); diff --git a/modules/openxr/editor/openxr_binding_modifier_editor.cpp b/modules/openxr/editor/openxr_binding_modifier_editor.cpp index 94d5b8d5f3..172dc68607 100644 --- a/modules/openxr/editor/openxr_binding_modifier_editor.cpp +++ b/modules/openxr/editor/openxr_binding_modifier_editor.cpp @@ -263,6 +263,7 @@ OpenXRBindingModifierEditor::OpenXRBindingModifierEditor() { rem_binding_modifier_btn = memnew(Button); rem_binding_modifier_btn->set_tooltip_text(TTR("Remove this binding modifier.")); rem_binding_modifier_btn->connect(SceneStringName(pressed), callable_mp(this, &OpenXRBindingModifierEditor::_on_remove_binding_modifier)); + rem_binding_modifier_btn->set_accessibility_name(TTRC("Remove")); rem_binding_modifier_btn->set_flat(true); header_hb->add_child(rem_binding_modifier_btn); diff --git a/modules/openxr/editor/openxr_interaction_profile_editor.cpp b/modules/openxr/editor/openxr_interaction_profile_editor.cpp index 1e9fe3cadc..f4f26aebff 100644 --- a/modules/openxr/editor/openxr_interaction_profile_editor.cpp +++ b/modules/openxr/editor/openxr_interaction_profile_editor.cpp @@ -181,6 +181,7 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase() { binding_modifiers_btn = memnew(Button); binding_modifiers_btn->set_tooltip_text(TTR("Edit binding modifiers")); binding_modifiers_btn->connect("pressed", callable_mp(this, &OpenXRInteractionProfileEditorBase::_on_open_binding_modifiers)); + binding_modifiers_btn->set_accessibility_name(TTRC("Edit")); // TODO show visual difference if there are binding modifiers for this interaction profile toolbar_vb->add_child(binding_modifiers_btn); } @@ -308,6 +309,7 @@ void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, co action_binding_modifiers_btn->set_flat(true); action_binding_modifiers_btn->set_button_icon(get_theme_icon(SNAME("Modifiers"), EditorStringName(EditorIcons))); action_binding_modifiers_btn->connect(SceneStringName(pressed), callable_mp((Window *)action_binding_modifiers_dialog, &Window::popup_centered).bind(Size2i(500, 400))); + action_binding_modifiers_btn->set_accessibility_name(TTRC("Modifiers")); // TODO change style of button if there are binding modifiers action_hb->add_child(action_binding_modifiers_btn); @@ -315,6 +317,7 @@ void OpenXRInteractionProfileEditor::_add_io_path(VBoxContainer *p_container, co action_rem->set_flat(true); action_rem->set_button_icon(get_theme_icon(SNAME("Remove"), EditorStringName(EditorIcons))); action_rem->connect(SceneStringName(pressed), callable_mp((OpenXRInteractionProfileEditor *)this, &OpenXRInteractionProfileEditor::_on_remove_pressed).bind(action->get_name_with_set(), String(p_io_path->openxr_path))); + action_rem->set_accessibility_name(TTRC("Remove")); action_hb->add_child(action_rem); } }