You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-13 13:31:48 +00:00
-Fixed revert scene, should work proprely now, fixes #2782
This commit is contained in:
@@ -635,6 +635,16 @@ String EditorData::get_scene_type(int p_idx) const {
|
|||||||
return edited_scene[p_idx].root->get_type();
|
return edited_scene[p_idx].root->get_type();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
void EditorData::move_edited_scene_to_index(int p_idx) {
|
||||||
|
|
||||||
|
ERR_FAIL_INDEX(current_edited_scene,edited_scene.size());
|
||||||
|
ERR_FAIL_INDEX(p_idx,edited_scene.size());
|
||||||
|
|
||||||
|
EditedScene es=edited_scene[current_edited_scene];
|
||||||
|
edited_scene.remove(current_edited_scene);
|
||||||
|
edited_scene.insert(p_idx,es);
|
||||||
|
current_edited_scene=p_idx;
|
||||||
|
}
|
||||||
|
|
||||||
Ref<Script> EditorData::get_scene_root_script(int p_idx) const {
|
Ref<Script> EditorData::get_scene_root_script(int p_idx) const {
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,7 @@ public:
|
|||||||
void set_edited_scene_live_edit_root(const NodePath& p_root);
|
void set_edited_scene_live_edit_root(const NodePath& p_root);
|
||||||
NodePath get_edited_scene_live_edit_root();
|
NodePath get_edited_scene_live_edit_root();
|
||||||
bool check_and_update_scene(int p_idx);
|
bool check_and_update_scene(int p_idx);
|
||||||
|
void move_edited_scene_to_index(int p_idx);
|
||||||
|
|
||||||
|
|
||||||
void set_plugin_window_layout(Ref<ConfigFile> p_layout);
|
void set_plugin_window_layout(Ref<ConfigFile> p_layout);
|
||||||
|
|||||||
@@ -2368,6 +2368,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
|||||||
if (!scene)
|
if (!scene)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
String filename = scene->get_filename();
|
||||||
|
|
||||||
|
if (filename==String()) {
|
||||||
|
show_warning("Can't reload a scene that was never saved..");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (unsaved_cache && !p_confirmed) {
|
if (unsaved_cache && !p_confirmed) {
|
||||||
confirmation->get_ok()->set_text("Revert");
|
confirmation->get_ok()->set_text("Revert");
|
||||||
confirmation->set_text("This action cannot be undone. Revert anyway?");
|
confirmation->set_text("This action cannot be undone. Revert anyway?");
|
||||||
@@ -2375,7 +2382,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Error err = load_scene(scene->get_filename());
|
|
||||||
|
int cur_idx = editor_data.get_edited_scene();
|
||||||
|
_remove_edited_scene();
|
||||||
|
Error err = load_scene(filename);
|
||||||
|
editor_data.move_edited_scene_to_index(cur_idx);
|
||||||
|
get_undo_redo()->clear_history();
|
||||||
|
scene_tabs->set_current_tab(cur_idx);
|
||||||
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user