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#ifndef PROJECT_EXPORT_H
32#define PROJECT_EXPORT_H
33
34#include "editor/export/editor_export_preset.h"
35#include "scene/gui/dialogs.h"
36
37class CheckBox;
38class CheckButton;
39class EditorFileDialog;
40class EditorFileSystemDirectory;
41class EditorInspector;
42class EditorPropertyPath;
43class ItemList;
44class LinkButton;
45class MenuButton;
46class OptionButton;
47class PopupMenu;
48class RichTextLabel;
49class TabContainer;
50class Tree;
51class TreeItem;
52
53class ProjectExportTextureFormatError : public HBoxContainer {
54 GDCLASS(ProjectExportTextureFormatError, HBoxContainer);
55
56 Label *texture_format_error_label = nullptr;
57 LinkButton *fix_texture_format_button = nullptr;
58 String setting_identifier;
59 void _on_fix_texture_format_pressed();
60
61protected:
62 static void _bind_methods();
63 void _notification(int p_what);
64
65public:
66 void show_for_texture_format(const String &p_friendly_name, const String &p_setting_identifier);
67 ProjectExportTextureFormatError();
68};
69
70class ProjectExportDialog : public ConfirmationDialog {
71 GDCLASS(ProjectExportDialog, ConfirmationDialog);
72
73private:
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
86 Button *button_export = nullptr;
87 bool updating = false;
88
89 RichTextLabel *result_dialog_log = nullptr;
90 AcceptDialog *result_dialog = nullptr;
91 ConfirmationDialog *delete_confirm = nullptr;
92
93 OptionButton *export_filter = nullptr;
94 LineEdit *include_filters = nullptr;
95 LineEdit *exclude_filters = nullptr;
96 Tree *include_files = nullptr;
97 Label *server_strip_message = nullptr;
98 PopupMenu *file_mode_popup = nullptr;
99
100 Label *include_label = nullptr;
101 MarginContainer *include_margin = nullptr;
102
103 Button *export_button = nullptr;
104 Button *export_all_button = nullptr;
105 AcceptDialog *export_all_dialog = nullptr;
106
107 RBSet<String> feature_set;
108 LineEdit *custom_features = nullptr;
109 RichTextLabel *custom_feature_display = nullptr;
110
111 LineEdit *script_key = nullptr;
112 Label *script_key_error = nullptr;
113
114 ProjectExportTextureFormatError *export_texture_format_error = nullptr;
115 Label *export_error = nullptr;
116 Label *export_warning = nullptr;
117 HBoxContainer *export_templates_error = nullptr;
118
119 String default_filename;
120
121 void _runnable_pressed();
122 void _update_parameters(const String &p_edited_property);
123 void _name_changed(const String &p_string);
124 void _export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing);
125 void _add_preset(int p_platform);
126 void _edit_preset(int p_index);
127 void _duplicate_preset();
128 void _delete_preset();
129 void _delete_preset_confirm();
130 void _update_export_all();
131
132 void _force_update_current_preset_parameters();
133 void _update_current_preset();
134 void _update_presets();
135
136 void _export_type_changed(int p_which);
137 void _filter_changed(const String &p_filter);
138 void _fill_resource_tree();
139 void _setup_item_for_file_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_mode);
140 bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> &current, EditorExportPreset::ExportFilter p_export_filter);
141 void _propagate_file_export_mode(TreeItem *p_item, EditorExportPreset::FileExportMode p_inherited_export_mode);
142 void _tree_changed();
143 void _check_propagated_to_item(Object *p_obj, int column);
144 void _tree_popup_edited(bool p_arrow_clicked);
145 void _set_file_export_mode(int p_id);
146
147 Variant get_drag_data_fw(const Point2 &p_point, Control *p_from);
148 bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const;
149 void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from);
150
151 EditorFileDialog *export_pck_zip = nullptr;
152 EditorFileDialog *export_project = nullptr;
153 CheckBox *export_debug = nullptr;
154 CheckBox *export_pck_zip_debug = nullptr;
155
156 CheckButton *enc_pck = nullptr;
157 CheckButton *enc_directory = nullptr;
158 LineEdit *enc_in_filters = nullptr;
159 LineEdit *enc_ex_filters = nullptr;
160
161 void _open_export_template_manager();
162
163 void _export_pck_zip();
164 void _export_pck_zip_selected(const String &p_path);
165
166 void _validate_export_path(const String &p_path);
167 void _export_project();
168 void _export_project_to_path(const String &p_path);
169 void _export_all_dialog();
170 void _export_all_dialog_action(const String &p_str);
171 void _export_all(bool p_debug);
172
173 void _update_feature_list();
174 void _custom_features_changed(const String &p_text);
175
176 bool updating_script_key = false;
177 bool updating_enc_filters = false;
178 void _enc_pck_changed(bool p_pressed);
179 void _enc_directory_changed(bool p_pressed);
180 void _enc_filters_changed(const String &p_text);
181 void _script_encryption_key_changed(const String &p_key);
182 bool _validate_script_encryption_key(const String &p_key);
183
184 void _open_key_help_link();
185
186 void _tab_changed(int);
187
188protected:
189 void _theme_changed();
190 void _notification(int p_what);
191 static void _bind_methods();
192
193public:
194 void popup_export();
195
196 void set_export_path(const String &p_value);
197 String get_export_path();
198
199 Ref<EditorExportPreset> get_current_preset() const;
200
201 ProjectExportDialog();
202 ~ProjectExportDialog();
203};
204
205#endif // PROJECT_EXPORT_H
206