summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-03 11:44:09 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-03 11:44:09 +0200
commit9dbf9aa4dce3d9ec48b5280395fe8d493dc11e61 (patch)
tree6e3301aff2dd2df8ae91854738522d40e50ff891
parentd1c27f239da0e8e42c44342962d95a698bd69295 (diff)
parent543ab3da11884bff5ac70ef3ebf03b9761207291 (diff)
downloadredot-engine-9dbf9aa4dce3d9ec48b5280395fe8d493dc11e61.tar.gz
Merge pull request #96511 from lawnjelly/fix_namespace_conflict
Fix SCU global namespace conflict in `resource_format_text.cpp`
-rw-r--r--scene/resources/resource_format_text.cpp15
-rw-r--r--scene/resources/resource_format_text.h12
2 files changed, 17 insertions, 10 deletions
diff --git a/scene/resources/resource_format_text.cpp b/scene/resources/resource_format_text.cpp
index 90102e44e4..e9df20d9db 100644
--- a/scene/resources/resource_format_text.cpp
+++ b/scene/resources/resource_format_text.cpp
@@ -35,17 +35,12 @@
#include "core/io/missing_resource.h"
#include "core/object/script_language.h"
-// Version 2: Changed names for Basis, AABB, Vectors, etc.
-// Version 3: New string ID for ext/subresources, breaks forward compat.
-// Version 4: PackedByteArray can be base64 encoded, and PackedVector4Array was added.
-#define FORMAT_VERSION 4
-// For compat, save as version 3 if not using PackedVector4Array or no big PackedByteArray.
-#define FORMAT_VERSION_COMPAT 3
-
-#define _printerr() ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data());
-
///
+void ResourceLoaderText::_printerr() {
+ ERR_PRINT(String(res_path + ":" + itos(lines) + " - Parse Error: " + error_text).utf8().get_data());
+}
+
Ref<Resource> ResourceLoaderText::get_resource() {
return resource;
}
@@ -1734,7 +1729,7 @@ Error ResourceFormatSaverTextInstance::save(const String &p_path, const Ref<Reso
if (load_steps > 1) {
title += "load_steps=" + itos(load_steps) + " ";
}
- title += "format=" + itos(use_compat ? FORMAT_VERSION_COMPAT : FORMAT_VERSION) + "";
+ title += "format=" + itos(use_compat ? ResourceLoaderText::FORMAT_VERSION_COMPAT : ResourceLoaderText::FORMAT_VERSION) + "";
ResourceUID::ID uid = ResourceSaver::get_resource_id_for_path(local_path, true);
diff --git a/scene/resources/resource_format_text.h b/scene/resources/resource_format_text.h
index b5542f77ba..8397bc985f 100644
--- a/scene/resources/resource_format_text.h
+++ b/scene/resources/resource_format_text.h
@@ -38,6 +38,17 @@
#include "scene/resources/packed_scene.h"
class ResourceLoaderText {
+public:
+ enum {
+ // Version 2: Changed names for Basis, AABB, Vectors, etc.
+ // Version 3: New string ID for ext/subresources, breaks forward compat.
+ // Version 4: PackedByteArray can be base64 encoded, and PackedVector4Array was added.
+ FORMAT_VERSION = 4,
+ // For compat, save as version 3 if not using PackedVector4Array or no big PackedByteArray.
+ FORMAT_VERSION_COMPAT = 3,
+ };
+
+private:
bool translation_remapped = false;
String local_path;
String res_path;
@@ -100,6 +111,7 @@ class ResourceLoaderText {
static Error _parse_sub_resource_dummy(DummyReadData *p_data, VariantParser::Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
static Error _parse_ext_resource_dummy(DummyReadData *p_data, VariantParser::Stream *p_stream, Ref<Resource> &r_res, int &line, String &r_err_str);
+ void _printerr();
VariantParser::ResourceParser rp;