Merge pull request #14348 from waldson/feature-set-main-screen-plugin-icon
Add method on EditorPlugin to set main screen plugins icons
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user