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

Fixed file picker in portrait scene exports #1623

Merged

Conversation

oddfacade
Copy link
Contributor

The portrait export editor is unable to edit strings exported with the @export_file annotation because they weren't being correctly serialized with var_to_str before being stored in the tree item's metadata. The file picker is also ignoring submission events from its LineEdit child, which in this instance means the file picker's text box, despite being editable, can't actually be used to define the file.

This commit fixes both issues. However, the fact that these were seemingly special-cased indicates to me that there may have been a conscious decision to make them this way. I was not able to determine what the reasoning might have been, so I leave the question open for reviewers.

The portrait export editor is unable to edit strings exported with the
`@export_file` annotation because they weren't being correctly
serialized with `var_to_str` before being stored in the tree item's
metadata. The file picker is also ignoring submission events from its
`LineEdit` child, which in this instance means the file picker's text
box, despite being editable, can't actually be used to define the file.

This commit fixes both issues. However, the fact that these were
seemingly special-cased indicates to me that there may have been a
conscious decision to make them this way. I was not able to determine
what the reasoning might have been, so I leave the question open for
reviewers.
flat = true

[connection signal="focus_entered" from="HBox/Field" to="." method="_on_field_focus_entered"]
[connection signal="focus_exited" from="HBox/Field" to="." method="_on_field_focus_exited"]
[connection signal="text_submitted" from="HBox/Field" to="." method="_on_file_dialog_selected"]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the actual change. I connected the text_submitted signal to the same callback used by the file selection dialog.

@@ -97,7 +95,7 @@ func _on_export_number_submitted(value:float, property_name:String) -> void:
set_export_override(property_name, var_to_str(value))

func _on_export_file_submitted(property_name:String, value:String) -> void:
set_export_override(property_name, value)
set_export_override(property_name, var_to_str(value))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is needed because it's read back and deserialized using str_to_var, which will give you null if it gets an unquoted string (that doesn't correspond to some other type).

@Jowan-Spooner Jowan-Spooner merged commit 984bcb7 into dialogic-godot:main Jun 26, 2023
@Jowan-Spooner
Copy link
Collaborator

Looks very good! Thank you very much!

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.

None yet

2 participants