-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Fix C# Hint NodeType and ResourceType HintString #91645
Conversation
d4da121
to
231eb47
Compare
1bf2d8c
to
0d6465c
Compare
Thanks for contributing to the .NET module! This looks really nice although I feel like it goes against the current behavior. The way I'm a bit worried that this change will make things a bit confusing to users, because now some times the type will take precedence and others it will be the attribute. My personal preference would be for the attribute to always override the type, since I believe when the user is being explicit we should respect that. However, this is a behavior change that may be a bit too disruptive for existing users. And now that I laid out my concerns and personal preferences, I'd love to hear what other .NET contributors think. |
Same thing, I feel like always respecting the explicit metadata given by the user (if valid) is what we want / what anyone would expect.
Is it disruptive? I'd imagine existing users either
Or is there something I'm missing/misunderstanding? Footnotes |
GDScript: Add @export_custom annotation #72912 The new @export_custom allows this. extends Node
enum Alignment {
Good,
Neutral,
Evil
}
@export_custom(PROPERTY_HINT_NODE_TYPE,"Node2D,Object") var node:Object
@export_custom(PROPERTY_HINT_NODE_TYPE,"Node2D,Resource") var node2:Node
@export_custom(PROPERTY_HINT_RESOURCE_TYPE ,"Node2D,Texture2D") var nodeResouce:Resource
@export_custom(PROPERTY_HINT_RESOURCE_TYPE ,"Node2D,Texture2D") var enumResouce:Alignment I don't think public partial class CustomNode: Node
{
public enum Alignment {
Good,
Neutral,
Evil
}
[Export(PropertyHint.NodeType, "Node2D,Object")] public GodotObject Node;
[Export(PropertyHint.NodeType, "Node2D,Resource")] public Node Node2;
[Export(PropertyHint.ResourceType, "Node2D,Texture2D")] public Resource NodeResouce;
[Export(PropertyHint.ResourceType,"Node2D,Texture2D")] public Alignment MyResource;
} Even if something goes wrong, it should be thrown a warning by the editor instead of being directly overwritten by the source code generator. |
710d0d2
to
06b716d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is there something I'm missing/misunderstanding?
@paulloz No, I think you got it perfectly. Whenever something changes behavior I get a little nervous, but I think you are completely correct that it won't be disruptive, thank you.
Should
[Export]
be used consistently with@export_custom
?
@ZerxZ Yeah, I think the GDScript annotation fulfills the same use cases. Thank you for showing how @export_custom
works, this was helpful. I think it makes sense to follow the same behavior, and it probably matches user expectations when using the attribute.
So it sounds like there's consensus on allowing explicit hints override computed hints, since explicitness indicates intention. We should probably make sure other hints also work like this, but that would be work for a follow-up PR.
This PR goes in that direction and works as expected, so I'm approving.
Thanks! 🎉 |
Thanks! And congrats for your first merged Godot contribution 🎉 |
Thanks! 🎉 |
Fix #91644