{"id":22395095,"url":"https://github.com/atlinx/godot-pluginassetsregistry","last_synced_at":"2026-03-19T22:43:14.990Z","repository":{"id":110784552,"uuid":"361033115","full_name":"Atlinx/Godot-PluginAssetsRegistry","owner":"Atlinx","description":"A GDScript that scales assets used by plugins (like images and fonts) automatically based on the editor's current UI scale.","archived":false,"fork":false,"pushed_at":"2021-08-11T15:14:04.000Z","size":193,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-01T04:28:03.140Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"GDScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Atlinx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-24T00:03:02.000Z","updated_at":"2023-08-08T11:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"7586cc34-e76e-4ec6-895e-6eac6b569da3","html_url":"https://github.com/Atlinx/Godot-PluginAssetsRegistry","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlinx%2FGodot-PluginAssetsRegistry","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlinx%2FGodot-PluginAssetsRegistry/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlinx%2FGodot-PluginAssetsRegistry/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Atlinx%2FGodot-PluginAssetsRegistry/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Atlinx","download_url":"https://codeload.github.com/Atlinx/Godot-PluginAssetsRegistry/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245749800,"owners_count":20666084,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-05T05:13:08.249Z","updated_at":"2025-10-26T20:13:34.306Z","avatar_url":"https://github.com/Atlinx.png","language":"GDScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Godot Plugin Assets Registry\n\nA GDScript that scales assets used by plugins (like images and fonts) automatically based on the editor's current UI scale.\n\nThis script keeps a record of all loaded assets and does not duplicate the same asset more than once, which saves on memory.\n\n## Installation\n\n1. Copy the `plugin_assets_registry.gd` into your plugin's folder\n\n```\nres://\n└─ addons\n   └─ my_plugin\n      └─ plugin_assets_registry.gd \u003c- COPY HERE\n```\n\n2. Change `PLUGIN_ABSOLUTE_PATH_PREFIX` to be the path to your plugin's folder\n\n```GDScript\n# Inside \"plugin_assets_registry.gd\"\n\nclass_name PluginAssetsRegistry\nextends Reference\n\n# Replace 'demo_plugin' with your plugin's name\nconst PLUGIN_ABSOLUTE_PATH_PREFIX = \"res://addons/demo_plugin/\"\n\n...\n```\n\n3. Create a new instance of `PluginAssetsRegistry` inside of your main plugin script that extends `EditorPlugin`, and pass in your plugin inside of the `new()` constructor\n\n```GDScript\n# Inside \"plugin.gd\"\n\nextends EditorPlugin\n\nvar assets_registry = PluginAssetsRegistry.new(self)\n\n...\n```\n\n## Use\n\n`assets_registry.load_asset(asset_path: String)`\n\n- Loads a scaled asset using a path that is relative to the plugin folder. (ie `assets/fonts/font.tres` has a real path of `res://addons/my_plugin/assets/fonts/font.tres`, where `res://addons/my_plugin` is the plugin folder.)\n\n`assets_registry.load_asset(asset)`\n\n- Loads a scaled asset using an already loaded asset\n\n## Recommended Use\n\nYou should create a `_setup_editor_assets(asset_registry)` function in all the node you wish to use scaled assets and then have the plugin.gd script call `_setup_editor_assets` on those nodes, with the `assets_registry` as the argument. This lets each script load the assets they need since they have access to the `PluginAssetsRegistry` instance.\n\nie.\n```GDScript\n# Inside \"plugin.gd\"\n\nextends EditorPlugin\n\nvar assets_registry = PluginAssetsRegistry.new(self)\nvar plugin_ui : PluginUI\n\n...\n\nfunc _ready():\n   plugin_ui._setup_editor_assets(assets_registry)\n  \n...\n```\n \n```GDScript\n# Inside \"plugin_ui.gd\"\n\nclass_name PluginUI\nextends Control\n\nvar label: Label\nvar custom_button: CustomUISection\n\n...\n\nfunc _setup_editor_assets(assets_registry):\n   label.add_font_override(\"font\", assets_registry.load_asset(\"assets/fonts/my_font.tres\"))\n\n   # Chaining the _setup_editor_assets to child nodes\n   CustomUISection._setup_editor_assets(assets_registry)\n\n...\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlinx%2Fgodot-pluginassetsregistry","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlinx%2Fgodot-pluginassetsregistry","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlinx%2Fgodot-pluginassetsregistry/lists"}