-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Fix C# issues in inspector-plugin tutorial #7223
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# issues in inspector-plugin tutorial #7223
Conversation
Updated Inspector Plugin tutorial to reflect that C#'s EditorInspectorPlugin::_CanHandle() takes a GodotObject, not a Variant.
Put a line-break and indentation to avoid horizontal scrolling in the displayed code.
|
Converting to draft as I've found some additional issues with the code on this page:
|
Changed example code for EditorInspectorPlugin::_ParseProperty(): * Fixed method signature * Use new enum type of parameter for comparison instead of int. * Use "name" parameter as property-identifying argument to AddPropertyEditor() instead of undeclared variable
Updated example to use virtual method _UpdateProperty() instead of non-virtual method UpdateProperty().
|
Should be good to go now, with example code on that page compiling/working. |
raulsntos
left a comment
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.
The changes are correct, at some point the API changed before the 4.0 release and I forgot to update this documentation.
| public override bool _ParseProperty(GodotObject @object, Variant.Type type, | ||
| string name, PropertyHint hintType, string hintString, | ||
| PropertyUsageFlags usageFlags, bool wide) |
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.
I don't think we usually split long method signature lines in the documentation, but I think it's fine to start doing it. I'm not sure what should be the maximum character length though.
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.
No worries either way - I was asked to break lines that were causing horizontal scroll (in both C# and GDScript) on an earlier PR, so I assumed that was the preferred approach.
The C# style guide suggests 100 characters, but I had to break this at around 90 to avoid scroll.
|
Thanks! And thanks for the review. Merged! |
|
Pushed to |
C#'s
EditorInspectorPlugin::_CanHandle()method takes an argument of typeGodotObject, but the tutorial page for inspector plugins gave an override example taking typeVariant.Additionally, the same page had one C# line that was causing horizontal scroll in the code panel, and I've included a fix for that.