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

📃 Property array support #124

Merged
merged 15 commits into from
Sep 17, 2023

Conversation

mrfelipemartins
Copy link
Contributor

Description

Introducing support for Array Properties. Arrays can be of any currently supported property type except for Array. I tried to reuse existing property controls but a few tweaks was needed. New arrays are by default of type string, I believe we should have a popup for selecting the array type before it's created but I also think that this should be default for all properties that has settings so maybe this should be addressed in a separate PR.

Addressed issues

Screenshots

image image

@bitbrain
Copy link
Owner

PR looks good already - I definitely have to try this out. In the meantime, could you also make sure to add some more unit tests for those new UI components you created?

@mrfelipemartins
Copy link
Contributor Author

Sure! I will create the tests. There are some improvements that I believe should be done, like ones we discussed on discord, but they should apply to all properties so I will create a separate issue to address them.

@bitbrain
Copy link
Owner

I have thoroughly tested this pull request and it looks mostly good to me, however, I found some flaws with it that we may need to address:

Dubious error when adding an array of type reference and trying to add an item

Pandora error: value <null> is incompatible with type <RefCounted#-9223368694665487790>

The error disappeared after restarting Godot.

Unable to configure the property type of array

One use case I have is that I have a bag with let's say 6 item slots. However, I only want to select entities of type Item and not get all the entities in the world suggested. To solve this, we could show as part of the array property settings the (proxied) settings of its type underneath it.
Screenshot 2023-09-15 175710

  • When selecting the reference type, it displays all the config of reference underneath it. Those settings could function similar to what we already have: by default, it always uses the default settings coming with the PandoraEntityType - when the user then overrides stuff, the overrides could be stored inside the array settings under a special new key, e.g. "type_settings": ...
  • whenever we add a new element to the array, we apply the settings to that entry
  • changing a property value should apply this to all entries in the array (if any exist)

Changing the array type does not give a warning

In case the array is not empty and I am changing the type, it just wipes the data. We may want to think about showing a popup to ask the user first. The same applies to other properties so finding a universal solution (as a separate PR) might be preferrable.

Copy link
Owner

@bitbrain bitbrain left a comment

Choose a reason for hiding this comment

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

as mentioned above.

@bitbrain
Copy link
Owner

LGTM - well done!

@bitbrain bitbrain merged commit c94061f into bitbrain:godot-4.x Sep 17, 2023
3 checks passed
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.

📃 Property array support
2 participants