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.
This commit is contained in:
Hristo Stamenov 2022-07-31 11:07:48 +03:00
parent 19e0e06dd0
commit 0e1f7e9f89
9 changed files with 110 additions and 116 deletions

View file

@ -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 &E : props) {
p_properties->push_back(E);
for (const PropertyInfo &prop : props) {
p_properties->push_back(prop);
}
props.clear();
sptr = sptr->_base;
}
}