Skip to content

Commit

Permalink
Merge pull request #45202 from aaronfranke/assetlib-url
Browse files Browse the repository at this point in the history
Move the Asset Library API URLs to the Editor Settings
  • Loading branch information
akien-mga authored Jan 26, 2021
2 parents b84729f + 925d28e commit 7601ccb
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions editor/plugins/asset_library_editor_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,18 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
search_hb2->add_child(memnew(Label(TTR("Site:") + " ")));
repository = memnew(OptionButton);

repository->add_item("godotengine.org");
repository->set_item_metadata(0, "https://godotengine.org/asset-library/api");
repository->add_item("localhost");
repository->set_item_metadata(1, "http://127.0.0.1/asset-library/api");
{
Dictionary default_urls;
default_urls["godotengine.org"] = "https://godotengine.org/asset-library/api";
default_urls["localhost"] = "http://127.0.0.1/asset-library/api";
Dictionary available_urls = _EDITOR_DEF("asset_library/available_urls", default_urls, true);
Array keys = available_urls.keys();
for (int i = 0; i < available_urls.size(); i++) {
String key = keys[i];
repository->add_item(key);
repository->set_item_metadata(i, available_urls[key]);
}
}

repository->connect("item_selected", callable_mp(this, &EditorAssetLibrary::_repository_changed));

Expand Down

0 comments on commit 7601ccb

Please sign in to comment.