Skip to content

Commit 9195bad

Browse files
committed
Initial editor accessibility.
1 parent e9fbf18 commit 9195bad

File tree

137 files changed

+1545
-94
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

137 files changed

+1545
-94
lines changed

doc/classes/EditorProperty.xml

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
<member name="draw_warning" type="bool" setter="set_draw_warning" getter="is_draw_warning" default="false">
119119
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.
120120
</member>
121+
<member name="focus_mode" type="int" setter="set_focus_mode" getter="get_focus_mode" overrides="Control" enum="Control.FocusMode" default="3" />
121122
<member name="keying" type="bool" setter="set_keying" getter="is_keying" default="false">
122123
Used by the inspector, set to [code]true[/code] when the property can add keys for animation.
123124
</member>

doc/classes/EditorSettings.xml

+3
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,9 @@
233233
<member name="docks/property_editor/subresource_hue_tint" type="float" setter="" getter="">
234234
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.
235235
</member>
236+
<member name="docks/scene_tree/accessibility_warnings" type="bool" setter="" getter="">
237+
If [code]true[/code], accessibility related warnings are displayed alongside other configuration warnings.
238+
</member>
236239
<member name="docks/scene_tree/ask_before_deleting_related_animation_tracks" type="bool" setter="" getter="">
237240
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.
238241
</member>

editor/action_map_editor.cpp

+17-7
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
257257
label->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
258258
action_tree->set_drag_preview(label);
259259

260+
get_viewport()->gui_set_drag_description(vformat(RTR("Action %s"), name));
261+
260262
Dictionary drag_data;
261263

262264
if (selected->has_meta("__action")) {
@@ -267,6 +269,8 @@ Variant ActionMapEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from
267269
drag_data["input_type"] = "event";
268270
}
269271

272+
drag_data["source"] = selected->get_instance_id();
273+
270274
action_tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN);
271275

272276
return drag_data;
@@ -278,9 +282,11 @@ bool ActionMapEditor::can_drop_data_fw(const Point2 &p_point, const Variant &p_d
278282
return false;
279283
}
280284

