Path: blob/master/editor/export/editor_export_plugin.h
9902 views
/**************************************************************************/1/* editor_export_plugin.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 once3132#include "core/os/shared_object.h"33#include "editor_export_platform.h"34#include "editor_export_preset.h"35#include "scene/main/node.h"3637class EditorExportPlugin : public RefCounted {38GDCLASS(EditorExportPlugin, RefCounted);3940friend class EditorExport;41friend class EditorExportPlatform;42friend class EditorExportPreset;4344String export_base_path;45Ref<EditorExportPreset> export_preset;4647Vector<SharedObject> shared_objects;48struct ExtraFile {49String path;50Vector<uint8_t> data;51bool remap = false;52};53Vector<ExtraFile> extra_files;54bool skipped = false;5556Vector<String> apple_embedded_platform_frameworks;57Vector<String> apple_embedded_platform_embedded_frameworks;58Vector<String> apple_embedded_platform_project_static_libs;59String apple_embedded_platform_plist_content;60String apple_embedded_platform_linker_flags;61Vector<String> apple_embedded_platform_bundle_files;62String apple_embedded_platform_cpp_code;6364Vector<String> macos_plugin_files;6566_FORCE_INLINE_ void _clear() {67shared_objects.clear();68extra_files.clear();69skipped = false;70}7172_FORCE_INLINE_ void _export_end_clear() {73apple_embedded_platform_frameworks.clear();74apple_embedded_platform_embedded_frameworks.clear();75apple_embedded_platform_bundle_files.clear();76apple_embedded_platform_plist_content = "";77apple_embedded_platform_linker_flags = "";78apple_embedded_platform_cpp_code = "";79macos_plugin_files.clear();80}8182// Export83void _export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features);84void _export_begin_script(const Vector<String> &p_features, bool p_debug, const String &p_path, int p_flags);85void _export_end_script();8687String _has_valid_export_configuration(const Ref<EditorExportPlatform> &p_export_platform, const Ref<EditorExportPreset> &p_preset);8889protected:90void set_export_base_path(const String &p_export_base_path);91const String &get_export_base_path() const;92void set_export_preset(const Ref<EditorExportPreset> &p_preset);93Ref<EditorExportPreset> get_export_preset() const;94Ref<EditorExportPlatform> get_export_platform() const;9596void add_file(const String &p_path, const Vector<uint8_t> &p_file, bool p_remap);97void add_shared_object(const String &p_path, const Vector<String> &tags, const String &p_target = String());98void _add_shared_object(const SharedObject &p_shared_object);99100void add_apple_embedded_platform_framework(const String &p_path);101void add_apple_embedded_platform_embedded_framework(const String &p_path);102void add_apple_embedded_platform_project_static_lib(const String &p_path);103void add_apple_embedded_platform_plist_content(const String &p_plist_content);104void add_apple_embedded_platform_linker_flags(const String &p_flags);105void add_apple_embedded_platform_bundle_file(const String &p_path);106void add_apple_embedded_platform_cpp_code(const String &p_code);107void add_macos_plugin_file(const String &p_path);108109void skip();110111virtual void _export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features);112virtual void _export_begin(const HashSet<String> &p_features, bool p_debug, const String &p_path, int p_flags);113virtual void _export_end();114115static void _bind_methods();116117GDVIRTUAL3(_export_file, String, String, Vector<String>)118GDVIRTUAL4(_export_begin, Vector<String>, bool, String, uint32_t)119GDVIRTUAL0(_export_end)120121GDVIRTUAL2RC(bool, _begin_customize_resources, const Ref<EditorExportPlatform> &, const Vector<String> &)122GDVIRTUAL2R_REQUIRED(Ref<Resource>, _customize_resource, const Ref<Resource> &, String)123124GDVIRTUAL2RC(bool, _begin_customize_scenes, const Ref<EditorExportPlatform> &, const Vector<String> &)125GDVIRTUAL2R_REQUIRED(Node *, _customize_scene, Node *, String)126GDVIRTUAL0RC_REQUIRED(uint64_t, _get_customization_configuration_hash)127128GDVIRTUAL0(_end_customize_scenes)129GDVIRTUAL0(_end_customize_resources)130131GDVIRTUAL2RC(PackedStringArray, _get_export_features, const Ref<EditorExportPlatform> &, bool);132GDVIRTUAL1RC(TypedArray<Dictionary>, _get_export_options, const Ref<EditorExportPlatform> &);133GDVIRTUAL1RC(Dictionary, _get_export_options_overrides, const Ref<EditorExportPlatform> &);134GDVIRTUAL1RC(bool, _should_update_export_options, const Ref<EditorExportPlatform> &);135GDVIRTUAL2RC(bool, _get_export_option_visibility, const Ref<EditorExportPlatform> &, String);136GDVIRTUAL2RC(String, _get_export_option_warning, const Ref<EditorExportPlatform> &, String);137138GDVIRTUAL0RC_REQUIRED(String, _get_name)139140GDVIRTUAL1RC(bool, _supports_platform, const Ref<EditorExportPlatform> &);141142GDVIRTUAL2RC(PackedStringArray, _get_android_dependencies, const Ref<EditorExportPlatform> &, bool);143GDVIRTUAL2RC(PackedStringArray, _get_android_dependencies_maven_repos, const Ref<EditorExportPlatform> &, bool);144GDVIRTUAL2RC(PackedStringArray, _get_android_libraries, const Ref<EditorExportPlatform> &, bool);145GDVIRTUAL2RC(String, _get_android_manifest_activity_element_contents, const Ref<EditorExportPlatform> &, bool);146GDVIRTUAL2RC(String, _get_android_manifest_application_element_contents, const Ref<EditorExportPlatform> &, bool);147GDVIRTUAL2RC(String, _get_android_manifest_element_contents, const Ref<EditorExportPlatform> &, bool);148GDVIRTUAL2RC(PackedByteArray, _update_android_prebuilt_manifest, const Ref<EditorExportPlatform> &, const PackedByteArray &);149150virtual bool _begin_customize_resources(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization151virtual 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.152153virtual bool _begin_customize_scenes(const Ref<EditorExportPlatform> &p_platform, const Vector<String> &p_features); // Return true if this plugin does property export customization154virtual Node *_customize_scene(Node *p_root, const String &p_path); // Return true if a change was made155156virtual uint64_t _get_customization_configuration_hash() const; // Hash used for caching customized resources and scenes.157158virtual void _end_customize_scenes();159virtual void _end_customize_resources();160161virtual PackedStringArray _get_export_features(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;162virtual void _get_export_options(const Ref<EditorExportPlatform> &p_export_platform, List<EditorExportPlatform::ExportOption> *r_options) const;163virtual Dictionary _get_export_options_overrides(const Ref<EditorExportPlatform> &p_export_platform) const;164virtual bool _should_update_export_options(const Ref<EditorExportPlatform> &p_export_platform) const;165virtual bool _get_export_option_visibility(const Ref<EditorExportPlatform> &p_export_platform, const String &p_option_name) const;166virtual String _get_export_option_warning(const Ref<EditorExportPlatform> &p_export_platform, const String &p_option_name) const;167168public:169virtual String get_name() const;170171virtual bool supports_platform(const Ref<EditorExportPlatform> &p_export_platform) const;172PackedStringArray get_export_features(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;173174virtual PackedStringArray get_android_dependencies(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;175virtual PackedStringArray get_android_dependencies_maven_repos(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;176virtual PackedStringArray get_android_libraries(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;177virtual String get_android_manifest_activity_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;178virtual String get_android_manifest_application_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;179virtual String get_android_manifest_element_contents(const Ref<EditorExportPlatform> &p_export_platform, bool p_debug) const;180virtual PackedByteArray update_android_prebuilt_manifest(const Ref<EditorExportPlatform> &p_export_platform, const PackedByteArray &p_manifest_data) const;181182Vector<String> get_apple_embedded_platform_frameworks() const;183Vector<String> get_apple_embedded_platform_embedded_frameworks() const;184Vector<String> get_apple_embedded_platform_project_static_libs() const;185String get_apple_embedded_platform_plist_content() const;186String get_apple_embedded_platform_linker_flags() const;187Vector<String> get_apple_embedded_platform_bundle_files() const;188String get_apple_embedded_platform_cpp_code() const;189const Vector<String> &get_macos_plugin_files() const;190Variant get_option(const StringName &p_name) const;191};192193194