Work on fixing compile.

This commit is contained in:
Relintai 2023-01-09 01:17:15 +01:00
parent eb5cd105fb
commit a06914f234
6 changed files with 19 additions and 20 deletions

View File

@ -69,7 +69,7 @@ Ref<ImageTexture> TextureLayerMerger::get_result_as_texture() const {
Ref<ImageTexture> 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

View File

@ -277,7 +277,7 @@ TextureMerger::TextureMerger() {
_automatic_merge = false;
#if VERSION_MAJOR < 4
_packer.instance();
_packer.instantiate();
#else
_packer.instantiate();
#endif

View File

@ -84,7 +84,7 @@ Ref<AtlasTexture> TexturePacker::add_texture(const Ref<Texture> &texture) {
Ref<AtlasTexture> tex;
#if VERSION_MAJOR < 4
tex.instance();
tex.instantiate();
#else
tex.instantiate();
#endif
@ -125,7 +125,7 @@ Ref<AtlasTexture> TexturePacker::add_texture(const Ref<Texture> &texture) {
Ref<AtlasTexture> tex;
#if VERSION_MAJOR < 4
tex.instance();
tex.instantiate();
#else
tex.instantiate();
#endif
@ -414,7 +414,7 @@ void TexturePacker::merge() {
Ref<Image> image;
#if VERSION_MAJOR < 4
image.instance();
image.instantiate();
#else
image.instantiate();
#endif
@ -422,7 +422,7 @@ void TexturePacker::merge() {
Ref<ImageTexture> texture;
#if VERSION_MAJOR < 4
texture.instance();
texture.instantiate();
#else
texture.instantiate();
#endif

View File

@ -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

View File

@ -60,22 +60,22 @@ String PackerImageResourceImporter::get_preset_name(int p_idx) const {
return "";
}
void PackerImageResourceImporter::get_import_options(List<ImportOption> *r_options, int p_preset) const {
void PackerImageResourceImporter::get_import_options(const String &p_path, List<ImportOption> *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<StringName, Variant> &p_options) const {
bool PackerImageResourceImporter::get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const {
return true;
}
Error PackerImageResourceImporter::import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
Error PackerImageResourceImporter::import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files, Variant *r_metadata) {
bool hdr_as_srgb = p_options["hdr_as_srgb"];
float scale = p_options["scale"];
Ref<Image> 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<PackerImageResource> 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;
}

View File

@ -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<ImportOption> *r_options, int p_preset = 0) const;
virtual bool get_option_visibility(const String &p_option, const Map<StringName, Variant> &p_options) const;
virtual void get_import_options(const String &p_path, List<ImportOption> *r_options, int p_preset) const override;
virtual bool get_option_visibility(const String &p_path, const String &p_option, const HashMap<StringName, Variant> &p_options) const override;
virtual Error import(const String &p_source_file, const String &p_save_path, const Map<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
virtual Error import(const String &p_source_file, const String &p_save_path, const HashMap<StringName, Variant> &p_options, List<String> *r_platform_variants, List<String> *r_gen_files = NULL, Variant *r_metadata = NULL);
PackerImageResourceImporter();
~PackerImageResourceImporter();