Repository: godotengine/godot
File: editor/scene/texture/texture_editor_plugin.cpp (C++)

Code before:
	texture_display->set_texture_filter(TEXTURE_FILTER_NEAREST_WITH_MIPMAPS);
	texture_display->set_texture(p_texture);
	texture_display->set_expand_mode(TextureRect::EXPAND_IGNORE_SIZE);
	texture_display->set_material(material);
	centering_container->add_child(texture_display);

	// Creating a separate control so it is not affected by the filtering shader.
	outline_overlay = memnew(Control);
	centering_container->add_child(outline_overlay);

	outline_overlay->connect(SceneStringName(draw), callable_mp(this, &TexturePreview::_draw_outline));

	if (p_texture.is_valid()) {
		_update_texture_display_ratio();
		p_texture->connect_changed(callable_mp(this, &TexturePreview::_update_texture_display_ratio));
	}

	// Null can be passed by `Camera3DPreview` (which immediately after sets a texture anyways).
	const Image::Format format = p_texture.is_valid() ? get_texture_2d_format(p_texture.ptr()) : Image::FORMAT_MAX;
	const uint32_t components_mask = format != Image::FORMAT_MAX ? Image::get_format_component_mask(format) : 0xf;

	// Setup Mipmap selector
	const int mipmaps = get_texture_mipmaps_count(p_texture);
	if (mipmaps > 0) {
		mipmap_spinbox = memnew(SpinBox);
		mipmap_spinbox->set_tooltip_text("Mipmap level viewer.");
		mipmap_spinbox->set_step(1);
		mipmap_spinbox->set_max(mipmaps);
		mipmap_spinbox->set_modulate(Color(1, 1, 1, 0.8));
		mipmap_spinbox->set_h_grow_direction(GROW_DIRECTION_BEGIN);
		mipmap_spinbox->set_h_size_flags(Control::SIZE_SHRINK_END);
		mipmap_spinbox->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
		mipmap_spinbox->set_anchors_preset(Control::PRESET_TOP_RIGHT);
		mipmap_spinbox->connect(SceneStringName(value_changed), callable_mp(this, &TexturePreview::on_selected_mipmap_changed));
		add_child(mipmap_spinbox);
	}

	// Add color channel selector at the bottom left if more than 1 channel is available.
	if (p_show_metadata && !is_power_of_2(components_mask)) {
		channel_selector = memnew(ColorChannelSelector);
		channel_selector->connect("selected_channels_changed", callable_mp(this, &TexturePreview::on_selected_channels_changed));
		channel_selector->set_h_size_flags(Control::SIZE_SHRINK_BEGIN);
		channel_selector->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
		channel_selector->set_available_channels_mask(components_mask);
		add_child(channel_selector);
	}

	if (p_show_metadata) {
		metadata_label = memnew(Label);
		metadata_label->set_focus_mode(FOCUS_ACCESSIBILITY);


Review comment (suggestion):
```suggestion
		mipmap_spinbox->set_tooltip_text(TTRC("Mipmap level viewer."));
```
Also I'd change the text to something like "Mipmap index.". It's odd calling SpinBox a "viewer".

Code after:
	centering_container->add_child(outline_overlay);

	outline_overlay->connect(SceneStringName(draw), callable_mp(this, &TexturePreview::_draw_outline));

	if (p_texture.is_valid()) {
		_update_texture_display_ratio();
		p_texture->connect_changed(callable_mp(this, &TexturePreview::_update_texture_display_ratio));
	}

	// Null can be passed by `Camera3DPreview` (which immediately after sets a texture anyways).
	const Image::Format format = p_texture.is_valid() ? get_texture_2d_format(p_texture.ptr()) : Image::FORMAT_MAX;
	const uint32_t components_mask = format != Image::FORMAT_MAX ? Image::get_format_component_mask(format) : 0xf;

	// Setup Mipmap selector.
	const int mipmaps = get_texture_mipmaps_count(p_texture);
	if (mipmaps > 0) {
		mipmap_spinbox = memnew(SpinBox);
		mipmap_spinbox->set_tooltip_text(TTRC("Mipmap level index selector."));
		mipmap_spinbox->set_max(mipmaps);
		mipmap_spinbox->set_modulate(Color(1, 1, 1, 0.8));
		mipmap_spinbox->set_h_grow_direction(GROW_DIRECTION_BEGIN);
		mipmap_spinbox->set_h_size_flags(Control::SIZE_SHRINK_END);
		mipmap_spinbox->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
		mipmap_spinbox->set_anchors_preset(Control::PRESET_TOP_RIGHT);
		mipmap_spinbox->connect(SceneStringName(value_changed), callable_mp(this, &TexturePreview::on_selected_mipmap_changed));
		add_child(mipmap_spinbox);
	}

	// Add color channel selector at the bottom left if more than 1 channel is available.
	if (p_show_metadata && !Math::is_power_of_2(components_mask)) {
		channel_selector = memnew(ColorChannelSelector);
		channel_selector->connect("selected_channels_changed", callable_mp(this, &TexturePreview::on_selected_channels_changed));
		channel_selector->set_h_size_flags(Control::SIZE_SHRINK_BEGIN);
		channel_selector->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
		channel_selector->set_available_channels_mask(components_mask);
		add_child(channel_selector);
	}

	if (p_show_metadata) {
		metadata_label = memnew(Label);
		metadata_label->set_focus_mode(FOCUS_ACCESSIBILITY);

		if (p_texture.is_valid()) {
			_update_metadata_label_text();
			p_texture->connect_changed(callable_mp(this, &TexturePreview::_update_metadata_label_text));
		}

		// It's okay that these colors are static since the grid color is static too.
		metadata_label->add_theme_color_override(SceneStringName(font_color), Color(1, 1, 1));
		metadata_label->add_theme_color_override("font_shadow_color", Color(0, 0, 0));