Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditorFileDialog has missing icons #74762

Closed
SirQuartz opened this issue Mar 11, 2023 · 5 comments · Fixed by #81130
Closed

EditorFileDialog has missing icons #74762

SirQuartz opened this issue Mar 11, 2023 · 5 comments · Fixed by #81130

Comments

@SirQuartz
Copy link
Contributor

Godot version

4.0.stable.mono

System information

Windows 11, Vulkan, NVIDIA GTX 3080

Issue description

EditorFileDialog is missing icons.

EditorFileDialog

Steps to reproduce

Show the EditorFileDialog

Minimal reproduction project

N/A

@YuriSizov
Copy link
Contributor

That's the first time anyone reports that, so I don't think it's as simple as "Show the EditorFileDialog". Can you give me more specific steps and more details about the project that you're making? Is it a native editor window, is it a plugin? In which context does this dialog appear, saving what exactly? Do you have a custom editor theme, a custom project theme?

@SirQuartz
Copy link
Contributor Author

SirQuartz commented Mar 13, 2023

I was creating a plugin, I did nothing to alter the appearance of EditorFileDialog. All I did was create a new instance, then call show() on it. This is what it looks like. It should be noted, that the normal FileDialog does correctly load icons, but for some reason, EditorFileDialog does not.

I have no custom themes whatsoever anywhere in this project period, everything is at the default, and this is simply as it appears in-engine. So when I say "Show the EditorFileDialog" I literally mean just show it (call show()). It's not caused by me altering any theme settings.

@tool
extends EditorPlugin

func _enter_tree():
	var file_dialog = EditorFileDialog.new()
	file_dialog.mode = Window.MODE_WINDOWED
	file_dialog.display_mode = EditorFileDialog.DISPLAY_THUMBNAILS
	file_dialog.size = Vector2(400, 500)
	file_dialog.transient = false
	add_child(file_dialog)

	file_dialog.show()

@YuriSizov
Copy link
Contributor

You are adding a child to the editor plugin node directly. EditorPlugin is not a Control node or a Window node. It doesn't propagate the theme, and I'm not entirely sure where in the editor node tree it is added. So when you add a control node to it, it has no access to the editor theme, so it cannot fetch the icons.

What you should do instead is use get_editor_interface().get_base_control(). Same is true for 3.x and 4.0.

@SirQuartz
Copy link
Contributor Author

Alright, so I assume this is intended behavior then? If so, it should probably be documented somewhere in the EditorFileDialog class.

@YuriSizov
Copy link
Contributor

YuriSizov commented Mar 13, 2023

This is unrelated to the EditorFileDialog class. It applies to any control that you add to the editor UI. It needs to be added to the UI root, or to other control nodes in the editor. This is also neither intended, nor unintended. It's just how UI works in Godot, themes propagate through controls and windows, but they don't propagate through other types of nodes.

I'm pretty sure all of the official tutorials do that part correctly, but we can add a note in the EditorPlugin's description, perhaps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants