From a06914f234e7169b4226b2009573fa8a41168aef Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 9 Jan 2023 01:17:15 +0100 Subject: [PATCH] Work on fixing compile. --- layers/texture_layer_merger.cpp | 4 ++-- texture_merger.cpp | 2 +- texture_packer.cpp | 8 ++++---- .../editor_plugin_packer_image_resource.cpp | 2 +- texture_resource/packer_image_resource_importer.cpp | 12 ++++++------ texture_resource/packer_image_resource_importer.h | 11 +++++------ 6 files changed, 19 insertions(+), 20 deletions(-) diff --git a/layers/texture_layer_merger.cpp b/layers/texture_layer_merger.cpp index 53d68b0..2a8fbe4 100644 --- a/layers/texture_layer_merger.cpp +++ b/layers/texture_layer_merger.cpp @@ -69,7 +69,7 @@ Ref TextureLayerMerger::get_result_as_texture() const { Ref tex; #if VERSION_MAJOR < 4 - tex.instance(); + tex.instantiate(); #else tex.instantiate(); #endif @@ -186,7 +186,7 @@ void TextureLayerMerger::merge() { if (!_image.is_valid()) { #if VERSION_MAJOR < 4 - _image.instance(); + _image.instantiate(); #else _image.instantiate(); #endif diff --git a/texture_merger.cpp b/texture_merger.cpp index a5a2e73..a397ad6 100644 --- a/texture_merger.cpp +++ b/texture_merger.cpp @@ -277,7 +277,7 @@ TextureMerger::TextureMerger() { _automatic_merge = false; #if VERSION_MAJOR < 4 - _packer.instance(); + _packer.instantiate(); #else _packer.instantiate(); #endif diff --git a/texture_packer.cpp b/texture_packer.cpp index 9495def..4a1070e 100644 --- a/texture_packer.cpp +++ b/texture_packer.cpp @@ -84,7 +84,7 @@ Ref TexturePacker::add_texture(const Ref &texture) { Ref tex; #if VERSION_MAJOR < 4 - tex.instance(); + tex.instantiate(); #else tex.instantiate(); #endif @@ -125,7 +125,7 @@ Ref TexturePacker::add_texture(const Ref &texture) { Ref tex; #if VERSION_MAJOR < 4 - tex.instance(); + tex.instantiate(); #else tex.instantiate(); #endif @@ -414,7 +414,7 @@ void TexturePacker::merge() { Ref image; #if VERSION_MAJOR < 4 - image.instance(); + image.instantiate(); #else image.instantiate(); #endif @@ -422,7 +422,7 @@ void TexturePacker::merge() { Ref texture; #if VERSION_MAJOR < 4 - texture.instance(); + texture.instantiate(); #else texture.instantiate(); #endif diff --git a/texture_resource/editor_plugin_packer_image_resource.cpp b/texture_resource/editor_plugin_packer_image_resource.cpp index 51cef94..3aff359 100644 --- a/texture_resource/editor_plugin_packer_image_resource.cpp +++ b/texture_resource/editor_plugin_packer_image_resource.cpp @@ -28,7 +28,7 @@ void EditorPluginPackerImageResource::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: #if VERSION_MAJOR < 4 - _importer.instance(); + _importer.instantiate(); #else _importer.instantiate(); #endif diff --git a/texture_resource/packer_image_resource_importer.cpp b/texture_resource/packer_image_resource_importer.cpp index 4d3fff7..3377f0c 100644 --- a/texture_resource/packer_image_resource_importer.cpp +++ b/texture_resource/packer_image_resource_importer.cpp @@ -60,22 +60,22 @@ String PackerImageResourceImporter::get_preset_name(int p_idx) const { return ""; } -void PackerImageResourceImporter::get_import_options(List *r_options, int p_preset) const { +void PackerImageResourceImporter::get_import_options(const String &p_path, List *r_options, int p_preset) const { r_options->push_back(ImportOption(PropertyInfo(Variant::BOOL, "hdr_as_srgb"), false)); r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "scale"), 1.0)); } -bool PackerImageResourceImporter::get_option_visibility(const String &p_option, const Map &p_options) const { +bool PackerImageResourceImporter::get_option_visibility(const String &p_path, const String &p_option, const HashMap &p_options) const { return true; } -Error PackerImageResourceImporter::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { +Error PackerImageResourceImporter::import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { bool hdr_as_srgb = p_options["hdr_as_srgb"]; float scale = p_options["scale"]; Ref image; #if VERSION_MAJOR < 4 - image.instance(); + image.instantiate(); #else image.instantiate(); #endif @@ -87,14 +87,14 @@ Error PackerImageResourceImporter::import(const String &p_source_file, const Str Ref res; #if VERSION_MAJOR < 4 - res.instance(); + res.instantiate(); #else res.instantiate(); #endif res->set_data(image); - return ResourceSaver::save(p_save_path + "." + get_save_extension(), res); + return ResourceSaver::save(res, p_save_path + "." + get_save_extension()); return Error::ERR_PARSE_ERROR; } diff --git a/texture_resource/packer_image_resource_importer.h b/texture_resource/packer_image_resource_importer.h index 937e03c..b114d23 100644 --- a/texture_resource/packer_image_resource_importer.h +++ b/texture_resource/packer_image_resource_importer.h @@ -26,11 +26,11 @@ SOFTWARE. #include "core/version.h" #if VERSION_MAJOR > 3 -#include "core/string/ustring.h" #include "core/io/image.h" +#include "core/string/ustring.h" #else -#include "core/ustring.h" #include "core/image.h" +#include "core/ustring.h" #endif #include "core/io/resource_saver.h" @@ -41,7 +41,6 @@ SOFTWARE. #include "packer_image_resource.h" class PackerImageResourceImporter : public EditorImportPlugin { - GDCLASS(PackerImageResourceImporter, EditorImportPlugin); public: @@ -55,10 +54,10 @@ public: virtual int get_preset_count() const; virtual String get_preset_name(int p_idx) const; - virtual void get_import_options(List *r_options, int p_preset = 0) const; - virtual bool get_option_visibility(const String &p_option, const Map &p_options) const; + virtual void get_import_options(const String &p_path, List *r_options, int p_preset) const override; + virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap &p_options) const override; - virtual Error import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files = NULL, Variant *r_metadata = NULL); + virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap &p_options, List *r_platform_variants, List *r_gen_files = NULL, Variant *r_metadata = NULL); PackerImageResourceImporter(); ~PackerImageResourceImporter();