Skip to content

Allow texture preview to zoom and popout in separate window - #111849

Draft
Arnklit wants to merge 1 commit into
godotengine:masterfrom
Arnklit:popout-texture-preview
Draft

Allow texture preview to zoom and popout in separate window#111849
Arnklit wants to merge 1 commit into
godotengine:masterfrom
Arnklit:popout-texture-preview

Conversation

@Arnklit

@Arnklit Arnklit commented Oct 20, 2025

Copy link
Copy Markdown
Contributor

This adds a button that opens the preview in a popup and adds zoom controls. Resolves godotengine/godot-proposals#10160.

EDIT: Original video, before I added zoom, see video in comment for the current behavior

godot.windows.editor.dev.x86_64_jTxo9h7JiQ.mp4

@Arnklit
Arnklit requested review from a team October 20, 2025 14:46
@AThousandShips AThousandShips added this to the 4.x milestone Oct 20, 2025
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from 4ac01c6 to a943973 Compare November 28, 2025 23:02
@Arnklit

Arnklit commented Nov 28, 2025

Copy link
Copy Markdown
Contributor Author

Got a bit inspired and had a go at adding zooming to the preview as well. The code is probably a bit rough now, so I'm setting it to draft until I've done a review of it myself.

godot.windows.editor.dev.x86_64_JKHTVewkqO.mp4

@Arnklit Arnklit changed the title Allow texture preview to popout in separate window [WIP]Allow texture preview to zoom and popout in separate window Nov 28, 2025
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from a943973 to 58f3a27 Compare November 28, 2025 23:11
@Arnklit
Arnklit marked this pull request as draft November 28, 2025 23:11
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from 58f3a27 to 191406b Compare November 28, 2025 23:15
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from 191406b to 03161e5 Compare March 31, 2026 21:32
@Arnklit Arnklit changed the title [WIP]Allow texture preview to zoom and popout in separate window Allow texture preview to zoom and popout in separate window Mar 31, 2026
@Arnklit
Arnklit marked this pull request as ready for review March 31, 2026 21:35
@Arnklit
Arnklit requested a review from a team as a code owner March 31, 2026 21:35
@Arnklit

Arnklit commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Rebased and reworked with the new LOD selector. Ready for review.

godot.windows.editor.dev.x86_64_PIgfdd0NOB.mp4

@DDarby-Lewis I ended up moving the LOD selector you added in to the other side and I limited it's width to 2 digits, let me know what you think.

@Arnklit Arnklit closed this Mar 31, 2026
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from 03161e5 to 4a919ad Compare March 31, 2026 21:55
@Arnklit Arnklit reopened this Mar 31, 2026
@Arnklit

Arnklit commented Mar 31, 2026

Copy link
Copy Markdown
Contributor Author

Sorry, there was some ugly snafu in my git actions that closed the PR. should be back in order now.

@Arnklit

Arnklit commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Note I believe there was a bug in #109004
The preview shader used the texture function and set the lod bias, rather than the textureLod which sets the LOD directly. I changed that over as part of these changes, but maybe it should be put in a separate PR.

@DDarby-Lewis

Copy link
Copy Markdown
Contributor

@Arnklit good catch on the texturelod function, I think fixing it here is good, and I'm happy with the lod selector change :)

@akien-mga
akien-mga requested review from KoBeWi and YeldhamDev April 7, 2026 09:33
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from 2e69e15 to f38f9bd Compare May 18, 2026 12:30
@Arnklit

Arnklit commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

Rebased

Comment thread editor/scene/texture/texture_editor_plugin.cpp Outdated
Comment thread editor/scene/texture/texture_editor_plugin.cpp Outdated
Comment thread editor/scene/texture/texture_editor_plugin.cpp Outdated
Comment thread editor/scene/texture/texture_editor_plugin.cpp Outdated
Comment thread editor/scene/texture/texture_editor_plugin.cpp Outdated

@Calinou Calinou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally (rebased on top of master 321b8c9), it works as expected.

Some feedback:

  • The speed at which you pan doesn't match the mouse cursor movement, which feels odd. Panning is much faster than expected, especially at higher zoom levels.

  • It should be possible to pan the view with the middle mouse button, for consistency with the 2D editor viewport.

  • Zooming in at higher levels feels less impactful, as the zoom percentage is increased linearly (e.g. going from 400% to 410% is a much lower increase than going from 100% to 110%). I would look at how the 2D editor viewport handles zoom for inspiration, as it uses nonlinear scaling for scroll wheel zoom to ensure it feels consistent across zoom levels.

  • At the minimum width, the mipmap and zoom indicators can overlap:

Image

This can also occur in the inspector if it's made narrow enough, especially if the channel indicator is also visible. This is roughly the minimum width required for them to not overlap:

Image

left_upper_corner_container->set_v_size_flags(Control::SIZE_SHRINK_BEGIN);
add_child(left_upper_corner_container);

// Add color channel selector at the bottom left if more than 1 channel is available.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the channel selector in the top-left corner, just like in the inspector:

Suggested change
// Add color channel selector at the bottom left if more than 1 channel is available.
// Add color channel selector at the top-left corner if more than 1 channel is available.

return texture_display;
}

void TexturePreview::_texture_display_gui_input(const Ref<InputEvent> &p_event) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should use ViewPanner for panning, instead of implementing it manually.

@QbieShay

Copy link
Copy Markdown
Contributor

I think this is useful functionality. I'm particularly fond of the per-channel view.

I tested the PR, and I have some UX comments:

It's a bit hard to understand whether some channels are active or not. I suggest using the same scheme as the 3d view:
image

I would also suggest 2 more buttons for the channel: RGB, RGBA. RGBA is selected by default. RGB shows RGB without A
Clicking RGB is exclusive with RGBA and exclusive with per-component, while components stay non-exclusive with one another.

Would it be possible to use the whole space to pan and zoom? it feels very wasteful to have all that lateral space unused.

I would also label the MIP button. I would not completely disable it when there's no mipmap, i would just leave it there with disabled buttons. Alternatively, the up button is active but clicking it shows an error message that asks the user to enable mip if they want more mip.

@Arnklit

Arnklit commented May 19, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback @AThousandShips and @Calinou . I'll submit fixes for those issues soon. @KoBeWi I did not realise there was a helper class for exactly that, makes sense. I'll have a go at moving over to that.

@QbieShay I didn't add the channel selectors and mipmap selectors, they are already in master, I just had to adjust them a bit to accomodate the UI. And I had to make sure they worked in the popped out preview.

@QbieShay

Copy link
Copy Markdown
Contributor

What about the zooming rect using the whole space?

@Arnklit

Arnklit commented May 21, 2026

Copy link
Copy Markdown
Contributor Author

What about the zooming rect using the whole space?

Yeah I think that should be doable. I'm trying to rewrite it to use the ViewPanner now and that kind of changes the entire structure of the thing. I'll see if I can make that work.

@Arnklit
Arnklit marked this pull request as draft June 3, 2026 14:39
@Arnklit
Arnklit force-pushed the popout-texture-preview branch from f38f9bd to ff1c8a2 Compare June 9, 2026 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add zoom function to the Texture preview inspector

6 participants