From c6f28925e2aec9889132932356a041a1693ca812 Mon Sep 17 00:00:00 2001 From: Waldson PatrĂ­cio Date: Wed, 6 Dec 2017 19:27:45 -0300 Subject: Add method to set main screen plugin icon --- editor/editor_node.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'editor/editor_node.cpp') diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index d6c8d6519..604f15a76 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -337,7 +337,13 @@ void EditorNode::_notification(int p_what) { //_update_icons for (int i = 0; i < singleton->main_editor_buttons.size(); i++) { - main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")); + Ref icon = singleton->main_editor_buttons[i]->get_icon(); + + if (icon.is_valid()) { + main_editor_buttons[i]->set_icon(icon); + } else if (singleton->gui_base->has_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")) { + main_editor_buttons[i]->set_icon(gui_base->get_icon(singleton->main_editor_buttons[i]->get_name(), "EditorIcons")); + } } play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons")); play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons")); @@ -2670,7 +2676,14 @@ void EditorNode::add_editor_plugin(EditorPlugin *p_editor) { tb->set_toggle_mode(true); tb->connect("pressed", singleton, "_editor_select", varray(singleton->main_editor_buttons.size())); tb->set_text(p_editor->get_name()); - tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons")); + Ref icon = p_editor->get_icon(); + + if (icon.is_valid()) { + tb->set_icon(icon); + } else if (singleton->gui_base->has_icon(p_editor->get_name(), "EditorIcons")) { + tb->set_icon(singleton->gui_base->get_icon(p_editor->get_name(), "EditorIcons")); + } + tb->set_name(p_editor->get_name()); singleton->main_editor_buttons.push_back(tb); singleton->main_editor_button_vb->add_child(tb); -- cgit v1.2.3-70-g09d2