editor_export_preset.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /**************************************************************************/
  2. /* editor_export_preset.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. #ifndef EDITOR_EXPORT_PRESET_H
  31. #define EDITOR_EXPORT_PRESET_H
  32. class EditorExportPlatform;
  33. #include "core/object/ref_counted.h"
  34. class EditorExportPreset : public RefCounted {
  35. GDCLASS(EditorExportPreset, RefCounted);
  36. public:
  37. enum ExportFilter {
  38. EXPORT_ALL_RESOURCES,
  39. EXPORT_SELECTED_SCENES,
  40. EXPORT_SELECTED_RESOURCES,
  41. EXCLUDE_SELECTED_RESOURCES,
  42. EXPORT_CUSTOMIZED,
  43. };
  44. enum FileExportMode {
  45. MODE_FILE_NOT_CUSTOMIZED,
  46. MODE_FILE_STRIP,
  47. MODE_FILE_KEEP,
  48. MODE_FILE_REMOVE,
  49. };
  50. private:
  51. Ref<EditorExportPlatform> platform;
  52. ExportFilter export_filter = EXPORT_ALL_RESOURCES;
  53. String include_filter;
  54. String exclude_filter;
  55. String export_path;
  56. String exporter;
  57. HashSet<String> selected_files;
  58. HashMap<String, FileExportMode> customized_files;
  59. bool runnable = false;
  60. bool dedicated_server = false;
  61. friend class EditorExport;
  62. friend class EditorExportPlatform;
  63. HashMap<StringName, PropertyInfo> properties;
  64. HashMap<StringName, Variant> values;
  65. HashMap<StringName, bool> update_visibility;
  66. String name;
  67. String custom_features;
  68. String enc_in_filters;
  69. String enc_ex_filters;
  70. bool enc_pck = false;
  71. bool enc_directory = false;
  72. String script_key;
  73. protected:
  74. bool _set(const StringName &p_name, const Variant &p_value);
  75. bool _get(const StringName &p_name, Variant &r_ret) const;
  76. void _get_property_list(List<PropertyInfo> *p_list) const;
  77. String _get_property_warning(const StringName &p_name) const;
  78. static void _bind_methods();
  79. public:
  80. Ref<EditorExportPlatform> get_platform() const;
  81. bool has(const StringName &p_property) const { return values.has(p_property); }
  82. void update_files();
  83. Vector<String> get_files_to_export() const;
  84. Dictionary get_customized_files() const;
  85. int get_customized_files_count() const;
  86. void set_customized_files(const Dictionary &p_files);
  87. void add_export_file(const String &p_path);
  88. void remove_export_file(const String &p_path);
  89. bool has_export_file(const String &p_path);
  90. void set_file_export_mode(const String &p_path, FileExportMode p_mode);
  91. FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;
  92. void set_name(const String &p_name);
  93. String get_name() const;
  94. void set_runnable(bool p_enable);
  95. bool is_runnable() const;
  96. void set_dedicated_server(bool p_enable);
  97. bool is_dedicated_server() const;
  98. void set_export_filter(ExportFilter p_filter);
  99. ExportFilter get_export_filter() const;
  100. void set_include_filter(const String &p_include);
  101. String get_include_filter() const;
  102. void set_exclude_filter(const String &p_exclude);
  103. String get_exclude_filter() const;
  104. void set_custom_features(const String &p_custom_features);
  105. String get_custom_features() const;
  106. void set_export_path(const String &p_path);
  107. String get_export_path() const;
  108. void set_enc_in_filter(const String &p_filter);
  109. String get_enc_in_filter() const;
  110. void set_enc_ex_filter(const String &p_filter);
  111. String get_enc_ex_filter() const;
  112. void set_enc_pck(bool p_enabled);
  113. bool get_enc_pck() const;
  114. void set_enc_directory(bool p_enabled);
  115. bool get_enc_directory() const;
  116. void set_script_encryption_key(const String &p_key);
  117. String get_script_encryption_key() const;
  118. Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;
  119. const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }
  120. const HashMap<StringName, Variant> &get_values() const { return values; }
  121. EditorExportPreset();
  122. };
  123. #endif // EDITOR_EXPORT_PRESET_H