Skip to content

Instantly share code, notes, and snippets.

@vintprox
Last active July 2, 2022 21:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vintprox/ef7da94f97cc1c124d55506bcdcaedd9 to your computer and use it in GitHub Desktop.
Save vintprox/ef7da94f97cc1c124d55506bcdcaedd9 to your computer and use it in GitHub Desktop.
Explore the Asset Library with designated query in Godot 4.x Editor
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