2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2017-09-01 14:07:55 +00:00
|
|
|
/* editor_export.h */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
2017-08-27 12:16:55 +00:00
|
|
|
/* https://godotengine.org */
|
2014-02-10 01:10:30 +00:00
|
|
|
/*************************************************************************/
|
2022-01-03 20:27:34 +00:00
|
|
|
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
|
2014-02-10 01:10:30 +00: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. */
|
|
|
|
/*************************************************************************/
|
2018-01-04 23:50:27 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
#ifndef EDITOR_EXPORT_H
|
|
|
|
#define EDITOR_EXPORT_H
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-06-11 12:51:48 +00:00
|
|
|
#include "core/io/dir_access.h"
|
2020-11-07 22:33:38 +00:00
|
|
|
#include "core/io/resource.h"
|
2022-06-03 15:34:24 +00:00
|
|
|
#include "scene/gui/rich_text_label.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
#include "scene/main/node.h"
|
2017-02-20 02:19:30 +00:00
|
|
|
#include "scene/main/timer.h"
|
2017-03-05 15:44:50 +00:00
|
|
|
#include "scene/resources/texture.h"
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
class FileAccess;
|
2017-02-20 02:19:30 +00:00
|
|
|
class EditorExportPlatform;
|
2017-02-21 03:05:15 +00:00
|
|
|
class EditorFileSystemDirectory;
|
2018-10-01 14:46:50 +00:00
|
|
|
struct EditorProgress;
|
2016-02-28 02:10:44 +00:00
|
|
|
|
2021-06-04 16:03:15 +00:00
|
|
|
class EditorExportPreset : public RefCounted {
|
|
|
|
GDCLASS(EditorExportPreset, RefCounted);
|
2019-03-19 18:35:57 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
public:
|
2017-02-13 01:51:16 +00:00
|
|
|
enum ExportFilter {
|
2017-02-20 02:19:30 +00:00
|
|
|
EXPORT_ALL_RESOURCES,
|
|
|
|
EXPORT_SELECTED_SCENES,
|
|
|
|
EXPORT_SELECTED_RESOURCES,
|
2020-11-15 00:54:24 +00:00
|
|
|
EXCLUDE_SELECTED_RESOURCES,
|
2017-02-13 01:51:16 +00:00
|
|
|
};
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-23 18:28:29 +00:00
|
|
|
enum ScriptExportMode {
|
|
|
|
MODE_SCRIPT_TEXT,
|
|
|
|
MODE_SCRIPT_COMPILED,
|
|
|
|
};
|
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
private:
|
2017-02-20 02:19:30 +00:00
|
|
|
Ref<EditorExportPlatform> platform;
|
2020-05-12 15:01:17 +00:00
|
|
|
ExportFilter export_filter = EXPORT_ALL_RESOURCES;
|
2017-02-20 02:19:30 +00:00
|
|
|
String include_filter;
|
|
|
|
String exclude_filter;
|
2018-10-27 13:53:05 +00:00
|
|
|
String export_path;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
String exporter;
|
2022-05-19 15:00:06 +00:00
|
|
|
HashSet<String> selected_files;
|
2020-05-12 15:01:17 +00:00
|
|
|
bool runnable = false;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
friend class EditorExport;
|
|
|
|
friend class EditorExportPlatform;
|
2014-02-24 12:53:33 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
List<PropertyInfo> properties;
|
2022-05-13 13:04:37 +00:00
|
|
|
HashMap<StringName, Variant> values;
|
2014-02-24 12:53:33 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
String name;
|
2017-03-05 15:44:50 +00:00
|
|
|
|
2017-07-19 20:00:46 +00:00
|
|
|
String custom_features;
|
|
|
|
|
2020-04-28 17:51:29 +00:00
|
|
|
String enc_in_filters;
|
|
|
|
String enc_ex_filters;
|
|
|
|
bool enc_pck = false;
|
|
|
|
bool enc_directory = false;
|
|
|
|
|
2020-05-12 15:01:17 +00:00
|
|
|
int script_mode = MODE_SCRIPT_COMPILED;
|
2018-12-23 18:28:29 +00:00
|
|
|
String script_key;
|
|
|
|
|
2014-02-24 12:53:33 +00:00
|
|
|
protected:
|
2017-03-05 15:44:50 +00:00
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
2014-02-24 12:53:33 +00:00
|
|
|
|
|
|
|
public:
|
2017-02-21 03:05:15 +00:00
|
|
|
Ref<EditorExportPlatform> get_platform() const;
|
2017-03-28 01:21:21 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool has(const StringName &p_property) const { return values.has(p_property); }
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2020-06-10 09:41:42 +00:00
|
|
|
void update_files_to_export();
|
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
Vector<String> get_files_to_export() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_export_file(const String &p_path);
|
|
|
|
void remove_export_file(const String &p_path);
|
|
|
|
bool has_export_file(const String &p_path);
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_name(const String &p_name);
|
2017-02-20 02:19:30 +00:00
|
|
|
String get_name() const;
|
|
|
|
|
|
|
|
void set_runnable(bool p_enable);
|
|
|
|
bool is_runnable() const;
|
|
|
|
|
|
|
|
void set_export_filter(ExportFilter p_filter);
|
|
|
|
ExportFilter get_export_filter() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_include_filter(const String &p_include);
|
2017-02-20 02:19:30 +00:00
|
|
|
String get_include_filter() const;
|
2017-02-13 01:51:16 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_exclude_filter(const String &p_exclude);
|
2017-02-20 02:19:30 +00:00
|
|
|
String get_exclude_filter() const;
|
|
|
|
|
2017-07-19 20:00:46 +00:00
|
|
|
void set_custom_features(const String &p_custom_features);
|
|
|
|
String get_custom_features() const;
|
|
|
|
|
2018-10-27 13:53:05 +00:00
|
|
|
void set_export_path(const String &p_path);
|
|
|
|
String get_export_path() const;
|
|
|
|
|
2020-04-28 17:51:29 +00:00
|
|
|
void set_enc_in_filter(const String &p_filter);
|
|
|
|
String get_enc_in_filter() const;
|
|
|
|
|
|
|
|
void set_enc_ex_filter(const String &p_filter);
|
|
|
|
String get_enc_ex_filter() const;
|
|
|
|
|
|
|
|
void set_enc_pck(bool p_enabled);
|
|
|
|
bool get_enc_pck() const;
|
|
|
|
|
|
|
|
void set_enc_directory(bool p_enabled);
|
|
|
|
bool get_enc_directory() const;
|
|
|
|
|
2018-12-23 18:28:29 +00:00
|
|
|
void set_script_export_mode(int p_mode);
|
|
|
|
int get_script_export_mode() const;
|
|
|
|
|
|
|
|
void set_script_encryption_key(const String &p_key);
|
|
|
|
String get_script_encryption_key() const;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
const List<PropertyInfo> &get_properties() const { return properties; }
|
2014-02-24 12:53:33 +00:00
|
|
|
|
2020-05-12 15:01:17 +00:00
|
|
|
EditorExportPreset() {}
|
2014-02-24 12:53:33 +00:00
|
|
|
};
|
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
struct SharedObject {
|
|
|
|
String path;
|
|
|
|
Vector<String> tags;
|
2022-03-10 07:48:25 +00:00
|
|
|
String target;
|
2017-10-02 15:01:43 +00:00
|
|
|
|
2022-03-10 07:48:25 +00:00
|
|
|
SharedObject(const String &p_path, const Vector<String> &p_tags, const String &p_target) :
|
2017-12-06 20:36:34 +00:00
|
|
|
path(p_path),
|
2022-03-10 07:48:25 +00:00
|
|
|
tags(p_tags),
|
|
|
|
target(p_target) {
|
2017-10-02 15:01:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SharedObject() {}
|
|
|
|
};
|
|
|
|
|
2021-06-04 16:03:15 +00:00
|
|
|
class EditorExportPlatform : public RefCounted {
|
|
|
|
GDCLASS(EditorExportPlatform, RefCounted);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
|
|
|
public:
|
2020-04-28 17:51:29 +00:00
|
|
|
typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
|
2017-10-02 15:01:43 +00:00
|
|
|
typedef Error (*EditorExportSaveSharedObject)(void *p_userdata, const SharedObject &p_so);
|
2016-04-28 00:39:52 +00:00
|
|
|
|
2022-06-03 15:34:24 +00:00
|
|
|
enum ExportMessageType {
|
|
|
|
EXPORT_MESSAGE_NONE,
|
|
|
|
EXPORT_MESSAGE_INFO,
|
|
|
|
EXPORT_MESSAGE_WARNING,
|
|
|
|
EXPORT_MESSAGE_ERROR,
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ExportMessage {
|
|
|
|
ExportMessageType msg_type;
|
|
|
|
String category;
|
|
|
|
String text;
|
|
|
|
};
|
|
|
|
|
2016-04-28 00:39:52 +00:00
|
|
|
private:
|
2017-02-13 01:51:16 +00:00
|
|
|
struct SavedData {
|
2020-11-24 09:12:55 +00:00
|
|
|
uint64_t ofs = 0;
|
|
|
|
uint64_t size = 0;
|
|
|
|
bool encrypted = false;
|
2017-02-21 03:05:15 +00:00
|
|
|
Vector<uint8_t> md5;
|
|
|
|
CharString path_utf8;
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
bool operator<(const SavedData &p_data) const {
|
2017-02-21 03:05:15 +00:00
|
|
|
return path_utf8 < p_data.path_utf8;
|
|
|
|
}
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PackData {
|
2022-03-23 09:08:58 +00:00
|
|
|
Ref<FileAccess> f;
|
2017-02-13 01:51:16 +00:00
|
|
|
Vector<SavedData> file_ofs;
|
2020-11-24 09:12:55 +00:00
|
|
|
EditorProgress *ep = nullptr;
|
|
|
|
Vector<SharedObject> *so_files = nullptr;
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2015-12-13 04:08:36 +00:00
|
|
|
struct ZipData {
|
2020-11-24 09:12:55 +00:00
|
|
|
void *zip = nullptr;
|
|
|
|
EditorProgress *ep = nullptr;
|
2015-12-13 04:08:36 +00:00
|
|
|
};
|
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
struct FeatureContainers {
|
2022-05-19 15:00:06 +00:00
|
|
|
HashSet<String> features;
|
2020-02-17 21:06:54 +00:00
|
|
|
Vector<String> features_pv;
|
2017-10-02 15:01:43 +00:00
|
|
|
};
|
|
|
|
|
2022-06-03 15:34:24 +00:00
|
|
|
Vector<ExportMessage> messages;
|
|
|
|
|
2022-05-19 15:00:06 +00:00
|
|
|
void _export_find_resources(EditorFileSystemDirectory *p_dir, HashSet<String> &p_paths);
|
|
|
|
void _export_find_dependencies(const String &p_path, HashSet<String> &p_paths);
|
2017-02-21 03:05:15 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
void gen_debug_flags(Vector<String> &r_flags, int p_flags);
|
2020-04-28 17:51:29 +00:00
|
|
|
static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
|
|
|
|
static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2022-05-19 15:00:06 +00:00
|
|
|
void _edit_files_with_filter(Ref<DirAccess> &da, const Vector<String> &p_filters, HashSet<String> &r_list, bool exclude);
|
|
|
|
void _edit_filter_list(HashSet<String> &r_list, const String &p_filter, bool exclude);
|
2017-08-14 13:13:09 +00:00
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
static Error _add_shared_object(void *p_userdata, const SharedObject &p_so);
|
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
protected:
|
2017-10-02 15:01:43 +00:00
|
|
|
struct ExportNotifier {
|
|
|
|
ExportNotifier(EditorExportPlatform &p_platform, const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
|
|
|
|
~ExportNotifier();
|
|
|
|
};
|
|
|
|
|
2022-03-10 07:48:25 +00:00
|
|
|
FeatureContainers get_feature_containers(const Ref<EditorExportPreset> &p_preset, bool p_debug);
|
2017-10-02 15:01:43 +00:00
|
|
|
|
2017-04-21 23:15:42 +00:00
|
|
|
bool exists_export_template(String template_file_name, String *err) const;
|
2020-04-01 23:20:12 +00:00
|
|
|
String find_export_template(String template_file_name, String *err = nullptr) const;
|
2017-03-23 23:14:12 +00:00
|
|
|
void gen_export_flags(Vector<String> &r_flags, int p_flags);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
public:
|
2017-07-19 20:00:46 +00:00
|
|
|
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0;
|
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
struct ExportOption {
|
|
|
|
PropertyInfo option;
|
|
|
|
Variant default_value;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-12-08 20:07:33 +00:00
|
|
|
ExportOption(const PropertyInfo &p_info, const Variant &p_default) :
|
|
|
|
option(p_info),
|
|
|
|
default_value(p_default) {
|
2017-03-05 15:44:50 +00:00
|
|
|
}
|
2017-02-13 01:51:16 +00:00
|
|
|
ExportOption() {}
|
|
|
|
};
|
2015-12-13 04:08:36 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
virtual Ref<EditorExportPreset> create_preset();
|
|
|
|
|
2022-06-03 15:34:24 +00:00
|
|
|
virtual void clear_messages() { messages.clear(); }
|
|
|
|
virtual void add_message(ExportMessageType p_type, const String &p_category, const String &p_message) {
|
|
|
|
ExportMessage msg;
|
|
|
|
msg.category = p_category;
|
|
|
|
msg.text = p_message;
|
|
|
|
msg.msg_type = p_type;
|
|
|
|
messages.push_back(msg);
|
|
|
|
switch (p_type) {
|
|
|
|
case EXPORT_MESSAGE_INFO: {
|
|
|
|
print_line(vformat("%s: %s\n", msg.category, msg.text));
|
|
|
|
} break;
|
|
|
|
case EXPORT_MESSAGE_WARNING: {
|
|
|
|
WARN_PRINT(vformat("%s: %s\n", msg.category, msg.text));
|
|
|
|
} break;
|
|
|
|
case EXPORT_MESSAGE_ERROR: {
|
|
|
|
ERR_PRINT(vformat("%s: %s\n", msg.category, msg.text));
|
|
|
|
} break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual int get_message_count() const {
|
|
|
|
return messages.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ExportMessage get_message(int p_index) const {
|
|
|
|
ERR_FAIL_INDEX_V(p_index, messages.size(), ExportMessage());
|
|
|
|
return messages[p_index];
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ExportMessageType get_worst_message_type() const {
|
|
|
|
ExportMessageType worst_type = EXPORT_MESSAGE_NONE;
|
|
|
|
for (int i = 0; i < messages.size(); i++) {
|
|
|
|
worst_type = MAX(worst_type, messages[i].msg_type);
|
|
|
|
}
|
|
|
|
return worst_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool fill_log_messages(RichTextLabel *p_log, Error p_err);
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual void get_export_options(List<ExportOption> *r_options) = 0;
|
2020-04-24 07:45:14 +00:00
|
|
|
virtual bool should_update_export_options() { return false; }
|
2022-05-13 13:04:37 +00:00
|
|
|
virtual bool get_export_option_visibility(const String &p_option, const HashMap<StringName, Variant> &p_options) const { return true; }
|
2017-03-28 01:21:21 +00:00
|
|
|
|
2017-07-19 20:00:46 +00:00
|
|
|
virtual String get_os_name() const = 0;
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual String get_name() const = 0;
|
2019-06-11 18:43:37 +00:00
|
|
|
virtual Ref<Texture2D> get_logo() const = 0;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2022-03-10 07:48:25 +00:00
|
|
|
Error export_project_files(const Ref<EditorExportPreset> &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2022-03-10 07:48:25 +00:00
|
|
|
Error save_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, Vector<SharedObject> *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr);
|
|
|
|
Error save_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2019-10-11 11:47:28 +00:00
|
|
|
virtual bool poll_export() { return false; }
|
|
|
|
virtual int get_options_count() const { return 0; }
|
|
|
|
virtual String get_options_tooltip() const { return ""; }
|
|
|
|
virtual Ref<ImageTexture> get_option_icon(int p_index) const;
|
|
|
|
virtual String get_option_label(int p_device) const { return ""; }
|
|
|
|
virtual String get_option_tooltip(int p_device) const { return ""; }
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
enum DebugFlags {
|
2017-03-05 15:44:50 +00:00
|
|
|
DEBUG_FLAG_DUMB_CLIENT = 1,
|
|
|
|
DEBUG_FLAG_REMOTE_DEBUG = 2,
|
|
|
|
DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST = 4,
|
|
|
|
DEBUG_FLAG_VIEW_COLLISONS = 8,
|
|
|
|
DEBUG_FLAG_VIEW_NAVIGATION = 16,
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2017-03-23 23:14:12 +00:00
|
|
|
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { return OK; }
|
2019-06-11 18:43:37 +00:00
|
|
|
virtual Ref<Texture2D> get_run_icon() const { return get_logo(); }
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2021-12-29 01:06:12 +00:00
|
|
|
String test_etc2() const;
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2018-10-29 21:18:49 +00:00
|
|
|
virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const = 0;
|
2017-03-05 15:44:50 +00:00
|
|
|
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0;
|
2018-04-26 21:08:19 +00:00
|
|
|
virtual Error export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
|
|
|
|
virtual Error export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
|
2017-07-19 20:00:46 +00:00
|
|
|
virtual void get_platform_features(List<String> *r_features) = 0;
|
2022-05-19 15:00:06 +00:00
|
|
|
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) = 0;
|
2020-03-16 08:37:43 +00:00
|
|
|
virtual String get_debug_protocol() const { return "tcp://"; }
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
EditorExportPlatform();
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2021-06-04 16:03:15 +00:00
|
|
|
class EditorExportPlugin : public RefCounted {
|
|
|
|
GDCLASS(EditorExportPlugin, RefCounted);
|
2017-09-14 22:38:38 +00:00
|
|
|
|
|
|
|
friend class EditorExportPlatform;
|
|
|
|
|
2018-12-23 18:28:29 +00:00
|
|
|
Ref<EditorExportPreset> export_preset;
|
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
Vector<SharedObject> shared_objects;
|
2017-09-14 22:38:38 +00:00
|
|
|
struct ExtraFile {
|
|
|
|
String path;
|
|
|
|
Vector<uint8_t> data;
|
2020-11-24 09:12:55 +00:00
|
|
|
bool remap = false;
|
2017-09-14 22:38:38 +00:00
|
|
|
};
|
|
|
|
Vector<ExtraFile> extra_files;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool skipped = false;
|
2017-09-14 22:38:38 +00:00
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
Vector<String> ios_frameworks;
|
2020-08-05 17:55:29 +00:00
|
|
|
Vector<String> ios_embedded_frameworks;
|
2020-03-18 16:40:04 +00:00
|
|
|
Vector<String> ios_project_static_libs;
|
2017-10-02 15:01:43 +00:00
|
|
|
String ios_plist_content;
|
|
|
|
String ios_linker_flags;
|
|
|
|
Vector<String> ios_bundle_files;
|
|
|
|
String ios_cpp_code;
|
|
|
|
|
2021-12-18 09:21:08 +00:00
|
|
|
Vector<String> osx_plugin_files;
|
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
_FORCE_INLINE_ void _clear() {
|
|
|
|
shared_objects.clear();
|
|
|
|
extra_files.clear();
|
|
|
|
skipped = false;
|
|
|
|
}
|
|
|
|
|
2017-10-02 15:01:43 +00:00
|
|
|
_FORCE_INLINE_ void _export_end() {
|
|
|
|
ios_frameworks.clear();
|
2020-08-05 17:55:29 +00:00
|
|
|
ios_embedded_frameworks.clear();
|
2017-10-02 15:01:43 +00:00
|
|
|
ios_bundle_files.clear();
|
|
|
|
ios_plist_content = "";
|
|
|
|
ios_linker_flags = "";
|
|
|
|
ios_cpp_code = "";
|
2021-12-18 09:21:08 +00:00
|
|
|
osx_plugin_files.clear();
|
2017-10-02 15:01:43 +00:00
|
|
|
}
|
|
|
|
|
2020-02-17 21:06:54 +00:00
|
|
|
void _export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features);
|
|
|
|
void _export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags);
|
2018-12-07 18:05:10 +00:00
|
|
|
void _export_end_script();
|
2017-09-14 22:38:38 +00:00
|
|
|
|
|
|
|
protected:
|
2018-12-23 18:28:29 +00:00
|
|
|
void set_export_preset(const Ref<EditorExportPreset> &p_preset);
|
|
|
|
Ref<EditorExportPreset> get_export_preset() const;
|
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
void add_file(const String &p_path, const Vector<uint8_t> &p_file, bool p_remap);
|
2022-03-10 07:48:25 +00:00
|
|
|
void add_shared_object(const String &p_path, const Vector<String> &tags, const String &p_target = String());
|
2017-10-02 15:01:43 +00:00
|
|
|
|
|
|
|
void add_ios_framework(const String &p_path);
|
2020-08-05 17:55:29 +00:00
|
|
|
void add_ios_embedded_framework(const String &p_path);
|
2020-03-18 16:40:04 +00:00
|
|
|
void add_ios_project_static_lib(const String &p_path);
|
2017-10-02 15:01:43 +00:00
|
|
|
void add_ios_plist_content(const String &p_plist_content);
|
|
|
|
void add_ios_linker_flags(const String &p_flags);
|
|
|
|
void add_ios_bundle_file(const String &p_path);
|
|
|
|
void add_ios_cpp_code(const String &p_code);
|
2021-12-18 09:21:08 +00:00
|
|
|
void add_osx_plugin_file(const String &p_path);
|
2017-10-02 15:01:43 +00:00
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
void skip();
|
|
|
|
|
2022-05-19 15:00:06 +00:00
|
|
|
virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features);
|
|
|
|
virtual void _export_begin(const HashSet<String> &p_features, bool p_debug, const String &p_path, int p_flags);
|
2017-09-14 22:38:38 +00:00
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2021-08-22 01:52:44 +00:00
|
|
|
GDVIRTUAL3(_export_file, String, String, Vector<String>)
|
|
|
|
GDVIRTUAL4(_export_begin, Vector<String>, bool, String, uint32_t)
|
|
|
|
GDVIRTUAL0(_export_end)
|
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
public:
|
2017-10-02 15:01:43 +00:00
|
|
|
Vector<String> get_ios_frameworks() const;
|
2020-08-05 17:55:29 +00:00
|
|
|
Vector<String> get_ios_embedded_frameworks() const;
|
2020-03-18 16:40:04 +00:00
|
|
|
Vector<String> get_ios_project_static_libs() const;
|
2017-10-02 15:01:43 +00:00
|
|
|
String get_ios_plist_content() const;
|
|
|
|
String get_ios_linker_flags() const;
|
|
|
|
Vector<String> get_ios_bundle_files() const;
|
|
|
|
String get_ios_cpp_code() const;
|
2021-12-18 09:21:08 +00:00
|
|
|
const Vector<String> &get_osx_plugin_files() const;
|
2017-10-02 15:01:43 +00:00
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
EditorExportPlugin();
|
|
|
|
};
|
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
class EditorExport : public Node {
|
2017-03-05 15:44:50 +00:00
|
|
|
GDCLASS(EditorExport, Node);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-03-17 06:33:00 +00:00
|
|
|
Vector<Ref<EditorExportPlatform>> export_platforms;
|
|
|
|
Vector<Ref<EditorExportPreset>> export_presets;
|
|
|
|
Vector<Ref<EditorExportPlugin>> export_plugins;
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2020-04-24 07:45:14 +00:00
|
|
|
StringName _export_presets_updated;
|
|
|
|
|
2022-04-04 13:06:57 +00:00
|
|
|
Timer *save_timer = nullptr;
|
2022-02-15 14:56:58 +00:00
|
|
|
bool block_save = false;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
static EditorExport *singleton;
|
2015-11-09 03:49:18 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
void _save();
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
protected:
|
|
|
|
friend class EditorExportPreset;
|
2017-02-20 02:19:30 +00:00
|
|
|
void save_presets();
|
2016-02-27 03:32:00 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
void _notification(int p_what);
|
2014-02-10 01:10:30 +00:00
|
|
|
static void _bind_methods();
|
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
public:
|
|
|
|
static EditorExport *get_singleton() { return singleton; }
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_export_platform(const Ref<EditorExportPlatform> &p_platform);
|
2017-02-13 01:51:16 +00:00
|
|
|
int get_export_platform_count();
|
|
|
|
Ref<EditorExportPlatform> get_export_platform(int p_idx);
|
2014-02-10 01:10:30 +00:00
|
|
|
|
2017-03-05 15:44:50 +00:00
|
|
|
void add_export_preset(const Ref<EditorExportPreset> &p_preset, int p_at_pos = -1);
|
2017-02-13 01:51:16 +00:00
|
|
|
int get_export_preset_count() const;
|
|
|
|
Ref<EditorExportPreset> get_export_preset(int p_idx);
|
|
|
|
void remove_export_preset(int p_idx);
|
2015-12-04 13:18:28 +00:00
|
|
|
|
2017-09-14 22:38:38 +00:00
|
|
|
void add_export_plugin(const Ref<EditorExportPlugin> &p_plugin);
|
|
|
|
void remove_export_plugin(const Ref<EditorExportPlugin> &p_plugin);
|
2020-03-17 06:33:00 +00:00
|
|
|
Vector<Ref<EditorExportPlugin>> get_export_plugins();
|
2017-09-14 22:38:38 +00:00
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
void load_config();
|
2020-04-24 07:45:14 +00:00
|
|
|
void update_export_presets();
|
2017-03-23 23:14:12 +00:00
|
|
|
bool poll_export_platforms();
|
|
|
|
|
2017-02-13 01:51:16 +00:00
|
|
|
EditorExport();
|
|
|
|
~EditorExport();
|
2014-02-10 01:10:30 +00:00
|
|
|
};
|
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
class EditorExportPlatformPC : public EditorExportPlatform {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorExportPlatformPC, EditorExportPlatform);
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2019-03-25 19:56:33 +00:00
|
|
|
private:
|
2017-02-20 02:19:30 +00:00
|
|
|
Ref<ImageTexture> logo;
|
|
|
|
String name;
|
2017-07-19 20:00:46 +00:00
|
|
|
String os_name;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2022-03-21 00:31:05 +00:00
|
|
|
int chmod_flags = -1;
|
2019-03-25 19:56:33 +00:00
|
|
|
|
2017-02-20 02:19:30 +00:00
|
|
|
public:
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void get_export_options(List<ExportOption> *r_options) override;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual String get_name() const override;
|
|
|
|
virtual String get_os_name() const override;
|
|
|
|
virtual Ref<Texture2D> get_logo() const override;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override;
|
|
|
|
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override;
|
2019-10-04 15:01:13 +00:00
|
|
|
virtual Error sign_shared_object(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path);
|
2022-03-22 14:40:34 +00:00
|
|
|
virtual String get_template_file_name(const String &p_target, const String &p_arch) const = 0;
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2022-05-04 09:57:21 +00:00
|
|
|
virtual Error prepare_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
|
|
|
|
virtual Error modify_template(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { return OK; };
|
|
|
|
virtual Error export_project_data(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags);
|
2021-12-20 09:28:54 +00:00
|
|
|
|
|
|
|
void set_extension(const String &p_extension, const String &p_feature_key = "default");
|
2017-03-05 15:44:50 +00:00
|
|
|
void set_name(const String &p_name);
|
2017-07-19 20:00:46 +00:00
|
|
|
void set_os_name(const String &p_name);
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2019-06-11 18:43:37 +00:00
|
|
|
void set_logo(const Ref<Texture2D> &p_logo);
|
2017-02-20 02:19:30 +00:00
|
|
|
|
2017-07-19 20:00:46 +00:00
|
|
|
void add_platform_feature(const String &p_feature);
|
2020-07-10 10:34:39 +00:00
|
|
|
virtual void get_platform_features(List<String> *r_features) override;
|
2022-05-19 15:00:06 +00:00
|
|
|
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override;
|
2017-07-19 20:00:46 +00:00
|
|
|
|
2017-09-17 17:40:58 +00:00
|
|
|
int get_chmod_flags() const;
|
|
|
|
void set_chmod_flags(int p_flags);
|
|
|
|
|
2022-06-03 15:34:24 +00:00
|
|
|
virtual Error fixup_embedded_pck(const String &p_path, int64_t p_embedded_start, int64_t p_embedded_size) {
|
2022-03-21 00:31:05 +00:00
|
|
|
return Error::OK;
|
|
|
|
}
|
2017-02-20 02:19:30 +00:00
|
|
|
};
|
|
|
|
|
2017-12-15 11:38:24 +00:00
|
|
|
class EditorExportTextSceneToBinaryPlugin : public EditorExportPlugin {
|
2019-03-19 18:35:57 +00:00
|
|
|
GDCLASS(EditorExportTextSceneToBinaryPlugin, EditorExportPlugin);
|
2017-12-15 11:38:24 +00:00
|
|
|
|
|
|
|
public:
|
2022-05-19 15:00:06 +00:00
|
|
|
virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) override;
|
2017-12-15 11:38:24 +00:00
|
|
|
EditorExportTextSceneToBinaryPlugin();
|
|
|
|
};
|
|
|
|
|
2014-02-10 01:10:30 +00:00
|
|
|
#endif // EDITOR_IMPORT_EXPORT_H
|