Improve Editor Inspector/Theme item lookup performance
Changes to reduce the latency between changing node selection in the editor and seeing the new node reflected in the Inspector tab - Use Vector instead of List for ThemeOwner::get_theme_type_dependencies and related functions - Use Vector instead of List for ThemeContext::themes, set_themes(), and get_themes() - Add ClassDB:get_inheritance_chain_nocheck to get all parent/ancestor classes at once, to avoid repeated ClassDB locking overhead - Update BIND_THEME_ITEM macros and ThemeDB::update_class_instance_items to use provided StringNames for call to ThemeItemSetter, instead of creating a new StringName in each call These changes reduce the time taken by EditorInspector::update_tree by around 30-35%
This commit is contained in:
@ -291,6 +291,29 @@ StringName ClassDB::get_parent_class_nocheck(const StringName &p_class) {
|
||||
return ti->inherits;
|
||||
}
|
||||
|
||||
bool ClassDB::get_inheritance_chain_nocheck(const StringName &p_class, Vector<StringName> &r_result) {
|
||||
OBJTYPE_RLOCK;
|
||||
|
||||
ClassInfo *start = classes.getptr(p_class);
|
||||
if (!start) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int classes_to_add = 0;
|
||||
for (ClassInfo *ti = start; ti; ti = ti->inherits_ptr) {
|
||||
classes_to_add++;
|
||||
}
|
||||
|
||||
int64_t old_size = r_result.size();
|
||||
r_result.resize(old_size + classes_to_add);
|
||||
StringName *w = r_result.ptrw() + old_size;
|
||||
for (ClassInfo *ti = start; ti; ti = ti->inherits_ptr) {
|
||||
*w++ = ti->name;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
StringName ClassDB::get_compatibility_remapped_class(const StringName &p_class) {
|
||||
if (classes.has(p_class)) {
|
||||
return p_class;
|
||||
|
||||
Reference in New Issue
Block a user