Merge pull request #11849 from cart/mono_parent_fields
Mono: support exported parent class fields
This commit is contained in:
commit
30328e7dfc
1 changed files with 31 additions and 22 deletions
|
@ -1201,8 +1201,6 @@ bool CSharpScript::_update_exports() {
|
||||||
exported_members_cache.clear();
|
exported_members_cache.clear();
|
||||||
exported_members_defval_cache.clear();
|
exported_members_defval_cache.clear();
|
||||||
|
|
||||||
const Vector<GDMonoField *> &fields = script_class->get_all_fields();
|
|
||||||
|
|
||||||
// We are creating a temporary new instance of the class here to get the default value
|
// We are creating a temporary new instance of the class here to get the default value
|
||||||
// TODO Workaround. Should be replaced with IL opcodes analysis
|
// TODO Workaround. Should be replaced with IL opcodes analysis
|
||||||
|
|
||||||
|
@ -1226,6 +1224,11 @@ bool CSharpScript::_update_exports() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GDMonoClass *top = script_class;
|
||||||
|
|
||||||
|
while (top && top != native) {
|
||||||
|
const Vector<GDMonoField *> &fields = top->get_all_fields();
|
||||||
|
|
||||||
for (int i = 0; i < fields.size(); i++) {
|
for (int i = 0; i < fields.size(); i++) {
|
||||||
GDMonoField *field = fields[i];
|
GDMonoField *field = fields[i];
|
||||||
|
|
||||||
|
@ -1235,6 +1238,9 @@ bool CSharpScript::_update_exports() {
|
||||||
String name = field->get_name();
|
String name = field->get_name();
|
||||||
StringName cname = name;
|
StringName cname = name;
|
||||||
|
|
||||||
|
if (member_info.has(cname))
|
||||||
|
continue;
|
||||||
|
|
||||||
Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type());
|
Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type());
|
||||||
|
|
||||||
if (field->has_attribute(CACHED_CLASS(ExportAttribute))) {
|
if (field->has_attribute(CACHED_CLASS(ExportAttribute))) {
|
||||||
|
@ -1257,6 +1263,9 @@ bool CSharpScript::_update_exports() {
|
||||||
member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
|
member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
top = top->get_parent_class();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (placeholders.size()) {
|
if (placeholders.size()) {
|
||||||
|
|
Loading…
Reference in a new issue