Update icons when theme changed
This commit is contained in:
parent
08584b7e22
commit
2de1dfa42f
16 changed files with 117 additions and 41 deletions
|
@ -44,9 +44,11 @@ void EditorAbout::_notification(int p_what) {
|
|||
case NOTIFICATION_ENTER_TREE:
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
Ref<Font> font = EditorNode::get_singleton()->get_gui_base()->get_font("source", "EditorFonts");
|
||||
Control *base = EditorNode::get_singleton()->get_gui_base();
|
||||
Ref<Font> font = base->get_font("source", "EditorFonts");
|
||||
_tpl_text->add_font_override("normal_font", font);
|
||||
_license_text->add_font_override("normal_font", font);
|
||||
_logo->set_texture(base->get_icon("Logo", "EditorIcons"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,6 +121,26 @@ void EditorAudioBus::_notification(int p_what) {
|
|||
|
||||
set_process(is_visible_in_tree());
|
||||
}
|
||||
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
|
||||
for (int i = 0; i < cc; i++) {
|
||||
channel[i].vu_l->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_l->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].vu_r->set_under_texture(get_icon("BusVuEmpty", "EditorIcons"));
|
||||
channel[i].vu_r->set_progress_texture(get_icon("BusVuFull", "EditorIcons"));
|
||||
channel[i].prev_active = true;
|
||||
}
|
||||
scale->set_texture(get_icon("BusVuDb", "EditorIcons"));
|
||||
|
||||
disabled_vu = get_icon("BusVuFrozen", "EditorIcons");
|
||||
|
||||
solo->set_icon(get_icon("AudioBusSolo", "EditorIcons"));
|
||||
mute->set_icon(get_icon("AudioBusMute", "EditorIcons"));
|
||||
bypass->set_icon(get_icon("AudioBusBypass", "EditorIcons"));
|
||||
|
||||
bus_options->set_icon(get_icon("GuiMiniTabMenu", "EditorIcons"));
|
||||
}
|
||||
}
|
||||
|
||||
void EditorAudioBus::update_send() {
|
||||
|
|
|
@ -349,14 +349,20 @@ void EditorNode::_notification(int p_what) {
|
|||
|
||||
// update_icons
|
||||
for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
|
||||
Ref<Texture> icon = singleton->main_editor_buttons[i]->get_icon();
|
||||
|
||||
ToolButton *tb = singleton->main_editor_buttons[i];
|
||||
EditorPlugin *p_editor = singleton->editor_table[i];
|
||||
Ref<Texture> icon = p_editor->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"));
|
||||
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"));
|
||||
}
|
||||
}
|
||||
|
||||
_build_icon_type_cache();
|
||||
|
||||
play_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons"));
|
||||
play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
|
||||
play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "EditorIcons"));
|
||||
|
@ -382,6 +388,15 @@ void EditorNode::_notification(int p_what) {
|
|||
dock_tab_move_left->set_icon(theme->get_icon("Back", "EditorIcons"));
|
||||
dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons"));
|
||||
update_menu->set_icon(gui_base->get_icon("Progress1", "EditorIcons"));
|
||||
|
||||
PopupMenu *p = help_menu->get_popup();
|
||||
p->set_item_icon(p->get_item_index(HELP_CLASSES), gui_base->get_icon("ClassList", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_SEARCH), gui_base->get_icon("HelpSearch", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_DOCS), gui_base->get_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_QA), gui_base->get_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_ISSUES), gui_base->get_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_COMMUNITY), gui_base->get_icon("Instance", "EditorIcons"));
|
||||
p->set_item_icon(p->get_item_index(HELP_ABOUT), gui_base->get_icon("Godot", "EditorIcons"));
|
||||
}
|
||||
|
||||
if (p_what == Control::NOTIFICATION_RESIZED) {
|
||||
|
@ -3441,6 +3456,19 @@ Ref<Texture> EditorNode::_file_dialog_get_icon(const String &p_path) {
|
|||
return singleton->icon_type_cache["Object"];
|
||||
}
|
||||
|
||||
void EditorNode::_build_icon_type_cache() {
|
||||
|
||||
List<StringName> tl;
|
||||
StringName ei = "EditorIcons";
|
||||
theme_base->get_theme()->get_icon_list(ei, &tl);
|
||||
for (List<StringName>::Element *E = tl.front(); E; E = E->next()) {
|
||||
|
||||
if (!ClassDB::class_exists(E->get()))
|
||||
continue;
|
||||
icon_type_cache[E->get()] = theme_base->get_theme()->get_icon(E->get(), ei);
|
||||
}
|
||||
}
|
||||
|
||||
void EditorNode::_file_dialog_register(FileDialog *p_dialog) {
|
||||
|
||||
singleton->file_dialogs.insert(p_dialog);
|
||||
|
@ -5132,7 +5160,6 @@ EditorNode::EditorNode() {
|
|||
gui_base->add_child(export_template_manager);
|
||||
|
||||
about = memnew(EditorAbout);
|
||||
about->get_logo()->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
|
||||
gui_base->add_child(about);
|
||||
|
||||
warning = memnew(AcceptDialog);
|
||||
|
@ -5797,17 +5824,7 @@ EditorNode::EditorNode() {
|
|||
EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
|
||||
EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported");
|
||||
|
||||
{
|
||||
List<StringName> tl;
|
||||
StringName ei = "EditorIcons";
|
||||
theme_base->get_theme()->get_icon_list(ei, &tl);
|
||||
for (List<StringName>::Element *E = tl.front(); E; E = E->next()) {
|
||||
|
||||
if (!ClassDB::class_exists(E->get()))
|
||||
continue;
|
||||
icon_type_cache[E->get()] = theme_base->get_theme()->get_icon(E->get(), ei);
|
||||
}
|
||||
}
|
||||
_build_icon_type_cache();
|
||||
|
||||
Node::set_human_readable_collision_renaming(true);
|
||||
|
||||
|
|
|
@ -496,6 +496,7 @@ private:
|
|||
Set<EditorFileDialog *> editor_file_dialogs;
|
||||
|
||||
Map<String, Ref<Texture> > icon_type_cache;
|
||||
void _build_icon_type_cache();
|
||||
|
||||
bool _initializing_addons;
|
||||
Map<String, EditorPlugin *> plugin_addons;
|
||||
|
|
|
@ -533,11 +533,9 @@ void EditorAssetLibrary::_notification(int p_what) {
|
|||
switch (p_what) {
|
||||
case NOTIFICATION_READY: {
|
||||
|
||||
TextureRect *tf = memnew(TextureRect);
|
||||
tf->set_texture(get_icon("Error", "EditorIcons"));
|
||||
error_tr->set_texture(get_icon("Error", "EditorIcons"));
|
||||
reverse->set_icon(get_icon("Sort", "EditorIcons"));
|
||||
|
||||
error_hb->add_child(tf);
|
||||
error_label->raise();
|
||||
} break;
|
||||
|
||||
|
@ -585,6 +583,8 @@ void EditorAssetLibrary::_notification(int p_what) {
|
|||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
||||
library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
error_tr->set_texture(get_icon("Error", "EditorIcons"));
|
||||
reverse->set_icon(get_icon("Sort", "EditorIcons"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
@ -1452,6 +1452,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
|
|||
error_label = memnew(Label);
|
||||
error_label->add_color_override("color", get_color("error_color", "Editor"));
|
||||
error_hb->add_child(error_label);
|
||||
error_tr = memnew(TextureRect);
|
||||
error_hb->add_child(error_tr);
|
||||
|
||||
description = NULL;
|
||||
|
||||
|
|
|
@ -194,6 +194,7 @@ class EditorAssetLibrary : public PanelContainer {
|
|||
Button *search;
|
||||
ProgressBar *load_status;
|
||||
HBoxContainer *error_hb;
|
||||
TextureRect *error_tr;
|
||||
Label *error_label;
|
||||
MenuButton *support;
|
||||
|
||||
|
|
|
@ -247,7 +247,7 @@ void ItemListEditor::_node_removed(Node *p_node) {
|
|||
|
||||
void ItemListEditor::_notification(int p_notification) {
|
||||
|
||||
if (p_notification == NOTIFICATION_ENTER_TREE) {
|
||||
if (p_notification == NOTIFICATION_ENTER_TREE || p_notification == NOTIFICATION_THEME_CHANGED) {
|
||||
|
||||
add_button->set_icon(get_icon("Add", "EditorIcons"));
|
||||
del_button->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
|
|
|
@ -600,6 +600,7 @@ void TextureRegionEditor::apply_rect(const Rect2 &rect) {
|
|||
|
||||
void TextureRegionEditor::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_READY: {
|
||||
zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
|
||||
zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
|
||||
|
|
|
@ -48,6 +48,20 @@ void TileMapEditor::_notification(int p_what) {
|
|||
|
||||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
|
||||
if (new_show_tile_info != show_tile_info) {
|
||||
show_tile_info = new_show_tile_info;
|
||||
tile_info->set_visible(show_tile_info);
|
||||
}
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
_update_palette();
|
||||
}
|
||||
|
||||
} // fallthrough
|
||||
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
|
||||
transp->set_icon(get_icon("Transpose", "EditorIcons"));
|
||||
|
@ -61,19 +75,6 @@ void TileMapEditor::_notification(int p_what) {
|
|||
search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
|
||||
|
||||
} break;
|
||||
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
bool new_show_tile_info = EditorSettings::get_singleton()->get("editors/tile_map/show_tile_info_on_hover");
|
||||
if (new_show_tile_info != show_tile_info) {
|
||||
show_tile_info = new_show_tile_info;
|
||||
tile_info->set_visible(show_tile_info);
|
||||
}
|
||||
|
||||
if (is_visible_in_tree()) {
|
||||
_update_palette();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ void TileSetEditor::_bind_methods() {
|
|||
}
|
||||
|
||||
void TileSetEditor::_notification(int p_what) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE) {
|
||||
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
tools[TOOL_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons"));
|
||||
tools[BITMASK_COPY]->set_icon(get_icon("Duplicate", "EditorIcons"));
|
||||
tools[BITMASK_PASTE]->set_icon(get_icon("Override", "EditorIcons"));
|
||||
|
|
|
@ -56,6 +56,12 @@ void ProjectExportDialog::_notification(int p_what) {
|
|||
case NOTIFICATION_POPUP_HIDE: {
|
||||
EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
|
||||
} break;
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
delete_preset->set_icon(get_icon("Remove", "EditorIcons"));
|
||||
Control *panel = custom_feature_display->get_parent_control();
|
||||
if (panel)
|
||||
panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,6 +110,14 @@ void ProjectSettingsEditor::_notification(int p_what) {
|
|||
EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
|
||||
} break;
|
||||
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
|
||||
|
||||
search_button->set_icon(get_icon("Search", "EditorIcons"));
|
||||
clear_button->set_icon(get_icon("Close", "EditorIcons"));
|
||||
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_KEY), get_icon("Keyboard", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_BUTTON), get_icon("JoyButton", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_JOY_MOTION), get_icon("JoyAxis", "EditorIcons"));
|
||||
popup_add->set_item_icon(popup_add->get_item_index(INPUT_MOUSE_BUTTON), get_icon("Mouse", "EditorIcons"));
|
||||
_update_actions();
|
||||
} break;
|
||||
}
|
||||
|
|
|
@ -550,6 +550,10 @@ void SceneTreeEditor::_notification(int p_what) {
|
|||
get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
|
||||
EditorSettings::get_singleton()->disconnect("settings_changed", this, "_editor_settings_changed");
|
||||
}
|
||||
if (p_what == NOTIFICATION_THEME_CHANGED) {
|
||||
|
||||
_update_tree();
|
||||
}
|
||||
}
|
||||
|
||||
TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) {
|
||||
|
|
|
@ -41,10 +41,12 @@
|
|||
void ScriptCreateDialog::_notification(int p_what) {
|
||||
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED:
|
||||
case NOTIFICATION_ENTER_TREE: {
|
||||
path_button->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
parent_browse_button->set_icon(get_icon("Folder", "EditorIcons"));
|
||||
}
|
||||
status_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -609,10 +611,10 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
hb->add_child(path_error_label);
|
||||
vb->add_child(hb);
|
||||
|
||||
PanelContainer *pc = memnew(PanelContainer);
|
||||
pc->set_h_size_flags(Control::SIZE_FILL);
|
||||
pc->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
|
||||
pc->add_child(vb);
|
||||
status_panel = memnew(PanelContainer);
|
||||
status_panel->set_h_size_flags(Control::SIZE_FILL);
|
||||
status_panel->add_style_override("panel", EditorNode::get_singleton()->get_gui_base()->get_stylebox("bg", "Tree"));
|
||||
status_panel->add_child(vb);
|
||||
|
||||
/* Margins */
|
||||
|
||||
|
@ -631,7 +633,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
|
|||
vb->add_child(empty_h->duplicate());
|
||||
vb->add_child(gc);
|
||||
vb->add_child(empty_h->duplicate());
|
||||
vb->add_child(pc);
|
||||
vb->add_child(status_panel);
|
||||
vb->add_child(empty_h->duplicate());
|
||||
hb = memnew(HBoxContainer);
|
||||
hb->add_child(empty_v->duplicate());
|
||||
|
|
|
@ -46,6 +46,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
|
|||
LineEdit *class_name;
|
||||
Label *error_label;
|
||||
Label *path_error_label;
|
||||
PanelContainer *status_panel;
|
||||
LineEdit *parent_name;
|
||||
Button *parent_browse_button;
|
||||
OptionButton *language_menu;
|
||||
|
|
|
@ -1160,6 +1160,16 @@ void ScriptEditorDebugger::_notification(int p_what) {
|
|||
inspect_scene_tree->add_color_override("relationship_line_color", rl_color);
|
||||
} else
|
||||
inspect_scene_tree->add_constant_override("draw_relationship_lines", 0);
|
||||
|
||||
copy->set_icon(get_icon("ActionCopy", "EditorIcons"));
|
||||
step->set_icon(get_icon("DebugStep", "EditorIcons"));
|
||||
next->set_icon(get_icon("DebugNext", "EditorIcons"));
|
||||
back->set_icon(get_icon("Back", "EditorIcons"));
|
||||
forward->set_icon(get_icon("Forward", "EditorIcons"));
|
||||
dobreak->set_icon(get_icon("Pause", "EditorIcons"));
|
||||
docontinue->set_icon(get_icon("DebugContinue", "EditorIcons"));
|
||||
vmem_refresh->set_icon(get_icon("Reload", "EditorIcons"));
|
||||
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue