Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core: Do not save default values of script properties in .tres files #80897

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions scene/resources/resource_format_text.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2149,6 +2149,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso

List<PropertyInfo> property_list;
res->get_property_list(&property_list);
Ref<Script> res_script = res->get_script();
for (List<PropertyInfo>::Element *PE = property_list.front(); PE; PE = PE->next()) {
if (skip_editor && PE->get().name.begins_with("__editor")) {
continue;
Expand Down Expand Up @@ -2180,6 +2181,9 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
}

Variant default_value = ClassDB::class_get_default_property_value(res->get_class(), name);
if (res_script.is_valid()) {
res_script->get_property_default_value(name, default_value);
}

if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value))) {
continue;
Expand Down