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

Adding element to array with @export_multiline deletes previously entered items #89288

Closed
tvenclovas96 opened this issue Mar 8, 2024 · 6 comments · Fixed by #92225
Closed

Comments

@tvenclovas96
Copy link

tvenclovas96 commented Mar 8, 2024

Tested versions

Tested in 4.3 dev4 and 4.2 dev2

System information

Godot v4.3.dev3 - Windows 10.0.19045 - Vulkan (Mobile) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.4601) - AMD Ryzen 5 5600X 6-Core Processor (12 Threads)

Issue description

When @export_multiline is used with an array of strings, if strings are set in the inspector, deleting or adding an element to the array in the inspector will clear the entered strings. Saving after entering the strings doesn't affect this behavior. Undoing with ctrl+z returns the strings and "sets" them, so they will no longer be cleared by adding or deleting an element.

With regular @export, the strings can be set by pressing Enter and are not cleared when modifying the array. With @export_multiline enter does not set the string, it adds a new line to the string.

Steps to reproduce

Add the following line to a node or resource:

@export_multiline var array_of_strings: Array[String] = []

Write strings to 1 or more array elements in the inspector, then add or remove an element.

Minimal reproduction project (MRP)

N/A

@AlexOtsuka
Copy link
Contributor

Hi,

I was able to reproduce this in 4.3, but not in 4.2.1, where it seems to work as intended.

Undoing with ctrl+z returns the strings and "sets" them, so they will no longer be cleared by adding or deleting an element.

This is true, but only if the cursor isn't inside the text field that's being reverted. If it is, adding an element will wipe the contents of that text field again.

@adamscott adamscott changed the title Adding element to array with @export_multiline deletes previously entered items Adding element to array with @export_multiline deletes previously entered items Mar 12, 2024
@adamscott
Copy link
Member

@tvenclovas96 Is it reproducible when you add an element through a script instead of through the inspector?

@tvenclovas96
Copy link
Author

@adamscott I'm not entirely sure what you mean. When running the project, the added string values will be detected, and values can be appended to the array as expected. This includes tool scripts. Modifying the exported array in the inspector after running will still delete the written strings, unless they were "set", such as by ctrl+z. If any default elements of the exported array are defined, they will be unaffected by this behavior.

@dalexeev
Copy link
Member

I tested this, GDScript provides the correct property info. It looks like this is an editor regression, the inspector seems to be caching old data. If you unselect the current node and select it again, then when you remove/add an element, other elements will be reset to their previous values, not necessarily empty.

@matheusmdx
Copy link
Contributor

Bisecting points to #80706 as the culprit:

image

@dalexeev
Copy link
Member

^^ CC @ajreckof @KoBeWi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Bad
Development

Successfully merging a pull request may close this issue.

7 participants