Path: blob/master/editor/export/editor_export_preset.h
21100 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 dedicated_server = false;7273Vector<String> patches;74bool patch_delta_encoding_enabled = false;75int patch_delta_zstd_level = 19;76double patch_delta_min_reduction = 0.1;77String patch_delta_include_filter = "*";78String patch_delta_exclude_filter;7980friend class EditorExport;81friend class EditorExportPlatform;8283HashMap<StringName, PropertyInfo> properties;84HashMap<StringName, Variant> values;85HashMap<StringName, Variant> value_overrides;86HashMap<StringName, bool> update_visibility;8788String name;8990String custom_features;9192String enc_in_filters;93String enc_ex_filters;94bool enc_pck = false;95bool enc_directory = false;96uint64_t seed = 0;9798String script_key;99ScriptExportMode script_mode = MODE_SCRIPT_BINARY_TOKENS_COMPRESSED;100101protected:102bool _set(const StringName &p_name, const Variant &p_value);103bool _get(const StringName &p_name, Variant &r_ret) const;104void _get_property_list(List<PropertyInfo> *p_list) const;105106String _get_property_warning(const StringName &p_name) const;107108static void _bind_methods();109110#ifndef DISABLE_DEPRECATED111int _get_script_export_mode_bind_compat_107167() const;112static void _bind_compatibility_methods();113#endif114115public:116Ref<EditorExportPlatform> get_platform() const;117118bool has(const StringName &p_property) const { return values.has(p_property); }119120void update_files();121void update_value_overrides();122123Vector<String> get_files_to_export() const;124HashSet<String> get_selected_files() const;125void set_selected_files(const HashSet<String> &p_files);126Dictionary get_customized_files() const;127int get_customized_files_count() const;128void set_customized_files(const Dictionary &p_files);129130void add_export_file(const String &p_path);131void remove_export_file(const String &p_path);132bool has_export_file(const String &p_path);133134void set_file_export_mode(const String &p_path, FileExportMode p_mode);135FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;136137Variant get_project_setting(const StringName &p_name);138139void set_name(const String &p_name);140String get_name() const;141142void set_runnable(bool p_enable);143bool is_runnable() const;144145bool are_advanced_options_enabled() const;146147void set_dedicated_server(bool p_enable);148bool is_dedicated_server() const;149150void set_export_filter(ExportFilter p_filter);151ExportFilter get_export_filter() const;152153void set_include_filter(const String &p_include);154String get_include_filter() const;155156void set_exclude_filter(const String &p_exclude);157String get_exclude_filter() const;158159void add_patch(const String &p_path, int p_at_pos = -1);160void set_patch(int p_index, const String &p_path);161162String get_patch(int p_index);163void remove_patch(int p_index);164165void set_patches(const Vector<String> &p_patches);166Vector<String> get_patches() const;167168void set_patch_delta_encoding_enabled(bool p_enable);169bool is_patch_delta_encoding_enabled() const;170171void set_patch_delta_zstd_level(int p_level);172int get_patch_delta_zstd_level() const;173174void set_patch_delta_min_reduction(double p_ratio);175double get_patch_delta_min_reduction() const;176177void set_patch_delta_include_filter(const String &p_filter);178String get_patch_delta_include_filter() const;179180void set_patch_delta_exclude_filter(const String &p_filter);181String get_patch_delta_exclude_filter() const;182183void set_custom_features(const String &p_custom_features);184String get_custom_features() const;185186void set_export_path(const String &p_path);187String get_export_path() const;188189void set_enc_in_filter(const String &p_filter);190String get_enc_in_filter() const;191192void set_enc_ex_filter(const String &p_filter);193String get_enc_ex_filter() const;194195void set_seed(uint64_t p_seed);196uint64_t get_seed() const;197198void set_enc_pck(bool p_enabled);199bool get_enc_pck() const;200201void set_enc_directory(bool p_enabled);202bool get_enc_directory() const;203204void set_script_encryption_key(const String &p_key);205String get_script_encryption_key() const;206207void set_script_export_mode(ScriptExportMode p_mode);208ScriptExportMode get_script_export_mode() const;209210Variant _get_or_env(const StringName &p_name, const String &p_env_var) const {211return get_or_env(p_name, p_env_var);212}213Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;214215// Return the preset's version number, or fall back to the216// `application/config/version` project setting if set to an empty string.217// If `p_windows_version` is `true`, formats the returned version number to218// be compatible with Windows executable metadata (which requires a219// 4-component format).220String get_version(const StringName &p_name, bool p_windows_version = false) const;221222const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }223const HashMap<StringName, Variant> &get_values() const { return values; }224};225226VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter);227VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode);228VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode);229230231