-
Notifications
You must be signed in to change notification settings - Fork 4
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
[Godot 4] Typed arrays support, Enable packed arrays, Workaround for read-only collections & some small fixes. #6
Conversation
…und for dicts/arrays being sometimes read-only
Hello. Thank you for the contribution!
Huge find. Might be an issue with an in-dev feature for another of my plugins. I couldn't edit a value but it showed no error message, did it for you?
But the ID did?
Isn't |
I noticed the error mainly on arrays, could not add any values to arrays on first time, and the editor showed error:
With further testhing, dictionarys do not seem to be read-only, just cannot add with
I see, I wasn't aware of |
while the workaround is "working" there might be bugs because read-only is by design, according to:
godotengine/godot#73766 (comment) So rather up to you if the workaround for arrays should be merged to this. Anyways, probably should start porting this to engine then, because array editing is as bad rn as dicts, in the stock editor. Unfortunately I do not have time right now to investigate this, could otherwise, even if I do not have much experience yet in the editor code itself. |
Got to reviewing PRs properly, so now should be merged. Thank you! Apparently, this is in fact getting ported to engine - not by me, but I'm looking forward to it as well! |
I wanted to use this addon with nested array/dict structures so I fixed some things:
*1 Aside from disabling user from changing to incorrect type, the code checks for changing items to incorrect types. The type switcher code also had issues because it assumed the button type list was same as engine type list, but the button type list omitted some types, so the index did not match. Fixed this by creating helper func to map selection index to real type.
(As for not hiding the other types completely with typed arrays, it makes this easier to code because the index then corresponds to the list in
type_option_button
.)*2 Some arrays & dictionarys reported as being read-only on first use. I implemented a workaround that appends the collection to a new collection and then reassings it back to the original collection. This might be resource intensive on large collections (untested). This issue might be related or not, I am not sure: godotengine/godot#73766
In any case, I had the read-only issue in the test project (with the resources and with a test scene/script), when adding elements to a array the first time. Not after having added elements, even after reload of scene (or the whole engine).