@@ -133,7 +133,7 @@ void SpriteFramesEditor::_sheet_preview_draw() {
133133
134134 if (frames_selected.is_empty ()) {
135135 split_sheet_dialog->get_ok_button ()->set_disabled (true );
136- split_sheet_dialog->set_ok_button_text (TTR (" No Frames Selected" ));
136+ split_sheet_dialog->set_ok_button_text (TTRC (" No Frames Selected" ));
137137 return ;
138138 }
139139
@@ -676,9 +676,30 @@ void SpriteFramesEditor::_notification(int p_what) {
676676 _update_show_settings ();
677677 } break ;
678678
679- case NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
679+ case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: {
680+ _update_show_settings ();
681+ } break ;
682+
680683 case NOTIFICATION_TRANSLATION_CHANGED: {
681684 _update_show_settings ();
685+ anim_speed->set_suffix (TTR (" FPS" ));
686+
687+ // Similar to `_update_library_impl()`, but only updates text for "empty" items.
688+ if (frames.is_valid ()) {
689+ for (int i = 0 ; i < frames->get_frame_count (edited_anim); i++) {
690+ Ref<Texture2D> texture = frames->get_frame_texture (edited_anim, i);
691+ if (texture.is_null ()) {
692+ String name = itos (i);
693+ float duration = frames->get_frame_duration (edited_anim, i);
694+ texture = empty_icon;
695+ name += " : " + TTR (" (empty)" );
696+ if (duration != 1 .0f ) {
697+ name += String::utf8 (" [× " ) + String::num (duration, 2 ) + " ]" ;
698+ }
699+ frame_list->set_item_text (i, name);
700+ }
701+ }
702+ }
682703 } break ;
683704
684705 case NOTIFICATION_READY: {
@@ -701,11 +722,11 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
701722 resource = ResourceLoader::load (p_path[i]);
702723
703724 if (resource.is_null ()) {
704- dialog->set_text (TTR (" ERROR: Couldn't load frame resource!" ));
705- dialog->set_title (TTR (" Error!" ));
725+ dialog->set_text (TTRC (" ERROR: Couldn't load frame resource!" ));
726+ dialog->set_title (TTRC (" Error!" ));
706727
707728 // dialog->get_cancel()->set_text("Close");
708- dialog->set_ok_button_text (TTR (" Close" ));
729+ dialog->set_ok_button_text (TTRC (" Close" ));
709730 dialog->popup_centered ();
710731 return ; // /beh should show an error i guess
711732 }
@@ -1235,7 +1256,7 @@ void SpriteFramesEditor::_animation_remove() {
12351256 return ;
12361257 }
12371258
1238- delete_dialog->set_text (TTR (" Delete Animation?" ));
1259+ delete_dialog->set_text (TTRC (" Delete Animation?" ));
12391260 delete_dialog->popup_centered ();
12401261}
12411262
@@ -1550,6 +1571,8 @@ void SpriteFramesEditor::_update_library_impl() {
15501571 }
15511572
15521573 bool is_first_selection = true ;
1574+ // NOTE: When the language is changed, the text of the items is updated in `NOTIFICATION_TRANSLATION_CHANGED`.
1575+ // If there are changes related to the items and their text in the loop below, the code in `NOTIFICATION_TRANSLATION_CHANGED` must also be changed.
15531576 for (int i = 0 ; i < frames->get_frame_count (edited_anim); i++) {
15541577 String name = itos (i);
15551578 Ref<Texture2D> texture = frames->get_frame_texture (edited_anim, i);
@@ -1963,7 +1986,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
19631986 vbc_animlist->set_custom_minimum_size (Size2 (150 , 0 ) * EDSCALE);
19641987
19651988 VBoxContainer *sub_vb = memnew (VBoxContainer);
1966- vbc_animlist->add_margin_child (TTR (" Animations:" ), sub_vb, true );
1989+ vbc_animlist->add_margin_child (TTRC (" Animations:" ), sub_vb, true );
19671990 sub_vb->set_v_size_flags (SIZE_EXPAND_FILL);
19681991
19691992 HBoxContainer *hbc_animlist = memnew (HBoxContainer);
@@ -1995,15 +2018,15 @@ SpriteFramesEditor::SpriteFramesEditor() {
19952018
19962019 autoplay = memnew (Button);
19972020 autoplay->set_theme_type_variation (SceneStringName (FlatButton));
1998- autoplay->set_tooltip_text (TTR (" Autoplay on Load" ));
2021+ autoplay->set_tooltip_text (TTRC (" Autoplay on Load" ));
19992022 autoplay_container->add_child (autoplay);
20002023
20012024 hbc_animlist->add_child (memnew (VSeparator));
20022025
20032026 anim_loop = memnew (Button);
20042027 anim_loop->set_toggle_mode (true );
20052028 anim_loop->set_theme_type_variation (SceneStringName (FlatButton));
2006- anim_loop->set_tooltip_text (TTR (" Animation Looping" ));
2029+ anim_loop->set_tooltip_text (TTRC (" Animation Looping" ));
20072030 anim_loop->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_animation_loop_changed));
20082031 hbc_animlist->add_child (anim_loop);
20092032
@@ -2013,7 +2036,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
20132036 anim_speed->set_max (120 );
20142037 anim_speed->set_step (0.01 );
20152038 anim_speed->set_custom_arrow_step (1 );
2016- anim_speed->set_tooltip_text (TTR (" Animation Speed" ));
2039+ anim_speed->set_tooltip_text (TTRC (" Animation Speed" ));
20172040 anim_speed->get_line_edit ()->set_expand_to_text_length_enabled (true );
20182041 anim_speed->get_line_edit ()->connect (SceneStringName (resized), callable_mp (this , &SpriteFramesEditor::_animation_speed_resized));
20192042 anim_speed->connect (SceneStringName (value_changed), callable_mp (this , &SpriteFramesEditor::_animation_speed_changed));
@@ -2022,14 +2045,15 @@ SpriteFramesEditor::SpriteFramesEditor() {
20222045 anim_search_box = memnew (LineEdit);
20232046 sub_vb->add_child (anim_search_box);
20242047 anim_search_box->set_h_size_flags (SIZE_EXPAND_FILL);
2025- anim_search_box->set_placeholder (TTR (" Filter Animations" ));
2048+ anim_search_box->set_placeholder (TTRC (" Filter Animations" ));
20262049 anim_search_box->set_clear_button_enabled (true );
20272050 anim_search_box->connect (SceneStringName (text_changed), callable_mp (this , &SpriteFramesEditor::_animation_search_text_changed));
20282051
20292052 animations = memnew (Tree);
20302053 sub_vb->add_child (animations);
20312054 animations->set_v_size_flags (SIZE_EXPAND_FILL);
20322055 animations->set_hide_root (true );
2056+ animations->set_auto_translate_mode (AUTO_TRANSLATE_MODE_DISABLED);
20332057 // HACK: The cell_selected signal is emitted before the FPS spinbox loses focus and applies the change.
20342058 animations->connect (" cell_selected" , callable_mp (this , &SpriteFramesEditor::_animation_selected), CONNECT_DEFERRED);
20352059 animations->connect (" item_edited" , callable_mp (this , &SpriteFramesEditor::_animation_name_edited));
@@ -2045,7 +2069,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
20452069
20462070 missing_anim_label = memnew (Label);
20472071 missing_anim_label->set_focus_mode (FOCUS_ACCESSIBILITY);
2048- missing_anim_label->set_text (TTR (" This resource does not have any animations." ));
2072+ missing_anim_label->set_text (TTRC (" This resource does not have any animations." ));
20492073 missing_anim_label->set_h_size_flags (SIZE_EXPAND_FILL);
20502074 missing_anim_label->set_v_size_flags (SIZE_EXPAND_FILL);
20512075 missing_anim_label->set_horizontal_alignment (HORIZONTAL_ALIGNMENT_CENTER);
@@ -2059,7 +2083,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
20592083 anim_frames_vb->hide ();
20602084
20612085 sub_vb = memnew (VBoxContainer);
2062- anim_frames_vb->add_margin_child (TTR (" Animation Frames:" ), sub_vb, true );
2086+ anim_frames_vb->add_margin_child (TTRC (" Animation Frames:" ), sub_vb, true );
20632087
20642088 HFlowContainer *hfc = memnew (HFlowContainer);
20652089 sub_vb->add_child (hfc);
@@ -2070,27 +2094,27 @@ SpriteFramesEditor::SpriteFramesEditor() {
20702094
20712095 play_bw_from = memnew (Button);
20722096 play_bw_from->set_theme_type_variation (SceneStringName (FlatButton));
2073- play_bw_from->set_tooltip_text (TTR (" Play selected animation backwards from current pos. (A)" ));
2097+ play_bw_from->set_tooltip_text (TTRC (" Play selected animation backwards from current pos. (A)" ));
20742098 playback_container->add_child (play_bw_from);
20752099
20762100 play_bw = memnew (Button);
20772101 play_bw->set_theme_type_variation (SceneStringName (FlatButton));
2078- play_bw->set_tooltip_text (TTR (" Play selected animation backwards from end. (Shift+A)" ));
2102+ play_bw->set_tooltip_text (TTRC (" Play selected animation backwards from end. (Shift+A)" ));
20792103 playback_container->add_child (play_bw);
20802104
20812105 stop = memnew (Button);
20822106 stop->set_theme_type_variation (SceneStringName (FlatButton));
2083- stop->set_tooltip_text (TTR (" Pause/stop animation playback. (S)" ));
2107+ stop->set_tooltip_text (TTRC (" Pause/stop animation playback. (S)" ));
20842108 playback_container->add_child (stop);
20852109
20862110 play = memnew (Button);
20872111 play->set_theme_type_variation (SceneStringName (FlatButton));
2088- play->set_tooltip_text (TTR (" Play selected animation from start. (Shift+D)" ));
2112+ play->set_tooltip_text (TTRC (" Play selected animation from start. (Shift+D)" ));
20892113 playback_container->add_child (play);
20902114
20912115 play_from = memnew (Button);
20922116 play_from->set_theme_type_variation (SceneStringName (FlatButton));
2093- play_from->set_tooltip_text (TTR (" Play selected animation from current pos. (D)" ));
2117+ play_from->set_tooltip_text (TTRC (" Play selected animation from current pos. (D)" ));
20942118 playback_container->add_child (play_from);
20952119
20962120 hfc->add_child (memnew (VSeparator));
@@ -2163,7 +2187,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
21632187 hfc->add_child (hbc_frame_duration);
21642188
21652189 Label *label = memnew (Label);
2166- label->set_text (TTR (" Frame Duration:" ));
2190+ label->set_text (TTRC (" Frame Duration:" ));
21672191 hbc_frame_duration->add_child (label);
21682192
21692193 frame_duration = memnew (SpinBox);
@@ -2276,7 +2300,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
22762300
22772301 split_sheet_dialog = memnew (ConfirmationDialog);
22782302 add_child (split_sheet_dialog);
2279- split_sheet_dialog->set_title (TTR (" Select Frames" ));
2303+ split_sheet_dialog->set_title (TTRC (" Select Frames" ));
22802304 split_sheet_dialog->connect (SceneStringName (confirmed), callable_mp (this , &SpriteFramesEditor::_sheet_add_frames));
22812305
22822306 HBoxContainer *split_sheet_hb = memnew (HBoxContainer);
@@ -2291,30 +2315,30 @@ SpriteFramesEditor::SpriteFramesEditor() {
22912315
22922316 HBoxContainer *split_sheet_menu_hb = memnew (HBoxContainer);
22932317
2294- split_sheet_menu_hb->add_child (memnew (Label (TTR (" Frame Order" ))));
2318+ split_sheet_menu_hb->add_child (memnew (Label (TTRC (" Frame Order" ))));
22952319
22962320 split_sheet_order = memnew (OptionButton);
2297- split_sheet_order->add_item (TTR (" As Selected" ), FRAME_ORDER_SELECTION);
2298- split_sheet_order->add_separator (TTR (" By Row" ));
2299- split_sheet_order->add_item (TTR (" Left to Right, Top to Bottom" ), FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM);
2300- split_sheet_order->add_item (TTR (" Left to Right, Bottom to Top" ), FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP);
2301- split_sheet_order->add_item (TTR (" Right to Left, Top to Bottom" ), FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM);
2302- split_sheet_order->add_item (TTR (" Right to Left, Bottom to Top" ), FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP);
2303- split_sheet_order->add_separator (TTR (" By Column" ));
2304- split_sheet_order->add_item (TTR (" Top to Bottom, Left to Right" ), FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT);
2305- split_sheet_order->add_item (TTR (" Top to Bottom, Right to Left" ), FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT);
2306- split_sheet_order->add_item (TTR (" Bottom to Top, Left to Right" ), FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT);
2307- split_sheet_order->add_item (TTR (" Bottom to Top, Right to Left" ), FRAME_ORDER_BOTTOM_TOP_RIGHT_LEFT);
2321+ split_sheet_order->add_item (TTRC (" As Selected" ), FRAME_ORDER_SELECTION);
2322+ split_sheet_order->add_separator (TTRC (" By Row" ));
2323+ split_sheet_order->add_item (TTRC (" Left to Right, Top to Bottom" ), FRAME_ORDER_LEFT_RIGHT_TOP_BOTTOM);
2324+ split_sheet_order->add_item (TTRC (" Left to Right, Bottom to Top" ), FRAME_ORDER_LEFT_RIGHT_BOTTOM_TOP);
2325+ split_sheet_order->add_item (TTRC (" Right to Left, Top to Bottom" ), FRAME_ORDER_RIGHT_LEFT_TOP_BOTTOM);
2326+ split_sheet_order->add_item (TTRC (" Right to Left, Bottom to Top" ), FRAME_ORDER_RIGHT_LEFT_BOTTOM_TOP);
2327+ split_sheet_order->add_separator (TTRC (" By Column" ));
2328+ split_sheet_order->add_item (TTRC (" Top to Bottom, Left to Right" ), FRAME_ORDER_TOP_BOTTOM_LEFT_RIGHT);
2329+ split_sheet_order->add_item (TTRC (" Top to Bottom, Right to Left" ), FRAME_ORDER_TOP_BOTTOM_RIGHT_LEFT);
2330+ split_sheet_order->add_item (TTRC (" Bottom to Top, Left to Right" ), FRAME_ORDER_BOTTOM_TOP_LEFT_RIGHT);
2331+ split_sheet_order->add_item (TTRC (" Bottom to Top, Right to Left" ), FRAME_ORDER_BOTTOM_TOP_RIGHT_LEFT);
23082332 split_sheet_order->connect (SceneStringName (item_selected), callable_mp (this , &SpriteFramesEditor::_sheet_order_selected));
23092333 split_sheet_menu_hb->add_child (split_sheet_order);
23102334
23112335 Button *select_all = memnew (Button);
2312- select_all->set_text (TTR (" Select All" ));
2336+ select_all->set_text (TTRC (" Select All" ));
23132337 select_all->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_sheet_select_all_frames));
23142338 split_sheet_menu_hb->add_child (select_all);
23152339
23162340 Button *clear_all = memnew (Button);
2317- clear_all->set_text (TTR (" Select None" ));
2341+ clear_all->set_text (TTRC (" Select None" ));
23182342 clear_all->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_sheet_clear_all_frames));
23192343 split_sheet_menu_hb->add_child (clear_all);
23202344
@@ -2324,7 +2348,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
23242348 toggle_settings_button->set_h_size_flags (SIZE_SHRINK_END);
23252349 toggle_settings_button->set_theme_type_variation (SceneStringName (FlatButton));
23262350 toggle_settings_button->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_toggle_show_settings));
2327- toggle_settings_button->set_tooltip_text (TTR (" Toggle Settings Panel" ));
2351+ toggle_settings_button->set_tooltip_text (TTRC (" Toggle Settings Panel" ));
23282352 split_sheet_menu_hb->add_child (toggle_settings_button);
23292353
23302354 split_sheet_vb->add_child (split_sheet_menu_hb);
@@ -2362,21 +2386,21 @@ SpriteFramesEditor::SpriteFramesEditor() {
23622386 split_sheet_zoom_out = memnew (Button);
23632387 split_sheet_zoom_out->set_theme_type_variation (SceneStringName (FlatButton));
23642388 split_sheet_zoom_out->set_focus_mode (FOCUS_ACCESSIBILITY);
2365- split_sheet_zoom_out->set_tooltip_text (TTR (" Zoom Out" ));
2389+ split_sheet_zoom_out->set_tooltip_text (TTRC (" Zoom Out" ));
23662390 split_sheet_zoom_out->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_sheet_zoom_out));
23672391 split_sheet_zoom_hb->add_child (split_sheet_zoom_out);
23682392
23692393 split_sheet_zoom_reset = memnew (Button);
23702394 split_sheet_zoom_reset->set_theme_type_variation (SceneStringName (FlatButton));
23712395 split_sheet_zoom_reset->set_focus_mode (FOCUS_ACCESSIBILITY);
2372- split_sheet_zoom_reset->set_tooltip_text (TTR (" Zoom Reset" ));
2396+ split_sheet_zoom_reset->set_tooltip_text (TTRC (" Zoom Reset" ));
23732397 split_sheet_zoom_reset->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_sheet_zoom_reset));
23742398 split_sheet_zoom_hb->add_child (split_sheet_zoom_reset);
23752399
23762400 split_sheet_zoom_in = memnew (Button);
23772401 split_sheet_zoom_in->set_theme_type_variation (SceneStringName (FlatButton));
23782402 split_sheet_zoom_in->set_focus_mode (FOCUS_ACCESSIBILITY);
2379- split_sheet_zoom_in->set_tooltip_text (TTR (" Zoom In" ));
2403+ split_sheet_zoom_in->set_tooltip_text (TTRC (" Zoom In" ));
23802404 split_sheet_zoom_in->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_sheet_zoom_in));
23812405 split_sheet_zoom_hb->add_child (split_sheet_zoom_in);
23822406
@@ -2386,7 +2410,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
23862410 HBoxContainer *split_sheet_h_hb = memnew (HBoxContainer);
23872411 split_sheet_h_hb->set_h_size_flags (SIZE_EXPAND_FILL);
23882412
2389- Label *split_sheet_h_label = memnew (Label (TTR (" Horizontal" )));
2413+ Label *split_sheet_h_label = memnew (Label (TTRC (" Horizontal" )));
23902414 split_sheet_h_label->set_h_size_flags (SIZE_EXPAND_FILL);
23912415 split_sheet_h_hb->add_child (split_sheet_h_label);
23922416
@@ -2404,7 +2428,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
24042428 HBoxContainer *split_sheet_v_hb = memnew (HBoxContainer);
24052429 split_sheet_v_hb->set_h_size_flags (SIZE_EXPAND_FILL);
24062430
2407- Label *split_sheet_v_label = memnew (Label (TTR (" Vertical" )));
2431+ Label *split_sheet_v_label = memnew (Label (TTRC (" Vertical" )));
24082432 split_sheet_v_label->set_h_size_flags (SIZE_EXPAND_FILL);
24092433 split_sheet_v_hb->add_child (split_sheet_v_label);
24102434
@@ -2422,7 +2446,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
24222446 HBoxContainer *split_sheet_size_hb = memnew (HBoxContainer);
24232447 split_sheet_size_hb->set_h_size_flags (SIZE_EXPAND_FILL);
24242448
2425- Label *split_sheet_size_label = memnew (Label (TTR (" Size" )));
2449+ Label *split_sheet_size_label = memnew (Label (TTRC (" Size" )));
24262450 split_sheet_size_label->set_h_size_flags (SIZE_EXPAND_FILL);
24272451 split_sheet_size_label->set_v_size_flags (SIZE_SHRINK_BEGIN);
24282452 split_sheet_size_hb->add_child (split_sheet_size_label);
@@ -2453,7 +2477,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
24532477 HBoxContainer *split_sheet_sep_hb = memnew (HBoxContainer);
24542478 split_sheet_sep_hb->set_h_size_flags (SIZE_EXPAND_FILL);
24552479
2456- Label *split_sheet_sep_label = memnew (Label (TTR (" Separation" )));
2480+ Label *split_sheet_sep_label = memnew (Label (TTRC (" Separation" )));
24572481 split_sheet_sep_label->set_h_size_flags (SIZE_EXPAND_FILL);
24582482 split_sheet_sep_label->set_v_size_flags (SIZE_SHRINK_BEGIN);
24592483 split_sheet_sep_hb->add_child (split_sheet_sep_label);
@@ -2482,7 +2506,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
24822506 HBoxContainer *split_sheet_offset_hb = memnew (HBoxContainer);
24832507 split_sheet_offset_hb->set_h_size_flags (SIZE_EXPAND_FILL);
24842508
2485- Label *split_sheet_offset_label = memnew (Label (TTR (" Offset" )));
2509+ Label *split_sheet_offset_label = memnew (Label (TTRC (" Offset" )));
24862510 split_sheet_offset_label->set_h_size_flags (SIZE_EXPAND_FILL);
24872511 split_sheet_offset_label->set_v_size_flags (SIZE_SHRINK_BEGIN);
24882512 split_sheet_offset_hb->add_child (split_sheet_offset_label);
@@ -2509,14 +2533,14 @@ SpriteFramesEditor::SpriteFramesEditor() {
25092533 split_sheet_settings_vb->add_child (split_sheet_offset_hb);
25102534
25112535 Button *auto_slice = memnew (Button);
2512- auto_slice->set_text (TTR (" Auto Slice" ));
2536+ auto_slice->set_text (TTRC (" Auto Slice" ));
25132537 auto_slice->connect (SceneStringName (pressed), callable_mp (this , &SpriteFramesEditor::_auto_slice_sprite_sheet));
25142538 split_sheet_settings_vb->add_child (auto_slice);
25152539
25162540 split_sheet_hb->add_child (split_sheet_settings_vb);
25172541
25182542 file_split_sheet = memnew (EditorFileDialog);
2519- file_split_sheet->set_title (TTR (" Create Frames from Sprite Sheet" ));
2543+ file_split_sheet->set_title (TTRC (" Create Frames from Sprite Sheet" ));
25202544 file_split_sheet->set_file_mode (EditorFileDialog::FILE_MODE_OPEN_FILE);
25212545 add_child (file_split_sheet);
25222546 file_split_sheet->connect (" file_selected" , callable_mp (this , &SpriteFramesEditor::_prepare_sprite_sheet));
0 commit comments