Last active
July 2, 2022 21:10
-
-
Save vintprox/ef7da94f97cc1c124d55506bcdcaedd9 to your computer and use it in GitHub Desktop.
Explore the Asset Library with designated query in Godot 4.x Editor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func assetlib_search(query: String): | |
var assetlib_view: Control = get_editor_interface().get_editor_main_control().find_children("*", "EditorAssetLibrary", false, false).pop_front() | |
if not assetlib_view: | |
OS.shell_open("https://godotengine.org/asset-library/asset?filter=" + query.uri_encode()) | |
return | |
get_editor_interface().set_main_screen_editor("AssetLib") | |
await get_tree().create_timer(1).timeout | |
var search_field: LineEdit = assetlib_view.find_children("*", "LineEdit", true, false).pop_front() | |
search_field.set_text(query) | |
await get_tree().process_frame | |
search_field.emit_signal("text_changed", query) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment