Merge pull request #55830 from zaevi/fix_3.x_ViewportPreview_upside-down

This commit is contained in:
Rémi Verschelde 2021-12-12 21:02:55 +01:00 committed by GitHub
commit 07fb636171
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -38,6 +38,8 @@ void EditorInspectorPluginViewportPreview::parse_begin(Object *p_object) {
Viewport *viewport = Object::cast_to<Viewport>(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);