Skip to content

Improve documentation of some Resource methods #102499

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

Merged
merged 1 commit into from
Jun 28, 2025

Conversation

Jordyfel
Copy link
Contributor

@Jordyfel Jordyfel commented Feb 6, 2025

#90969 exposed some methods in Resource, but most of them are only useful for implementing resource formats and are major footguns otherwise. This aims to explain more clearly what they do. Also syncs the already existing comments with these changes.

@Jordyfel Jordyfel requested review from a team as code owners February 6, 2025 20:23
</description>
</method>
<method name="reset_state">
<return type="void" />
<description>
For resources that use a variable number of properties, either via [method Object._validate_property] or [method Object._get_property_list], override [method _reset_state] to correctly clear the resource's state.
Makes the resource clear its non-exported properties. Useful when implementing a custom resource format by extending [ResourceFormatLoader] and [ResourceFormatSaver].
Copy link
Member

Choose a reason for hiding this comment

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

It may be good to add somethiing like, "See also [method _reset_state]".

I still don't quite get why we need both. @dsnopek, couldn't just reset_state be overridable in GDExtension?

@RandomShaper
Copy link
Member

Looks good overall.

@Jordyfel
Copy link
Contributor Author

Jordyfel commented May 9, 2025

Asking for review on this, since it received a thumbs up from a core team member. The discussion on whether the method should stay exposed doesn't apply anymore after 4.4 release.

@Mickeon Mickeon self-requested a review May 9, 2025 08:02
@Mickeon
Copy link
Member

Mickeon commented Jun 6, 2025

The discussion on whether the method should stay exposed doesn't apply anymore after 4.4 release.

There's still merit to it, actually. I genuinely think the move to expose reset_state was excessive. In all of my efforts to remove setup_local_to_scene, the argument against it is the same. It should probably be deprecated.

But that's beyond the improvements done in this PR.

@Mickeon Mickeon modified the milestones: 4.x, 4.5 Jun 6, 2025
Copy link
Member

@Mickeon Mickeon left a comment

Choose a reason for hiding this comment

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

Genuinely a massive improvement. Although, what a mess in the API, with those newly introduced methods. Only their virtual equivalent should've been exposed, probably.

@Mickeon Mickeon requested review from RandomShaper and Calinou June 6, 2025 15:10
@akien-mga akien-mga merged commit 1123d7f into godotengine:master Jun 28, 2025
20 checks passed
@akien-mga
Copy link
Member

Thanks!

@Jordyfel Jordyfel deleted the resource-docs branch June 28, 2025 16:44
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.

6 participants