2022-07-17 17:24:37 +00:00
|
|
|
/**************************************************************************/
|
|
|
|
/* editor_export_preset.h */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* This file is part of: */
|
|
|
|
/* GODOT ENGINE */
|
|
|
|
/* https://godotengine.org */
|
|
|
|
/**************************************************************************/
|
|
|
|
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
|
|
|
|
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
|
|
|
|
/* */
|
|
|
|
/* Permission is hereby granted, free of charge, to any person obtaining */
|
|
|
|
/* a copy of this software and associated documentation files (the */
|
|
|
|
/* "Software"), to deal in the Software without restriction, including */
|
|
|
|
/* without limitation the rights to use, copy, modify, merge, publish, */
|
|
|
|
/* distribute, sublicense, and/or sell copies of the Software, and to */
|
|
|
|
/* permit persons to whom the Software is furnished to do so, subject to */
|
|
|
|
/* the following conditions: */
|
|
|
|
/* */
|
|
|
|
/* The above copyright notice and this permission notice shall be */
|
|
|
|
/* included in all copies or substantial portions of the Software. */
|
|
|
|
/* */
|
|
|
|
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
|
|
|
|
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
|
|
|
|
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
|
|
|
|
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
|
|
|
|
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
|
|
|
|
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
|
|
|
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
#ifndef EDITOR_EXPORT_PRESET_H
|
|
|
|
#define EDITOR_EXPORT_PRESET_H
|
|
|
|
|
|
|
|
class EditorExportPlatform;
|
|
|
|
|
|
|
|
#include "core/object/ref_counted.h"
|
|
|
|
|
|
|
|
class EditorExportPreset : public RefCounted {
|
|
|
|
GDCLASS(EditorExportPreset, RefCounted);
|
|
|
|
|
|
|
|
public:
|
|
|
|
enum ExportFilter {
|
|
|
|
EXPORT_ALL_RESOURCES,
|
|
|
|
EXPORT_SELECTED_SCENES,
|
|
|
|
EXPORT_SELECTED_RESOURCES,
|
|
|
|
EXCLUDE_SELECTED_RESOURCES,
|
2022-12-20 21:49:11 +00:00
|
|
|
EXPORT_CUSTOMIZED,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum FileExportMode {
|
|
|
|
MODE_FILE_NOT_CUSTOMIZED,
|
|
|
|
MODE_FILE_STRIP,
|
|
|
|
MODE_FILE_KEEP,
|
|
|
|
MODE_FILE_REMOVE,
|
2022-07-17 17:24:37 +00:00
|
|
|
};
|
|
|
|
|
2024-01-22 14:31:55 +00:00
|
|
|
enum ScriptExportMode {
|
|
|
|
MODE_SCRIPT_TEXT,
|
|
|
|
MODE_SCRIPT_BINARY_TOKENS,
|
2024-01-26 17:49:31 +00:00
|
|
|
MODE_SCRIPT_BINARY_TOKENS_COMPRESSED,
|
2024-01-22 14:31:55 +00:00
|
|
|
};
|
|
|
|
|
2022-07-17 17:24:37 +00:00
|
|
|
private:
|
|
|
|
Ref<EditorExportPlatform> platform;
|
|
|
|
ExportFilter export_filter = EXPORT_ALL_RESOURCES;
|
|
|
|
String include_filter;
|
|
|
|
String exclude_filter;
|
|
|
|
String export_path;
|
|
|
|
|
|
|
|
String exporter;
|
|
|
|
HashSet<String> selected_files;
|
2022-12-20 21:49:11 +00:00
|
|
|
HashMap<String, FileExportMode> customized_files;
|
2022-07-17 17:24:37 +00:00
|
|
|
bool runnable = false;
|
2022-12-20 21:49:11 +00:00
|
|
|
bool dedicated_server = false;
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
friend class EditorExport;
|
|
|
|
friend class EditorExportPlatform;
|
|
|
|
|
2023-07-04 13:39:23 +00:00
|
|
|
HashMap<StringName, PropertyInfo> properties;
|
2022-07-17 17:24:37 +00:00
|
|
|
HashMap<StringName, Variant> values;
|
2024-02-12 22:16:48 +00:00
|
|
|
HashMap<StringName, Variant> value_overrides;
|
2022-08-09 15:51:43 +00:00
|
|
|
HashMap<StringName, bool> update_visibility;
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
String name;
|
|
|
|
|
|
|
|
String custom_features;
|
|
|
|
|
|
|
|
String enc_in_filters;
|
|
|
|
String enc_ex_filters;
|
|
|
|
bool enc_pck = false;
|
|
|
|
bool enc_directory = false;
|
|
|
|
|
|
|
|
String script_key;
|
2024-01-26 17:49:31 +00:00
|
|
|
int script_mode = MODE_SCRIPT_BINARY_TOKENS_COMPRESSED;
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool _set(const StringName &p_name, const Variant &p_value);
|
|
|
|
bool _get(const StringName &p_name, Variant &r_ret) const;
|
|
|
|
void _get_property_list(List<PropertyInfo> *p_list) const;
|
|
|
|
|
2023-03-09 08:41:52 +00:00
|
|
|
String _get_property_warning(const StringName &p_name) const;
|
|
|
|
|
|
|
|
static void _bind_methods();
|
|
|
|
|
2022-07-17 17:24:37 +00:00
|
|
|
public:
|
|
|
|
Ref<EditorExportPlatform> get_platform() const;
|
|
|
|
|
|
|
|
bool has(const StringName &p_property) const { return values.has(p_property); }
|
|
|
|
|
2022-12-20 21:49:11 +00:00
|
|
|
void update_files();
|
2024-02-12 22:16:48 +00:00
|
|
|
void update_value_overrides();
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
Vector<String> get_files_to_export() const;
|
2022-12-20 21:49:11 +00:00
|
|
|
Dictionary get_customized_files() const;
|
|
|
|
int get_customized_files_count() const;
|
|
|
|
void set_customized_files(const Dictionary &p_files);
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
void add_export_file(const String &p_path);
|
|
|
|
void remove_export_file(const String &p_path);
|
|
|
|
bool has_export_file(const String &p_path);
|
|
|
|
|
2022-12-20 21:49:11 +00:00
|
|
|
void set_file_export_mode(const String &p_path, FileExportMode p_mode);
|
|
|
|
FileExportMode get_file_export_mode(const String &p_path, FileExportMode p_default = MODE_FILE_NOT_CUSTOMIZED) const;
|
|
|
|
|
2022-07-17 17:24:37 +00:00
|
|
|
void set_name(const String &p_name);
|
|
|
|
String get_name() const;
|
|
|
|
|
|
|
|
void set_runnable(bool p_enable);
|
|
|
|
bool is_runnable() const;
|
|
|
|
|
2022-12-20 21:49:11 +00:00
|
|
|
void set_dedicated_server(bool p_enable);
|
|
|
|
bool is_dedicated_server() const;
|
|
|
|
|
2022-07-17 17:24:37 +00:00
|
|
|
void set_export_filter(ExportFilter p_filter);
|
|
|
|
ExportFilter get_export_filter() const;
|
|
|
|
|
|
|
|
void set_include_filter(const String &p_include);
|
|
|
|
String get_include_filter() const;
|
|
|
|
|
|
|
|
void set_exclude_filter(const String &p_exclude);
|
|
|
|
String get_exclude_filter() const;
|
|
|
|
|
|
|
|
void set_custom_features(const String &p_custom_features);
|
|
|
|
String get_custom_features() const;
|
|
|
|
|
|
|
|
void set_export_path(const String &p_path);
|
|
|
|
String get_export_path() const;
|
|
|
|
|
|
|
|
void set_enc_in_filter(const String &p_filter);
|
|
|
|
String get_enc_in_filter() const;
|
|
|
|
|
|
|
|
void set_enc_ex_filter(const String &p_filter);
|
|
|
|
String get_enc_ex_filter() const;
|
|
|
|
|
|
|
|
void set_enc_pck(bool p_enabled);
|
|
|
|
bool get_enc_pck() const;
|
|
|
|
|
|
|
|
void set_enc_directory(bool p_enabled);
|
|
|
|
bool get_enc_directory() const;
|
|
|
|
|
|
|
|
void set_script_encryption_key(const String &p_key);
|
|
|
|
String get_script_encryption_key() const;
|
|
|
|
|
2024-01-22 14:31:55 +00:00
|
|
|
void set_script_export_mode(int p_mode);
|
|
|
|
int get_script_export_mode() const;
|
|
|
|
|
2023-05-10 09:40:17 +00:00
|
|
|
Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;
|
|
|
|
|
2023-07-17 07:53:45 +00:00
|
|
|
// Return the preset's version number, or fall back to the
|
|
|
|
// `application/config/version` project setting if set to an empty string.
|
|
|
|
// If `p_windows_version` is `true`, formats the returned version number to
|
|
|
|
// be compatible with Windows executable metadata (which requires a
|
|
|
|
// 4-component format).
|
|
|
|
String get_version(const StringName &p_name, bool p_windows_version = false) const;
|
|
|
|
|
2023-07-04 13:39:23 +00:00
|
|
|
const HashMap<StringName, PropertyInfo> &get_properties() const { return properties; }
|
|
|
|
const HashMap<StringName, Variant> &get_values() const { return values; }
|
2022-07-17 17:24:37 +00:00
|
|
|
|
|
|
|
EditorExportPreset();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDITOR_EXPORT_PRESET_H
|