1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #105502 from tehKaiN/editor_interface_close_scene

Add `EditorInterface::close_scene()`
This commit is contained in:
Thaddeus Crews
2025-06-02 18:51:29 -05:00
5 changed files with 27 additions and 0 deletions

View File

@@ -4993,6 +4993,19 @@ bool EditorNode::_find_scene_in_use(Node *p_node, const String &p_path) const {
return false;
}
bool EditorNode::close_scene() {
int tab_index = editor_data.get_edited_scene();
if (tab_index == 0 && get_edited_scene() == nullptr && editor_data.get_scene_path(tab_index).is_empty()) {
return false;
}
tab_closing_idx = tab_index;
current_menu_option = SCENE_CLOSE;
_discard_changes();
changing_scene = false;
return true;
}
bool EditorNode::is_scene_in_use(const String &p_path) {
Node *es = get_edited_scene();
if (es) {