Allow texture preview to zoom and popout in separate window - #111849
Allow texture preview to zoom and popout in separate window#111849Arnklit wants to merge 1 commit into
Conversation
4ac01c6 to
a943973
Compare
|
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 |
a943973 to
58f3a27
Compare
58f3a27 to
191406b
Compare
191406b to
03161e5
Compare
|
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. |
03161e5 to
4a919ad
Compare
|
Sorry, there was some ugly snafu in my git actions that closed the PR. should be back in order now. |
|
Note I believe there was a bug in #109004 |
|
@Arnklit good catch on the texturelod function, I think fixing it here is good, and I'm happy with the lod selector change :) |
2e69e15 to
f38f9bd
Compare
|
Rebased |
Calinou
left a comment
There was a problem hiding this comment.
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:
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:
| 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. |
There was a problem hiding this comment.
I see the channel selector in the top-left corner, just like in the inspector:
| // 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) { |
There was a problem hiding this comment.
You should use ViewPanner for panning, instead of implementing it manually.
|
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. |
|
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. |
f38f9bd to
ff1c8a2
Compare

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