1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Refactor editor icon retrieval

This commit is contained in:
willnationsdev
2018-09-02 16:40:51 -05:00
committed by Will Nations
parent 06c8b5a4ff
commit 5436abefe4
29 changed files with 192 additions and 252 deletions

View File

@@ -54,12 +54,7 @@ void EditorPath::_add_children_to_popup(Object *p_obj, int p_depth) {
if (!obj)
continue;
Ref<Texture> icon;
if (has_icon(obj->get_class(), "EditorIcons"))
icon = get_icon(obj->get_class(), "EditorIcons");
else
icon = get_icon("Object", "EditorIcons");
Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);
int index = popup->get_item_count();
popup->add_icon_item(icon, E->get().name.capitalize(), objects.size());
@@ -122,12 +117,7 @@ void EditorPath::_notification(int p_what) {
String type = obj->get_class();
Ref<Texture> icon;
if (has_icon(obj->get_class(), "EditorIcons"))
icon = get_icon(obj->get_class(), "EditorIcons");
else
icon = get_icon("Object", "EditorIcons");
Ref<Texture> icon = EditorNode::get_singleton()->get_object_icon(obj);
icon->draw(ci, Point2i(ofs, (size.height - icon->get_height()) / 2));