Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
godotengine
GitHub Repository: godotengine/godot
Path: blob/master/editor/export/editor_export_plugin.h
9902 views
1
/**************************************************************************/
2
/* editor_export_plugin.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
31
#pragma once
32
33
#include "core/os/shared_object.h"
34
#include "editor_export_platform.h"
35
#include "editor_export_preset.h"
36
#include "scene/main/node.h"
37
38
class EditorExportPlugin : public RefCounted {
39
GDCLASS(EditorExportPlugin, RefCounted);
40
41
friend class EditorExport;
42
friend class EditorExportPlatform;
43
friend class EditorExportPreset;
44
45
String export_base_path;
46
Ref<EditorExportPreset> export_preset;
47
48
Vector<SharedObject> shared_objects;
49
struct ExtraFile {
50
String path;
51
Vector<uint8_t> data;
52
bool remap = false;
53
};
54
Vector<ExtraFile> extra_files;
55
bool skipped = false;
56
57
Vector<String> apple_embedded_platform_frameworks;
58
Vector<String> apple_embedded_platform_embedded_frameworks;
59
Vector<String> apple_embedded_platform_project_static_libs;
60
String apple_embedded_platform_plist_content;
61
String apple_embedded_platform_linker_flags;
62
Vector<String> apple_embedded_platform_bundle_files;
63
String apple_embedded_platform_cpp_code;
64
65
Vector<String> macos_plugin_files;
66
67
_FORCE_INLINE_ void _clear() {
68
shared_objects.clear();
69
extra_files.clear();
70
skipped = false;
71
}
72
73
_FORCE_INLINE_ void _export_end_clear() {
74
apple_embedded_platform_frameworks.clear();
75
apple_embedded_platform_embedded_frameworks.clear();
76
apple_embedded_platform_bundle_files.clear();
77
apple_embedded_platform_plist_content = "";
78
apple_embedded_platform_linker_flags = "";
79
apple_embedded_platform_cpp_code = "";
80
macos_plugin_files.clear();
81
}
82
83
// Export
84
void _export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features);
85
void _export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags);
86
void _export_end_script();
87
88
String _has_valid_export_configuration(const Ref<EditorExportPlatform> &p_export_platform, const Ref<EditorExportPreset> &p_preset);
89
90
protected:
91
void set_export_base_path(const String &p_export_base_path);
92
const String &get_export_base_path() const;
93
void set_export_preset(const Ref<EditorExportPreset> &p_preset);
94
Ref<EditorExportPreset> get_export_preset() const;
95
Ref<EditorExportPlatform> get_export_platform() const;
96
97
void add_file(const String &p_path, const Vector<uint8_t> &p_file, bool p_remap);
98
void add_shared_object(const String &p_path, const Vector<String> &tags, const String &p_target = String());
99
void _add_shared_object(const SharedObject &p_shared_object);
100
101
void add_apple_embedded_platform_framework(const String &p_path);
102
void add_apple_embedded_platform_embedded_framework(const String &p_path);
103
void add_apple_embedded_platform_project_static_lib(const String &p_path);
104
void add_apple_embedded_platform_plist_content(const String &p_plist_content);
105
void add_apple_embedded_platform_linker_flags(const String &p_flags);
106
void add_apple_embedded_platform_bundle_file(const String &p_path);
107
void add_apple_embedded_platform_cpp_code(const String &p_code);
108
void add_macos_plugin_file(const String &p_path);
109
110
void skip();
111
112
virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features);
113
virtual void _export_begin(const HashSet<String> &p_features, bool p_debug, const String &p_path, int p_flags);
114
virtual void _export_end();
115
116
static void _bind_methods();
117
118
GDVIRTUAL3(_export_file, String, String, Vector<String>)
119
GDVIRTUAL4(_export_begin, Vector<String>, bool, String, uint32_t)
120
GDVIRTUAL0(_export_end)
121
122
GDVIRTUAL2RC(bool, _begin_customize_resources, const Ref<EditorExportPlatform> &, const Vector<String> &)
123
GDVIRTUAL2R_REQUIRED(Ref<Resource>, _customize_resource, const Ref<Resource> &, String)
124
125
GDVIRTUAL2RC(bool, _begin_customize_scenes, const Ref<EditorExportPlatform> &, const Vector<String> &)
126
GDVIRTUAL2R_REQUIRED(Node *, _customize_scene, Node *, String)
127
GDVIRTUAL0RC_REQUIRED(uint64_t, _get_customization_configuration_hash)
128
129
GDVIRTUAL0(_end_customize_scenes)
130
GDVIRTUAL0(_end_customize_resources)
131
132
GDVIRTUAL2RC(PackedStringArray, _get_export_features, const Ref<EditorExportPlatform> &, bool);
133
GDVIRTUAL1RC(TypedArray<Dictionary>, _get_export_options, const Ref<EditorExportPlatform> &);
134
GDVIRTUAL1RC(Dictionary, _get_export_options_overrides, const Ref<EditorExportPlatform> &);
135
GDVIRTUAL1RC(bool, _should_update_export_options, const Ref<EditorExportPlatform> &);
136
GDVIRTUAL2RC(bool, _get_export_option_visibility, const Ref<EditorExportPlatform> &, String);
137
GDVIRTUAL2RC(String, _get_export_option_warning, const Ref<EditorExportPlatform> &, String);
138
139
GDVIRTUAL0RC_REQUIRED(String, _get_name)
140
141
GDVIRTUAL1RC(bool, _supports_platform, const Ref<EditorExportPlatform> &);
142
143
GDVIRTUAL2RC(PackedStringArray, _get_android_dependencies, const Ref<EditorExportPlatform> &, bool);
144
GDVIRTUAL2RC(PackedStringArray, _get_android_dependencies_maven_repos, const Ref<EditorExportPlatform> &, bool);
145
GDVIRTUAL2RC(PackedStringArray, _get_android_libraries, const Ref<EditorExportPlatform> &, bool);
146
GDVIRTUAL2RC(String, _get_android_manifest_activity_element_contents, const Ref<EditorExportPlatform> &, bool);
147
GDVIRTUAL2RC(String, _get_android_manifest_application_element_contents, const Ref<EditorExportPlatform> &, bool);
148
GDVIRTUAL2RC(String, _get_android_manifest_element_contents, const Ref<EditorExportPlatform> &, bool);
149
GDVIRTUAL2RC(PackedByteArray, _update_android_prebuilt_manifest, const Ref<EditorExportPlatform> &, const PackedByteArray &);
150
151
virtual bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization
152
virtual Ref<Resource> _customize_resource(const Ref<Resource> &p_resource, const String &p_path); // If nothing is returned, it means do not touch (nothing changed). If something is returned (either the same or a different resource) it means changes are made.
153
154
virtual bool _begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization
155
virtual Node *_customize_scene(Node *p_root, const String &p_path); // Return true if a change was made
156
157
virtual uint64_t _get_customization_configuration_hash() const; // Hash used for caching customized resources and scenes.
158
159
virtual void _end_customize_scenes();
160
virtual void _end_customize_resources();
161
162
virtual PackedStringArray _get_export_features(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
163
virtual void _get_export_options(const Ref<EditorExportPlatform> &p_export_platform, List<EditorExportPlatform::ExportOption> *r_options) const;
164
virtual Dictionary _get_export_options_overrides(const Ref<EditorExportPlatform> &p_export_platform) const;
165
virtual bool _should_update_export_options(const Ref<EditorExportPlatform> &p_export_platform) const;
166
virtual bool _get_export_option_visibility(const Ref<EditorExportPlatform> &p_export_platform, const String &p_option_name) const;
167
virtual String _get_export_option_warning(const Ref<EditorExportPlatform> &p_export_platform, const String &p_option_name) const;
168
169
public:
170
virtual String get_name() const;
171
172
virtual bool supports_platform(const Ref<EditorExportPlatform> &p_export_platform) const;
173
PackedStringArray get_export_features(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
174
175
virtual PackedStringArray get_android_dependencies(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
176
virtual PackedStringArray get_android_dependencies_maven_repos(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
177
virtual PackedStringArray get_android_libraries(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
178
virtual String get_android_manifest_activity_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
179
virtual String get_android_manifest_application_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
180
virtual String get_android_manifest_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;
181
virtual PackedByteArray update_android_prebuilt_manifest(const Ref<EditorExportPlatform> &p_export_platform, const PackedByteArray &p_manifest_data) const;
182
183
Vector<String> get_apple_embedded_platform_frameworks() const;
184
Vector<String> get_apple_embedded_platform_embedded_frameworks() const;
185
Vector<String> get_apple_embedded_platform_project_static_libs() const;
186
String get_apple_embedded_platform_plist_content() const;
187
String get_apple_embedded_platform_linker_flags() const;
188
Vector<String> get_apple_embedded_platform_bundle_files() const;
189
String get_apple_embedded_platform_cpp_code() const;
190
const Vector<String> &get_macos_plugin_files() const;
191
Variant get_option(const StringName &p_name) const;
192
};
193
194