summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-07-23 12:10:32 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2021-07-23 12:12:25 +0200
commit7f83977f37f5f13024bee4f29ead87a992a072b6 (patch)
treeed99e787e70e87949c32decfb923c8610c036a1e /core
parent515670351a5b8d13eef475df9d602e846f53884d (diff)
Expose an ImportOrder enum in ResourceImporter
This avoids using magic numbers in code.
Diffstat (limited to 'core')
-rw-r--r--core/io/resource_importer.cpp5
-rw-r--r--core/io/resource_importer.h12
2 files changed, 16 insertions, 1 deletions
diff --git a/core/io/resource_importer.cpp b/core/io/resource_importer.cpp
index b503655edd..f612b84404 100644
--- a/core/io/resource_importer.cpp
+++ b/core/io/resource_importer.cpp
@@ -445,3 +445,8 @@ ResourceFormatImporter *ResourceFormatImporter::singleton = nullptr;
ResourceFormatImporter::ResourceFormatImporter() {
singleton = this;
}
+
+void ResourceImporter::_bind_methods() {
+ BIND_ENUM_CONSTANT(IMPORT_ORDER_DEFAULT);
+ BIND_ENUM_CONSTANT(IMPORT_ORDER_SCENE);
+}
diff --git a/core/io/resource_importer.h b/core/io/resource_importer.h
index 2ceeb176e5..62cb608a42 100644
--- a/core/io/resource_importer.h
+++ b/core/io/resource_importer.h
@@ -96,6 +96,9 @@ public:
class ResourceImporter : public RefCounted {
GDCLASS(ResourceImporter, RefCounted);
+protected:
+ static void _bind_methods();
+
public:
virtual String get_importer_name() const = 0;
virtual String get_visible_name() const = 0;
@@ -103,7 +106,7 @@ public:
virtual String get_save_extension() const = 0;
virtual String get_resource_type() const = 0;
virtual float get_priority() const { return 1.0; }
- virtual int get_import_order() const { return 0; }
+ virtual int get_import_order() const { return IMPORT_ORDER_DEFAULT; }
virtual int get_format_version() const { return 0; }
struct ImportOption {
@@ -117,6 +120,11 @@ public:
ImportOption() {}
};
+ enum ImportOrder {
+ IMPORT_ORDER_DEFAULT = 0,
+ IMPORT_ORDER_SCENE = 100,
+ };
+
virtual bool has_advanced_options() const { return false; }
virtual void show_advanced_options(const String &p_path) {}
@@ -137,4 +145,6 @@ public:
virtual String get_import_settings_string() const { return String(); }
};
+VARIANT_ENUM_CAST(ResourceImporter::ImportOrder);
+
#endif // RESOURCE_IMPORTER_H