1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-17 14:11:06 +00:00

Add EditorInterface::close_scene()

Co-authored-by: Tomasz Chabora <kobewi4e@gmail.com>
This commit is contained in:
KaiN
2025-04-17 19:37:55 +02:00
parent 2cde9292c3
commit 8cdb1768a4
5 changed files with 27 additions and 0 deletions

View File

@@ -4974,6 +4974,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) {