285+
TreeItem *source = Object::cast_to<TreeItem>(ObjectDB::get_instance(d["source"].operator ObjectID()));
281286
TreeItem *selected = action_tree->get_selected();
282-
TreeItem *item = action_tree->get_item_at_position(p_point);
283-
if (!selected || !item || item == selected) {
287+
288+
TreeItem *item = (p_point == Vector2(INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position(p_point);
289+
if (!selected || !item || item == source) {
284290
return false;
285291
}
286292

@@ -303,13 +309,13 @@ void ActionMapEditor::drop_data_fw(const Point2 &p_point, const Variant &p_data,
303309
}
304310

305311
TreeItem *selected = action_tree->get_selected();
306-
TreeItem *target = action_tree->get_item_at_position(p_point);
307-
bool drop_above = action_tree->get_drop_section_at_position(p_point) == -1;
308-
312+
TreeItem *target = (p_point == Vector2(INFINITY, INFINITY)) ? selected : action_tree->get_item_at_position(p_point);
309313
if (!target) {
310314
return;
311315
}
312316

317+
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;
318+
313319
Dictionary d = p_data;
314320
if (d["input_type"] == "action") {
315321
// Change action order.
@@ -501,8 +507,8 @@ void ActionMapEditor::update_action_list(const Vector<ActionInfo> &p_action_info
501507
}
502508

503509
// Third Column - Buttons
504-
event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Edit")), BUTTON_EDIT_EVENT, false, TTR("Edit Event"));
505-
event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Remove")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event"));
510+
event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Edit")), BUTTON_EDIT_EVENT, false, TTR("Edit Event"), TTR("Edit Event"));
511+
event_item->add_button(2, action_tree->get_editor_theme_icon(SNAME("Remove")), BUTTON_REMOVE_EVENT, false, TTR("Remove Event"), TTR("Remove Event"));
506512
event_item->set_button_color(2, 0, Color(1, 1, 1, 0.75));
507513
event_item->set_button_color(2, 1, Color(1, 1, 1, 0.75));
508514
}
@@ -543,13 +549,15 @@ ActionMapEditor::ActionMapEditor() {
543549
action_list_search = memnew(LineEdit);
544550
action_list_search->set_h_size_flags(Control::SIZE_EXPAND_FILL);
545551
action_list_search->set_placeholder(TTR("Filter by Name"));
552+
action_list_search->set_accessibility_name(TTR("Filter by Name"));
546553
action_list_search->set_clear_button_enabled(true);
547554
action_list_search->connect(SceneStringName(text_changed), callable_mp(this, &ActionMapEditor::_search_term_updated));
548555
top_hbox->add_child(action_list_search);
549556

550557
action_list_search_by_event = memnew(EventListenerLineEdit);
551558
action_list_search_by_event->set_h_size_flags(Control::SIZE_EXPAND_FILL);
552559
action_list_search_by_event->set_stretch_ratio(0.75);
560+
action_list_search_by_event->set_accessibility_name(TTR("Action Event"));
553561
action_list_search_by_event->connect("event_changed", callable_mp(this, &ActionMapEditor::_search_by_event));
554562
action_list_search_by_event->connect(SceneStringName(focus_entered), callable_mp(this, &ActionMapEditor::_on_filter_focused));
555563
action_list_search_by_event->connect(SceneStringName(focus_exited), callable_mp(this, &ActionMapEditor::_on_filter_unfocused));
@@ -569,6 +577,7 @@ ActionMapEditor::ActionMapEditor() {
569577
add_edit = memnew(LineEdit);
570578
add_edit->set_h_size_flags(Control::SIZE_EXPAND_FILL);
571579
add_edit->set_placeholder(TTR("Add New Action"));
580+
add_edit->set_accessibility_name(TTR("Add New Action"));
572581
add_edit->set_clear_button_enabled(true);
573582
add_edit->set_keep_editing_on_text_submit(true);
574583
add_edit->connect(SceneStringName(text_changed), callable_mp(this, &ActionMapEditor::_add_edit_text_changed));
@@ -597,6 +606,7 @@ ActionMapEditor::ActionMapEditor() {
597606
// Action Editor Tree
598607
action_tree = memnew(Tree);
599608
action_tree->set_v_size_flags(Control::SIZE_EXPAND_FILL);
609+
action_tree->set_accessibility_name(TTR("Action Map"));
600610
action_tree->set_columns(3);
601611
action_tree->set_hide_root(true);
602612
action_tree->set_column_titles_visible(true);

editor/add_metadata_dialog.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,13 @@ AddMetadataDialog::AddMetadataDialog() {
4141
hbc->add_child(memnew(Label(TTR("Name:"))));
4242

4343
add_meta_name = memnew(LineEdit);
44+
add_meta_name->set_accessibility_name(TTR("Name:"));
4445
add_meta_name->set_custom_minimum_size(Size2(200 * EDSCALE, 1));
4546
hbc->add_child(add_meta_name);
4647
hbc->add_child(memnew(Label(TTR("Type:"))));
4748

4849
add_meta_type = memnew(OptionButton);
50+
add_meta_type->set_accessibility_name(TTR("Type:"));
4951

5052
hbc->add_child(add_meta_type);
5153

editor/animation_bezier_editor.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,15 @@ void AnimationBezierTrackEdit::_notification(int p_what) {
245245
selected_icon = get_editor_theme_icon(SNAME("KeyBezierSelected"));
246246
} break;
247247

248+
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
249+
RID ae = get_accessibility_element();
250+
ERR_FAIL_COND(ae.is_null());
251+
252+
//TODO
253+
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_STATIC_TEXT);
254+
DisplayServer::get_singleton()->accessibility_update_set_value(ae, TTR(vformat("The %s is not accessible at this time.", "Animation bezier track editor")));
255+
} break;
256+
248257
case NOTIFICATION_DRAW: {
249258
if (animation.is_null()) {
250259
return;

0 commit comments

Comments
 (0)