summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorHristo Stamenov <capitane71@gmail.com>2022-07-31 11:07:48 +0300
committerHristo Stamenov <capitane71@gmail.com>2022-08-03 21:45:16 +0300
commit0e1f7e9f89e74ebf4b2dec04f26ffab13c32a237 (patch)
treefd05f2fef5c5d6b9d30ec20fac8317e3125f0a5c /modules/gdscript
parent19e0e06dd08fd9dd89fb09e0fed1286eaae32945 (diff)
Removed faulty function update after get_property_list.
The function tried to rearrange properties but that lead to problems with duplication or deleted properties. Implemented the logic that that function did inside the get_property_list both for tool scripts and non-tool scripts.
Diffstat (limited to 'modules/gdscript')
-rw-r--r--modules/gdscript/gdscript.cpp42
1 files changed, 30 insertions, 12 deletions
diff --git a/modules/gdscript/gdscript.cpp b/modules/gdscript/gdscript.cpp
index d752bef14f..dc6bfbb034 100644
--- a/modules/gdscript/gdscript.cpp
+++ b/modules/gdscript/gdscript.cpp
@@ -325,16 +325,23 @@ void GDScript::_get_script_property_list(List<PropertyInfo> *r_list, bool p_incl
for (int i = 0; i < msort.size(); i++) {
props.push_front(sptr->member_info[msort[i].name]);
}
+
+#ifdef TOOLS_ENABLED
+ r_list->push_back(sptr->get_class_category());
+#endif // TOOLS_ENABLED
+
+ for (const PropertyInfo &E : props) {
+ r_list->push_back(E);
+ }
+
+ props.clear();
+
if (!p_include_base) {
break;
}
sptr = sptr->_base;
}
-
- for (const PropertyInfo &E : props) {
- r_list->push_back(E);
- }
}
void GDScript::get_script_property_list(List<PropertyInfo> *r_list) const {
@@ -434,10 +441,6 @@ void GDScript::set_source_code(const String &p_code) {
#ifdef TOOLS_ENABLED
void GDScript::_update_exports_values(HashMap<StringName, Variant> &values, List<PropertyInfo> &propnames) {
- if (base_cache.is_valid()) {
- base_cache->_update_exports_values(values, propnames);
- }
-
for (const KeyValue<StringName, Variant> &E : member_default_values_cache) {
values[E.key] = E.value;
}
@@ -445,6 +448,10 @@ void GDScript::_update_exports_values(HashMap<StringName, Variant> &values, List
for (const PropertyInfo &E : members_cache) {
propnames.push_back(E);
}
+
+ if (base_cache.is_valid()) {
+ base_cache->_update_exports_values(values, propnames);
+ }
}
void GDScript::_add_doc(const DocData::ClassDoc &p_inner_class) {
@@ -703,6 +710,8 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
member_default_values_cache.clear();
_signals.clear();
+ members_cache.push_back(get_class_category());
+
for (int i = 0; i < c->members.size(); i++) {
const GDScriptParser::ClassNode::Member &member = c->members[i];
@@ -728,6 +737,9 @@ bool GDScript::_update_exports(bool *r_err, bool p_recursive_call, PlaceHolderSc
}
_signals[member.signal->identifier->name] = parameters_names;
} break;
+ case GDScriptParser::ClassNode::Member::GROUP: {
+ members_cache.push_back(member.annotation->export_info);
+ } break;
default:
break; // Nothing.
}
@@ -1510,11 +1522,17 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
props.push_front(sptr->member_info[msort[i].name]);
}
- sptr = sptr->_base;
- }
+#ifdef TOOLS_ENABLED
+ p_properties->push_back(sptr->get_class_category());
+#endif // TOOLS_ENABLED
+
+ for (const PropertyInfo &prop : props) {
+ p_properties->push_back(prop);
+ }
+
+ props.clear();
- for (const PropertyInfo &E : props) {
- p_properties->push_back(E);
+ sptr = sptr->_base;
}
}