Path: blob/master/editor/export/editor_export_preset.h
9903 views
/**************************************************************************/1/* editor_export_preset.h */2/**************************************************************************/3/* This file is part of: */4/* GODOT ENGINE */5/* https://godotengine.org */6/**************************************************************************/7/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */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/**************************************************************************/2930#pragma once3132class EditorExportPlatform;3334#include "core/object/ref_counted.h"3536class EditorExportPreset : public RefCounted {37GDCLASS(EditorExportPreset, RefCounted);3839public:40enum ExportFilter {41EXPORT_ALL_RESOURCES,42EXPORT_SELECTED_SCENES,43EXPORT_SELECTED_RESOURCES,44EXCLUDE_SELECTED_RESOURCES,45EXPORT_CUSTOMIZED,46};4748enum FileExportMode {49MODE_FILE_NOT_CUSTOMIZED,50MODE_FILE_STRIP,51MODE_FILE_KEEP,52MODE_FILE_REMOVE,53};5455enum ScriptExportMode {56MODE_SCRIPT_TEXT,57MODE_SCRIPT_BINARY_TOKENS,58MODE_SCRIPT_BINARY_TOKENS_COMPRESSED,59};6061private:62Ref<EditorExportPlatform> platform;63ExportFilter export_filter = EXPORT_ALL_RESOURCES;64String include_filter;65String exclude_filter;66String export_path;6768String exporter;69HashSet<String> selected_files;70HashMap<String, FileExportMode> customized_files;71bool runnable = false;72bool advanced_options_enabled = false;73bool dedicated_server = false;7475Vector<String> patches;7677friend class EditorExport;78friend class EditorExportPlatform;7980HashMap<StringName, PropertyInfo> properties;81HashMap<StringName, Variant> values;82HashMap<StringName, Variant> value_overrides;83HashMap<StringName, bool> update_visibility;8485String name;8687String custom_features;8889String enc_in_filters;90String enc_ex_filters;91bool enc_pck = false;92bool enc_directory = false;93uint64_t seed = 0;9495String script_key;96int script_mode = MODE_SCRIPT_BINARY_TOKENS_COMPRESSED;9798protected:99bool _set(const StringName &p_name, const Variant &p_value);100bool _get(const StringName &p_name, Variant &r_ret) const;101void _get_property_list(List<PropertyInfo> *p_list) const;102103String _get_property_warning(const StringName &p_name) const;104105static void _bind_methods();106107public:108Ref<EditorExportPlatform> get_platform() const;109110bool has(const StringName &p_property) const { return values.has(p_property); }111112void update_files();113void update_value_overrides();114115Vector<String> get_files_to_export() const;116Dictionary get_customized_files() const;117int get_customized_files_count() const;118void set_customized_files(const Dictionary &p_files);119120void add_export_file(const String &p_path);121void remove_export_file(const String &p_path);122bool has_export_file(const String &p_path);123124void set_file_export_mode(const String &p_path, FileExportMode p_mode);125FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;126127Variant get_project_setting(const StringName &p_name);128129void set_name(const String &p_name);130String get_name() const;131132void set_runnable(bool p_enable);133bool is_runnable() const;134135void set_advanced_options_enabled(bool p_enabled);136bool are_advanced_options_enabled() const;137138void set_dedicated_server(bool p_enable);139bool is_dedicated_server() const;140141void set_export_filter(ExportFilter p_filter);142ExportFilter get_export_filter() const;143144void set_include_filter(const String &p_include);145String get_include_filter() const;146147void set_exclude_filter(const String &p_exclude);148String get_exclude_filter() const;149150void add_patch(const String &p_path, int p_at_pos = -1);151void set_patch(int p_index, const String &p_path);152String get_patch(int p_index);153void remove_patch(int p_index);154void set_patches(const Vector<String> &p_patches);155Vector<String> get_patches() const;156157void set_custom_features(const String &p_custom_features);158String get_custom_features() const;159160void set_export_path(const String &p_path);161String get_export_path() const;162163void set_enc_in_filter(const String &p_filter);164String get_enc_in_filter() const;165166void set_enc_ex_filter(const String &p_filter);167String get_enc_ex_filter() const;168169void set_seed(uint64_t p_seed);170uint64_t get_seed() const;171172void set_enc_pck(bool p_enabled);173bool get_enc_pck() const;174175void set_enc_directory(bool p_enabled);176bool get_enc_directory() const;177178void set_script_encryption_key(const String &p_key);179String get_script_encryption_key() const;180181void set_script_export_mode(int p_mode);182int get_script_export_mode() const;183184Variant _get_or_env(const StringName &p_name, const String &p_env_var) const {185return get_or_env(p_name, p_env_var);186}187Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;188189// Return the preset's version number, or fall back to the190// `application/config/version` project setting if set to an empty string.191// If `p_windows_version` is `true`, formats the returned version number to192// be compatible with Windows executable metadata (which requires a193// 4-component format).194String get_version(const StringName &p_name, bool p_windows_version = false) const;195196const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }197const HashMap<StringName, Variant> &get_values() const { return values; }198};199200VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter);201VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode);202VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode);203204205