Skip to content

AcoAlexDev/GetFromGit-for-Godot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GetFromGit for Godot

GetFromGit is a Godot utility node for downloading and fetching content from public GitHub repositories and websites at runtime. GitHub URLs are automatically converted to raw form, supports async text retrieval, file downloads, and image loading.

Note

This asset is available in the official Godot Asset Libary! Download is suggested by using the godot website or the Godot editor itself in the AssetLib Tab.

Usage

  1. Download this repo
  2. Copy the GetFromGit folder into your godot project
  3. Instantiate a GetFromGit node in your scene
  4. Call the public methods on your node instance (see examples below).
@onready var GetFromGitNode: GetFromGit = $GetFromGit

Function Examples

  • func get_string_content_from_github(git_url:String) -> String:
print(await GetFromGitNode.get_string_content_from_github("https://github.com/AcoAlexDev/GetFromGit-for-Godot/edit/main/README.md"))
  • func get_string_content_from_website(url:String) -> String:
print(await GetFromGitNode.get_string_content_from_website("https://example.com/data.txt"))
  • func download_file_from_github(git_url:String, download_path:String = "res://") -> void:
GetFromGitNode.download_file_from_github("https://github.com/AcoAlexDev/GetFromGit-for-Godot/blob/main/GetFromGit/get_from_git_plugin.gd", "res://downloaded_file.gd")
  • func download_file_from_website(url:String, download_path:String = "res://") -> void:
GetFromGitNode.download_file_from_website("https://example.com/data.txt", "res://downloaded_data.txt")
  • func load_image_from_github(git_url:String) -> Image:
var image = await GetFromGitNode.load_image_from_github("https://github.com/AcoAlexDev/Aco-JUCE-CMake-Template/blob/main/Assets/bypass_image.png")
var tr = TextureRect.new()
tr.texture = ImageTexture.create_from_image(image)
add_child(tr)
  • func load_image_from_website(url:String) -> Image:
var image = await GetFromGitNode.load_image_from_website("https://fast-images.static-thomann.de/pics/images/logos/thomann-cyan-black.svg")
var tr = TextureRect.new()
tr.texture = ImageTexture.create_from_image(image)
add_child(tr)

Enable or disable debug_printing in the Inspector or with

GetFromGitNode.toggle_debug_printing(false)

License

This project is licensed under the MIT License. See the LICENSE.md for details.

Contributing

Contributions, issues, and feature requests are welcome. Feel free to open an issue or submit a pull request.

About

Drag all files into a godot project to use the GetFromGit object and download/fetch images, strings and everything else from git and other websites during runtime

Resources

License

Stars

Watchers

Forks

Contributors