From 065e2670af53ae2f71b78d57f8a217b4539cbbe2 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Mon, 11 Jun 2018 02:59:53 +0200 Subject: Added basic support for custom resource savers and loaders --- modules/dds/register_types.cpp | 7 ++++--- modules/dds/texture_loader_dds.h | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'modules/dds') diff --git a/modules/dds/register_types.cpp b/modules/dds/register_types.cpp index d6351fb6fe..94f0ebfd5f 100644 --- a/modules/dds/register_types.cpp +++ b/modules/dds/register_types.cpp @@ -32,15 +32,16 @@ #include "texture_loader_dds.h" -static ResourceFormatDDS *resource_loader_dds = NULL; +static Ref resource_loader_dds; void register_dds_types() { - resource_loader_dds = memnew(ResourceFormatDDS); + resource_loader_dds.instance(); ResourceLoader::add_resource_format_loader(resource_loader_dds); } void unregister_dds_types() { - memdelete(resource_loader_dds); + ResourceLoader::remove_resource_format_loader(resource_loader_dds); + resource_loader_dds.unref(); } diff --git a/modules/dds/texture_loader_dds.h b/modules/dds/texture_loader_dds.h index 4e2593c744..abd747f63e 100644 --- a/modules/dds/texture_loader_dds.h +++ b/modules/dds/texture_loader_dds.h @@ -35,6 +35,7 @@ #include "scene/resources/texture.h" class ResourceFormatDDS : public ResourceFormatLoader { + GDCLASS(ResourceFormatDDS, ResourceFormatLoader) public: virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL); virtual void get_recognized_extensions(List *p_extensions) const; -- cgit v1.2.3