summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-07 17:54:17 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-07 17:54:17 +0200
commit2b6e043491c746c069ceaa2f766a375ff0f30a64 (patch)
tree4cf4e5678f3b76d1bb9f3154701fad6d0d82c708 /editor/editor_node.cpp
parent0bd4a421bd6b0ac602b9033e31b8e781ed799715 (diff)
parenta3309215c200dff1cb8930cbdf83dbc0cff6d491 (diff)
downloadredot-engine-2b6e043491c746c069ceaa2f766a375ff0f30a64.tar.gz
Merge pull request #58617 from KoBeWi/custom_something
Improve handling of custom types
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 96b229b7ee..a2231f4601 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -4335,16 +4335,8 @@ Ref<Texture2D> EditorNode::get_class_icon(const String &p_class, const String &p
}
}
- const HashMap<String, Vector<EditorData::CustomType>> &p_map = EditorNode::get_editor_data().get_custom_types();
- for (const KeyValue<String, Vector<EditorData::CustomType>> &E : p_map) {
- const Vector<EditorData::CustomType> &ct = E.value;
- for (int i = 0; i < ct.size(); ++i) {
- if (ct[i].name == p_class) {
- if (ct[i].icon.is_valid()) {
- return ct[i].icon;
- }
- }
- }
+ if (const EditorData::CustomType *ctype = EditorNode::get_editor_data().get_custom_type_by_name(p_class)) {
+ return ctype->icon;
}
if (gui_base->has_theme_icon(p_class, SNAME("EditorIcons"))) {