godotengine / godotengine/godot-docs

Documentation for Custom resource format loaders is wrong

Open
#2,411 4 comments 0 reactions 0 assignees View on GitHub
area:engine details bug
Dominant language
reStructuredText
Stars
5.7k
Forks
3.8k
Avg merge
1d 20h
Merged PRs (30d)
25

Description

From @Darkheron:
> While writing a custom resource loader and following the directions here:
> https://docs.godotengine.org/en/3.1/development/cpp/custom_resource_format_loaders.html
> I have found that this documentation is very wrong and will certainly result in sigfaults/frustration :)
>
> In particular, the documentation regarding the registration and unregistration is flawed.
> New loaders/savers need to be registered as such:
>
> ```
> static Ref my_loader_text;
> void register_my_types()
> {
> my_loader_text.instance();
> ResourceLoader::add_resource_format_loader(m_loader_text);
> }
> ```
>
> and unregistered as such:
>
> ```
> void unregister_my_types()
> {
> ResourceLoader::remove_resource_format_loader(my_loader_text);
> my_loader_text.unref();
> }
> ```
>
> But also, the definition of the loader class itself is missing the GDCLASS macro... IE:
> `GDCLASS(MyLoaderText, ResourceFormatLoader)`
>
> There may be other errors, but these are what I have found thusfar.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.