mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
Merge commit godotengine/godot@5dd76968d8
This commit is contained in:
@@ -864,6 +864,19 @@ String GDExtensionResourceLoader::get_resource_type(const String &p_path) const
|
||||
}
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
void GDExtensionResourceLoader::get_classes_used(const String &p_path, HashSet<StringName> *r_classes) {
|
||||
Ref<GDExtension> gdext = ResourceLoader::load(p_path);
|
||||
if (gdext.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const StringName class_name : gdext->get_classes_used()) {
|
||||
if (ClassDB::class_exists(class_name)) {
|
||||
r_classes->insert(class_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool GDExtension::has_library_changed() const {
|
||||
return loader->has_library_changed();
|
||||
}
|
||||
|
||||
@@ -186,6 +186,9 @@ public:
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const override;
|
||||
virtual bool handles_type(const String &p_type) const override;
|
||||
virtual String get_resource_type(const String &p_path) const override;
|
||||
#ifdef TOOLS_ENABLED
|
||||
virtual void get_classes_used(const String &p_path, HashSet<StringName> *r_classes) override;
|
||||
#endif // TOOLS_ENABLED
|
||||
};
|
||||
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
||||
@@ -315,7 +315,9 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
|
||||
compatible = REDOT_VERSION_PATCH >= compatibility_minimum[2];
|
||||
}
|
||||
if (!compatible) {
|
||||
ERR_PRINT(vformat("GDExtension only compatible with Redot version %d.%d.%d or later: %s", compatibility_minimum[0], compatibility_minimum[1], compatibility_minimum[2], p_path));
|
||||
ERR_PRINT(vformat("GDExtension only compatible with Redot version %d.%d.%d or later: %s, but your Redot version is %d.%d.%d",
|
||||
compatibility_minimum[0], compatibility_minimum[1], compatibility_minimum[2], p_path,
|
||||
REDOT_VERSION_MAJOR, REDOT_VERSION_MINOR, REDOT_VERSION_PATCH));
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
|
||||
@@ -347,7 +349,8 @@ Error GDExtensionLibraryLoader::parse_gdextension_file(const String &p_path) {
|
||||
#endif
|
||||
|
||||
if (!compatible) {
|
||||
ERR_PRINT(vformat("GDExtension only compatible with Redot version %s or earlier: %s", compat_string, p_path));
|
||||
ERR_PRINT(vformat("GDExtension only compatible with Redot version %s or earlier: %s, but your Redot version is %d.%d.%d",
|
||||
compat_string, p_path, REDOT_VERSION_MAJOR, REDOT_VERSION_MINOR, REDOT_VERSION_PATCH));
|
||||
return ERR_INVALID_DATA;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user