Don't write global script class information if there is none

(cherry picked from commit 3163611f0c)
This commit is contained in:
Aaron Franke 2020-10-03 04:36:07 -04:00 committed by Rémi Verschelde
parent 55d756cbab
commit fcaf17824f
No known key found for this signature in database
GPG key ID: C3336907360768E1
2 changed files with 10 additions and 2 deletions

View file

@ -276,7 +276,11 @@ void ScriptServer::save_global_classes() {
gcarr.push_back(d); 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(); ProjectSettings::get_singleton()->save();
} }

View file

@ -965,7 +965,11 @@ void EditorData::script_class_save_icon_paths() {
d[E->get()] = _script_class_icon_paths[E->get()]; 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(); ProjectSettings::get_singleton()->save();
} }