2
0

project_export.h 8.8 KB

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