Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/export/project_export.h
21022 views
1
/**************************************************************************/
2
/* project_export.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
#include "editor/export/editor_export_preset.h"
34
#include "scene/gui/dialogs.h"
35
36
class CheckBox;
37
class CheckButton;
38
class EditorFileDialog;
39
class EditorFileSystemDirectory;
40
class EditorInspector;
41
class EditorPropertyPath;
42
class ItemList;
43
class LinkButton;
44
class MenuButton;
45
class OptionButton;
46
class PopupMenu;
47
class ProjectExportDialog;
48
class RichTextLabel;
49
class SpinBox;
50
class TabContainer;
51
class Tree;
52
class TreeItem;
53
54
class ProjectExportTextureFormatError : public HBoxContainer {
55
GDCLASS(ProjectExportTextureFormatError, HBoxContainer);
56
57
ProjectExportDialog *export_dialog = nullptr;
58
Label *texture_format_error_label = nullptr;
59
LinkButton *fix_texture_format_button = nullptr;
60
String setting_identifier;
61
void _on_fix_texture_format_pressed();
62
63
protected:
64
static void _bind_methods();
65
void _notification(int p_what);
66
67
public:
68
void show_for_texture_format(const String &p_friendly_name, const String &p_setting_identifier);
69
ProjectExportTextureFormatError(ProjectExportDialog *p_export_dialog);
70
};
71
72
class ProjectExportDialog : public ConfirmationDialog {
73
GDCLASS(ProjectExportDialog, ConfirmationDialog);
74
75
TabContainer *sections = nullptr;
76
77
MenuButton *add_preset = nullptr;
78
Button *duplicate_preset = nullptr;
79
Button *delete_preset = nullptr;
80
ItemList *presets = nullptr;
81
82
VBoxContainer *settings_vb = nullptr;
83
LineEdit *name = nullptr;
84
EditorPropertyPath *export_path = nullptr;
85
EditorInspector *parameters = nullptr;
86
CheckButton *runnable = nullptr;
87
CheckButton *advanced_options = nullptr;
88
89
Label *empty_label = nullptr;
90
91
bool updating = false;
92
93
RichTextLabel *result_dialog_log = nullptr;
94
AcceptDialog *result_dialog = nullptr;
95
ConfirmationDialog *delete_confirm = nullptr;
96
97
OptionButton *export_filter = nullptr;
98
LineEdit *include_filters = nullptr;
99
LineEdit *exclude_filters = nullptr;
100
Tree *include_files = nullptr;
101
Label *server_strip_message = nullptr;
102
PopupMenu *file_mode_popup = nullptr;
103
104
Label *include_label = nullptr;
105
MarginContainer *include_margin = nullptr;
106
107
Button *export_button = nullptr;
108
Button *export_all_button = nullptr;
109
AcceptDialog *export_all_dialog = nullptr;
110
111
RBSet<String> feature_set;
112
113
CheckButton *patch_delta_encoding = nullptr;
114
SpinBox *patch_delta_zstd_level = nullptr;
115
SpinBox *patch_delta_min_reduction = nullptr;
116
LineEdit *patch_delta_include_filter = nullptr;
117
LineEdit *patch_delta_exclude_filter = nullptr;
118
Tree *patches = nullptr;
119
int patch_index = -1;
120
EditorFileDialog *patch_dialog = nullptr;
121
ConfirmationDialog *patch_erase = nullptr;
122
Button *patch_add_btn = nullptr;
123
124
LineEdit *custom_features = nullptr;
125
RichTextLabel *custom_feature_display = nullptr;
126
127
LineEdit *script_key = nullptr;
128
Button *show_script_key = nullptr;
129
Label *script_key_error = nullptr;
130
131
ProjectExportTextureFormatError *export_texture_format_error = nullptr;
132
Label *export_error = nullptr;
133
Label *export_warning = nullptr;
134
HBoxContainer *export_templates_error = nullptr;
135
136
String default_filename;
137
138
bool exporting = false;
139
140
void _advanced_options_pressed();
141
void _runnable_pressed();
142
void _update_parameters(const String &p_edited_property);
143
void _name_changed(const String &p_string);
144
void _name_editing_finished();
145
void _export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing);
146
void _add_preset(int p_platform);
147
void _edit_preset(int p_index);
148
void _duplicate_preset();
149
void _delete_preset();
150
void _delete_preset_confirm();
151
void _update_export_all();
152
153
void _force_update_current_preset_parameters();
154
void _update_current_preset();
155
void _update_presets();
156
157
void _export_type_changed(int p_which);
158
void _filter_changed(const String &p_filter);
159
String _get_resource_export_header(EditorExportPreset::ExportFilter p_filter) const;
160
void _fill_resource_tree();
161
void _setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode);
162
bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter);
163
void _propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode);
164
void _tree_changed();
165
void _check_propagated_to_item(Object *p_obj, int column);
166
void _tree_popup_edited(bool p_arrow_clicked);
167
void _set_file_export_mode(int p_id);
168
169
bool updating_patch_delta_filters = false;
170
void _patch_delta_encoding_changed(bool p_pressed);
171
void _patch_delta_include_filter_changed(const String &p_filter);
172
void _patch_delta_exclude_filter_changed(const String &p_filter);
173
void _patch_delta_zstd_level_changed(double p_value);
174
void _patch_delta_min_reduction_changed(double p_value);
175
void _patch_tree_button_clicked(Object *p_item, int p_column, int p_id, int p_mouse_button_index);
176
void _patch_tree_item_edited();
177
void _patch_file_selected(const String &p_path);
178
void _patch_delete_confirmed();
179
void _patch_add_pack_pressed();
180
181
Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
182
bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
183
void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
184
185
EditorFileDialog *export_pck_zip = nullptr;
186
EditorFileDialog *export_project = nullptr;
187
188
CheckButton *enc_pck = nullptr;
189
CheckButton *enc_directory = nullptr;
190
LineEdit *enc_in_filters = nullptr;
191
LineEdit *enc_ex_filters = nullptr;
192
LineEdit *seed_input = nullptr;
193
194
OptionButton *script_mode = nullptr;
195
196
void _open_export_template_manager();
197
198
void _export_pck_zip();
199
void _export_pck_zip_selected(const String &p_path);
200
201
void _export_project();
202
void _export_project_to_path(const String &p_path);
203
void _export_all_dialog();
204
void _export_all_dialog_action(const String &p_str);
205
void _export_all(bool p_debug);
206
207
void _update_feature_list();
208
void _custom_features_changed(const String &p_text);
209
210
bool updating_script_key = false;
211
bool updating_enc_filters = false;
212
bool updating_seed = false;
213
void _enc_pck_changed(bool p_pressed);
214
void _enc_directory_changed(bool p_pressed);
215
void _enc_filters_changed(const String &p_text);
216
void _seed_input_changed(const String &p_text);
217
void _script_encryption_key_changed(const String &p_key);
218
void _script_encryption_key_visibility_changed(bool p_visible);
219
bool _validate_script_encryption_key(const String &p_key);
220
221
void _script_export_mode_changed(EditorExportPreset::ScriptExportMode p_mode);
222
223
void _open_key_help_link();
224
225
void _tab_changed(int);
226
227
protected:
228
void _notification(int p_what);
229
static void _bind_methods();
230
231
public:
232
void popup_export();
233
234
void set_export_path(const String &p_value);
235
String get_export_path();
236
237
Ref<EditorExportPreset> get_current_preset() const;
238
239
bool is_exporting() const { return exporting; }
240
241
ProjectExportDialog();
242
};
243
244