project_export.h 8.1 KB

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