From 1426df66a8397f3f03aaa541399054f0487fc8a1 Mon Sep 17 00:00:00 2001 From: Zae Date: Sun, 12 Dec 2021 00:53:49 +0800 Subject: [PATCH] Fix ViewportPreview upside-down in 3.x. --- editor/plugins/viewport_preview_editor_plugin.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/plugins/viewport_preview_editor_plugin.cpp b/editor/plugins/viewport_preview_editor_plugin.cpp index 03cd57b8d55..8aec5d900b3 100644 --- a/editor/plugins/viewport_preview_editor_plugin.cpp +++ b/editor/plugins/viewport_preview_editor_plugin.cpp @@ -38,6 +38,8 @@ void EditorInspectorPluginViewportPreview::parse_begin(Object *p_object) { Viewport *viewport = Object::cast_to(p_object); TexturePreview *viewport_preview = memnew(TexturePreview(viewport->get_texture(), false)); + viewport_preview->get_texture_display()->set_flip_v(true); // flip as ViewportTexture in 3.x is upside-down. + // Otherwise `viewport_preview`'s `texture_display` doesn't update properly when `viewport`'s size changes. viewport->connect("size_changed", viewport_preview->get_texture_display(), "update"); add_custom_control(viewport_preview);