Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose several resource/resource-saver functions #90969

Merged

Conversation

Naros
Copy link
Contributor

@Naros Naros commented Apr 21, 2024

Exposes several methods for GDExtension and script languages related to Resource, ResourceUID, and ResourceSaver.

Bugsquad edit: The methods are Resource get_id_for_path, is_built_in, reset_state, set_id_for_path, set_path_cache, and ResourceSaver get_resource_id_for_path.

@akien-mga akien-mga modified the milestones: 4.x, 4.4 Jun 19, 2024
@Naros Naros force-pushed the expose-resource-and-saver-methods branch from 4c6e514 to 9c65962 Compare September 7, 2024 07:38
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's one issue to fix, but I'd like to see more justification for why these methods should be exposed.

There's no linked proposal, nor any explanation about what you need those methods for.

@Naros Naros force-pushed the expose-resource-and-saver-methods branch from 9c65962 to f143400 Compare September 15, 2024 17:41
@Naros
Copy link
Contributor Author

Naros commented Sep 15, 2024

Hi @akien-mga, exposing a number of these Resource-specific methods is to support custom resource format loaders and savers. Without these, implementors of custom loader/savers have to write their own ResourceCache implementation and this is sometimes at odds with the existing API that use the ResourceCache internally in other Resource methods.

The goal of exposing these is so that if a GDExtension implements a custom resource with custom loader/saver format impls that those implementations can reuse the existing ResourceCache and other facilities within the engine and only focus on supplying the bare implementation needed for the custom resource, loader, and saver wrappers.

In short, this allows a GDExtension implementation of a custom resource loader/saver to be able to work similarly to C++ modules that were to implement the loader/saver interface.

@Naros Naros requested a review from akien-mga September 15, 2024 19:25
@Naros Naros force-pushed the expose-resource-and-saver-methods branch from f143400 to bc3dcf3 Compare September 22, 2024 19:27
@Naros
Copy link
Contributor Author

Naros commented Sep 22, 2024

@akien-mga applied your suggestions.

@akien-mga akien-mga merged commit 510bc3d into godotengine:master Sep 23, 2024
19 checks passed
@akien-mga
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants