Register text editor's resource format loader similarly to other engine ResourceFormatLoaders.

This commit is contained in:
Relintai 2022-08-20 02:05:46 +02:00
parent 31bcbb0184
commit 07d3771a12

View File

@ -26,16 +26,17 @@ SOFTWARE.
#include "text_editor_format_loader.h" #include "text_editor_format_loader.h"
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
#include "text_editor_plugin.h"
#include "editor/editor_plugin.h" #include "editor/editor_plugin.h"
#include "text_editor_plugin.h"
#endif #endif
Ref<TextEditorTextLoader> text_editor_text_resource_loader;
void register_text_editor_types() { void register_text_editor_types() {
ClassDB::register_class<TextEditorFile>(); ClassDB::register_class<TextEditorFile>();
Ref<TextEditorTextLoader> loader; text_editor_text_resource_loader.instance();
loader.instance(); ResourceLoader::add_resource_format_loader(text_editor_text_resource_loader);
ResourceLoader::add_resource_format_loader(loader);
#ifdef TOOLS_ENABLED #ifdef TOOLS_ENABLED
EditorPlugins::add_by_type<TextEditorEditorPlugin>(); EditorPlugins::add_by_type<TextEditorEditorPlugin>();
@ -43,4 +44,6 @@ void register_text_editor_types() {
} }
void unregister_text_editor_types() { void unregister_text_editor_types() {
ResourceLoader::remove_resource_format_loader(text_editor_text_resource_loader);
text_editor_text_resource_loader.unref();
} }