Clean-up array editing

This commit is contained in:
reduz
2022-07-21 01:18:14 +02:00
committed by Juan Linietsky
parent 3b39f00761
commit 0351a0908f
5 changed files with 255 additions and 62 deletions

View File

@ -963,8 +963,11 @@ void ClassDB::add_linked_property(const StringName &p_class, const String &p_pro
ERR_FAIL_COND(!type->property_map.has(p_property));
ERR_FAIL_COND(!type->property_map.has(p_linked_property));
PropertyInfo &pinfo = type->property_map[p_property];
pinfo.linked_properties.push_back(p_linked_property);
if (!type->linked_properties.has(p_property)) {
type->linked_properties.insert(p_property, List<StringName>());
}
type->linked_properties[p_property].push_back(p_linked_property);
#endif
}
@ -992,6 +995,25 @@ void ClassDB::get_property_list(const StringName &p_class, List<PropertyInfo> *p
}
}
void ClassDB::get_linked_properties_info(const StringName &p_class, const StringName &p_property, List<StringName> *r_properties, bool p_no_inheritance) {
#ifdef TOOLS_ENABLED
ClassInfo *check = classes.getptr(p_class);
while (check) {
if (!check->linked_properties.has(p_property)) {
return;
}
for (const StringName &E : check->linked_properties[p_property]) {
r_properties->push_back(E);
}
if (p_no_inheritance) {
break;
}
check = check->inherits_ptr;
}
#endif
}
bool ClassDB::get_property_info(const StringName &p_class, const StringName &p_property, PropertyInfo *r_info, bool p_no_inheritance, const Object *p_validator) {
OBJTYPE_RLOCK;