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 31 #ifndef PROJECT_EXPORT_SETTINGS_H 32 #define PROJECT_EXPORT_SETTINGS_H 33 34 #include "core/os/dir_access.h" 35 #include "core/os/thread.h" 36 #include "editor/editor_export.h" 37 #include "editor/editor_file_dialog.h" 38 #include "editor/editor_file_system.h" 39 #include "editor/editor_inspector.h" 40 #include "editor/editor_properties.h" 41 #include "scene/gui/button.h" 42 #include "scene/gui/check_button.h" 43 #include "scene/gui/control.h" 44 #include "scene/gui/dialogs.h" 45 #include "scene/gui/file_dialog.h" 46 #include "scene/gui/label.h" 47 #include "scene/gui/link_button.h" 48 #include "scene/gui/menu_button.h" 49 #include "scene/gui/option_button.h" 50 #include "scene/gui/rich_text_label.h" 51 #include "scene/gui/slider.h" 52 #include "scene/gui/tab_container.h" 53 #include "scene/gui/tree.h" 54 #include "scene/main/timer.h" 55 56 class EditorNode; 57 58 class ProjectExportDialog : public ConfirmationDialog { 59 GDCLASS(ProjectExportDialog, ConfirmationDialog); 60 61 private: 62 TabContainer *sections; 63 64 MenuButton *add_preset; 65 Button *duplicate_preset; 66 Button *delete_preset; 67 ItemList *presets; 68 69 LineEdit *name; 70 EditorPropertyPath *export_path; 71 EditorInspector *parameters; 72 CheckButton *runnable; 73 74 Button *button_export; 75 bool updating; 76 77 AcceptDialog *error_dialog; 78 ConfirmationDialog *delete_confirm; 79 80 OptionButton *export_filter; 81 LineEdit *include_filters; 82 LineEdit *exclude_filters; 83 Tree *include_files; 84 85 Label *include_label; 86 MarginContainer *include_margin; 87 88 StringName editor_icons; 89 90 Tree *patches; 91 Button *patch_export; 92 int patch_index; 93 EditorFileDialog *patch_dialog; 94 ConfirmationDialog *patch_erase; 95 96 Button *export_button; 97 Button *export_all_button; 98 AcceptDialog *export_all_dialog; 99 100 LineEdit *custom_features; 101 RichTextLabel *custom_feature_display; 102 103 OptionButton *script_mode; 104 LineEdit *script_key; 105 Label *script_key_error; 106 107 Label *export_error; 108 HBoxContainer *export_templates_error; 109 110 String default_filename; 111 112 void _patch_selected(const String &p_path); 113 void _patch_deleted(); 114 115 void _runnable_pressed(); 116 void _update_parameters(const String &p_edited_property); 117 void _name_changed(const String &p_string); 118 void _export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing); 119 void _add_preset(int p_platform); 120 void _edit_preset(int p_index); 121 void _duplicate_preset(); 122 void _delete_preset(); 123 void _delete_preset_confirm(); 124 void _update_export_all(); 125 126 void _force_update_current_preset_parameters(); 127 void _update_current_preset(); 128 void _update_presets(); 129 130 void _export_type_changed(int p_which); 131 void _filter_changed(const String &p_filter); 132 void _fill_resource_tree(); 133 bool _fill_tree(EditorFileSystemDirectory *p_dir, TreeItem *p_item, Ref<EditorExportPreset> ¤t, bool p_only_scenes); 134 void _tree_changed(); 135 136 void _patch_button_pressed(Object *p_item, int p_column, int p_id); 137 void _patch_edited(); 138 139 Variant get_drag_data_fw(const Point2 &p_point, Control *p_from); 140 bool can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const; 141 void drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from); 142 143 EditorFileDialog *export_pck_zip; 144 EditorFileDialog *export_project; 145 CheckBox *export_debug; 146 CheckBox *export_pck_zip_debug; 147 148 void _open_export_template_manager(); 149 150 void _export_pck_zip(); 151 void _export_pck_zip_selected(const String &p_path); 152 153 void _validate_export_path(const String &p_path); 154 void _export_project(); 155 void _export_project_to_path(const String &p_path); 156 void _export_all_dialog(); 157 void _export_all_dialog_action(const String &p_str); 158 void _export_all(bool p_debug); 159 160 void _update_feature_list(); 161 void _custom_features_changed(const String &p_text); 162 163 bool updating_script_key; 164 void _script_export_mode_changed(int p_mode); 165 void _script_encryption_key_changed(const String &p_key); 166 bool _validate_script_encryption_key(const String &p_key); 167 168 void _tab_changed(int); 169 170 protected: 171 void _notification(int p_what); 172 static void _bind_methods(); 173 174 public: 175 void popup_export(); 176 177 void set_export_path(const String &p_value); 178 String get_export_path(); 179 180 Ref<EditorExportPreset> get_current_preset() const; 181 182 ProjectExportDialog(); 183 ~ProjectExportDialog(); 184 }; 185 186 #endif // PROJECT_EXPORT_SETTINGS_H 187