1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Allow EditorExportPlugins to provide export options

This commit is contained in:
RedworkDE
2023-02-08 13:36:02 +01:00
parent c151d3231f
commit 6963e84b58
5 changed files with 79 additions and 4 deletions

View File

@@ -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);
}