Browse Source

Update icons when theme changed

Poommetee Ketson 7 years ago
parent
commit
2de1dfa42f

+ 3 - 1
editor/editor_about.cpp

@@ -44,9 +44,11 @@ void EditorAbout::_notification(int p_what) {
 		case NOTIFICATION_ENTER_TREE:
 		case NOTIFICATION_ENTER_TREE:
 		case NOTIFICATION_THEME_CHANGED: {
 		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);
 			_tpl_text->add_font_override("normal_font", font);
 			_license_text->add_font_override("normal_font", font);
 			_license_text->add_font_override("normal_font", font);
+			_logo->set_texture(base->get_icon("Logo", "EditorIcons"));
 		} break;
 		} break;
 	}
 	}
 }
 }

+ 20 - 0
editor/editor_audio_buses.cpp

@@ -121,6 +121,26 @@ void EditorAudioBus::_notification(int p_what) {
 
 
 		set_process(is_visible_in_tree());
 		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() {
 void EditorAudioBus::update_send() {

+ 33 - 16
editor/editor_node.cpp

@@ -349,14 +349,20 @@ void EditorNode::_notification(int p_what) {
 
 
 		// update_icons
 		// update_icons
 		for (int i = 0; i < singleton->main_editor_buttons.size(); i++) {
 		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()) {
 			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_button->set_icon(gui_base->get_icon("MainPlay", "EditorIcons"));
 		play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
 		play_scene_button->set_icon(gui_base->get_icon("PlayScene", "EditorIcons"));
 		play_custom_scene_button->set_icon(gui_base->get_icon("PlayCustom", "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_left->set_icon(theme->get_icon("Back", "EditorIcons"));
 		dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons"));
 		dock_tab_move_right->set_icon(theme->get_icon("Forward", "EditorIcons"));
 		update_menu->set_icon(gui_base->get_icon("Progress1", "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) {
 	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"];
 	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) {
 void EditorNode::_file_dialog_register(FileDialog *p_dialog) {
 
 
 	singleton->file_dialogs.insert(p_dialog);
 	singleton->file_dialogs.insert(p_dialog);
@@ -5132,7 +5160,6 @@ EditorNode::EditorNode() {
 	gui_base->add_child(export_template_manager);
 	gui_base->add_child(export_template_manager);
 
 
 	about = memnew(EditorAbout);
 	about = memnew(EditorAbout);
-	about->get_logo()->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
 	gui_base->add_child(about);
 	gui_base->add_child(about);
 
 
 	warning = memnew(AcceptDialog);
 	warning = memnew(AcceptDialog);
@@ -5797,17 +5824,7 @@ EditorNode::EditorNode() {
 	EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
 	EditorFileSystem::get_singleton()->connect("filesystem_changed", this, "_fs_changed");
 	EditorFileSystem::get_singleton()->connect("resources_reimported", this, "_resources_reimported");
 	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);
 	Node::set_human_readable_collision_renaming(true);
 
 

+ 1 - 0
editor/editor_node.h

@@ -496,6 +496,7 @@ private:
 	Set<EditorFileDialog *> editor_file_dialogs;
 	Set<EditorFileDialog *> editor_file_dialogs;
 
 
 	Map<String, Ref<Texture> > icon_type_cache;
 	Map<String, Ref<Texture> > icon_type_cache;
+	void _build_icon_type_cache();
 
 
 	bool _initializing_addons;
 	bool _initializing_addons;
 	Map<String, EditorPlugin *> plugin_addons;
 	Map<String, EditorPlugin *> plugin_addons;

+ 5 - 3
editor/plugins/asset_library_editor_plugin.cpp

@@ -533,11 +533,9 @@ void EditorAssetLibrary::_notification(int p_what) {
 	switch (p_what) {
 	switch (p_what) {
 		case NOTIFICATION_READY: {
 		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"));
 			reverse->set_icon(get_icon("Sort", "EditorIcons"));
 
 
-			error_hb->add_child(tf);
 			error_label->raise();
 			error_label->raise();
 		} break;
 		} break;
 
 
@@ -585,6 +583,8 @@ void EditorAssetLibrary::_notification(int p_what) {
 		case NOTIFICATION_THEME_CHANGED: {
 		case NOTIFICATION_THEME_CHANGED: {
 
 
 			library_scroll_bg->add_style_override("panel", get_stylebox("bg", "Tree"));
 			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;
 		} break;
 	}
 	}
 }
 }
@@ -1452,6 +1452,8 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
 	error_label = memnew(Label);
 	error_label = memnew(Label);
 	error_label->add_color_override("color", get_color("error_color", "Editor"));
 	error_label->add_color_override("color", get_color("error_color", "Editor"));
 	error_hb->add_child(error_label);
 	error_hb->add_child(error_label);
+	error_tr = memnew(TextureRect);
+	error_hb->add_child(error_tr);
 
 
 	description = NULL;
 	description = NULL;
 
 

+ 1 - 0
editor/plugins/asset_library_editor_plugin.h

@@ -194,6 +194,7 @@ class EditorAssetLibrary : public PanelContainer {
 	Button *search;
 	Button *search;
 	ProgressBar *load_status;
 	ProgressBar *load_status;
 	HBoxContainer *error_hb;
 	HBoxContainer *error_hb;
+	TextureRect *error_tr;
 	Label *error_label;
 	Label *error_label;
 	MenuButton *support;
 	MenuButton *support;
 
 

+ 1 - 1
editor/plugins/item_list_editor_plugin.cpp

@@ -247,7 +247,7 @@ void ItemListEditor::_node_removed(Node *p_node) {
 
 
 void ItemListEditor::_notification(int p_notification) {
 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"));
 		add_button->set_icon(get_icon("Add", "EditorIcons"));
 		del_button->set_icon(get_icon("Remove", "EditorIcons"));
 		del_button->set_icon(get_icon("Remove", "EditorIcons"));

+ 1 - 0
editor/plugins/texture_region_editor_plugin.cpp

@@ -600,6 +600,7 @@ void TextureRegionEditor::apply_rect(const Rect2 &rect) {
 
 
 void TextureRegionEditor::_notification(int p_what) {
 void TextureRegionEditor::_notification(int p_what) {
 	switch (p_what) {
 	switch (p_what) {
+		case NOTIFICATION_THEME_CHANGED:
 		case NOTIFICATION_READY: {
 		case NOTIFICATION_READY: {
 			zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
 			zoom_out->set_icon(get_icon("ZoomLess", "EditorIcons"));
 			zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));
 			zoom_reset->set_icon(get_icon("ZoomReset", "EditorIcons"));

+ 14 - 13
editor/plugins/tile_map_editor_plugin.cpp

@@ -48,6 +48,20 @@ void TileMapEditor::_notification(int p_what) {
 
 
 		} break;
 		} 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: {
 		case NOTIFICATION_ENTER_TREE: {
 
 
 			transp->set_icon(get_icon("Transpose", "EditorIcons"));
 			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"));
 			search_box->add_icon_override("right_icon", get_icon("Search", "EditorIcons"));
 
 
 		} break;
 		} 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;
 	}
 	}
 }
 }
 
 

+ 1 - 1
editor/plugins/tile_set_editor_plugin.cpp

@@ -256,7 +256,7 @@ void TileSetEditor::_bind_methods() {
 }
 }
 
 
 void TileSetEditor::_notification(int p_what) {
 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[TOOL_SELECT]->set_icon(get_icon("ToolSelect", "EditorIcons"));
 		tools[BITMASK_COPY]->set_icon(get_icon("Duplicate", "EditorIcons"));
 		tools[BITMASK_COPY]->set_icon(get_icon("Duplicate", "EditorIcons"));
 		tools[BITMASK_PASTE]->set_icon(get_icon("Override", "EditorIcons"));
 		tools[BITMASK_PASTE]->set_icon(get_icon("Override", "EditorIcons"));

+ 6 - 0
editor/project_export.cpp

@@ -56,6 +56,12 @@ void ProjectExportDialog::_notification(int p_what) {
 		case NOTIFICATION_POPUP_HIDE: {
 		case NOTIFICATION_POPUP_HIDE: {
 			EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
 			EditorSettings::get_singleton()->set("interface/dialogs/export_bounds", get_rect());
 		} break;
 		} 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;
 	}
 	}
 }
 }
 
 

+ 8 - 0
editor/project_settings_editor.cpp

@@ -110,6 +110,14 @@ void ProjectSettingsEditor::_notification(int p_what) {
 			EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
 			EditorSettings::get_singleton()->set("interface/dialogs/project_settings_bounds", get_rect());
 		} break;
 		} break;
 		case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
 		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();
 			_update_actions();
 		} break;
 		} break;
 	}
 	}

+ 4 - 0
editor/scene_tree_editor.cpp

@@ -550,6 +550,10 @@ void SceneTreeEditor::_notification(int p_what) {
 		get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
 		get_tree()->disconnect("node_configuration_warning_changed", this, "_warning_changed");
 		EditorSettings::get_singleton()->disconnect("settings_changed", this, "_editor_settings_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) {
 TreeItem *SceneTreeEditor::_find(TreeItem *p_node, const NodePath &p_path) {

+ 8 - 6
editor/script_create_dialog.cpp

@@ -41,10 +41,12 @@
 void ScriptCreateDialog::_notification(int p_what) {
 void ScriptCreateDialog::_notification(int p_what) {
 
 
 	switch (p_what) {
 	switch (p_what) {
+		case NOTIFICATION_THEME_CHANGED:
 		case NOTIFICATION_ENTER_TREE: {
 		case NOTIFICATION_ENTER_TREE: {
 			path_button->set_icon(get_icon("Folder", "EditorIcons"));
 			path_button->set_icon(get_icon("Folder", "EditorIcons"));
 			parent_browse_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);
 	hb->add_child(path_error_label);
 	vb->add_child(hb);
 	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 */
 	/* Margins */
 
 
@@ -631,7 +633,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
 	vb->add_child(empty_h->duplicate());
 	vb->add_child(empty_h->duplicate());
 	vb->add_child(gc);
 	vb->add_child(gc);
 	vb->add_child(empty_h->duplicate());
 	vb->add_child(empty_h->duplicate());
-	vb->add_child(pc);
+	vb->add_child(status_panel);
 	vb->add_child(empty_h->duplicate());
 	vb->add_child(empty_h->duplicate());
 	hb = memnew(HBoxContainer);
 	hb = memnew(HBoxContainer);
 	hb->add_child(empty_v->duplicate());
 	hb->add_child(empty_v->duplicate());

+ 1 - 0
editor/script_create_dialog.h

@@ -46,6 +46,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
 	LineEdit *class_name;
 	LineEdit *class_name;
 	Label *error_label;
 	Label *error_label;
 	Label *path_error_label;
 	Label *path_error_label;
+	PanelContainer *status_panel;
 	LineEdit *parent_name;
 	LineEdit *parent_name;
 	Button *parent_browse_button;
 	Button *parent_browse_button;
 	OptionButton *language_menu;
 	OptionButton *language_menu;

+ 10 - 0
editor/script_editor_debugger.cpp

@@ -1160,6 +1160,16 @@ void ScriptEditorDebugger::_notification(int p_what) {
 				inspect_scene_tree->add_color_override("relationship_line_color", rl_color);
 				inspect_scene_tree->add_color_override("relationship_line_color", rl_color);
 			} else
 			} else
 				inspect_scene_tree->add_constant_override("draw_relationship_lines", 0);
 				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;
 		} break;
 	}
 	}
 }
 }