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

Change the default PropertyUsageFlags for var fields #464

Merged
merged 1 commit into from
Nov 19, 2023

Conversation

HenryWConklin
Copy link
Contributor

PROPERTY_USAGE_NO_EDITOR still writes the property to files, which doesn't match the default property for vars in GDScript. PROPERTY_USAGE_NONE indicates that the property should not be saved or shown in the editor.

See https://docs.godotengine.org/en/stable/classes/class_@globalscope.html#class-globalscope-constant-property-usage-none

Fixes #463

PROPERTY_USAGE_NO_EDITOR still writes the property to files, which
doesn't match the default property for vars in GDScript.
PROPERTY_USAGE_NONE indicates that the property should not be saved
or shown in the editor.
@GodotRust
Copy link

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-464

@lilizoey
Copy link
Member

as mentioned here i dont think this is correct.

@Bromeon
Copy link
Member

Bromeon commented Oct 25, 2023

Thanks! We should clarify whether Godot behaves according to specification, and if not, report it upstream. Let's continue discussion in #463 until this is clarified 🙂

@Bromeon
Copy link
Member

Bromeon commented Nov 9, 2023

Someone will need to double-check Godot's behavior upstream, I'm not sure if I get around it before the 4.2 release.
We should then act accordingly (if necessary at all).

Are there any disadvantages to using NONE instead of NO_EDITOR? Otherwise we could just merge, if it fixes the issue at hand.

@Bromeon Bromeon closed this Nov 9, 2023
@Bromeon Bromeon reopened this Nov 9, 2023
@godot-rust godot-rust deleted a comment from GodotRust Nov 9, 2023
@HenryWConklin
Copy link
Contributor Author

HenryWConklin commented Nov 9, 2023

If you look at the value on NO_EDITOR it's actually just an alias for STORAGE, meaning the field does get saved. From my understanding messing with this, that doesn't match the default behavior for vars in gdscript which don't include STORAGE. So if the goal is to match gdscript I think NONE is the right thing to use.

Gdscript vars do also include SCRIPT_VARIABLE, but from digging through the Godot code I can't figure out what it actually does. And it doesn't look like any native types' fields include it so I'm not sure if a gdext type should.

I see downsides for STORAGE, i.e. accidentally serializing some massive field. NONE does nothing except expose to gdscript as far as I can tell, so only downside would be if I'm wrong about what most users would expect.

@Bromeon
Copy link
Member

Bromeon commented Nov 19, 2023

Merging this for now, as it makes the behavior more consistent with GDScript. If Godot changes something, I'm open to adapt this again 🙂

@Bromeon Bromeon added this pull request to the merge queue Nov 19, 2023
Merged via the queue into godot-rust:master with commit d6a24cd Nov 19, 2023
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

var properties without export are still saved to the scene file
4 participants