mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Fix duplication of inherited script properties
This commit is contained in:
parent
c12d63556b
commit
16e860bcb3
5 changed files with 88 additions and 13 deletions
|
@ -306,6 +306,9 @@ void GDScript::_get_script_property_list(List<PropertyInfo> *r_list, bool p_incl
|
|||
while (sptr) {
|
||||
Vector<_GDScriptMemberSort> msort;
|
||||
for (const KeyValue<StringName, MemberInfo> &E : sptr->member_indices) {
|
||||
if (!sptr->members.has(E.key)) {
|
||||
continue; // Skip base class members.
|
||||
}
|
||||
_GDScriptMemberSort ms;
|
||||
ms.index = E.value.index;
|
||||
ms.name = E.key;
|
||||
|
@ -1648,15 +1651,11 @@ bool GDScriptInstance::get(const StringName &p_name, Variant &r_ret) const {
|
|||
}
|
||||
|
||||
Variant::Type GDScriptInstance::get_property_type(const StringName &p_name, bool *r_is_valid) const {
|
||||
const GDScript *sptr = script.ptr();
|
||||
while (sptr) {
|
||||
if (sptr->member_indices.has(p_name)) {
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = true;
|
||||
}
|
||||
return sptr->member_indices[p_name].property_info.type;
|
||||
if (script->member_indices.has(p_name)) {
|
||||
if (r_is_valid) {
|
||||
*r_is_valid = true;
|
||||
}
|
||||
sptr = sptr->_base;
|
||||
return script->member_indices[p_name].property_info.type;
|
||||
}
|
||||
|
||||
if (r_is_valid) {
|
||||
|
@ -1732,6 +1731,9 @@ void GDScriptInstance::get_property_list(List<PropertyInfo> *p_properties) const
|
|||
|
||||
Vector<_GDScriptMemberSort> msort;
|
||||
for (const KeyValue<StringName, GDScript::MemberInfo> &F : sptr->member_indices) {
|
||||
if (!sptr->members.has(F.key)) {
|
||||
continue; // Skip base class members.
|
||||
}
|
||||
_GDScriptMemberSort ms;
|
||||
ms.index = F.value.index;
|
||||
ms.name = F.key;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue