Add EditorInterface::get_unsaved_scenes()
Co-Authored-By: Nikita <69168929+nikitalita@users.noreply.github.com>
This commit is contained in:
committed by
Thaddeus Crews
parent
a3e84cc2af
commit
11d7e298dd
@@ -724,10 +724,19 @@ PackedStringArray EditorInterface::get_open_scenes() const {
|
||||
Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
|
||||
|
||||
for (EditorData::EditedScene &edited_scene : scenes) {
|
||||
if (edited_scene.root == nullptr) {
|
||||
continue;
|
||||
ret.push_back(edited_scene.path);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
PackedStringArray EditorInterface::get_unsaved_scenes() const {
|
||||
PackedStringArray ret;
|
||||
Vector<EditorData::EditedScene> scenes = EditorNode::get_editor_data().get_edited_scenes();
|
||||
|
||||
for (int i = 0; i < scenes.size(); i++) {
|
||||
if (EditorNode::get_singleton()->is_scene_unsaved(i)) {
|
||||
ret.push_back(scenes[i].path);
|
||||
}
|
||||
ret.push_back(edited_scene.root->get_scene_file_path());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -909,6 +918,7 @@ void EditorInterface::_bind_methods() {
|
||||
ClassDB::bind_method(D_METHOD("is_object_edited", "object"), &EditorInterface::is_object_edited);
|
||||
|
||||
ClassDB::bind_method(D_METHOD("get_open_scenes"), &EditorInterface::get_open_scenes);
|
||||
ClassDB::bind_method(D_METHOD("get_unsaved_scenes"), &EditorInterface::get_unsaved_scenes);
|
||||
ClassDB::bind_method(D_METHOD("get_open_scene_roots"), &EditorInterface::get_open_scene_roots);
|
||||
ClassDB::bind_method(D_METHOD("get_edited_scene_root"), &EditorInterface::get_edited_scene_root);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user