From 5afc311783609cdc0d09f191b43372692c86df0d Mon Sep 17 00:00:00 2001 From: Daylily-Zeleen Date: Thu, 2 Feb 2023 15:25:53 +0800 Subject: [PATCH] Provide ability to override _export_end() in cpp. --- editor/export/editor_export_platform.cpp | 4 +++- editor/export/editor_export_plugin.cpp | 2 ++ editor/export/editor_export_plugin.h | 3 ++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 4e173799115f..767278bb0930 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -512,8 +512,10 @@ EditorExportPlatform::ExportNotifier::~ExportNotifier() { for (int i = 0; i < export_plugins.size(); i++) { if (export_plugins[i]->get_script_instance()) { export_plugins.write[i]->_export_end_script(); + } else { + export_plugins.write[i]->_export_end(); } - export_plugins.write[i]->_export_end(); + export_plugins.write[i]->_export_end_clear(); export_plugins.write[i]->set_export_preset(Ref()); } } diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp index 4e2c1a9af72a..dd30078c7654 100644 --- a/editor/export/editor_export_plugin.cpp +++ b/editor/export/editor_export_plugin.cpp @@ -222,6 +222,8 @@ void EditorExportPlugin::_export_file(const String &p_path, const String &p_type void EditorExportPlugin::_export_begin(const HashSet &p_features, bool p_debug, const String &p_path, int p_flags) { } +void EditorExportPlugin::_export_end() {} + void EditorExportPlugin::skip() { skipped = true; } diff --git a/editor/export/editor_export_plugin.h b/editor/export/editor_export_plugin.h index 120141b34797..1a985e4c0fb7 100644 --- a/editor/export/editor_export_plugin.h +++ b/editor/export/editor_export_plugin.h @@ -70,7 +70,7 @@ class EditorExportPlugin : public RefCounted { skipped = false; } - _FORCE_INLINE_ void _export_end() { + _FORCE_INLINE_ void _export_end_clear() { ios_frameworks.clear(); ios_embedded_frameworks.clear(); ios_bundle_files.clear(); @@ -105,6 +105,7 @@ class EditorExportPlugin : public RefCounted { virtual void _export_file(const String &p_path, const String &p_type, const HashSet &p_features); virtual void _export_begin(const HashSet &p_features, bool p_debug, const String &p_path, int p_flags); + virtual void _export_end(); static void _bind_methods();