summaryrefslogtreecommitdiff
path: root/modules/dds
diff options
context:
space:
mode:
authorMarc Gilleron <marc.gilleron@gmail.com>2018-06-11 02:59:53 +0200
committerMarc Gilleron <marc.gilleron@gmail.com>2018-12-15 05:34:53 +0000
commit065e2670af53ae2f71b78d57f8a217b4539cbbe2 (patch)
treea6b802b74f6f7ebd2018b5a3d35061bdcb91eb9d /modules/dds
parentca28c455bfdc8408485c217c17f07011c0b43f64 (diff)
Added basic support for custom resource savers and loaders
Diffstat (limited to 'modules/dds')
-rw-r--r--modules/dds/register_types.cpp7
-rw-r--r--modules/dds/texture_loader_dds.h1
2 files changed, 5 insertions, 3 deletions
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<ResourceFormatDDS> 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<String> *p_extensions) const;