export_template_manager.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622
  1. /*************************************************************************/
  2. /* export_template_manager.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "export_template_manager.h"
  31. #include "core/io/json.h"
  32. #include "core/io/zip_io.h"
  33. #include "core/os/dir_access.h"
  34. #include "core/os/input.h"
  35. #include "core/os/keyboard.h"
  36. #include "core/version.h"
  37. #include "editor_node.h"
  38. #include "editor_scale.h"
  39. void ExportTemplateManager::_update_template_list() {
  40. while (current_hb->get_child_count()) {
  41. memdelete(current_hb->get_child(0));
  42. }
  43. while (installed_vb->get_child_count()) {
  44. memdelete(installed_vb->get_child(0));
  45. }
  46. DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  47. Error err = d->change_dir(EditorSettings::get_singleton()->get_templates_dir());
  48. d->list_dir_begin();
  49. Set<String> templates;
  50. if (err == OK) {
  51. bool isdir;
  52. String c = d->get_next(&isdir);
  53. while (c != String()) {
  54. if (isdir && !c.begins_with(".")) {
  55. templates.insert(c);
  56. }
  57. c = d->get_next(&isdir);
  58. }
  59. }
  60. d->list_dir_end();
  61. memdelete(d);
  62. String current_version = VERSION_FULL_CONFIG;
  63. Label *current = memnew(Label);
  64. current->set_h_size_flags(SIZE_EXPAND_FILL);
  65. current_hb->add_child(current);
  66. if (templates.has(current_version)) {
  67. current->add_color_override("font_color", get_color("success_color", "Editor"));
  68. Button *redownload = memnew(Button);
  69. redownload->set_text(TTR("Re-Download"));
  70. current_hb->add_child(redownload);
  71. redownload->connect("pressed", this, "_download_template", varray(current_version));
  72. Button *uninstall = memnew(Button);
  73. uninstall->set_text(TTR("Uninstall"));
  74. current_hb->add_child(uninstall);
  75. current->set_text(current_version + " " + TTR("(Installed)"));
  76. uninstall->connect("pressed", this, "_uninstall_template", varray(current_version));
  77. } else {
  78. current->add_color_override("font_color", get_color("error_color", "Editor"));
  79. Button *redownload = memnew(Button);
  80. redownload->set_text(TTR("Download"));
  81. redownload->connect("pressed", this, "_download_template", varray(current_version));
  82. current_hb->add_child(redownload);
  83. current->set_text(current_version + " " + TTR("(Missing)"));
  84. }
  85. for (Set<String>::Element *E = templates.back(); E; E = E->prev()) {
  86. HBoxContainer *hbc = memnew(HBoxContainer);
  87. Label *version = memnew(Label);
  88. version->set_modulate(get_color("disabled_font_color", "Editor"));
  89. String text = E->get();
  90. if (text == current_version) {
  91. text += " " + TTR("(Current)");
  92. }
  93. version->set_text(text);
  94. version->set_h_size_flags(SIZE_EXPAND_FILL);
  95. hbc->add_child(version);
  96. Button *uninstall = memnew(Button);
  97. uninstall->set_text(TTR("Uninstall"));
  98. hbc->add_child(uninstall);
  99. uninstall->connect("pressed", this, "_uninstall_template", varray(E->get()));
  100. installed_vb->add_child(hbc);
  101. }
  102. }
  103. void ExportTemplateManager::_download_template(const String &p_version) {
  104. while (template_list->get_child_count()) {
  105. memdelete(template_list->get_child(0));
  106. }
  107. template_downloader->popup_centered_minsize();
  108. template_list_state->set_text(TTR("Retrieving mirrors, please wait..."));
  109. template_download_progress->set_max(100);
  110. template_download_progress->set_value(0);
  111. request_mirror->request("https://godotengine.org/mirrorlist/" + p_version + ".json");
  112. template_list_state->show();
  113. template_download_progress->show();
  114. }
  115. void ExportTemplateManager::_uninstall_template(const String &p_version) {
  116. remove_confirm->set_text(vformat(TTR("Remove template version '%s'?"), p_version));
  117. remove_confirm->popup_centered_minsize();
  118. to_remove = p_version;
  119. }
  120. void ExportTemplateManager::_uninstall_template_confirm() {
  121. DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  122. Error err = d->change_dir(EditorSettings::get_singleton()->get_templates_dir());
  123. ERR_FAIL_COND(err != OK);
  124. err = d->change_dir(to_remove);
  125. ERR_FAIL_COND(err != OK);
  126. Vector<String> files;
  127. d->list_dir_begin();
  128. bool isdir;
  129. String c = d->get_next(&isdir);
  130. while (c != String()) {
  131. if (!isdir) {
  132. files.push_back(c);
  133. }
  134. c = d->get_next(&isdir);
  135. }
  136. d->list_dir_end();
  137. for (int i = 0; i < files.size(); i++) {
  138. d->remove(files[i]);
  139. }
  140. d->change_dir("..");
  141. d->remove(to_remove);
  142. _update_template_list();
  143. }
  144. bool ExportTemplateManager::_install_from_file(const String &p_file, bool p_use_progress) {
  145. FileAccess *fa = NULL;
  146. zlib_filefunc_def io = zipio_create_io_from_file(&fa);
  147. unzFile pkg = unzOpen2(p_file.utf8().get_data(), &io);
  148. if (!pkg) {
  149. EditorNode::get_singleton()->show_warning(TTR("Can't open export templates zip."));
  150. return false;
  151. }
  152. int ret = unzGoToFirstFile(pkg);
  153. int fc = 0; //count them and find version
  154. String version;
  155. String contents_dir;
  156. while (ret == UNZ_OK) {
  157. unz_file_info info;
  158. char fname[16384];
  159. ret = unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
  160. String file = fname;
  161. if (file.ends_with("version.txt")) {
  162. Vector<uint8_t> data;
  163. data.resize(info.uncompressed_size);
  164. //read
  165. unzOpenCurrentFile(pkg);
  166. ret = unzReadCurrentFile(pkg, data.ptrw(), data.size());
  167. unzCloseCurrentFile(pkg);
  168. String data_str;
  169. data_str.parse_utf8((const char *)data.ptr(), data.size());
  170. data_str = data_str.strip_edges();
  171. // Version number should be of the form major.minor[.patch].status[.module_config]
  172. // so it can in theory have 3 or more slices.
  173. if (data_str.get_slice_count(".") < 3) {
  174. EditorNode::get_singleton()->show_warning(vformat(TTR("Invalid version.txt format inside templates: %s."), data_str));
  175. unzClose(pkg);
  176. return false;
  177. }
  178. version = data_str;
  179. contents_dir = file.get_base_dir().trim_suffix("/").trim_suffix("\\");
  180. }
  181. if (file.get_file().size() != 0) {
  182. fc++;
  183. }
  184. ret = unzGoToNextFile(pkg);
  185. }
  186. if (version == String()) {
  187. EditorNode::get_singleton()->show_warning(TTR("No version.txt found inside templates."));
  188. unzClose(pkg);
  189. return false;
  190. }
  191. String template_path = EditorSettings::get_singleton()->get_templates_dir().plus_file(version);
  192. DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  193. Error err = d->make_dir_recursive(template_path);
  194. if (err != OK) {
  195. EditorNode::get_singleton()->show_warning(TTR("Error creating path for templates:") + "\n" + template_path);
  196. unzClose(pkg);
  197. return false;
  198. }
  199. memdelete(d);
  200. ret = unzGoToFirstFile(pkg);
  201. EditorProgress *p = NULL;
  202. if (p_use_progress) {
  203. p = memnew(EditorProgress("ltask", TTR("Extracting Export Templates"), fc));
  204. }
  205. fc = 0;
  206. while (ret == UNZ_OK) {
  207. //get filename
  208. unz_file_info info;
  209. char fname[16384];
  210. unzGetCurrentFileInfo(pkg, &info, fname, 16384, NULL, 0, NULL, 0);
  211. String file_path(String(fname).simplify_path());
  212. String file = file_path.get_file();
  213. if (file.size() == 0) {
  214. ret = unzGoToNextFile(pkg);
  215. continue;
  216. }
  217. Vector<uint8_t> data;
  218. data.resize(info.uncompressed_size);
  219. //read
  220. unzOpenCurrentFile(pkg);
  221. unzReadCurrentFile(pkg, data.ptrw(), data.size());
  222. unzCloseCurrentFile(pkg);
  223. String base_dir = file_path.get_base_dir().trim_suffix("/");
  224. if (base_dir != contents_dir && base_dir.begins_with(contents_dir)) {
  225. base_dir = base_dir.substr(contents_dir.length(), file_path.length()).trim_prefix("/");
  226. file = base_dir.plus_file(file);
  227. DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
  228. ERR_CONTINUE(!da);
  229. String output_dir = template_path.plus_file(base_dir);
  230. if (!DirAccess::exists(output_dir)) {
  231. Error mkdir_err = da->make_dir_recursive(output_dir);
  232. ERR_CONTINUE(mkdir_err != OK);
  233. }
  234. }
  235. if (p) {
  236. p->step(TTR("Importing:") + " " + file, fc);
  237. }
  238. FileAccess *f = FileAccess::open(template_path.plus_file(file), FileAccess::WRITE);
  239. if (!f) {
  240. ret = unzGoToNextFile(pkg);
  241. fc++;
  242. ERR_CONTINUE(!f);
  243. }
  244. f->store_buffer(data.ptr(), data.size());
  245. memdelete(f);
  246. ret = unzGoToNextFile(pkg);
  247. fc++;
  248. }
  249. if (p) {
  250. memdelete(p);
  251. }
  252. unzClose(pkg);
  253. _update_template_list();
  254. return true;
  255. }
  256. void ExportTemplateManager::popup_manager() {
  257. _update_template_list();
  258. popup_centered_minsize(Size2(400, 400) * EDSCALE);
  259. }
  260. void ExportTemplateManager::ok_pressed() {
  261. template_open->popup_centered_ratio();
  262. }
  263. void ExportTemplateManager::_http_download_mirror_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
  264. if (p_status != HTTPRequest::RESULT_SUCCESS || p_code != 200) {
  265. EditorNode::get_singleton()->show_warning("Error getting the list of mirrors.");
  266. return;
  267. }
  268. String mirror_str;
  269. {
  270. PoolByteArray::Read r = p_data.read();
  271. mirror_str.parse_utf8((const char *)r.ptr(), p_data.size());
  272. }
  273. template_list_state->hide();
  274. template_download_progress->hide();
  275. Variant r;
  276. String errs;
  277. int errline;
  278. Error err = JSON::parse(mirror_str, r, errs, errline);
  279. if (err != OK) {
  280. EditorNode::get_singleton()->show_warning("Error parsing JSON of mirror list. Please report this issue!");
  281. return;
  282. }
  283. bool mirrors_found = false;
  284. Dictionary d = r;
  285. if (d.has("mirrors")) {
  286. Array mirrors = d["mirrors"];
  287. for (int i = 0; i < mirrors.size(); i++) {
  288. Dictionary m = mirrors[i];
  289. ERR_CONTINUE(!m.has("url") || !m.has("name"));
  290. LinkButton *lb = memnew(LinkButton);
  291. lb->set_text(m["name"]);
  292. lb->connect("pressed", this, "_begin_template_download", varray(m["url"]));
  293. template_list->add_child(lb);
  294. mirrors_found = true;
  295. }
  296. }
  297. if (!mirrors_found) {
  298. EditorNode::get_singleton()->show_warning(TTR("No download links found for this version. Direct download is only available for official releases."));
  299. return;
  300. }
  301. }
  302. void ExportTemplateManager::_http_download_templates_completed(int p_status, int p_code, const PoolStringArray &headers, const PoolByteArray &p_data) {
  303. switch (p_status) {
  304. case HTTPRequest::RESULT_CANT_RESOLVE: {
  305. template_list_state->set_text(TTR("Can't resolve."));
  306. } break;
  307. case HTTPRequest::RESULT_BODY_SIZE_LIMIT_EXCEEDED:
  308. case HTTPRequest::RESULT_CONNECTION_ERROR:
  309. case HTTPRequest::RESULT_CHUNKED_BODY_SIZE_MISMATCH: {
  310. template_list_state->set_text(TTR("Can't connect."));
  311. } break;
  312. case HTTPRequest::RESULT_SSL_HANDSHAKE_ERROR:
  313. case HTTPRequest::RESULT_CANT_CONNECT: {
  314. template_list_state->set_text(TTR("Can't connect."));
  315. } break;
  316. case HTTPRequest::RESULT_NO_RESPONSE: {
  317. template_list_state->set_text(TTR("No response."));
  318. } break;
  319. case HTTPRequest::RESULT_REQUEST_FAILED: {
  320. template_list_state->set_text(TTR("Request Failed."));
  321. } break;
  322. case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
  323. template_list_state->set_text(TTR("Redirect Loop."));
  324. } break;
  325. default: {
  326. if (p_code != 200) {
  327. template_list_state->set_text(TTR("Failed:") + " " + itos(p_code));
  328. } else {
  329. String path = download_templates->get_download_file();
  330. template_list_state->set_text(TTR("Download Complete."));
  331. template_downloader->hide();
  332. int ret = _install_from_file(path, false);
  333. if (ret) {
  334. Error err = OS::get_singleton()->move_to_trash(path);
  335. if (err != OK) {
  336. EditorNode::get_singleton()->add_io_error(TTR("Cannot remove:") + "\n" + path + "\n");
  337. }
  338. } else {
  339. WARN_PRINTS(vformat(TTR("Templates installation failed. The problematic templates archives can be found at '%s'."), path));
  340. }
  341. }
  342. } break;
  343. }
  344. set_process(false);
  345. }
  346. void ExportTemplateManager::_begin_template_download(const String &p_url) {
  347. if (Input::get_singleton()->is_key_pressed(KEY_SHIFT)) {
  348. OS::get_singleton()->shell_open(p_url);
  349. return;
  350. }
  351. for (int i = 0; i < template_list->get_child_count(); i++) {
  352. BaseButton *b = Object::cast_to<BaseButton>(template_list->get_child(0));
  353. if (b) {
  354. b->set_disabled(true);
  355. }
  356. }
  357. download_data.clear();
  358. download_templates->set_download_file(EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz"));
  359. download_templates->set_use_threads(true);
  360. Error err = download_templates->request(p_url);
  361. if (err != OK) {
  362. EditorNode::get_singleton()->show_warning(TTR("Error requesting url: ") + p_url);
  363. return;
  364. }
  365. set_process(true);
  366. template_list_state->show();
  367. template_download_progress->set_max(100);
  368. template_download_progress->set_value(0);
  369. template_download_progress->show();
  370. template_list_state->set_text(TTR("Connecting to Mirror..."));
  371. }
  372. void ExportTemplateManager::_window_template_downloader_closed() {
  373. download_templates->cancel_request();
  374. }
  375. void ExportTemplateManager::_notification(int p_what) {
  376. if (p_what == NOTIFICATION_PROCESS) {
  377. update_countdown -= get_process_delta_time();
  378. if (update_countdown > 0) {
  379. return;
  380. }
  381. update_countdown = 0.5;
  382. String status;
  383. bool errored = false;
  384. switch (download_templates->get_http_client_status()) {
  385. case HTTPClient::STATUS_DISCONNECTED:
  386. status = TTR("Disconnected");
  387. errored = true;
  388. break;
  389. case HTTPClient::STATUS_RESOLVING: status = TTR("Resolving"); break;
  390. case HTTPClient::STATUS_CANT_RESOLVE:
  391. status = TTR("Can't Resolve");
  392. errored = true;
  393. break;
  394. case HTTPClient::STATUS_CONNECTING: status = TTR("Connecting..."); break;
  395. case HTTPClient::STATUS_CANT_CONNECT:
  396. status = TTR("Can't Connect");
  397. errored = true;
  398. break;
  399. case HTTPClient::STATUS_CONNECTED: status = TTR("Connected"); break;
  400. case HTTPClient::STATUS_REQUESTING: status = TTR("Requesting..."); break;
  401. case HTTPClient::STATUS_BODY:
  402. status = TTR("Downloading");
  403. if (download_templates->get_body_size() > 0) {
  404. status += " " + String::humanize_size(download_templates->get_downloaded_bytes()) + "/" + String::humanize_size(download_templates->get_body_size());
  405. template_download_progress->set_max(download_templates->get_body_size());
  406. template_download_progress->set_value(download_templates->get_downloaded_bytes());
  407. } else {
  408. status += " " + String::humanize_size(download_templates->get_downloaded_bytes());
  409. }
  410. break;
  411. case HTTPClient::STATUS_CONNECTION_ERROR:
  412. status = TTR("Connection Error");
  413. errored = true;
  414. break;
  415. case HTTPClient::STATUS_SSL_HANDSHAKE_ERROR:
  416. status = TTR("SSL Handshake Error");
  417. errored = true;
  418. break;
  419. }
  420. template_list_state->set_text(status);
  421. if (errored) {
  422. set_process(false);
  423. ;
  424. }
  425. }
  426. if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
  427. if (!is_visible_in_tree()) {
  428. set_process(false);
  429. }
  430. }
  431. }
  432. void ExportTemplateManager::_bind_methods() {
  433. ClassDB::bind_method("_download_template", &ExportTemplateManager::_download_template);
  434. ClassDB::bind_method("_uninstall_template", &ExportTemplateManager::_uninstall_template);
  435. ClassDB::bind_method("_uninstall_template_confirm", &ExportTemplateManager::_uninstall_template_confirm);
  436. ClassDB::bind_method("_install_from_file", &ExportTemplateManager::_install_from_file);
  437. ClassDB::bind_method("_http_download_mirror_completed", &ExportTemplateManager::_http_download_mirror_completed);
  438. ClassDB::bind_method("_http_download_templates_completed", &ExportTemplateManager::_http_download_templates_completed);
  439. ClassDB::bind_method("_begin_template_download", &ExportTemplateManager::_begin_template_download);
  440. ClassDB::bind_method("_window_template_downloader_closed", &ExportTemplateManager::_window_template_downloader_closed);
  441. }
  442. ExportTemplateManager::ExportTemplateManager() {
  443. VBoxContainer *main_vb = memnew(VBoxContainer);
  444. add_child(main_vb);
  445. current_hb = memnew(HBoxContainer);
  446. main_vb->add_margin_child(TTR("Current Version:"), current_hb, false);
  447. installed_scroll = memnew(ScrollContainer);
  448. main_vb->add_margin_child(TTR("Installed Versions:"), installed_scroll, true);
  449. installed_vb = memnew(VBoxContainer);
  450. installed_scroll->add_child(installed_vb);
  451. installed_scroll->set_enable_v_scroll(true);
  452. installed_scroll->set_enable_h_scroll(false);
  453. installed_vb->set_h_size_flags(SIZE_EXPAND_FILL);
  454. get_cancel()->set_text(TTR("Close"));
  455. get_ok()->set_text(TTR("Install From File"));
  456. remove_confirm = memnew(ConfirmationDialog);
  457. remove_confirm->set_title(TTR("Remove Template"));
  458. add_child(remove_confirm);
  459. remove_confirm->connect("confirmed", this, "_uninstall_template_confirm");
  460. template_open = memnew(FileDialog);
  461. template_open->set_title(TTR("Select template file"));
  462. template_open->add_filter("*.tpz ; Godot Export Templates");
  463. template_open->set_access(FileDialog::ACCESS_FILESYSTEM);
  464. template_open->set_mode(FileDialog::MODE_OPEN_FILE);
  465. template_open->connect("file_selected", this, "_install_from_file", varray(true));
  466. add_child(template_open);
  467. set_title(TTR("Export Template Manager"));
  468. set_hide_on_ok(false);
  469. request_mirror = memnew(HTTPRequest);
  470. add_child(request_mirror);
  471. request_mirror->connect("request_completed", this, "_http_download_mirror_completed");
  472. download_templates = memnew(HTTPRequest);
  473. add_child(download_templates);
  474. download_templates->connect("request_completed", this, "_http_download_templates_completed");
  475. template_downloader = memnew(AcceptDialog);
  476. template_downloader->set_title(TTR("Download Templates"));
  477. template_downloader->get_ok()->set_text(TTR("Close"));
  478. template_downloader->set_exclusive(true);
  479. add_child(template_downloader);
  480. template_downloader->connect("popup_hide", this, "_window_template_downloader_closed");
  481. VBoxContainer *vbc = memnew(VBoxContainer);
  482. template_downloader->add_child(vbc);
  483. ScrollContainer *sc = memnew(ScrollContainer);
  484. sc->set_custom_minimum_size(Size2(400, 200) * EDSCALE);
  485. vbc->add_margin_child(TTR("Select mirror from list: (Shift+Click: Open in Browser)"), sc);
  486. template_list = memnew(VBoxContainer);
  487. sc->add_child(template_list);
  488. sc->set_enable_v_scroll(true);
  489. sc->set_enable_h_scroll(false);
  490. template_list_state = memnew(Label);
  491. vbc->add_child(template_list_state);
  492. template_download_progress = memnew(ProgressBar);
  493. vbc->add_child(template_download_progress);
  494. update_countdown = 0;
  495. }