Skip to content

Commit 97e5ddd

Browse files
committed
Merge pull request #106082 from jaydensipe/open-recent-better-ui
Show "No Recent Scenes" under `Open Recent` instead of redundant button
2 parents e0bbafc + 7430711 commit 97e5ddd

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

editor/editor_node.cpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4807,14 +4807,19 @@ void EditorNode::_update_recent_scenes() {
48074807
Array rc = EditorSettings::get_singleton()->get_project_metadata("recent_files", "scenes", Array());
48084808
recent_scenes->clear();
48094809

4810-
String path;
4811-
for (int i = 0; i < rc.size(); i++) {
4812-
path = rc[i];
4813-
recent_scenes->add_item(path.replace("res://", ""), i);
4814-
}
4810+
if (rc.size() == 0) {
4811+
recent_scenes->add_item(TTR("No Recent Scenes"), -1);
4812+
recent_scenes->set_item_disabled(-1, true);
4813+
} else {
4814+
String path;
4815+
for (int i = 0; i < rc.size(); i++) {
4816+
path = rc[i];
4817+
recent_scenes->add_item(path.replace("res://", ""), i);
4818+
}
48154819

4816-
recent_scenes->add_separator();
4817-
recent_scenes->add_shortcut(ED_SHORTCUT("editor/clear_recent", TTRC("Clear Recent Scenes")));
4820+
recent_scenes->add_separator();
4821+
recent_scenes->add_shortcut(ED_SHORTCUT("editor/clear_recent", TTRC("Clear Recent Scenes")));
4822+
}
48184823
recent_scenes->set_item_auto_translate_mode(-1, AUTO_TRANSLATE_MODE_ALWAYS);
48194824
recent_scenes->reset_size();
48204825
}

0 commit comments

Comments
 (0)