Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/export/editor_export_preset.h
21100 views
1
/**************************************************************************/
2
/* editor_export_preset.h */
3
/**************************************************************************/
4
/* This file is part of: */
5
/* GODOT ENGINE */
6
/* https://godotengine.org */
7
/**************************************************************************/
8
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
9
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
10
/* */
11
/* Permission is hereby granted, free of charge, to any person obtaining */
12
/* a copy of this software and associated documentation files (the */
13
/* "Software"), to deal in the Software without restriction, including */
14
/* without limitation the rights to use, copy, modify, merge, publish, */
15
/* distribute, sublicense, and/or sell copies of the Software, and to */
16
/* permit persons to whom the Software is furnished to do so, subject to */
17
/* the following conditions: */
18
/* */
19
/* The above copyright notice and this permission notice shall be */
20
/* included in all copies or substantial portions of the Software. */
21
/* */
22
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
23
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
24
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
25
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
26
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
27
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
28
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
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 dedicated_server = false;
73
74
Vector<String> patches;
75
bool patch_delta_encoding_enabled = false;
76
int patch_delta_zstd_level = 19;
77
double patch_delta_min_reduction = 0.1;
78
String patch_delta_include_filter = "*";
79
String patch_delta_exclude_filter;
80
81
friend class EditorExport;
82
friend class EditorExportPlatform;
83
84
HashMap<StringName, PropertyInfo> properties;
85
HashMap<StringName, Variant> values;
86
HashMap<StringName, Variant> value_overrides;
87
HashMap<StringName, bool> update_visibility;
88
89
String name;
90
91
String custom_features;
92
93
String enc_in_filters;
94
String enc_ex_filters;
95
bool enc_pck = false;
96
bool enc_directory = false;
97
uint64_t seed = 0;
98
99
String script_key;
100
ScriptExportMode script_mode = MODE_SCRIPT_BINARY_TOKENS_COMPRESSED;
101
102
protected:
103
bool _set(const StringName &p_name, const Variant &p_value);
104
bool _get(const StringName &p_name, Variant &r_ret) const;
105
void _get_property_list(List<PropertyInfo> *p_list) const;
106
107
String _get_property_warning(const StringName &p_name) const;
108
109
static void _bind_methods();
110
111
#ifndef DISABLE_DEPRECATED
112
int _get_script_export_mode_bind_compat_107167() const;
113
static void _bind_compatibility_methods();
114
#endif
115
116
public:
117
Ref<EditorExportPlatform> get_platform() const;
118
119
bool has(const StringName &p_property) const { return values.has(p_property); }
120
121
void update_files();
122
void update_value_overrides();
123
124
Vector<String> get_files_to_export() const;
125
HashSet<String> get_selected_files() const;
126
void set_selected_files(const HashSet<String> &p_files);
127
Dictionary get_customized_files() const;
128
int get_customized_files_count() const;
129
void set_customized_files(const Dictionary &p_files);
130
131
void add_export_file(const String &p_path);
132
void remove_export_file(const String &p_path);
133
bool has_export_file(const String &p_path);
134
135
void set_file_export_mode(const String &p_path, FileExportMode p_mode);
136
FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;
137
138
Variant get_project_setting(const StringName &p_name);
139
140
void set_name(const String &p_name);
141
String get_name() const;
142
143
void set_runnable(bool p_enable);
144
bool is_runnable() const;
145
146
bool are_advanced_options_enabled() const;
147
148
void set_dedicated_server(bool p_enable);
149
bool is_dedicated_server() const;
150
151
void set_export_filter(ExportFilter p_filter);
152
ExportFilter get_export_filter() const;
153
154
void set_include_filter(const String &p_include);
155
String get_include_filter() const;
156
157
void set_exclude_filter(const String &p_exclude);
158
String get_exclude_filter() const;
159
160
void add_patch(const String &p_path, int p_at_pos = -1);
161
void set_patch(int p_index, const String &p_path);
162
163
String get_patch(int p_index);
164
void remove_patch(int p_index);
165
166
void set_patches(const Vector<String> &p_patches);
167
Vector<String> get_patches() const;
168
169
void set_patch_delta_encoding_enabled(bool p_enable);
170
bool is_patch_delta_encoding_enabled() const;
171
172
void set_patch_delta_zstd_level(int p_level);
173
int get_patch_delta_zstd_level() const;
174
175
void set_patch_delta_min_reduction(double p_ratio);
176
double get_patch_delta_min_reduction() const;
177
178
void set_patch_delta_include_filter(const String &p_filter);
179
String get_patch_delta_include_filter() const;
180
181
void set_patch_delta_exclude_filter(const String &p_filter);
182
String get_patch_delta_exclude_filter() const;
183
184
void set_custom_features(const String &p_custom_features);
185
String get_custom_features() const;
186
187
void set_export_path(const String &p_path);
188
String get_export_path() const;
189
190
void set_enc_in_filter(const String &p_filter);
191
String get_enc_in_filter() const;
192
193
void set_enc_ex_filter(const String &p_filter);
194
String get_enc_ex_filter() const;
195
196
void set_seed(uint64_t p_seed);
197
uint64_t get_seed() const;
198
199
void set_enc_pck(bool p_enabled);
200
bool get_enc_pck() const;
201
202
void set_enc_directory(bool p_enabled);
203
bool get_enc_directory() const;
204
205
void set_script_encryption_key(const String &p_key);
206
String get_script_encryption_key() const;
207
208
void set_script_export_mode(ScriptExportMode p_mode);
209
ScriptExportMode get_script_export_mode() const;
210
211
Variant _get_or_env(const StringName &p_name, const String &p_env_var) const {
212
return get_or_env(p_name, p_env_var);
213
}
214
Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;
215
216
// Return the preset's version number, or fall back to the
217
// `application/config/version` project setting if set to an empty string.
218
// If `p_windows_version` is `true`, formats the returned version number to
219
// be compatible with Windows executable metadata (which requires a
220
// 4-component format).
221
String get_version(const StringName &p_name, bool p_windows_version = false) const;
222
223
const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }
224
const HashMap<StringName, Variant> &get_values() const { return values; }
225
};
226
227
VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter);
228
VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode);
229
VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode);
230
231