diff options
| author | George Marques | 2017-12-07 13:16:47 -0200 |
|---|---|---|
| committer | GitHub | 2017-12-07 13:16:47 -0200 |
| commit | cac5aa498f1db928de61dc3d997791609c9e5039 (patch) | |
| tree | a41f7d6db0ff92c9ab933be934a524d23f55b5b0 /editor/editor_node.cpp | |
| parent | dd892a327d39c6df71e5e447b30488d7694501b5 (diff) | |
| parent | c6f28925e2aec9889132932356a041a1693ca812 (diff) | |
| download | godot-cac5aa498f1db928de61dc3d997791609c9e5039.tar.gz godot-cac5aa498f1db928de61dc3d997791609c9e5039.tar.zst godot-cac5aa498f1db928de61dc3d997791609c9e5039.zip | |
Merge pull request #14348 from waldson/feature-set-main-screen-plugin-icon
Add method on EditorPlugin to set main screen plugins icons
Diffstat (limited to 'editor/editor_node.cpp')
| -rw-r--r-- | editor/editor_node.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 71728250a..76d77ac7a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -338,7 +338,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<Texture> 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")); @@ -2673,7 +2679,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<Texture> 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); |
