diff options
author | RedworkDE <10944644+RedworkDE@users.noreply.github.com> | 2023-02-08 13:36:02 +0100 |
---|---|---|
committer | RedworkDE <10944644+RedworkDE@users.noreply.github.com> | 2023-04-07 19:18:00 +0200 |
commit | 6963e84b58b72d6103c4ddb38c80173a62df7bf4 (patch) | |
tree | 9f8e940eac48903e29ad932f93611cbdb8036c35 /editor/export/editor_export_plugin.cpp | |
parent | c151d3231f8e5d207f64055c60c70967dd5351b5 (diff) | |
download | redot-engine-6963e84b58b72d6103c4ddb38c80173a62df7bf4.tar.gz |
Allow EditorExportPlugins to provide export options
Diffstat (limited to 'editor/export/editor_export_plugin.cpp')
-rw-r--r-- | editor/export/editor_export_plugin.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp index 5887befcd8..4e2c1a9af7 100644 --- a/editor/export/editor_export_plugin.cpp +++ b/editor/export/editor_export_plugin.cpp @@ -127,6 +127,11 @@ Vector<String> EditorExportPlugin::get_ios_project_static_libs() const { return ios_project_static_libs; } +Variant EditorExportPlugin::get_option(const StringName &p_name) const { + ERR_FAIL_NULL_V(export_preset, Variant()); + return export_preset->get(p_name); +} + void EditorExportPlugin::_export_file_script(const String &p_path, const String &p_type, const Vector<String> &p_features) { GDVIRTUAL_CALL(_export_file, p_path, p_type, p_features); } @@ -191,6 +196,26 @@ PackedStringArray EditorExportPlugin::_get_export_features(const Ref<EditorExpor return ret; } +void EditorExportPlugin::_get_export_options(const Ref<EditorExportPlatform> &p_platform, List<EditorExportPlatform::ExportOption> *r_options) const { + TypedArray<Dictionary> ret; + GDVIRTUAL_CALL(_get_export_options, p_platform, ret); + for (int i = 0; i < ret.size(); i++) { + Dictionary option = ret[i]; + ERR_CONTINUE_MSG(!option.has("option"), "Missing required element 'option'"); + ERR_CONTINUE_MSG(!option.has("default_value"), "Missing required element 'default_value'"); + PropertyInfo property_info = PropertyInfo::from_dict(option["option"]); + Variant default_value = option["default_value"]; + bool update_visibility = option.has("update_visibility") && option["update_visibility"]; + r_options->push_back(EditorExportPlatform::ExportOption(property_info, default_value, update_visibility)); + } +} + +bool EditorExportPlugin::_should_update_export_options(const Ref<EditorExportPlatform> &p_platform) const { + bool ret = false; + GDVIRTUAL_CALL(_should_update_export_options, p_platform, ret); + return ret; +} + void EditorExportPlugin::_export_file(const String &p_path, const String &p_type, const HashSet<String> &p_features) { } @@ -213,6 +238,7 @@ void EditorExportPlugin::_bind_methods() { ClassDB::bind_method(D_METHOD("add_ios_cpp_code", "code"), &EditorExportPlugin::add_ios_cpp_code); ClassDB::bind_method(D_METHOD("add_macos_plugin_file", "path"), &EditorExportPlugin::add_macos_plugin_file); ClassDB::bind_method(D_METHOD("skip"), &EditorExportPlugin::skip); + ClassDB::bind_method(D_METHOD("get_option", "name"), &EditorExportPlugin::get_option); GDVIRTUAL_BIND(_export_file, "path", "type", "features"); GDVIRTUAL_BIND(_export_begin, "features", "is_debug", "path", "flags"); @@ -229,6 +255,9 @@ void EditorExportPlugin::_bind_methods() { GDVIRTUAL_BIND(_end_customize_scenes); GDVIRTUAL_BIND(_end_customize_resources); + GDVIRTUAL_BIND(_get_export_options, "platform"); + GDVIRTUAL_BIND(_should_update_export_options, "platform"); + GDVIRTUAL_BIND(_get_export_features, "platform", "debug"); GDVIRTUAL_BIND(_get_name); } |