You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-09 12:50:35 +00:00
Fix script property of custom resources inherited from scripts are not saved
This commit is contained in:
@@ -36,6 +36,7 @@
|
|||||||
#include "core/io/missing_resource.h"
|
#include "core/io/missing_resource.h"
|
||||||
#include "core/object/script_language.h"
|
#include "core/object/script_language.h"
|
||||||
#include "core/version.h"
|
#include "core/version.h"
|
||||||
|
#include "scene/property_utils.h"
|
||||||
#include "scene/resources/packed_scene.h"
|
#include "scene/resources/packed_scene.h"
|
||||||
|
|
||||||
//#define print_bl(m_what) print_line(m_what)
|
//#define print_bl(m_what) print_line(m_what)
|
||||||
@@ -2284,7 +2285,8 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path, const Ref<Re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant default_value = ClassDB::class_get_default_property_value(E->get_class(), F.name);
|
bool is_script = F.name == CoreStringName(script);
|
||||||
|
Variant default_value = is_script ? Variant() : PropertyUtils::get_property_default_value(E.ptr(), F.name);
|
||||||
|
|
||||||
if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, p.value, default_value))) {
|
if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, p.value, default_value))) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
@@ -1931,7 +1931,8 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Variant default_value = PropertyUtils::get_property_default_value(res.ptr(), name);
|
bool is_script = name == CoreStringName(script);
|
||||||
|
Variant default_value = is_script ? Variant() : PropertyUtils::get_property_default_value(res.ptr(), name);
|
||||||
|
|
||||||
if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value))) {
|
if (default_value.get_type() != Variant::NIL && bool(Variant::evaluate(Variant::OP_EQUAL, value, default_value))) {
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user