From fcaf17824f46d544657f96b8893cc2ba462af6df Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Sat, 3 Oct 2020 04:36:07 -0400 Subject: [PATCH] Don't write global script class information if there is none (cherry picked from commit 3163611f0c855feaf3bddad3afe9afd6fd3cc2c6) --- core/script_language.cpp | 6 +++++- editor/editor_data.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/script_language.cpp b/core/script_language.cpp index 7392e7a0afc..96313898ec4 100644 --- a/core/script_language.cpp +++ b/core/script_language.cpp @@ -276,7 +276,11 @@ void ScriptServer::save_global_classes() { gcarr.push_back(d); } - ProjectSettings::get_singleton()->set("_global_script_classes", gcarr); + if (gcarr.empty()) { + ProjectSettings::get_singleton()->clear("_global_script_classes"); + } else { + ProjectSettings::get_singleton()->set("_global_script_classes", gcarr); + } ProjectSettings::get_singleton()->save(); } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 01cc23aaa29..93486860a77 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -965,7 +965,11 @@ void EditorData::script_class_save_icon_paths() { d[E->get()] = _script_class_icon_paths[E->get()]; } - ProjectSettings::get_singleton()->set("_global_script_class_icons", d); + if (d.empty()) { + ProjectSettings::get_singleton()->clear("_global_script_class_icons"); + } else { + ProjectSettings::get_singleton()->set("_global_script_class_icons", d); + } ProjectSettings::get_singleton()->save(); }