diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_export.cpp | 18 | ||||
-rw-r--r-- | editor/editor_export.h | 8 | ||||
-rw-r--r-- | editor/project_export.cpp | 4 |
3 files changed, 21 insertions, 9 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index b330f5d177..3585417d13 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -1288,8 +1288,18 @@ bool EditorExportPlatformPC::can_export(const Ref<EditorExportPreset> &p_preset, return valid; } -String EditorExportPlatformPC::get_binary_extension() const { - return extension; +String EditorExportPlatformPC::get_binary_extension(const Ref<EditorExportPreset> &p_preset) const { + for (Map<String, String>::Element *E = extensions.front(); E; E = E->next()) { + if (p_preset->get(E->key())) { + return extensions[E->key()]; + } + } + + if (extensions.has("default")) { + return extensions["default"]; + } + + return ""; } Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags) { @@ -1337,8 +1347,8 @@ Error EditorExportPlatformPC::export_project(const Ref<EditorExportPreset> &p_pr return save_pack(p_preset, pck_path); } -void EditorExportPlatformPC::set_extension(const String &p_extension) { - extension = p_extension; +void EditorExportPlatformPC::set_extension(const String &p_extension, const String &p_feature_key) { + extensions[p_feature_key] = p_extension; } void EditorExportPlatformPC::set_name(const String &p_name) { diff --git a/editor/editor_export.h b/editor/editor_export.h index 8b1cf4bcff..02b15aff10 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -240,7 +240,7 @@ public: virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const = 0; - virtual String get_binary_extension() const = 0; + virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const = 0; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0; virtual void get_platform_features(List<String> *r_features) = 0; @@ -363,7 +363,7 @@ class EditorExportPlatformPC : public EditorExportPlatform { Ref<ImageTexture> logo; String name; String os_name; - String extension; + Map<String, String> extensions; String release_file_32; String release_file_64; @@ -385,10 +385,10 @@ public: virtual Ref<Texture> get_logo() const; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const; - virtual String get_binary_extension() const; + virtual String get_binary_extension(const Ref<EditorExportPreset> &p_preset) const; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); - void set_extension(const String &p_extension); + void set_extension(const String &p_extension, const String &p_feature_key = "default"); void set_name(const String &p_name); void set_os_name(const String &p_name); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index 767dbcc27b..3c31b70564 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -718,7 +718,9 @@ void ProjectExportDialog::_export_project() { export_project->set_access(FileDialog::ACCESS_FILESYSTEM); export_project->clear_filters(); export_project->set_current_file(default_filename); - String extension = platform->get_binary_extension(); + + String extension = platform->get_binary_extension(current); + if (extension != String()) { export_project->add_filter("*." + extension + " ; " + platform->get_name() + " Export"); } |