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; Ref<ImageTexture> tex;
#if VERSION_MAJOR < 4 #if VERSION_MAJOR < 4
tex.instance(); tex.instantiate();
#else #else
tex.instantiate(); tex.instantiate();
#endif #endif
@ -186,7 +186,7 @@ void TextureLayerMerger::merge() {
if (!_image.is_valid()) { if (!_image.is_valid()) {
#if VERSION_MAJOR < 4 #if VERSION_MAJOR < 4
_image.instance(); _image.instantiate();
#else #else
_image.instantiate(); _image.instantiate();
#endif #endif

View File

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

View File

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

View File

@ -28,7 +28,7 @@ void EditorPluginPackerImageResource::_notification(int p_what) {
switch (p_what) { switch (p_what) {
case NOTIFICATION_ENTER_TREE: case NOTIFICATION_ENTER_TREE:
#if VERSION_MAJOR < 4 #if VERSION_MAJOR < 4
_importer.instance(); _importer.instantiate();
#else #else
_importer.instantiate(); _importer.instantiate();
#endif #endif

View File

@ -60,22 +60,22 @@ String PackerImageResourceImporter::get_preset_name(int p_idx) const {
return ""; 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::BOOL, "hdr_as_srgb"), false));
r_options->push_back(ImportOption(PropertyInfo(Variant::REAL, "scale"), 1.0)); 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; 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"]; bool hdr_as_srgb = p_options["hdr_as_srgb"];
float scale = p_options["scale"]; float scale = p_options["scale"];
Ref<Image> image; Ref<Image> image;
#if VERSION_MAJOR < 4 #if VERSION_MAJOR < 4
image.instance(); image.instantiate();
#else #else
image.instantiate(); image.instantiate();
#endif #endif
@ -87,14 +87,14 @@ Error PackerImageResourceImporter::import(const String &p_source_file, const Str
Ref<PackerImageResource> res; Ref<PackerImageResource> res;
#if VERSION_MAJOR < 4 #if VERSION_MAJOR < 4
res.instance(); res.instantiate();
#else #else
res.instantiate(); res.instantiate();
#endif #endif
res->set_data(image); 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; return Error::ERR_PARSE_ERROR;
} }

View File

@ -26,11 +26,11 @@ SOFTWARE.
#include "core/version.h" #include "core/version.h"
#if VERSION_MAJOR > 3 #if VERSION_MAJOR > 3
#include "core/string/ustring.h"
#include "core/io/image.h" #include "core/io/image.h"
#include "core/string/ustring.h"
#else #else
#include "core/ustring.h"
#include "core/image.h" #include "core/image.h"
#include "core/ustring.h"
#endif #endif
#include "core/io/resource_saver.h" #include "core/io/resource_saver.h"
@ -41,7 +41,6 @@ SOFTWARE.
#include "packer_image_resource.h" #include "packer_image_resource.h"
class PackerImageResourceImporter : public EditorImportPlugin { class PackerImageResourceImporter : public EditorImportPlugin {
GDCLASS(PackerImageResourceImporter, EditorImportPlugin); GDCLASS(PackerImageResourceImporter, EditorImportPlugin);
public: public:
@ -55,10 +54,10 @@ public:
virtual int get_preset_count() const; virtual int get_preset_count() const;
virtual String get_preset_name(int p_idx) 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 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_option, const Map<StringName, Variant> &p_options) const; 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();
~PackerImageResourceImporter(); ~PackerImageResourceImporter();