-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Using export_multiline should default to a blank string, not null #74188
Comments
Looks like this happens with other export annotations as well |
Export annotations do not change the default value of a variable. @export_multiline var dialog # = null Use an explicit initializer and/or specify a static type: @export_multiline var dialog = ""
@export_multiline var dialog_2: String |
Edited the markup in OP so I agree that showing |
Fixing this properly might be tricky. The export annotations define which kind of inspector widget is created ( It could likely have a check added here: void EditorPropertyMultilineText::update_property() {
String t = get_edited_object()->get(get_edited_property());
if (text->get_text() != t) {
text->set_text(t);
if (big_text && big_text->is_visible_in_tree()) {
big_text->set_text(t);
}
}
} To handle the case where So that wouldn't be too hard, but it's complex in terms of UX and requires quite some added boilerplate. If someone has a better idea, let me know :D As a side note, we could maybe add a GDScript warning when using a "typed" annotation (an annotation which is designed for a specific type) on an untyped and uninitialized export var. Finally, we could also change the design and make it so that typed annotations force initialize to the matching type. That's outside the scope of this discussion, and possibly not a wanted change, but it would solve this issue too. |
I wanted to suggest this too, it seems to me that this is the right and quite simple solution to implement. EDIT: The error "Specify a static type or initial value" is fine too. |
Godot version
v4.0.stable.official [92bee43]
System information
Windows 10
Issue description
Using @export_multiline and then not defining the variable causes the inspector to show
<null>
when it should show nothing.Steps to reproduce
Make a script, add this line
@export_multiline var dialog
look in inspector window
Minimal reproduction project
N/A
Bugsquad edit: Added mark up for
<null>
in the description, so GitHub does not show it as an empty string.The text was updated successfully, but these errors were encountered: