Make some editor export methods const

This commit is contained in:
Aaron Franke 2022-07-27 17:34:12 -05:00
parent 5352cf8e2f
commit a0072ba39f
No known key found for this signature in database
GPG Key ID: 40A1750B977E56BF
14 changed files with 29 additions and 29 deletions

View File

@ -428,7 +428,7 @@ void EditorExportPlatform::_edit_filter_list(HashSet<String> &r_list, const Stri
_edit_files_with_filter(da, filters, r_list, exclude); _edit_files_with_filter(da, filters, r_list, exclude);
} }
EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_containers(const Ref<EditorExportPreset> &p_preset, bool p_debug) { EditorExportPlatform::FeatureContainers EditorExportPlatform::get_feature_containers(const Ref<EditorExportPreset> &p_preset, bool p_debug) const {
Ref<EditorExportPlatform> platform = p_preset->get_platform(); Ref<EditorExportPlatform> platform = p_preset->get_platform();
List<String> feature_list; List<String> feature_list;
platform->get_platform_features(&feature_list); platform->get_platform_features(&feature_list);

View File

@ -110,14 +110,14 @@ protected:
~ExportNotifier(); ~ExportNotifier();
}; };
FeatureContainers get_feature_containers(const Ref<EditorExportPreset> &p_preset, bool p_debug); FeatureContainers get_feature_containers(const Ref<EditorExportPreset> &p_preset, bool p_debug) const;
bool exists_export_template(String template_file_name, String *err) const; bool exists_export_template(String template_file_name, String *err) const;
String find_export_template(String template_file_name, String *err = nullptr) const; String find_export_template(String template_file_name, String *err = nullptr) const;
void gen_export_flags(Vector<String> &r_flags, int p_flags); void gen_export_flags(Vector<String> &r_flags, int p_flags);
public: public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) = 0; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const = 0;
struct ExportOption { struct ExportOption {
PropertyInfo option; PropertyInfo option;
@ -211,7 +211,7 @@ public:
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0;
virtual Error export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); virtual Error export_pack(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual Error export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0); virtual Error export_zip(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
virtual void get_platform_features(List<String> *r_features) = 0; virtual void get_platform_features(List<String> *r_features) const = 0;
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) = 0; virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) = 0;
virtual String get_debug_protocol() const { return "tcp://"; } virtual String get_debug_protocol() const { return "tcp://"; }

View File

@ -32,7 +32,7 @@
#include "core/config/project_settings.h" #include "core/config/project_settings.h"
void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformPC::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
if (p_preset->get("texture_format/s3tc")) { if (p_preset->get("texture_format/s3tc")) {
r_features->push_back("s3tc"); r_features->push_back("s3tc");
} }
@ -224,7 +224,7 @@ void EditorExportPlatformPC::set_logo(const Ref<Texture2D> &p_logo) {
logo = p_logo; logo = p_logo;
} }
void EditorExportPlatformPC::get_platform_features(List<String> *r_features) { void EditorExportPlatformPC::get_platform_features(List<String> *r_features) const {
r_features->push_back("pc"); //all pcs support "pc" r_features->push_back("pc"); //all pcs support "pc"
r_features->push_back("s3tc"); //all pcs support "s3tc" compression r_features->push_back("s3tc"); //all pcs support "s3tc" compression
r_features->push_back(get_os_name().to_lower()); //OS name is a feature r_features->push_back(get_os_name().to_lower()); //OS name is a feature

View File

@ -44,7 +44,7 @@ private:
int chmod_flags = -1; int chmod_flags = -1;
public: public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
@ -68,7 +68,7 @@ public:
void set_logo(const Ref<Texture2D> &p_logo); void set_logo(const Ref<Texture2D> &p_logo);
void add_platform_feature(const String &p_feature); void add_platform_feature(const String &p_feature);
virtual void get_platform_features(List<String> *r_features) override; virtual void get_platform_features(List<String> *r_features) const override;
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override; virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override;
int get_chmod_flags() const; int get_chmod_flags() const;

View File

@ -1671,7 +1671,7 @@ Vector<String> EditorExportPlatformAndroid::get_enabled_abis(const Ref<EditorExp
return enabled_abis; return enabled_abis;
} }
void EditorExportPlatformAndroid::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformAndroid::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name"); String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
if (driver == "opengl3") { if (driver == "opengl3") {
r_features->push_back("etc"); r_features->push_back("etc");
@ -3109,7 +3109,7 @@ Error EditorExportPlatformAndroid::export_project_helper(const Ref<EditorExportP
CLEANUP_AND_RETURN(OK); CLEANUP_AND_RETURN(OK);
} }
void EditorExportPlatformAndroid::get_platform_features(List<String> *r_features) { void EditorExportPlatformAndroid::get_platform_features(List<String> *r_features) const {
r_features->push_back("mobile"); r_features->push_back("mobile");
r_features->push_back("android"); r_features->push_back("android");
} }

View File

@ -156,7 +156,7 @@ public:
typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key); typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key);
public: public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
@ -231,7 +231,7 @@ public:
Error export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, int p_flags); Error export_project_helper(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int export_format, bool should_sign, int p_flags);
virtual void get_platform_features(List<String> *r_features) override; virtual void get_platform_features(List<String> *r_features) const override;
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override; virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override;

View File

@ -32,7 +32,7 @@
#include "editor/editor_node.h" #include "editor/editor_node.h"
void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name"); String driver = ProjectSettings::get_singleton()->get("rendering/driver/driver_name");
// Vulkan and OpenGL ES 3.0 both mandate ETC2 support. // Vulkan and OpenGL ES 3.0 both mandate ETC2 support.
r_features->push_back("etc2"); r_features->push_back("etc2");
@ -43,7 +43,7 @@ void EditorExportPlatformIOS::get_preset_features(const Ref<EditorExportPreset>
} }
} }
Vector<EditorExportPlatformIOS::ExportArchitecture> EditorExportPlatformIOS::_get_supported_architectures() { Vector<EditorExportPlatformIOS::ExportArchitecture> EditorExportPlatformIOS::_get_supported_architectures() const {
Vector<ExportArchitecture> archs; Vector<ExportArchitecture> archs;
archs.push_back(ExportArchitecture("arm64", true)); archs.push_back(ExportArchitecture("arm64", true));
return archs; return archs;
@ -1155,7 +1155,7 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir
return OK; return OK;
} }
Vector<String> EditorExportPlatformIOS::_get_preset_architectures(const Ref<EditorExportPreset> &p_preset) { Vector<String> EditorExportPlatformIOS::_get_preset_architectures(const Ref<EditorExportPreset> &p_preset) const {
Vector<ExportArchitecture> all_archs = _get_supported_architectures(); Vector<ExportArchitecture> all_archs = _get_supported_architectures();
Vector<String> enabled_archs; Vector<String> enabled_archs;
for (int i = 0; i < all_archs.size(); ++i) { for (int i = 0; i < all_archs.size(); ++i) {

View File

@ -106,8 +106,8 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Error _export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir); Error _export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir);
Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir); Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir);
Vector<ExportArchitecture> _get_supported_architectures(); Vector<ExportArchitecture> _get_supported_architectures() const;
Vector<String> _get_preset_architectures(const Ref<EditorExportPreset> &p_preset); Vector<String> _get_preset_architectures(const Ref<EditorExportPreset> &p_preset) const;
void _add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets); void _add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, bool p_should_embed, Vector<IOSExportAsset> &r_exported_assets); Error _export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, bool p_should_embed, Vector<IOSExportAsset> &r_exported_assets);
@ -173,7 +173,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
} }
protected: protected:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
public: public:
@ -199,7 +199,7 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override;
virtual void get_platform_features(List<String> *r_features) override { virtual void get_platform_features(List<String> *r_features) const override {
r_features->push_back("mobile"); r_features->push_back("mobile");
r_features->push_back("ios"); r_features->push_back("ios");
} }

