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

Add buttons to remove keys\items from dictionaries\arrays. #29656

Merged

Conversation

nhold
Copy link
Contributor

@nhold nhold commented Jun 10, 2019

This PR adds a 'remove' button for array items and dictionary items.

Fixes #23058.

image

@nhold nhold force-pushed the add-remove-option-array-inspector branch from f5e7081 to 9aff0c3 Compare June 10, 2019 22:29
@akien-mga akien-mga added this to the 3.2 milestone Jun 13, 2019
@nhold nhold force-pushed the add-remove-option-array-inspector branch 2 times, most recently from dd6eaef to 8a96b8d Compare June 17, 2019 13:38
@nhold
Copy link
Contributor Author

nhold commented Jun 17, 2019

PoolXArrays now have deletes and no longer crash:

image

Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Looks good overall, can be merged once pending comments are addressed.

@nhold nhold force-pushed the add-remove-option-array-inspector branch from 8a96b8d to 8252db6 Compare June 19, 2019 11:59
@akien-mga
Copy link
Member

There seems to be some trailing whitespace according to Travis logs.

@nhold nhold force-pushed the add-remove-option-array-inspector branch from 8252db6 to 0c8b7a4 Compare June 20, 2019 11:04
@hilfazer
Copy link
Contributor

hilfazer commented Jun 20, 2019

This change bloats Inspector horizontally and the goal is to have it very horizontally compact.

Is there an option to hide this button?

InspectorWithRemoveButton

(above screenshot is actually from Debug window since Inspector has a bug and can't show 3rd level of nesting when dictionary is involved)

@akien-mga
Copy link
Member

Right, that was also my concern. I don't think it should be made optional, but we should find a different way to provide this feature without bloating the UI.

One option would be to change the Edit button to a drop down menu with Edit and Delete options.

@hilfazer
Copy link
Contributor

One button with 2 options is a cool idea.
I'd be even cooler if this button had less width than current Edit. Perhaps button from dock windows, with 3 vertical dots, could be used? It's quite thin.

@nhold
Copy link
Contributor Author

nhold commented Jun 20, 2019

The horizontal bloat for nested arrays\dictionaries needs to be solved in a smarter way but I can change the edit button to an 'options' button with edit and delete options.

@akien-mga
Copy link
Member

The horizontal bloat for nested arrays\dictionaries needs to be solved in a smarter way but I can change the edit button to an 'options' button with edit and delete options.

I agree with both statements, this will need to be reworked eventually, but in the meantime having an Options button instead of the current Edit one seems good.

@nhold nhold force-pushed the add-remove-option-array-inspector branch 3 times, most recently from 6477680 to 4453a96 Compare June 30, 2019 16:31
@nhold
Copy link
Contributor Author

nhold commented Jun 30, 2019

Some Notes:

  • I manually fixed the merge conflict (RID change).
  • Array now copies dictionary style (Edit Type->Remove Item) if it's untyped. If it's typed it's still the trash button as there is no reason to show a menu for one option.
  • Removed the dictionary addition, it already had a remove item anyway.
  • I ran the clang formatter through Visual Studio, it seemed to alter parts in the file I hadn't touched please advise if I should revert these lines.

@akien-mga
Copy link
Member

I ran the clang formatter through Visual Studio, it seemed to alter parts in the file I hadn't touched please advise if I should revert these lines.

The changes removing new lines after { are wrong indeed, our style guide allows those so far and up until version 8.0 at least clang-format would not remove them. What version do you have?

@akien-mga
Copy link
Member

akien-mga commented Jul 1, 2019

The changes removing new lines after { are wrong indeed, our style guide allows those so far and up until version 8.0 at least clang-format would not remove them. What version do you have?

For the reference, the option that controls this is KeepEmptyLinesAtTheStartOfBlocks, which should default to true in clang-format 8.0 or earlier (so we don't override its default value for now). If you have a newer version (from SVN) and they decided to change the default, that could explain the changes you got.

@nhold nhold force-pushed the add-remove-option-array-inspector branch 3 times, most recently from ce4948e to 7d92369 Compare July 2, 2019 02:39
@nhold nhold force-pushed the add-remove-option-array-inspector branch from 7d92369 to bd9cc84 Compare July 2, 2019 02:42
@nhold
Copy link
Contributor Author

nhold commented Jul 2, 2019

I am not certain what version of clang-format visual studio uses. I used a custom install and it worked fine. Hopefully this is now satisfactory.

image

@akien-mga akien-mga merged commit 0ab11e4 into godotengine:master Jul 2, 2019
@akien-mga
Copy link
Member

Thanks!

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

Successfully merging this pull request may close these issues.

Adding option to remove item from array in inspector export
5 participants