project_export.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. /*************************************************************************/
  2. /* project_export.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* http://www.godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
  9. /* */
  10. /* Permission is hereby granted, free of charge, to any person obtaining */
  11. /* a copy of this software and associated documentation files (the */
  12. /* "Software"), to deal in the Software without restriction, including */
  13. /* without limitation the rights to use, copy, modify, merge, publish, */
  14. /* distribute, sublicense, and/or sell copies of the Software, and to */
  15. /* permit persons to whom the Software is furnished to do so, subject to */
  16. /* the following conditions: */
  17. /* */
  18. /* The above copyright notice and this permission notice shall be */
  19. /* included in all copies or substantial portions of the Software. */
  20. /* */
  21. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  22. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  23. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  24. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  25. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  26. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  27. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  28. /*************************************************************************/
  29. #ifndef PROJECT_EXPORT_SETTINGS_H
  30. #define PROJECT_EXPORT_SETTINGS_H
  31. #include "scene/main/timer.h"
  32. #include "scene/gui/control.h"
  33. #include "scene/gui/tree.h"
  34. #include "scene/gui/label.h"
  35. #include "scene/gui/file_dialog.h"
  36. #include "scene/gui/button.h"
  37. #include "scene/gui/dialogs.h"
  38. #include "scene/gui/tab_container.h"
  39. #include "os/dir_access.h"
  40. #include "os/thread.h"
  41. #include "scene/gui/option_button.h"
  42. #include "scene/gui/empty_control.h"
  43. #include "scene/gui/slider.h"
  44. #include "tools/editor/editor_file_system.h"
  45. #include "property_editor.h"
  46. #include "editor_import_export.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. AcceptDialog *error;
  64. ConfirmationDialog *confirm;
  65. Button *button_reload;
  66. LineEdit *filters;
  67. HBoxContainer *plat_errors;
  68. Label *platform_error_string;
  69. Tree * tree;
  70. FileDialog *pck_export;
  71. FileDialog *file_export;
  72. CheckButton *file_export_check;
  73. LineEdit *file_export_password;
  74. Button *button_export;
  75. String _delete_attempt;
  76. bool updating;
  77. void _tree_changed();
  78. void _update_tree();
  79. bool _create_tree(TreeItem *p_parent,EditorFileSystemDirectory *p_dir);
  80. void _rescan();
  81. // void _confirmed();
  82. void _scan_finished();
  83. void _validate_platform();
  84. ///////////////////
  85. Tree * platforms;
  86. PropertyEditor *platform_options;
  87. OptionButton *export_mode;
  88. VBoxContainer *tree_vb;
  89. VBoxContainer *image_vb;
  90. OptionButton *image_action;
  91. HSlider *image_quality;
  92. SpinBox *image_shrink;
  93. Tree *image_formats;
  94. Vector<TreeItem*> formats;
  95. LineEdit *group_new_name;
  96. HSlider *group_lossy_quality;
  97. Label *group_new_name_error;
  98. VBoxContainer *group_options;
  99. Tree *groups;
  100. SpinBox *group_shrink;
  101. CheckButton *group_atlas;
  102. OptionButton *group_image_action;
  103. Button *group_add;
  104. Tree *group_images;
  105. LineEdit *group_images_filter;
  106. Button *atlas_preview;
  107. AcceptDialog *atlas_preview_dialog;
  108. TextureFrame *atlas_preview_frame;
  109. VBoxContainer *script_vbox;
  110. OptionButton *script_mode;
  111. LineEdit *script_key;
  112. void _export_mode_changed(int p_idx);
  113. void _prop_edited(String what);
  114. void _update_platform();
  115. void _update_exporter();
  116. void _platform_selected();
  117. void _filters_edited(String what);
  118. void _update_group_tree();
  119. void _image_filter_changed(String);
  120. 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);
  121. void _group_item_edited();
  122. void _group_atlas_preview();
  123. void _quality_edited(float what);
  124. void _image_export_edited(int what);
  125. void _shrink_edited(float what);
  126. void _update_group_list();
  127. void _select_group(const String& p_by_name);
  128. String _get_selected_group();
  129. void _update_group();
  130. void _group_changed(Variant v);
  131. void _group_selected();
  132. void _group_add();
  133. void _group_select_all();
  134. void _group_select_none();
  135. void _group_del(Object *item,int p_column, int p_button);
  136. bool updating_script;
  137. void _update_script();
  138. void _script_edited(Variant v);
  139. void _export_action(const String& p_file);
  140. void _export_action_pck(const String& p_file);
  141. void ok_pressed();
  142. void custom_action(const String&);
  143. void _save_export_cfg();
  144. void _format_toggled();
  145. protected:
  146. void _notification(int p_what);
  147. static void _bind_methods();
  148. public:
  149. String get_selected_path() const;
  150. Error export_platform(const String& p_platform, const String& p_path, bool p_debug,const String& p_password,bool p_quit_after=false);
  151. ProjectExportDialog(EditorNode *p_editor);
  152. ~ProjectExportDialog();
  153. };
  154. class EditorData;
  155. class ProjectExport : public ConfirmationDialog {
  156. OBJ_TYPE( ProjectExport, ConfirmationDialog );
  157. EditorData *editor_data;
  158. AcceptDialog *error;
  159. Label *label;
  160. OptionButton *export_preset;
  161. public:
  162. Error export_project(const String& p_preset);
  163. void popup_export();
  164. ProjectExport(EditorData* p_data);
  165. };
  166. #endif // PROJECT_EXPORT_SETTINGS_H