Skip to content

Commit

Permalink
Editor: Opt-out for costly node paths update on save
Browse files Browse the repository at this point in the history
Allows working around godotengine#43156.
This is an opt-out setting for users who need it, until we can establish that
fully removing this code would not reintroduce the bug it aimed to fix (godotengine#7976).

Co-authored-by: Mariusz Chwalba <mariusz@chwalba.net>
  • Loading branch information
akien-mga and lekoder committed Apr 13, 2021
1 parent 9df1ed3 commit 1776068
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
17 changes: 10 additions & 7 deletions editor/editor_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1503,14 +1503,16 @@ void EditorNode::_save_scene(String p_file, int idx) {
return;
}

// force creation of node path cache
// (hacky but needed for the tree to update properly)
Node *dummy_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
if (!dummy_scene) {
show_accept(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."), TTR("OK"));
return;
if (force_update_node_paths_cache) {
// force creation of node path cache
// (hacky but needed for the tree to update properly)
Node *dummy_scene = sdata->instance(PackedScene::GEN_EDIT_STATE_INSTANCE);
if (!dummy_scene) {
show_accept(TTR("Couldn't save scene. Likely dependencies (instances or inheritance) couldn't be satisfied."), TTR("OK"));
return;
}
memdelete(dummy_scene);
}
memdelete(dummy_scene);

int flg = 0;
if (EditorSettings::get_singleton()->get("filesystem/on_save/compress_binary_resources"))
Expand Down Expand Up @@ -5842,6 +5844,7 @@ EditorNode::EditorNode() {
cmdline_export_mode = false;
scene_distraction = false;
script_distraction = false;
force_update_node_paths_cache = GLOBAL_DEF_RST("editor/validate_node_paths_on_scene_save", true);

TranslationServer::get_singleton()->set_enabled(false);
// load settings
Expand Down
1 change: 1 addition & 0 deletions editor/editor_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class EditorNode : public Node {
uint64_t saved_version;
uint64_t last_checked_version;
bool unsaved_cache;
bool force_update_node_paths_cache;
String open_navigate;
bool changing_scene;
bool waiting_for_first_scan;
Expand Down

0 comments on commit 1776068

Please sign in to comment.