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