summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRaul Santos <raulsntos@gmail.com>2021-10-30 16:55:21 +0200
committerRaul Santos <raulsntos@gmail.com>2021-10-30 17:11:40 +0200
commit2913c32db5220873953826f5aa33b160de605abb (patch)
tree03c208d13fb0c333ddcf513633c548ec5662d6cb /modules
parent6b0b1a4c042175190381737e3000027ef912e6cb (diff)
Ensure C# script properties are added to the end
Ensures that the `get_property_list` and `get_script_property_list` methods push the script properties to the end of the given list, this prevents the script property from appearing after the script variables.
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/csharp_script.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp
index b85b65e6d9..6970349414 100644
--- a/modules/mono/csharp_script.cpp
+++ b/modules/mono/csharp_script.cpp
@@ -1813,8 +1813,9 @@ void CSharpInstance::get_event_signals_state_for_reloading(List<Pair<StringName,
}
void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {
+ List<PropertyInfo> props;
for (OrderedHashMap<StringName, PropertyInfo>::ConstElement E = script->member_info.front(); E; E = E.next()) {
- p_properties->push_front(E.value());
+ props.push_front(E.value());
}
// Call _get_property_list
@@ -1837,15 +1838,19 @@ void CSharpInstance::get_property_list(List<PropertyInfo> *p_properties) const {
if (ret) {
Array array = Array(GDMonoMarshal::mono_object_to_variant(ret));
for (int i = 0, size = array.size(); i < size; i++) {
- p_properties->push_back(PropertyInfo::from_dict(array.get(i)));
+ props.push_back(PropertyInfo::from_dict(array.get(i)));
}
}
- return;
+ break;
}
top = top->get_parent_class();
}
+
+ for (const PropertyInfo &prop : props) {
+ p_properties->push_back(prop);
+ }
}
Variant::Type CSharpInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
@@ -3499,8 +3504,14 @@ Ref<Script> CSharpScript::get_base_script() const {
}
void CSharpScript::get_script_property_list(List<PropertyInfo> *r_list) const {
+ List<PropertyInfo> props;
+
for (OrderedHashMap<StringName, PropertyInfo>::ConstElement E = member_info.front(); E; E = E.next()) {
- r_list->push_front(E.value());
+ props.push_front(E.value());
+ }
+
+ for (const PropertyInfo &prop : props) {
+ r_list->push_back(prop);
}
}