| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
#pragma once |
| 32 |
|
| 33 |
class EditorExportPlatform; |
| 34 |
|
| 35 |
#include "core/object/ref_counted.h" |
| 36 |
|
| 37 |
class EditorExportPreset : public RefCounted { |
| 38 |
GDCLASS(EditorExportPreset, RefCounted); |
| 39 |
|
| 40 |
public: |
| 41 |
enum ExportFilter { |
| 42 |
EXPORT_ALL_RESOURCES, |
| 43 |
EXPORT_SELECTED_SCENES, |
| 44 |
EXPORT_SELECTED_RESOURCES, |
| 45 |
EXCLUDE_SELECTED_RESOURCES, |
| 46 |
EXPORT_CUSTOMIZED, |
| 47 |
}; |
| 48 |
|
| 49 |
enum FileExportMode { |
| 50 |
MODE_FILE_NOT_CUSTOMIZED, |
| 51 |
MODE_FILE_STRIP, |
| 52 |
MODE_FILE_KEEP, |
| 53 |
MODE_FILE_REMOVE, |
| 54 |
}; |
| 55 |
|
| 56 |
enum ScriptExportMode { |
| 57 |
MODE_SCRIPT_TEXT, |
| 58 |
MODE_SCRIPT_BINARY_TOKENS, |
| 59 |
MODE_SCRIPT_BINARY_TOKENS_COMPRESSED, |
| 60 |
}; |
| 61 |
|
| 62 |
private: |
| 63 |
Ref<EditorExportPlatform> platform; |
| 64 |
ExportFilter export_filter = EXPORT_ALL_RESOURCES; |
| 65 |
String include_filter; |
| 66 |
String exclude_filter; |
| 67 |
String export_path; |
| 68 |
|
| 69 |
String exporter; |
| 70 |
HashSet<String> selected_files; |
| 71 |
HashMap<String, FileExportMode> customized_files; |
| 72 |
bool runnable = false; |
| 73 |
bool dedicated_server = false; |
| 74 |
|
| 75 |
Vector<String> patches; |
| 76 |
bool patch_delta_encoding_enabled = false; |
| 77 |
int patch_delta_zstd_level = 19; |
| 78 |
double patch_delta_min_reduction = 0.1; |
| 79 |
String patch_delta_include_filter = "*"; |
| 80 |
String patch_delta_exclude_filter; |
| 81 |
|
| 82 |
friend class EditorExport; |
| 83 |
friend class EditorExportPlatform; |
| 84 |
|
| 85 |
HashMap<StringName, PropertyInfo> properties; |
| 86 |
HashMap<StringName, Variant> values; |
| 87 |
HashMap<StringName, Variant> value_overrides; |
| 88 |
HashMap<StringName, bool> update_visibility; |
| 89 |
|
| 90 |
String name; |
| 91 |
|
| 92 |
String custom_features; |
| 93 |
|
| 94 |
String enc_in_filters; |
| 95 |
String enc_ex_filters; |
| 96 |
bool enc_pck = false; |
| 97 |
bool enc_directory = false; |
| 98 |
uint64_t seed = 0; |
| 99 |
|
| 100 |
String script_key; |
| 101 |
ScriptExportMode script_mode = MODE_SCRIPT_BINARY_TOKENS_COMPRESSED; |
| 102 |
|
| 103 |
protected: |
| 104 |
bool _set(const StringName &p_name, const Variant &p_value); |
| 105 |
bool _get(const StringName &p_name, Variant &r_ret) const; |
| 106 |
void _get_property_list(List<PropertyInfo> *p_list) const; |
| 107 |
|
| 108 |
String _get_property_warning(const StringName &p_name) const; |
| 109 |
|
| 110 |
static void _bind_methods(); |
| 111 |
|
| 112 |
#ifndef DISABLE_DEPRECATED |
| 113 |
int _get_script_export_mode_bind_compat_107167() const; |
| 114 |
static void _bind_compatibility_methods(); |
| 115 |
#endif |
| 116 |
|
| 117 |
public: |
| 118 |
Ref<EditorExportPlatform> get_platform() const; |
| 119 |
|
| 120 |
bool has(const StringName &p_property) const { return values.has(p_property); } |
| 121 |
|
| 122 |
void update_files(); |
| 123 |
void update_value_overrides(); |
| 124 |
|
| 125 |
Vector<String> get_files_to_export() const; |
| 126 |
HashSet<String> get_selected_files() const; |
| 127 |
void set_selected_files(const HashSet<String> &p_files); |
| 128 |
Dictionary get_customized_files() const; |
| 129 |
int get_customized_files_count() const; |
| 130 |
void set_customized_files(const Dictionary &p_files); |
| 131 |
|
| 132 |
void add_export_file(const String &p_path); |
| 133 |
void remove_export_file(const String &p_path); |
| 134 |
bool has_export_file(const String &p_path); |
| 135 |
|
| 136 |
void set_file_export_mode(const String &p_path, FileExportMode p_mode); |
| 137 |
FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const; |
| 138 |
|
| 139 |
Variant get_project_setting(const StringName &p_name); |
| 140 |
|
| 141 |
void set_name(const String &p_name); |
| 142 |
String get_name() const; |
| 143 |
|
| 144 |
void set_runnable(bool p_enable); |
| 145 |
bool is_runnable() const; |
| 146 |
|
| 147 |
bool are_advanced_options_enabled() const; |
| 148 |
|
| 149 |
void set_dedicated_server(bool p_enable); |
| 150 |
bool is_dedicated_server() const; |
| 151 |
|
| 152 |
void set_export_filter(ExportFilter p_filter); |
| 153 |
ExportFilter get_export_filter() const; |
| 154 |
|
| 155 |
void set_include_filter(const String &p_include); |
| 156 |
String get_include_filter() const; |
| 157 |
|
| 158 |
void set_exclude_filter(const String &p_exclude); |
| 159 |
String get_exclude_filter() const; |
| 160 |
|
| 161 |
void add_patch(const String &p_path, int p_at_pos = -1); |
| 162 |
void set_patch(int p_index, const String &p_path); |
| 163 |
|
| 164 |
String get_patch(int p_index); |
| 165 |
void remove_patch(int p_index); |
| 166 |
|
| 167 |
void set_patches(const Vector<String> &p_patches); |
| 168 |
Vector<String> get_patches() const; |
| 169 |
|
| 170 |
void set_patch_delta_encoding_enabled(bool p_enable); |
| 171 |
bool is_patch_delta_encoding_enabled() const; |
| 172 |
|
| 173 |
void set_patch_delta_zstd_level(int p_level); |
| 174 |
int get_patch_delta_zstd_level() const; |
| 175 |
|
| 176 |
void set_patch_delta_min_reduction(double p_ratio); |
| 177 |
double get_patch_delta_min_reduction() const; |
| 178 |
|
| 179 |
void set_patch_delta_include_filter(const String &p_filter); |
| 180 |
String get_patch_delta_include_filter() const; |
| 181 |
|
| 182 |
void set_patch_delta_exclude_filter(const String &p_filter); |
| 183 |
String get_patch_delta_exclude_filter() const; |
| 184 |
|
| 185 |
void set_custom_features(const String &p_custom_features); |
| 186 |
String get_custom_features() const; |
| 187 |
|
| 188 |
void set_export_path(const String &p_path); |
| 189 |
String get_export_path() const; |
| 190 |
|
| 191 |
void set_enc_in_filter(const String &p_filter); |
| 192 |
String get_enc_in_filter() const; |
| 193 |
|
| 194 |
void set_enc_ex_filter(const String &p_filter); |
| 195 |
String get_enc_ex_filter() const; |
| 196 |
|
| 197 |
void set_seed(uint64_t p_seed); |
| 198 |
uint64_t get_seed() const; |
| 199 |
|
| 200 |
void set_enc_pck(bool p_enabled); |
| 201 |
bool get_enc_pck() const; |
| 202 |
|
| 203 |
void set_enc_directory(bool p_enabled); |
| 204 |
bool get_enc_directory() const; |
| 205 |
|
| 206 |
void set_script_encryption_key(const String &p_key); |
| 207 |
String get_script_encryption_key() const; |
| 208 |
|
| 209 |
void set_script_export_mode(ScriptExportMode p_mode); |
| 210 |
ScriptExportMode get_script_export_mode() const; |
| 211 |
|
| 212 |
Variant _get_or_env(const StringName &p_name, const String &p_env_var) const { |
| 213 |
return get_or_env(p_name, p_env_var); |
| 214 |
} |
| 215 |
Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const; |
| 216 |
|
| 217 |
|
| 218 |
|
| 219 |
|
| 220 |
|
| 221 |
|
| 222 |
String get_version(const StringName &p_name, bool p_windows_version = false) const; |
| 223 |
|
| 224 |
const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; } |
| 225 |
const HashMap<StringName, Variant> &get_values() const { return values; } |
| 226 |
}; |
| 227 |
|
| 228 |
VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter); |
| 229 |
VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode); |
| 230 |
VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode); |