project_export.h 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  1. /*************************************************************************/
  2. /* project_export.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  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. #ifndef PROJECT_EXPORT_SETTINGS_H
  31. #define PROJECT_EXPORT_SETTINGS_H
  32. #include "editor/editor_file_dialog.h"
  33. #include "os/dir_access.h"
  34. #include "os/thread.h"
  35. #include "scene/gui/button.h"
  36. #include "scene/gui/control.h"
  37. #include "scene/gui/dialogs.h"
  38. #include "scene/gui/label.h"
  39. #include "scene/gui/option_button.h"
  40. #include "scene/gui/tab_container.h"
  41. #include "scene/gui/tree.h"
  42. #include "scene/main/timer.h"
  43. #include "editor/editor_file_system.h"
  44. #include "editor_import_export.h"
  45. #include "property_editor.h"
  46. #include "scene/gui/slider.h"
  47. class EditorNode;
  48. class ProjectExportDialog : public ConfirmationDialog {
  49. OBJ_TYPE(ProjectExportDialog, ConfirmationDialog);
  50. public:
  51. enum ExportAction {
  52. ACTION_NONE,
  53. ACTION_COPY,
  54. ACTION_BUNDLE,
  55. ACTION_MAX
  56. };
  57. static const char *da_string[ACTION_MAX];
  58. private:
  59. EditorNode *editor;
  60. String expopt;
  61. TabContainer *sections;
  62. bool updating_tree;
  63. bool pending_update_tree;
  64. AcceptDialog *error;
  65. ConfirmationDialog *confirm;
  66. ConfirmationDialog *confirm_keystore;
  67. Button *button_reload;
  68. LineEdit *filters, *filters_exclude, *filters_exclude_dir;
  69. HBoxContainer *plat_errors;
  70. Label *platform_error_string;
  71. StringName ei;
  72. StringName ot;
  73. Tree *tree;
  74. EditorFileDialog *pck_export;
  75. EditorFileDialog *file_export;
  76. LineEdit *file_export_password;
  77. Button *button_export;
  78. String _delete_attempt;
  79. bool updating;
  80. void _tree_changed();
  81. void _update_tree();
  82. bool _create_tree(TreeItem *p_parent, EditorFileSystemDirectory *p_dir);
  83. void _rescan();
  84. // void _confirmed();
  85. void _scan_finished();
  86. void _validate_platform();
  87. ///////////////////
  88. Tree *platforms;
  89. PropertyEditor *platform_options;
  90. OptionButton *export_mode;
  91. CheckButton *convert_text_scenes;
  92. VBoxContainer *tree_vb;
  93. VBoxContainer *image_vb;
  94. OptionButton *image_action;
  95. HSlider *image_quality;
  96. SpinBox *image_shrink;
  97. Tree *image_formats;
  98. Vector<TreeItem *> formats;
  99. LineEdit *group_new_name;
  100. HSlider *group_lossy_quality;
  101. Label *group_new_name_error;
  102. VBoxContainer *group_options;
  103. Tree *groups;
  104. SpinBox *group_shrink;
  105. CheckButton *group_atlas;
  106. OptionButton *group_image_action;
  107. Button *group_add;
  108. Tree *group_images;
  109. LineEdit *group_images_filter;
  110. Button *atlas_preview;
  111. AcceptDialog *atlas_preview_dialog;
  112. TextureFrame *atlas_preview_frame;
  113. VBoxContainer *script_vbox;
  114. OptionButton *script_mode;
  115. LineEdit *script_key;
  116. VBoxContainer *sample_vbox;
  117. OptionButton *sample_mode;
  118. SpinBox *sample_max_hz;
  119. CheckButton *sample_trim;
  120. ConfirmationDialog *keystore_create_dialog;
  121. EditorFileDialog *keystore_file_dialog;
  122. void _export_mode_changed(int p_idx);
  123. void _prop_edited(String what);
  124. void _update_platform();
  125. void _update_exporter();
  126. void _platform_selected();
  127. void _filters_edited(String what);
  128. void _filters_exclude_edited(String what);
  129. void _filters_exclude_dir_edited(String what);
  130. void _update_group_tree();
  131. void _image_filter_changed(String);
  132. bool _update_group_treef(TreeItem *p_parent, EditorFileSystemDirectory *p_dir, const Set<String> &p_extensions, const String &p_groups, const Map<StringName, int> &p_group_index);
  133. void _group_item_edited();
  134. void _group_atlas_preview();
  135. void _quality_edited(float what);
  136. void _image_export_edited(int what);
  137. void _shrink_edited(float what);
  138. void _sample_convert_edited(int what);
  139. void _update_group_list();
  140. void _select_group(const String &p_by_name);
  141. String _get_selected_group();
  142. void _update_group();
  143. void _group_changed(Variant v);
  144. void _group_selected();
  145. void _group_add();
  146. void _group_select_all();
  147. void _group_select_none();
  148. void _group_del(Object *item, int p_column, int p_button);
  149. bool updating_script;
  150. void _update_script();
  151. void _script_edited(Variant v);
  152. void _export_action(const String &p_file);
  153. void _export_action_pck(const String &p_file);
  154. void ok_pressed();
  155. void custom_action(const String &);
  156. LineEdit *_create_keystore_input(Control *container, const String &p_label, const String &name);
  157. void _create_android_keystore_window();
  158. void _create_android_keystore();
  159. bool _check_android_setting(const Ref<EditorExportPlatform> &exporter);
  160. void _check_keystore_path(const String &path);
  161. void _keystore_dir_selected(const String &path);
  162. void _keystore_created();
  163. void _save_export_cfg();
  164. void _format_toggled();
  165. protected:
  166. void _notification(int p_what);
  167. static void _bind_methods();
  168. public:
  169. String get_selected_path() const;
  170. Error export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false);
  171. void popup_export();
  172. ProjectExportDialog(EditorNode *p_editor);
  173. ~ProjectExportDialog();
  174. };
  175. class EditorData;
  176. class ProjectExport : public ConfirmationDialog {
  177. OBJ_TYPE(ProjectExport, ConfirmationDialog);
  178. EditorData *editor_data;
  179. AcceptDialog *error;
  180. Label *label;
  181. OptionButton *export_preset;
  182. public:
  183. Error export_project(const String &p_preset);
  184. void popup_export();
  185. ProjectExport(EditorData *p_data);
  186. };
  187. #endif // PROJECT_EXPORT_SETTINGS_H