summaryrefslogtreecommitdiff
path: root/platform/javascript/export/export.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /platform/javascript/export/export.cpp
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'platform/javascript/export/export.cpp')
-rw-r--r--platform/javascript/export/export.cpp27
1 files changed, 0 insertions, 27 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index fbc298a399..b5172651d0 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -41,7 +41,6 @@
#define EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG "webassembly_debug.zip"
class EditorHTTPServer : public Reference {
-
private:
Ref<TCP_Server> server;
Ref<StreamPeerTCP> connection;
@@ -165,7 +164,6 @@ public:
return;
while (true) {
-
char *r = (char *)req_buf;
int l = req_pos - 1;
if (l > 3 && r[l] == '\n' && r[l - 1] == '\r' && r[l - 2] == '\n' && r[l - 3] == '\r') {
@@ -191,7 +189,6 @@ public:
};
class EditorExportPlatformJavaScript : public EditorExportPlatform {
-
GDCLASS(EditorExportPlatformJavaScript, EditorExportPlatform);
Ref<ImageTexture> logo;
@@ -231,7 +228,6 @@ public:
virtual Ref<Texture2D> get_run_icon() const;
virtual void get_platform_features(List<String> *r_features) {
-
r_features->push_back("web");
r_features->push_back(get_os_name());
}
@@ -246,7 +242,6 @@ public:
};
void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Ref<EditorExportPreset> &p_preset, const String &p_name, bool p_debug, int p_flags) {
-
String str_template = String::utf8(reinterpret_cast<const char *>(p_html.ptr()), p_html.size());
String str_export;
Vector<String> lines = str_template.split("\n");
@@ -256,7 +251,6 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
flags_json = JSON::print(flags);
for (int i = 0; i < lines.size(); i++) {
-
String current_line = lines[i];
current_line = current_line.replace("$GODOT_BASENAME", p_name);
current_line = current_line.replace("$GODOT_PROJECT_NAME", ProjectSettings::get_singleton()->get_setting("application/config/name"));
@@ -274,7 +268,6 @@ void EditorExportPlatformJavaScript::_fix_html(Vector<uint8_t> &p_html, const Re
}
void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
-
if (p_preset->get("vram_texture_compression/for_desktop")) {
r_features->push_back("s3tc");
}
@@ -291,7 +284,6 @@ void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportP
}
void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_options) {
-
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "vram_texture_compression/for_desktop"), true)); // S3TC
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "vram_texture_compression/for_mobile"), false)); // ETC or ETC2, depending on renderer
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "html/custom_html_shell", PROPERTY_HINT_FILE, "*.html"), ""));
@@ -301,22 +293,18 @@ void EditorExportPlatformJavaScript::get_export_options(List<ExportOption> *r_op
}
String EditorExportPlatformJavaScript::get_name() const {
-
return "HTML5";
}
String EditorExportPlatformJavaScript::get_os_name() const {
-
return "HTML5";
}
Ref<Texture2D> EditorExportPlatformJavaScript::get_logo() const {
-
return logo;
}
bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
-
String err;
bool valid = false;
@@ -358,7 +346,6 @@ bool EditorExportPlatformJavaScript::can_export(const Ref<EditorExportPreset> &p
}
List<String> EditorExportPlatformJavaScript::get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
-
List<String> list;
list.push_back("html");
return list;
@@ -376,7 +363,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
template_path = template_path.strip_edges();
if (template_path == String()) {
-
if (p_debug)
template_path = find_export_template(EXPORT_TEMPLATE_WEBASSEMBLY_DEBUG);
else
@@ -404,7 +390,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
unzFile pkg = unzOpen2(template_path.utf8().get_data(), &io);
if (!pkg) {
-
EditorNode::get_singleton()->show_warning(TTR("Could not open template for export:") + "\n" + template_path);
return ERR_FILE_NOT_FOUND;
}
@@ -434,7 +419,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
//write
if (file == "godot.html") {
-
if (!custom_html.empty()) {
continue;
}
@@ -442,14 +426,11 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
file = p_path.get_file();
} else if (file == "godot.js") {
-
file = p_path.get_file().get_basename() + ".js";
} else if (file == "godot.worker.js") {
-
file = p_path.get_file().get_basename() + ".worker.js";
} else if (file == "godot.wasm") {
-
file = p_path.get_file().get_basename() + ".wasm";
}
@@ -467,7 +448,6 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
unzClose(pkg);
if (!custom_html.empty()) {
-
FileAccess *f = FileAccess::open(custom_html, FileAccess::READ);
if (!f) {
EditorNode::get_singleton()->show_warning(TTR("Could not read custom HTML shell:") + "\n" + custom_html);
@@ -531,11 +511,9 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese
}
bool EditorExportPlatformJavaScript::poll_export() {
-
Ref<EditorExportPreset> preset;
for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
-
Ref<EditorExportPreset> ep = EditorExport::get_singleton()->get_export_preset(i);
if (ep->is_runnable() && ep->get_platform() == this) {
preset = ep;
@@ -561,12 +539,10 @@ Ref<ImageTexture> EditorExportPlatformJavaScript::get_option_icon(int p_index) c
}
int EditorExportPlatformJavaScript::get_options_count() const {
-
return menu_options;
}
Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_option, int p_debug_flags) {
-
if (p_option == 1) {
MutexLock lock(server_lock);
server->stop();
@@ -614,7 +590,6 @@ Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_prese
}
Ref<Texture2D> EditorExportPlatformJavaScript::get_run_icon() const {
-
return run_icon;
}
@@ -630,7 +605,6 @@ void EditorExportPlatformJavaScript::_server_thread_poll(void *data) {
}
EditorExportPlatformJavaScript::EditorExportPlatformJavaScript() {
-
server.instance();
server_quit = false;
server_thread = Thread::create(_server_thread_poll, this);
@@ -660,7 +634,6 @@ EditorExportPlatformJavaScript::~EditorExportPlatformJavaScript() {
}
void register_javascript_exporter() {
-
EDITOR_DEF("export/web/http_host", "localhost");
EDITOR_DEF("export/web/http_port", 8060);
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "export/web/http_port", PROPERTY_HINT_RANGE, "1,65535,1"));