summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/sub_viewport_preview_editor_plugin.cpp1
-rw-r--r--editor/plugins/texture_editor_plugin.cpp8
2 files changed, 4 insertions, 5 deletions
diff --git a/editor/plugins/sub_viewport_preview_editor_plugin.cpp b/editor/plugins/sub_viewport_preview_editor_plugin.cpp
index 5fd173cae3..75c47bda2e 100644
--- a/editor/plugins/sub_viewport_preview_editor_plugin.cpp
+++ b/editor/plugins/sub_viewport_preview_editor_plugin.cpp
@@ -38,6 +38,7 @@ void EditorInspectorPluginSubViewportPreview::parse_begin(Object *p_object) {
SubViewport *sub_viewport = Object::cast_to<SubViewport>(p_object);
TexturePreview *sub_viewport_preview = memnew(TexturePreview(sub_viewport->get_texture(), false));
+ // Otherwise `sub_viewport_preview`'s `texture_display` doesn't update properly when `sub_viewport`'s size changes.
sub_viewport->connect("size_changed", callable_mp((CanvasItem *)sub_viewport_preview->get_texture_display(), &CanvasItem::update));
add_custom_control(sub_viewport_preview);
}
diff --git a/editor/plugins/texture_editor_plugin.cpp b/editor/plugins/texture_editor_plugin.cpp
index 6ee652098d..4029d6785c 100644
--- a/editor/plugins/texture_editor_plugin.cpp
+++ b/editor/plugins/texture_editor_plugin.cpp
@@ -37,10 +37,8 @@ TextureRect *TexturePreview::get_texture_display() {
}
TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
- Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
-
TextureRect *checkerboard = memnew(TextureRect);
- checkerboard->set_texture(theme->get_icon("Checkerboard", "EditorIcons"));
+ checkerboard->set_texture(get_theme_icon("Checkerboard", "EditorIcons"));
checkerboard->set_stretch_mode(TextureRect::STRETCH_TILE);
checkerboard->set_texture_repeat(CanvasItem::TEXTURE_REPEAT_ENABLED);
checkerboard->set_custom_minimum_size(Size2(0.0, 256.0) * EDSCALE);
@@ -70,10 +68,10 @@ TexturePreview::TexturePreview(Ref<Texture2D> p_texture, bool p_show_metadata) {
metadata_label->add_theme_font_size_override("font_size", 16 * EDSCALE);
metadata_label->add_theme_color_override("font_outline_color", Color::named("black"));
metadata_label->add_theme_constant_override("outline_size", 2 * EDSCALE);
- Ref<Font> metadata_label_font = theme->get_font("expression", "EditorFonts");
+ Ref<Font> metadata_label_font = get_theme_font("expression", "EditorFonts");
metadata_label->add_theme_font_override("font", metadata_label_font);
- // it's okay that these colors are static since the grid color is static too
+ // It's okay that these colors are static since the grid color is static too.
metadata_label->add_theme_color_override("font_color", Color::named("white"));
metadata_label->add_theme_color_override("font_color_shadow", Color::named("black"));