2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2017-09-01 16:07:55 +02:00
|
|
|
/* editor_export.cpp */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 14:16:55 +02:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 02:10:30 +01:00
|
|
|
/*************************************************************************/
|
2017-01-01 22:01:57 +01:00
|
|
|
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
|
2017-04-08 00:11:42 +02:00
|
|
|
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
|
2014-02-10 02:10:30 +01:00
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/*************************************************************************/
|
2017-02-20 03:19:30 +01:00
|
|
|
#include "editor_export.h"
|
2017-04-28 18:29:15 +02:00
|
|
|
|
2017-03-05 14:21:25 +01:00
|
|
|
#include "editor/editor_file_system.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "editor/plugins/script_editor_plugin.h"
|
2017-02-13 02:51:16 +01:00
|
|
|
#include "editor_node.h"
|
|
|
|
#include "editor_settings.h"
|
|
|
|
#include "io/config_file.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "io/resource_loader.h"
|
|
|
|
#include "io/resource_saver.h"
|
2017-02-13 02:51:16 +01:00
|
|
|
#include "io/zip_io.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "os/file_access.h"
|
2017-07-19 22:00:46 +02:00
|
|
|
#include "project_settings.h"
|
2017-03-05 16:44:50 +01:00
|
|
|
#include "script_language.h"
|
|
|
|
#include "version.h"
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-04-28 18:29:15 +02:00
|
|
|
#include "thirdparty/misc/md5.h"
|
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
static int _get_pad(int p_alignment, int p_n) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
int rest = p_n % p_alignment;
|
|
|
|
int pad = 0;
|
|
|
|
if (rest > 0) {
|
|
|
|
pad = p_alignment - rest;
|
|
|
|
};
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
return pad;
|
2017-03-21 03:31:41 +01:00
|
|
|
}
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
#define PCK_PADDING 16
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool EditorExportPreset::_set(const StringName &p_name, const Variant &p_value) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (values.has(p_name)) {
|
|
|
|
values[p_name] = p_value;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
2017-02-13 02:51:16 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
if (values.has(p_name)) {
|
2017-03-05 16:44:50 +01:00
|
|
|
r_ret = values[p_name];
|
2017-02-13 02:51:16 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
2017-03-28 03:21:21 +02:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::_get_property_list(List<PropertyInfo> *p_list) const {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (const List<PropertyInfo>::Element *E = properties.front(); E; E = E->next()) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-28 03:21:21 +02:00
|
|
|
if (platform->get_option_visibility(E->get().name, values)) {
|
|
|
|
p_list->push_back(E->get());
|
|
|
|
}
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
Ref<EditorExportPlatform> EditorExportPreset::get_platform() const {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
return platform;
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
Vector<String> EditorExportPreset::get_files_to_export() const {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
Vector<String> files;
|
2017-03-05 16:44:50 +01:00
|
|
|
for (Set<String>::Element *E = selected_files.front(); E; E = E->next()) {
|
2017-02-20 03:19:30 +01:00
|
|
|
files.push_back(E->get());
|
|
|
|
}
|
|
|
|
return files;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::set_name(const String &p_name) {
|
|
|
|
name = p_name;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPreset::get_name() const {
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPreset::set_runnable(bool p_enable) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
runnable = p_enable;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorExportPreset::is_runnable() const {
|
|
|
|
|
|
|
|
return runnable;
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPreset::set_export_filter(ExportFilter p_filter) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
export_filter = p_filter;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
EditorExportPreset::ExportFilter EditorExportPreset::get_export_filter() const {
|
|
|
|
return export_filter;
|
|
|
|
}
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::set_include_filter(const String &p_include) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
include_filter = p_include;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPreset::get_include_filter() const {
|
|
|
|
|
|
|
|
return include_filter;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::set_exclude_filter(const String &p_exclude) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
exclude_filter = p_exclude;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPreset::get_exclude_filter() const {
|
|
|
|
|
|
|
|
return exclude_filter;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::add_export_file(const String &p_path) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
selected_files.insert(p_path);
|
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::remove_export_file(const String &p_path) {
|
2017-02-20 03:19:30 +01:00
|
|
|
selected_files.erase(p_path);
|
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool EditorExportPreset::has_export_file(const String &p_path) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
return selected_files.has(p_path);
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::add_patch(const String &p_path, int p_at_pos) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_at_pos < 0)
|
2017-02-20 03:19:30 +01:00
|
|
|
patches.push_back(p_path);
|
|
|
|
else
|
2017-03-05 16:44:50 +01:00
|
|
|
patches.insert(p_at_pos, p_path);
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPreset::remove_patch(int p_idx) {
|
|
|
|
patches.remove(p_idx);
|
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPreset::set_patch(int p_index, const String &p_path) {
|
|
|
|
ERR_FAIL_INDEX(p_index, patches.size());
|
|
|
|
patches[p_index] = p_path;
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
String EditorExportPreset::get_patch(int p_index) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ERR_FAIL_INDEX_V(p_index, patches.size(), String());
|
2017-02-20 03:19:30 +01:00
|
|
|
return patches[p_index];
|
|
|
|
}
|
|
|
|
|
|
|
|
Vector<String> EditorExportPreset::get_patches() const {
|
|
|
|
return patches;
|
|
|
|
}
|
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
void EditorExportPreset::set_custom_features(const String &p_custom_features) {
|
|
|
|
|
|
|
|
custom_features = p_custom_features;
|
|
|
|
EditorExport::singleton->save_presets();
|
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPreset::get_custom_features() const {
|
|
|
|
|
|
|
|
return custom_features;
|
|
|
|
}
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExportPreset::EditorExportPreset() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
export_filter = EXPORT_ALL_RESOURCES;
|
|
|
|
runnable = false;
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
///////////////////////////////////
|
|
|
|
|
|
|
|
void EditorExportPlatform::gen_debug_flags(Vector<String> &r_flags, int p_flags) {
|
|
|
|
|
2017-05-09 13:57:07 +02:00
|
|
|
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
|
2017-06-10 16:28:18 +02:00
|
|
|
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)
|
|
|
|
host = "localhost";
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
|
2017-02-13 02:51:16 +01:00
|
|
|
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
|
|
|
|
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-fs");
|
2017-03-05 16:44:50 +01:00
|
|
|
r_flags.push_back(host + ":" + itos(port));
|
|
|
|
if (passwd != "") {
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-fs-password");
|
2017-02-13 02:51:16 +01:00
|
|
|
r_flags.push_back(passwd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-debug");
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-06-10 16:28:18 +02:00
|
|
|
r_flags.push_back(host + ":" + String::num(remote_port));
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
List<String> breakpoints;
|
|
|
|
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
|
|
|
|
|
|
|
|
if (breakpoints.size()) {
|
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--breakpoints");
|
2017-02-13 02:51:16 +01:00
|
|
|
String bpoints;
|
2017-03-05 16:44:50 +01:00
|
|
|
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bpoints += E->get().replace(" ", "%20");
|
2017-02-13 02:51:16 +01:00
|
|
|
if (E->next())
|
2017-03-05 16:44:50 +01:00
|
|
|
bpoints += ",";
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
r_flags.push_back(bpoints);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--debug-collisions");
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--debug-navigation");
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
PackData *pd = (PackData *)p_userdata;
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
SavedData sd;
|
2017-03-05 16:44:50 +01:00
|
|
|
sd.path_utf8 = p_path.utf8();
|
2017-02-21 04:05:15 +01:00
|
|
|
sd.ofs = pd->f->get_pos();
|
|
|
|
sd.size = p_data.size();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
pd->f->store_buffer(p_data.ptr(), p_data.size());
|
|
|
|
int pad = _get_pad(PCK_PADDING, sd.size);
|
|
|
|
for (int i = 0; i < pad; i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
pd->f->store_8(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
MD5_CTX ctx;
|
|
|
|
MD5Init(&ctx);
|
2017-03-05 16:44:50 +01:00
|
|
|
MD5Update(&ctx, (unsigned char *)p_data.ptr(), p_data.size());
|
2017-02-21 04:05:15 +01:00
|
|
|
MD5Final(&ctx);
|
|
|
|
sd.md5.resize(16);
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < 16; i++) {
|
|
|
|
sd.md5[i] = ctx.digest[i];
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pd->file_ofs.push_back(sd);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
pd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
return OK;
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatform::_save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String path = p_path.replace_first("res://", "");
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ZipData *zd = (ZipData *)p_userdata;
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
zipFile zip = (zipFile)zd->zip;
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
zipOpenNewFileInZip(zip,
|
2017-03-05 16:44:50 +01:00
|
|
|
path.utf8().get_data(),
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
Z_DEFLATED,
|
|
|
|
Z_DEFAULT_COMPRESSION);
|
|
|
|
|
|
|
|
zipWriteInFileInZip(zip, p_data.ptr(), p_data.size());
|
2017-02-13 02:51:16 +01:00
|
|
|
zipCloseFileInZip(zip);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
zd->ep->step(TTR("Storing File:") + " " + p_path, 2 + p_file * 100 / p_total, false);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-02-13 02:51:16 +01:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-04-22 01:15:42 +02:00
|
|
|
String EditorExportPlatform::find_export_template(String template_file_name, String *err) const {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-21 23:34:26 +01:00
|
|
|
String base_name = itos(VERSION_MAJOR) + "." + itos(VERSION_MINOR) + "-" + _MKSTR(VERSION_STATUS) + "/" + template_file_name;
|
|
|
|
String user_file = EditorSettings::get_singleton()->get_settings_path() + "/templates/" + base_name;
|
2017-03-05 16:44:50 +01:00
|
|
|
String system_file = OS::get_singleton()->get_installed_templates_path();
|
|
|
|
bool has_system_path = (system_file != "");
|
2017-03-21 23:34:26 +01:00
|
|
|
system_file = system_file.plus_file(base_name);
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-21 23:34:26 +01:00
|
|
|
print_line("test user file: " + user_file);
|
2017-02-13 02:51:16 +01:00
|
|
|
// Prefer user file
|
|
|
|
if (FileAccess::exists(user_file)) {
|
|
|
|
return user_file;
|
|
|
|
}
|
2017-03-21 23:34:26 +01:00
|
|
|
print_line("test system file: " + system_file);
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
// Now check system file
|
|
|
|
if (has_system_path) {
|
|
|
|
if (FileAccess::exists(system_file)) {
|
|
|
|
return system_file;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-22 01:15:42 +02:00
|
|
|
// Not found
|
|
|
|
if (err) {
|
|
|
|
*err += "No export template found at \"" + user_file + "\"";
|
|
|
|
if (has_system_path)
|
|
|
|
*err += "\n or \"" + system_file + "\".";
|
|
|
|
else
|
|
|
|
*err += ".";
|
|
|
|
}
|
|
|
|
return String(); // not found
|
|
|
|
}
|
|
|
|
|
|
|
|
bool EditorExportPlatform::exists_export_template(String template_file_name, String *err) const {
|
|
|
|
return find_export_template(template_file_name, err) != "";
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
Ref<EditorExportPreset> EditorExportPlatform::create_preset() {
|
|
|
|
|
|
|
|
Ref<EditorExportPreset> preset;
|
|
|
|
preset.instance();
|
2017-03-05 16:44:50 +01:00
|
|
|
preset->platform = Ref<EditorExportPlatform>(this);
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
List<ExportOption> options;
|
|
|
|
get_export_options(&options);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (List<ExportOption>::Element *E = options.front(); E; E = E->next()) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
preset->properties.push_back(E->get().option);
|
2017-03-05 16:44:50 +01:00
|
|
|
preset->values[E->get().option.name] = E->get().default_value;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return preset;
|
|
|
|
}
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatform::_export_find_resources(EditorFileSystemDirectory *p_dir, Set<String> &p_paths) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < p_dir->get_subdir_count(); i++) {
|
|
|
|
_export_find_resources(p_dir->get_subdir(i), p_paths);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < p_dir->get_file_count(); i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
p_paths.insert(p_dir->get_file_path(i));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatform::_export_find_dependencies(const String &p_path, Set<String> &p_paths) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
if (p_paths.has(p_path))
|
|
|
|
return;
|
|
|
|
|
|
|
|
p_paths.insert(p_path);
|
|
|
|
|
|
|
|
EditorFileSystemDirectory *dir;
|
|
|
|
int file_idx;
|
2017-03-05 16:44:50 +01:00
|
|
|
dir = EditorFileSystem::get_singleton()->find_file(p_path, &file_idx);
|
2017-02-21 04:05:15 +01:00
|
|
|
if (!dir)
|
|
|
|
return;
|
|
|
|
|
|
|
|
Vector<String> deps = dir->get_file_deps(file_idx);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < deps.size(); i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_export_find_dependencies(deps[i], p_paths);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-14 15:13:09 +02:00
|
|
|
void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vector<String> &p_filters, Set<String> &r_list, bool exclude) {
|
|
|
|
|
|
|
|
da->list_dir_begin();
|
|
|
|
String cur_dir = da->get_current_dir().replace("\\", "/");
|
|
|
|
if (!cur_dir.ends_with("/"))
|
|
|
|
cur_dir += "/";
|
|
|
|
|
|
|
|
Vector<String> dirs;
|
|
|
|
String f;
|
|
|
|
while ((f = da->get_next()) != "") {
|
|
|
|
if (da->current_is_dir())
|
|
|
|
dirs.push_back(f);
|
|
|
|
else {
|
|
|
|
String fullpath = cur_dir + f;
|
|
|
|
for (int i = 0; i < p_filters.size(); ++i) {
|
|
|
|
if (fullpath.matchn(p_filters[i])) {
|
|
|
|
if (!exclude) {
|
|
|
|
r_list.insert(fullpath);
|
|
|
|
} else {
|
|
|
|
r_list.erase(fullpath);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
da->list_dir_end();
|
|
|
|
|
|
|
|
for (int i = 0; i < dirs.size(); ++i) {
|
|
|
|
String dir = dirs[i];
|
|
|
|
if (dir.begins_with("."))
|
|
|
|
continue;
|
|
|
|
da->change_dir(dir);
|
|
|
|
_edit_files_with_filter(da, p_filters, r_list, exclude);
|
|
|
|
da->change_dir("..");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPlatform::_edit_filter_list(Set<String> &r_list, const String &p_filter, bool exclude) {
|
|
|
|
|
|
|
|
if (p_filter == "")
|
|
|
|
return;
|
|
|
|
Vector<String> split = p_filter.split(",");
|
|
|
|
Vector<String> filters;
|
|
|
|
for (int i = 0; i < split.size(); i++) {
|
|
|
|
String f = split[i].strip_edges();
|
|
|
|
if (f.empty())
|
|
|
|
continue;
|
|
|
|
filters.push_back(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
DirAccess *da = DirAccess::open("res://");
|
|
|
|
ERR_FAIL_NULL(da);
|
|
|
|
_edit_files_with_filter(da, filters, r_list, exclude);
|
|
|
|
memdelete(da);
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatform::export_project_files(const Ref<EditorExportPreset> &p_preset, EditorExportSaveFunction p_func, void *p_udata) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
Ref<EditorExportPlatform> platform = p_preset->get_platform();
|
|
|
|
List<String> feature_list;
|
2017-03-05 16:44:50 +01:00
|
|
|
platform->get_preset_features(p_preset, &feature_list);
|
2017-02-21 04:05:15 +01:00
|
|
|
//figure out features
|
|
|
|
Set<String> features;
|
2017-03-05 16:44:50 +01:00
|
|
|
for (List<String>::Element *E = feature_list.front(); E; E = E->next()) {
|
2017-02-21 04:05:15 +01:00
|
|
|
features.insert(E->get());
|
|
|
|
}
|
|
|
|
|
|
|
|
//figure out paths of files that will be exported
|
|
|
|
Set<String> paths;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_preset->get_export_filter() == EditorExportPreset::EXPORT_ALL_RESOURCES) {
|
2017-02-21 04:05:15 +01:00
|
|
|
//find stuff
|
2017-03-05 16:44:50 +01:00
|
|
|
_export_find_resources(EditorFileSystem::get_singleton()->get_filesystem(), paths);
|
2017-02-21 04:05:15 +01:00
|
|
|
} else {
|
2017-03-05 16:44:50 +01:00
|
|
|
bool scenes_only = p_preset->get_export_filter() == EditorExportPreset::EXPORT_SELECTED_SCENES;
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
Vector<String> files = p_preset->get_files_to_export();
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < files.size(); i++) {
|
|
|
|
if (scenes_only && ResourceLoader::get_resource_type(files[i]) != "PackedScene")
|
2017-02-21 04:05:15 +01:00
|
|
|
continue;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
_export_find_dependencies(files[i], paths);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-14 15:13:09 +02:00
|
|
|
_edit_filter_list(paths, p_preset->get_include_filter(), false);
|
|
|
|
_edit_filter_list(paths, p_preset->get_exclude_filter(), true);
|
|
|
|
|
2017-02-21 04:05:15 +01:00
|
|
|
//store everything in the export medium
|
|
|
|
int idx = 0;
|
2017-03-05 16:44:50 +01:00
|
|
|
int total = paths.size();
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (Set<String>::Element *E = paths.front(); E; E = E->next()) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
String path = E->get();
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (FileAccess::exists(path + ".import")) {
|
2017-02-21 04:05:15 +01:00
|
|
|
//file is imported, replace by what it imports
|
|
|
|
Ref<ConfigFile> config;
|
|
|
|
config.instance();
|
2017-03-05 16:44:50 +01:00
|
|
|
Error err = config->load(path + ".import");
|
|
|
|
if (err != OK) {
|
|
|
|
ERR_PRINTS("Could not parse: '" + path + "', not exported.");
|
2017-02-21 04:05:15 +01:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
List<String> remaps;
|
2017-03-05 16:44:50 +01:00
|
|
|
config->get_section_keys("remap", &remaps);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (List<String>::Element *F = remaps.front(); F; F = F->next()) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String remap = F->get();
|
|
|
|
if (remap == "path") {
|
|
|
|
String remapped_path = config->get_value("remap", remap);
|
2017-02-21 04:05:15 +01:00
|
|
|
Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
|
2017-03-05 16:44:50 +01:00
|
|
|
p_func(p_udata, remapped_path, array, idx, total);
|
2017-02-21 04:05:15 +01:00
|
|
|
} else if (remap.begins_with("path.")) {
|
2017-03-05 16:44:50 +01:00
|
|
|
String feature = remap.get_slice(".", 1);
|
2017-02-21 04:05:15 +01:00
|
|
|
if (features.has(feature)) {
|
2017-03-05 16:44:50 +01:00
|
|
|
String remapped_path = config->get_value("remap", remap);
|
2017-02-21 04:05:15 +01:00
|
|
|
Vector<uint8_t> array = FileAccess::get_file_as_array(remapped_path);
|
2017-03-05 16:44:50 +01:00
|
|
|
p_func(p_udata, remapped_path, array, idx, total);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//also save the .import file
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<uint8_t> array = FileAccess::get_file_as_array(path + ".import");
|
|
|
|
p_func(p_udata, path + ".import", array, idx, total);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
} else {
|
|
|
|
//just store it as it comes
|
|
|
|
Vector<uint8_t> array = FileAccess::get_file_as_array(path);
|
2017-03-05 16:44:50 +01:00
|
|
|
p_func(p_udata, path, array, idx, total);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
idx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
//save config!
|
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
Vector<String> custom_list;
|
|
|
|
|
|
|
|
if (p_preset->get_custom_features() != String()) {
|
|
|
|
|
|
|
|
Vector<String> tmp_custom_list = p_preset->get_custom_features().split(",");
|
|
|
|
|
|
|
|
for (int i = 0; i < tmp_custom_list.size(); i++) {
|
|
|
|
String f = tmp_custom_list[i].strip_edges();
|
|
|
|
if (f != String()) {
|
|
|
|
custom_list.push_back(f);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
String config_file = "project.binary";
|
2017-03-05 16:44:50 +01:00
|
|
|
String engine_cfb = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmp" + config_file;
|
2017-07-19 22:00:46 +02:00
|
|
|
ProjectSettings::get_singleton()->save_custom(engine_cfb, ProjectSettings::CustomMap(), custom_list);
|
2017-02-21 04:05:15 +01:00
|
|
|
Vector<uint8_t> data = FileAccess::get_file_as_array(engine_cfb);
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
p_func(p_udata, "res://" + config_file, data, idx, total);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-02-13 02:51:16 +01:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatform::save_pack(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorProgress ep("savepack", TTR("Packing"), 102);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String tmppath = EditorSettings::get_singleton()->get_settings_path() + "/tmp/packtmp";
|
|
|
|
FileAccess *ftmp = FileAccess::open(tmppath, FileAccess::WRITE);
|
|
|
|
ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE)
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
PackData pd;
|
2017-03-05 16:44:50 +01:00
|
|
|
pd.ep = &ep;
|
|
|
|
pd.f = ftmp;
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error err = export_project_files(p_preset, _save_pack_file, &pd);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
memdelete(ftmp); //close tmp file
|
|
|
|
|
|
|
|
if (err)
|
|
|
|
return err;
|
|
|
|
|
|
|
|
pd.file_ofs.sort(); //do sort, so we can do binary search later
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
FileAccess *f = FileAccess::open(p_path, FileAccess::WRITE);
|
|
|
|
ERR_FAIL_COND_V(!f, ERR_CANT_CREATE)
|
2017-02-21 04:05:15 +01:00
|
|
|
f->store_32(0x43504447); //GDPK
|
|
|
|
f->store_32(1); //pack version
|
|
|
|
f->store_32(VERSION_MAJOR);
|
|
|
|
f->store_32(VERSION_MINOR);
|
|
|
|
f->store_32(0); //hmph
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < 16; i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
//reserved
|
|
|
|
f->store_32(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
f->store_32(pd.file_ofs.size()); //amount of files
|
|
|
|
|
|
|
|
size_t header_size = f->get_pos();
|
|
|
|
|
|
|
|
//precalculate header size
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < pd.file_ofs.size(); i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
header_size += 4; // size of path string (32 bits is enough)
|
|
|
|
uint32_t string_len = pd.file_ofs[i].path_utf8.length();
|
2017-03-05 16:44:50 +01:00
|
|
|
header_size += string_len + _get_pad(4, string_len); ///size of path string
|
2017-02-21 04:05:15 +01:00
|
|
|
header_size += 8; // offset to file _with_ header size included
|
|
|
|
header_size += 8; // size of file
|
2017-03-05 16:44:50 +01:00
|
|
|
header_size += 16; // md5
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
size_t header_padding = _get_pad(PCK_PADDING, header_size);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < pd.file_ofs.size(); i++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
uint32_t string_len = pd.file_ofs[i].path_utf8.length();
|
2017-03-05 16:44:50 +01:00
|
|
|
uint32_t pad = _get_pad(4, string_len);
|
|
|
|
;
|
|
|
|
f->store_32(string_len + pad);
|
|
|
|
f->store_buffer((const uint8_t *)pd.file_ofs[i].path_utf8.get_data(), string_len);
|
|
|
|
for (uint32_t j = 0; j < pad; j++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
f->store_8(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
f->store_64(pd.file_ofs[i].ofs + header_padding + header_size);
|
|
|
|
f->store_64(pd.file_ofs[i].size); // pay attention here, this is where file is
|
2017-03-05 16:44:50 +01:00
|
|
|
f->store_buffer(pd.file_ofs[i].md5.ptr(), 16); //also save md5 for file
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (uint32_t j = 0; j < header_padding; j++) {
|
2017-02-21 04:05:15 +01:00
|
|
|
f->store_8(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
//save the rest of the data
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ftmp = FileAccess::open(tmppath, FileAccess::READ);
|
2017-02-21 04:05:15 +01:00
|
|
|
if (!ftmp) {
|
|
|
|
memdelete(f);
|
2017-03-05 16:44:50 +01:00
|
|
|
ERR_FAIL_COND_V(!ftmp, ERR_CANT_CREATE)
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
const int bufsize = 16384;
|
2017-02-21 04:05:15 +01:00
|
|
|
uint8_t buf[bufsize];
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
while (true) {
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int got = ftmp->get_buffer(buf, bufsize);
|
|
|
|
if (got <= 0)
|
2017-02-21 04:05:15 +01:00
|
|
|
break;
|
2017-03-05 16:44:50 +01:00
|
|
|
f->store_buffer(buf, got);
|
2017-02-21 04:05:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
memdelete(ftmp);
|
|
|
|
|
|
|
|
f->store_32(0x43504447); //GDPK
|
|
|
|
memdelete(f);
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatform::save_zip(const Ref<EditorExportPreset> &p_preset, const String &p_path) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorProgress ep("savezip", TTR("Packing"), 102);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
//FileAccess *tmp = FileAccess::open(tmppath,FileAccess::WRITE);
|
|
|
|
|
|
|
|
FileAccess *src_f;
|
|
|
|
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
|
2017-03-05 16:44:50 +01:00
|
|
|
zipFile zip = zipOpen2(p_path.utf8().get_data(), APPEND_STATUS_CREATE, NULL, &io);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
|
|
|
ZipData zd;
|
2017-03-05 16:44:50 +01:00
|
|
|
zd.ep = &ep;
|
|
|
|
zd.zip = zip;
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error err = export_project_files(p_preset, _save_zip_file, &zd);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
zipClose(zip, NULL);
|
2017-02-21 04:05:15 +01:00
|
|
|
|
2017-02-13 02:51:16 +01:00
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
2017-03-24 00:14:12 +01:00
|
|
|
void EditorExportPlatform::gen_export_flags(Vector<String> &r_flags, int p_flags) {
|
|
|
|
|
2017-05-09 13:57:07 +02:00
|
|
|
String host = EditorSettings::get_singleton()->get("network/debug/remote_host");
|
2017-06-10 16:28:18 +02:00
|
|
|
int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
|
2017-03-24 00:14:12 +01:00
|
|
|
|
|
|
|
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)
|
|
|
|
host = "localhost";
|
|
|
|
|
|
|
|
if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
|
|
|
|
int port = EditorSettings::get_singleton()->get("filesystem/file_server/port");
|
|
|
|
String passwd = EditorSettings::get_singleton()->get("filesystem/file_server/password");
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-fs");
|
2017-03-24 00:14:12 +01:00
|
|
|
r_flags.push_back(host + ":" + itos(port));
|
|
|
|
if (passwd != "") {
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-fs-password");
|
2017-03-24 00:14:12 +01:00
|
|
|
r_flags.push_back(passwd);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
|
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--remote-debug");
|
2017-03-24 00:14:12 +01:00
|
|
|
|
2017-06-10 16:28:18 +02:00
|
|
|
r_flags.push_back(host + ":" + String::num(remote_port));
|
2017-03-24 00:14:12 +01:00
|
|
|
|
|
|
|
List<String> breakpoints;
|
|
|
|
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
|
|
|
|
|
|
|
|
if (breakpoints.size()) {
|
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--breakpoints");
|
2017-03-24 00:14:12 +01:00
|
|
|
String bpoints;
|
|
|
|
for (const List<String>::Element *E = breakpoints.front(); E; E = E->next()) {
|
|
|
|
|
|
|
|
bpoints += E->get().replace(" ", "%20");
|
|
|
|
if (E->next())
|
|
|
|
bpoints += ",";
|
|
|
|
}
|
|
|
|
|
|
|
|
r_flags.push_back(bpoints);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_flags & DEBUG_FLAG_VIEW_COLLISONS) {
|
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--debug-collisions");
|
2017-03-24 00:14:12 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
|
|
|
|
|
2017-08-19 16:45:03 +02:00
|
|
|
r_flags.push_back("--debug-navigation");
|
2017-03-24 00:14:12 +01:00
|
|
|
}
|
|
|
|
}
|
2017-02-13 02:51:16 +01:00
|
|
|
EditorExportPlatform::EditorExportPlatform() {
|
|
|
|
}
|
|
|
|
|
|
|
|
////
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
EditorExport *EditorExport::singleton = NULL;
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
void EditorExport::_save() {
|
|
|
|
|
|
|
|
Ref<ConfigFile> config;
|
|
|
|
config.instance();
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < export_presets.size(); i++) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
Ref<EditorExportPreset> preset = export_presets[i];
|
2017-03-05 16:44:50 +01:00
|
|
|
String section = "preset." + itos(i);
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "name", preset->get_name());
|
|
|
|
config->set_value(section, "platform", preset->get_platform()->get_name());
|
|
|
|
config->set_value(section, "runnable", preset->is_runnable());
|
2017-07-20 11:48:00 +02:00
|
|
|
config->set_value(section, "custom_features", preset->get_custom_features());
|
2017-03-05 16:44:50 +01:00
|
|
|
bool save_files = false;
|
|
|
|
switch (preset->get_export_filter()) {
|
2017-02-20 03:19:30 +01:00
|
|
|
case EditorExportPreset::EXPORT_ALL_RESOURCES: {
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "export_filter", "all_resources");
|
2017-02-20 03:19:30 +01:00
|
|
|
} break;
|
|
|
|
case EditorExportPreset::EXPORT_SELECTED_SCENES: {
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "export_filter", "scenes");
|
|
|
|
save_files = true;
|
2017-02-20 03:19:30 +01:00
|
|
|
} break;
|
|
|
|
case EditorExportPreset::EXPORT_SELECTED_RESOURCES: {
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "export_filter", "resources");
|
|
|
|
save_files = true;
|
2017-02-20 03:19:30 +01:00
|
|
|
} break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (save_files) {
|
|
|
|
Vector<String> export_files = preset->get_files_to_export();
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "export_files", export_files);
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
config->set_value(section, "include_filter", preset->get_include_filter());
|
|
|
|
config->set_value(section, "exclude_filter", preset->get_exclude_filter());
|
|
|
|
config->set_value(section, "patch_list", preset->get_patches());
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String option_section = "preset." + itos(i) + ".options";
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (const List<PropertyInfo>::Element *E = preset->get_properties().front(); E; E = E->next()) {
|
|
|
|
config->set_value(option_section, E->get().name, preset->get(E->get().name));
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
config->save("res://export_presets.cfg");
|
|
|
|
|
|
|
|
print_line("saved ok");
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExport::save_presets() {
|
|
|
|
|
|
|
|
print_line("save presets");
|
|
|
|
if (block_save)
|
|
|
|
return;
|
|
|
|
save_timer->start();
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExport::_bind_methods() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ClassDB::bind_method("_save", &EditorExport::_save);
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExport::add_export_platform(const Ref<EditorExportPlatform> &p_platform) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
export_platforms.push_back(p_platform);
|
|
|
|
}
|
|
|
|
|
|
|
|
int EditorExport::get_export_platform_count() {
|
|
|
|
|
|
|
|
return export_platforms.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<EditorExportPlatform> EditorExport::get_export_platform(int p_idx) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ERR_FAIL_INDEX_V(p_idx, export_platforms.size(), Ref<EditorExportPlatform>());
|
2017-02-13 02:51:16 +01:00
|
|
|
|
|
|
|
return export_platforms[p_idx];
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExport::add_export_preset(const Ref<EditorExportPreset> &p_preset, int p_at_pos) {
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_at_pos < 0)
|
2017-02-13 02:51:16 +01:00
|
|
|
export_presets.push_back(p_preset);
|
|
|
|
else
|
2017-03-05 16:44:50 +01:00
|
|
|
export_presets.insert(p_at_pos, p_preset);
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
int EditorExport::get_export_preset_count() const {
|
|
|
|
|
|
|
|
return export_presets.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
Ref<EditorExportPreset> EditorExport::get_export_preset(int p_idx) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
ERR_FAIL_INDEX_V(p_idx, export_presets.size(), Ref<EditorExportPreset>());
|
2017-02-13 02:51:16 +01:00
|
|
|
return export_presets[p_idx];
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExport::remove_export_preset(int p_idx) {
|
|
|
|
|
|
|
|
export_presets.remove(p_idx);
|
|
|
|
}
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
void EditorExport::_notification(int p_what) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (p_what == NOTIFICATION_ENTER_TREE) {
|
2017-02-20 03:19:30 +01:00
|
|
|
load_config();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-13 02:51:16 +01:00
|
|
|
void EditorExport::load_config() {
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
Ref<ConfigFile> config;
|
|
|
|
config.instance();
|
|
|
|
Error err = config->load("res://export_presets.cfg");
|
2017-03-05 16:44:50 +01:00
|
|
|
if (err != OK)
|
2017-02-20 03:19:30 +01:00
|
|
|
return;
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
block_save = true;
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
int index = 0;
|
|
|
|
while (true) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String section = "preset." + itos(index);
|
2017-02-20 03:19:30 +01:00
|
|
|
if (!config->has_section(section))
|
|
|
|
break;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String platform = config->get_value(section, "platform");
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
Ref<EditorExportPreset> preset;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < export_platforms.size(); i++) {
|
|
|
|
if (export_platforms[i]->get_name() == platform) {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset = export_platforms[i]->create_preset();
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!preset.is_valid()) {
|
|
|
|
index++;
|
|
|
|
ERR_CONTINUE(!preset.is_valid());
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
preset->set_name(config->get_value(section, "name"));
|
|
|
|
preset->set_runnable(config->get_value(section, "runnable"));
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
if (config->has_section_key(section, "custom_features")) {
|
|
|
|
preset->set_custom_features(config->get_value(section, "custom_features"));
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String export_filter = config->get_value(section, "export_filter");
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool get_files = false;
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
if (export_filter == "all_resources") {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset->set_export_filter(EditorExportPreset::EXPORT_ALL_RESOURCES);
|
2017-03-05 16:44:50 +01:00
|
|
|
} else if (export_filter == "scenes") {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset->set_export_filter(EditorExportPreset::EXPORT_SELECTED_SCENES);
|
2017-03-05 16:44:50 +01:00
|
|
|
get_files = true;
|
|
|
|
} else if (export_filter == "resources") {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset->set_export_filter(EditorExportPreset::EXPORT_SELECTED_RESOURCES);
|
2017-03-05 16:44:50 +01:00
|
|
|
get_files = true;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
if (get_files) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<String> files = config->get_value(section, "export_files");
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < files.size(); i++) {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset->add_export_file(files[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
preset->set_include_filter(config->get_value(section, "include_filter"));
|
|
|
|
preset->set_exclude_filter(config->get_value(section, "exclude_filter"));
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Vector<String> patch_list = config->get_value(section, "patch_list");
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (int i = 0; i < patch_list.size(); i++) {
|
2017-02-20 03:19:30 +01:00
|
|
|
preset->add_patch(patch_list[i]);
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
String option_section = "preset." + itos(index) + ".options";
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
List<String> options;
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
config->get_section_keys(option_section, &options);
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
for (List<String>::Element *E = options.front(); E; E = E->next()) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Variant value = config->get_value(option_section, E->get());
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
preset->set(E->get(), value);
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
add_export_preset(preset);
|
|
|
|
index++;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
block_save = false;
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
2017-03-24 00:14:12 +01:00
|
|
|
bool EditorExport::poll_export_platforms() {
|
|
|
|
|
|
|
|
bool changed = false;
|
|
|
|
for (int i = 0; i < export_platforms.size(); i++) {
|
|
|
|
if (export_platforms[i]->poll_devices()) {
|
|
|
|
changed = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return changed;
|
|
|
|
}
|
|
|
|
|
2017-02-13 02:51:16 +01:00
|
|
|
EditorExport::EditorExport() {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
save_timer = memnew(Timer);
|
2017-02-20 03:19:30 +01:00
|
|
|
add_child(save_timer);
|
|
|
|
save_timer->set_wait_time(0.8);
|
|
|
|
save_timer->set_one_shot(true);
|
2017-03-05 16:44:50 +01:00
|
|
|
save_timer->connect("timeout", this, "_save");
|
|
|
|
block_save = false;
|
2017-02-13 02:51:16 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
singleton = this;
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
EditorExport::~EditorExport() {
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
//////////
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
if (p_preset->get("texture_format/s3tc")) {
|
|
|
|
r_features->push_back("s3tc");
|
|
|
|
}
|
|
|
|
if (p_preset->get("texture_format/etc")) {
|
|
|
|
r_features->push_back("etc");
|
|
|
|
}
|
|
|
|
if (p_preset->get("texture_format/etc2")) {
|
|
|
|
r_features->push_back("etc2");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPlatformPC::get_export_options(List<ExportOption> *r_options) {
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/s3tc"), true));
|
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc"), false));
|
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "texture_format/etc2"), false));
|
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "binary_format/64_bits"), true));
|
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE), ""));
|
|
|
|
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE), ""));
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPlatformPC::get_name() const {
|
|
|
|
|
|
|
|
return name;
|
|
|
|
}
|
2017-07-19 22:00:46 +02:00
|
|
|
|
|
|
|
String EditorExportPlatformPC::get_os_name() const {
|
|
|
|
|
|
|
|
return os_name;
|
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
Ref<Texture> EditorExportPlatformPC::get_logo() const {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
|
|
|
return logo;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-04-22 01:15:42 +02:00
|
|
|
String err;
|
|
|
|
bool valid = true;
|
|
|
|
|
|
|
|
if (use64 && (!exists_export_template(debug_file_64, &err) || !exists_export_template(release_file_64, &err))) {
|
|
|
|
valid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!use64 && (!exists_export_template(debug_file_32, &err) || !exists_export_template(release_file_32, &err))) {
|
|
|
|
valid = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
String custom_debug_binary = p_preset->get("custom_template/debug");
|
|
|
|
String custom_release_binary = p_preset->get("custom_template/release");
|
|
|
|
|
|
|
|
if (custom_debug_binary == "" && custom_release_binary == "") {
|
|
|
|
if (!err.empty())
|
|
|
|
r_error = err;
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool dvalid = true;
|
|
|
|
bool rvalid = true;
|
|
|
|
|
|
|
|
if (!FileAccess::exists(custom_debug_binary)) {
|
|
|
|
dvalid = false;
|
|
|
|
err = "Custom debug binary not found.\n";
|
|
|
|
}
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-04-22 01:15:42 +02:00
|
|
|
if (!FileAccess::exists(custom_release_binary)) {
|
|
|
|
rvalid = false;
|
|
|
|
err += "Custom release binary not found.\n";
|
2017-02-22 01:30:20 +01:00
|
|
|
}
|
2017-03-21 03:31:41 +01:00
|
|
|
|
2017-04-22 01:15:42 +02:00
|
|
|
if (dvalid || rvalid)
|
|
|
|
valid = true;
|
|
|
|
else
|
|
|
|
valid = false;
|
|
|
|
|
|
|
|
if (!err.empty())
|
|
|
|
r_error = err;
|
|
|
|
return valid;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
String EditorExportPlatformPC::get_binary_extension() const {
|
|
|
|
return extension;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) {
|
2017-02-20 03:19:30 +01:00
|
|
|
|
2017-03-21 23:34:26 +01:00
|
|
|
String custom_debug = p_preset->get("custom_template/debug");
|
|
|
|
String custom_release = p_preset->get("custom_template/release");
|
|
|
|
|
|
|
|
String template_path = p_debug ? custom_debug : custom_release;
|
|
|
|
|
|
|
|
template_path = template_path.strip_edges();
|
|
|
|
|
|
|
|
if (template_path == String()) {
|
|
|
|
|
|
|
|
if (p_preset->get("binary_format/64_bits")) {
|
|
|
|
if (p_debug) {
|
|
|
|
template_path = find_export_template(debug_file_64);
|
|
|
|
} else {
|
|
|
|
template_path = find_export_template(release_file_64);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (p_debug) {
|
|
|
|
template_path = find_export_template(debug_file_32);
|
|
|
|
} else {
|
|
|
|
template_path = find_export_template(release_file_32);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (template_path != String() && !FileAccess::exists(template_path)) {
|
|
|
|
EditorNode::get_singleton()->show_warning(TTR("Template file not found:\n") + template_path);
|
|
|
|
return ERR_FILE_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
|
|
|
|
da->copy(template_path, p_path);
|
|
|
|
memdelete(da);
|
|
|
|
|
|
|
|
String pck_path = p_path.get_basename() + ".pck";
|
|
|
|
|
|
|
|
return save_pack(p_preset, pck_path);
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_extension(const String &p_extension) {
|
|
|
|
extension = p_extension;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_name(const String &p_name) {
|
|
|
|
name = p_name;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
void EditorExportPlatformPC::set_os_name(const String &p_name) {
|
|
|
|
os_name = p_name;
|
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_logo(const Ref<Texture> &p_logo) {
|
|
|
|
logo = p_logo;
|
2017-02-20 03:19:30 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_release_64(const String &p_file) {
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
release_file_64 = p_file;
|
2017-02-22 01:30:20 +01:00
|
|
|
}
|
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_release_32(const String &p_file) {
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
release_file_32 = p_file;
|
2017-02-22 01:30:20 +01:00
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_debug_64(const String &p_file) {
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
debug_file_64 = p_file;
|
2017-02-22 01:30:20 +01:00
|
|
|
}
|
2017-03-05 16:44:50 +01:00
|
|
|
void EditorExportPlatformPC::set_debug_32(const String &p_file) {
|
2017-02-22 01:30:20 +01:00
|
|
|
|
2017-03-05 16:44:50 +01:00
|
|
|
debug_file_32 = p_file;
|
2017-02-22 01:30:20 +01:00
|
|
|
}
|
|
|
|
|
2017-07-19 22:00:46 +02:00
|
|
|
void EditorExportPlatformPC::add_platform_feature(const String &p_feature) {
|
|
|
|
|
|
|
|
extra_features.insert(p_feature);
|
|
|
|
}
|
|
|
|
|
|
|
|
void EditorExportPlatformPC::get_platform_features(List<String> *r_features) {
|
|
|
|
r_features->push_back("pc"); //all pcs support "pc"
|
|
|
|
r_features->push_back("s3tc"); //all pcs support "s3tc" compression
|
|
|
|
r_features->push_back(get_os_name()); //OS name is a feature
|
|
|
|
for (Set<String>::Element *E = extra_features.front(); E; E = E->next()) {
|
|
|
|
r_features->push_back(E->get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-02-20 03:19:30 +01:00
|
|
|
EditorExportPlatformPC::EditorExportPlatformPC() {
|
2017-02-13 02:51:16 +01:00
|
|
|
}
|