View File

@ -302,7 +302,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> &
return OK; return OK;
} }
void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformJavaScript::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
if (p_preset->get("vram_texture_compression/for_desktop")) { if (p_preset->get("vram_texture_compression/for_desktop")) {
r_features->push_back("s3tc"); r_features->push_back("s3tc");
} }

View File

@ -110,7 +110,7 @@ class EditorExportPlatformJavaScript : public EditorExportPlatform {
static void _server_thread_poll(void *data); static void _server_thread_poll(void *data);
public: public:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
@ -130,7 +130,7 @@ public:
virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_option, int p_debug_flags) override; virtual Error run(const Ref<EditorExportPreset> &p_preset, int p_option, int p_debug_flags) override;
virtual Ref<Texture2D> get_run_icon() const override; virtual Ref<Texture2D> get_run_icon() const override;
virtual void get_platform_features(List<String> *r_features) override { virtual void get_platform_features(List<String> *r_features) const override {
r_features->push_back("web"); r_features->push_back("web");
r_features->push_back(get_os_name().to_lower()); r_features->push_back(get_os_name().to_lower());
} }

View File

@ -37,7 +37,7 @@
#include "modules/modules_enabled.gen.h" // For regex. #include "modules/modules_enabled.gen.h" // For regex.
void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformMacOS::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
if (p_preset->get("texture_format/s3tc")) { if (p_preset->get("texture_format/s3tc")) {
r_features->push_back("s3tc"); r_features->push_back("s3tc");
} }

View File

@ -99,7 +99,7 @@ class EditorExportPlatformMacOS : public EditorExportPlatform {
} }
protected: protected:
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
virtual bool get_export_option_visibility(const String &p_option, const HashMap<StringName, Variant> &p_options) const override; virtual bool get_export_option_visibility(const String &p_option, const HashMap<StringName, Variant> &p_options) const override;
@ -121,7 +121,7 @@ public:
virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override; virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override;
virtual void get_platform_features(List<String> *r_features) override { virtual void get_platform_features(List<String> *r_features) const override {
r_features->push_back("pc"); r_features->push_back("pc");
r_features->push_back("s3tc"); r_features->push_back("s3tc");
r_features->push_back("macos"); r_features->push_back("macos");

View File

@ -49,7 +49,7 @@ Ref<Texture2D> EditorExportPlatformUWP::get_logo() const {
return logo; return logo;
} }
void EditorExportPlatformUWP::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) { void EditorExportPlatformUWP::get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const {
r_features->push_back("s3tc"); r_features->push_back("s3tc");
r_features->push_back("etc"); r_features->push_back("etc");
switch ((int)p_preset->get("architecture/target")) { switch ((int)p_preset->get("architecture/target")) {
@ -494,7 +494,7 @@ Error EditorExportPlatformUWP::export_project(const Ref<EditorExportPreset> &p_p
return OK; return OK;
} }
void EditorExportPlatformUWP::get_platform_features(List<String> *r_features) { void EditorExportPlatformUWP::get_platform_features(List<String> *r_features) const {
r_features->push_back("pc"); r_features->push_back("pc");
r_features->push_back("uwp"); r_features->push_back("uwp");
} }

View File

@ -431,7 +431,7 @@ public:
virtual Ref<Texture2D> get_logo() const override; virtual Ref<Texture2D> get_logo() const override;
virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override; virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override;
virtual void get_export_options(List<ExportOption> *r_options) override; virtual void get_export_options(List<ExportOption> *r_options) override;
@ -439,7 +439,7 @@ public:
virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override; virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override;
virtual void get_platform_features(List<String> *r_features) override; virtual void get_platform_features(List<String> *r_features) const override;
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override; virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, HashSet<String> &p_features) override;