Merge pull request #28754 from YeldhamDev/inherent_scene_close_empty_changes

Change empty scene closing on new inherented scene to a better approach
This commit is contained in:
Rémi Verschelde 2019-05-08 15:48:23 +02:00 committed by GitHub
commit b0d73d3099
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 2 deletions

View File

@ -1271,6 +1271,11 @@ void EditorNode::_dialog_action(String p_file) {
switch (current_option) {
case FILE_NEW_INHERITED_SCENE: {
Node *scene = editor_data.get_edited_scene_root();
// If the previous scene is rootless, just close it in favor of the new one.
if (!scene)
_menu_option_confirm(FILE_CLOSE, false);
load_scene(p_file, false, true);
} break;
case FILE_OPEN_SCENE: {

View File

@ -671,7 +671,6 @@ public:
static void remove_editor_plugin(EditorPlugin *p_editor, bool p_config_changed = false);
void new_inherited_scene() { _menu_option_confirm(FILE_NEW_INHERITED_SCENE, false); }
void close_current_scene() { _menu_option_confirm(FILE_CLOSE, false); }
void set_docks_visible(bool p_show);
bool get_docks_visible() const;

View File

@ -334,7 +334,6 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) {
Node *scene = edited_scene;
if (!scene) {
EditorNode::get_singleton()->close_current_scene();
EditorNode::get_singleton()->new_inherited_scene();
break;
}