feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EDITOR_HTTP_SERVER_H
|
||||
#define WEB_EDITOR_HTTP_SERVER_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/image_loader.h"
|
||||
#include "core/io/stream_peer_tls.h"
|
||||
|
|
@ -70,5 +69,3 @@ public:
|
|||
Error listen(int p_port, IPAddress p_address, bool p_use_tls, String p_tls_key, String p_tls_cert);
|
||||
bool is_listening() const;
|
||||
};
|
||||
|
||||
#endif // WEB_EDITOR_HTTP_SERVER_H
|
||||
|
|
|
|||
|
|
@ -28,10 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EXPORT_H
|
||||
#define WEB_EXPORT_H
|
||||
#pragma once
|
||||
|
||||
void register_web_exporter_types();
|
||||
void register_web_exporter();
|
||||
|
||||
#endif // WEB_EXPORT_H
|
||||
|
|
|
|||
|
|
@ -164,15 +164,15 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
|
|||
const String custom_head_include = p_preset->get("html/head_include");
|
||||
HashMap<String, String> replaces;
|
||||
replaces["$GODOT_URL"] = p_name + ".js";
|
||||
replaces["$GODOT_PROJECT_NAME"] = GLOBAL_GET("application/config/name");
|
||||
replaces["$GODOT_PROJECT_NAME"] = get_project_setting(p_preset, "application/config/name");
|
||||
replaces["$GODOT_HEAD_INCLUDE"] = head_include + custom_head_include;
|
||||
replaces["$GODOT_CONFIG"] = str_config;
|
||||
replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(GLOBAL_GET("application/boot_splash/bg_color")).to_html(false);
|
||||
replaces["$GODOT_SPLASH_COLOR"] = "#" + Color(get_project_setting(p_preset, "application/boot_splash/bg_color")).to_html(false);
|
||||
|
||||
LocalVector<String> godot_splash_classes;
|
||||
godot_splash_classes.push_back("show-image--" + String(GLOBAL_GET("application/boot_splash/show_image")));
|
||||
godot_splash_classes.push_back("fullsize--" + String(GLOBAL_GET("application/boot_splash/fullsize")));
|
||||
godot_splash_classes.push_back("use-filter--" + String(GLOBAL_GET("application/boot_splash/use_filter")));
|
||||
godot_splash_classes.push_back("show-image--" + String(get_project_setting(p_preset, "application/boot_splash/show_image")));
|
||||
godot_splash_classes.push_back("fullsize--" + String(get_project_setting(p_preset, "application/boot_splash/fullsize")));
|
||||
godot_splash_classes.push_back("use-filter--" + String(get_project_setting(p_preset, "application/boot_splash/use_filter")));
|
||||
replaces["$GODOT_SPLASH_CLASSES"] = String(" ").join(godot_splash_classes);
|
||||
replaces["$GODOT_SPLASH"] = p_name + ".png";
|
||||
|
||||
|
|
@ -185,7 +185,7 @@ void EditorExportPlatformWeb::_fix_html(Vector<uint8_t> &p_html, const Ref<Edito
|
|||
_replace_strings(replaces, p_html);
|
||||
}
|
||||
|
||||
Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr) {
|
||||
Error EditorExportPlatformWeb::_add_manifest_icon(const Ref<EditorExportPreset> &p_preset, const String &p_path, const String &p_icon, int p_size, Array &r_arr) {
|
||||
const String name = p_path.get_file().get_basename();
|
||||
const String icon_name = vformat("%s.%dx%d.png", name, p_size, p_size);
|
||||
const String icon_dest = p_path.get_base_dir().path_join(icon_name);
|
||||
|
|
@ -202,7 +202,7 @@ Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const St
|
|||
icon->resize(p_size, p_size);
|
||||
}
|
||||
} else {
|
||||
icon = _get_project_icon();
|
||||
icon = _get_project_icon(p_preset);
|
||||
icon->resize(p_size, p_size);
|
||||
}
|
||||
const Error err = icon->save_png(icon_dest);
|
||||
|
|
@ -219,7 +219,7 @@ Error EditorExportPlatformWeb::_add_manifest_icon(const String &p_path, const St
|
|||
}
|
||||
|
||||
Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects) {
|
||||
String proj_name = GLOBAL_GET("application/config/name");
|
||||
String proj_name = get_project_setting(p_preset, "application/config/name");
|
||||
if (proj_name.is_empty()) {
|
||||
proj_name = "Godot Game";
|
||||
}
|
||||
|
|
@ -236,10 +236,11 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
replaces["___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___"] = ensure_crossorigin_isolation_headers ? "true" : "false";
|
||||
|
||||
// Files cached during worker install.
|
||||
Array cache_files;
|
||||
cache_files.push_back(name + ".html");
|
||||
cache_files.push_back(name + ".js");
|
||||
cache_files.push_back(name + ".offline.html");
|
||||
Array cache_files = {
|
||||
name + ".html",
|
||||
name + ".js",
|
||||
name + ".offline.html"
|
||||
};
|
||||
if (p_preset->get("html/export_icon")) {
|
||||
cache_files.push_back(name + ".icon.png");
|
||||
cache_files.push_back(name + ".apple-touch-icon.png");
|
||||
|
|
@ -250,9 +251,10 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
replaces["___GODOT_CACHE___"] = Variant(cache_files).to_json_string();
|
||||
|
||||
// Heavy files that are cached on demand.
|
||||
Array opt_cache_files;
|
||||
opt_cache_files.push_back(name + ".wasm");
|
||||
opt_cache_files.push_back(name + ".pck");
|
||||
Array opt_cache_files = {
|
||||
name + ".wasm",
|
||||
name + ".pck"
|
||||
};
|
||||
if (extensions) {
|
||||
opt_cache_files.push_back(name + ".side.wasm");
|
||||
for (int i = 0; i < p_shared_objects.size(); i++) {
|
||||
|
|
@ -306,19 +308,19 @@ Error EditorExportPlatformWeb::_build_pwa(const Ref<EditorExportPreset> &p_prese
|
|||
|
||||
Array icons_arr;
|
||||
const String icon144_path = p_preset->get("progressive_web_app/icon_144x144");
|
||||
err = _add_manifest_icon(p_path, icon144_path, 144, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon144_path, 144, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
}
|
||||
const String icon180_path = p_preset->get("progressive_web_app/icon_180x180");
|
||||
err = _add_manifest_icon(p_path, icon180_path, 180, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon180_path, 180, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
}
|
||||
const String icon512_path = p_preset->get("progressive_web_app/icon_512x512");
|
||||
err = _add_manifest_icon(p_path, icon512_path, 512, icons_arr);
|
||||
err = _add_manifest_icon(p_preset, p_path, icon512_path, 512, icons_arr);
|
||||
if (err != OK) {
|
||||
// Message is supplied by the subroutine method.
|
||||
return err;
|
||||
|
|
@ -559,7 +561,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
|
|||
html.resize(0);
|
||||
|
||||
// Export splash (why?)
|
||||
Ref<Image> splash = _get_project_splash();
|
||||
Ref<Image> splash = _get_project_splash(p_preset);
|
||||
const String splash_png_path = base_path + ".png";
|
||||
if (splash->save_png(splash_png_path) != OK) {
|
||||
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), splash_png_path));
|
||||
|
|
@ -569,7 +571,7 @@ Error EditorExportPlatformWeb::export_project(const Ref<EditorExportPreset> &p_p
|
|||
// Save a favicon that can be accessed without waiting for the project to finish loading.
|
||||
// This way, the favicon can be displayed immediately when loading the page.
|
||||
if (export_icon) {
|
||||
Ref<Image> favicon = _get_project_icon();
|
||||
Ref<Image> favicon = _get_project_icon(p_preset);
|
||||
const String favicon_png_path = base_path + ".icon.png";
|
||||
if (favicon->save_png(favicon_png_path) != OK) {
|
||||
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), vformat(TTR("Could not write file: \"%s\"."), favicon_png_path));
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef WEB_EXPORT_PLUGIN_H
|
||||
#define WEB_EXPORT_PLUGIN_H
|
||||
#pragma once
|
||||
|
||||
#include "editor_http_server.h"
|
||||
|
||||
|
|
@ -76,11 +75,11 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
return name;
|
||||
}
|
||||
|
||||
Ref<Image> _get_project_icon() const {
|
||||
Ref<Image> _get_project_icon(const Ref<EditorExportPreset> &p_preset) const {
|
||||
Error err = OK;
|
||||
Ref<Image> icon;
|
||||
icon.instantiate();
|
||||
const String icon_path = String(GLOBAL_GET("application/config/icon")).strip_edges();
|
||||
const String icon_path = String(get_project_setting(p_preset, "application/config/icon")).strip_edges();
|
||||
if (!icon_path.is_empty()) {
|
||||
icon = _load_icon_or_splash_image(icon_path, &err);
|
||||
}
|
||||
|
|
@ -90,11 +89,11 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
return icon;
|
||||
}
|
||||
|
||||
Ref<Image> _get_project_splash() const {
|
||||
Ref<Image> _get_project_splash(const Ref<EditorExportPreset> &p_preset) const {
|
||||
Error err = OK;
|
||||
Ref<Image> splash;
|
||||
splash.instantiate();
|
||||
const String splash_path = String(GLOBAL_GET("application/boot_splash/image")).strip_edges();
|
||||
const String splash_path = String(get_project_setting(p_preset, "application/boot_splash/image")).strip_edges();
|
||||
if (!splash_path.is_empty()) {
|
||||
splash = _load_icon_or_splash_image(splash_path, &err);
|
||||
}
|
||||
|
|
@ -107,7 +106,7 @@ class EditorExportPlatformWeb : public EditorExportPlatform {
|
|||
Error _extract_template(const String &p_template, const String &p_dir, const String &p_name, bool pwa);
|
||||
void _replace_strings(const HashMap<String, String> &p_replaces, Vector<uint8_t> &r_template);
|
||||
void _fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug, BitField<EditorExportPlatform::DebugFlags> p_flags, const Vector<SharedObject> p_shared_objects, const Dictionary &p_file_sizes);
|
||||
Error _add_manifest_icon(const String &p_path, const String &p_icon, int p_size, Array &r_arr);
|
||||
Error _add_manifest_icon(const Ref<EditorExportPreset> &p_preset, const String &p_path, const String &p_icon, int p_size, Array &r_arr);
|
||||
Error _build_pwa(const Ref<EditorExportPreset> &p_preset, const String p_path, const Vector<SharedObject> &p_shared_objects);
|
||||
Error _write_or_error(const uint8_t *p_content, int p_len, String p_path);
|
||||
|
||||
|
|
@ -152,5 +151,3 @@ public:
|
|||
EditorExportPlatformWeb();
|
||||
~EditorExportPlatformWeb();
|
||||
};
|
||||
|
||||
#endif // WEB_EXPORT_PLUGIN_H
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#fff" d="M7 5h18v21H7z"/><path fill="#eb6428" d="M3.143 1 5.48 27.504 15.967 31l10.553-3.496L28.857 1zM23.78 9.565H11.473l.275 3.308h11.759l-.911 9.937-6.556 1.808v.02h-.073l-6.61-1.828-.402-5.076h3.195l.234 2.552 3.583.97 3.595-.97.402-4.165H8.788L7.93 6.37h16.145z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32"><path fill="#fff" d="M7 5h18v21H7z"/><path fill="#eb6428" d="M3.143 1 5.48 27.504 15.967 31l10.553-3.496L28.857 1zM23.78 9.565H11.473l.275 3.308h11.759l-.911 9.937-6.556 1.808v.02h-.073l-6.61-1.828-.402-5.076h3.195l.234 2.552 3.583.97 3.595-.97.402-4.165H8.788L7.93 6.37h16.145z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 350 B After Width: | Height: | Size: 351 B |
|
|
@ -1 +1 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m2 1 1.09 12.357 4.9 1.63 4.9-1.63L13.98 1zm9.622 3.994h-5.74l.129 1.541h5.482l-.424 4.634-3.057.843v.01h-.033l-3.082-.853-.187-2.367h1.489l.11 1.19 1.67.452 1.676-.453.187-1.942h-5.21l-.4-4.546h7.527z"/></svg>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" width="16" height="16"><path fill="#e0e0e0" d="m2 1 1.09 12.357 4.9 1.63 4.9-1.63L13.98 1zm9.622 3.994h-5.74l.129 1.541h5.482l-.424 4.634-3.057.843v.01h-.033l-3.082-.853-.187-2.367h1.489l.11 1.19 1.67.452 1.676-.453.187-1.942h-5.21l-.4-4.546h7.527z"/></svg>
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 318 B After Width: | Height: | Size: 319 B |
Loading…
Add table
Add a link
Reference in a new issue