Amulet-Map-Editor icon indicating copy to clipboard operation
Amulet-Map-Editor copied to clipboard

Improve NBT editor

Open Podshot opened this issue 4 years ago • 4 comments

Reworked the NBT editor to use an abstracted representation of a NBT structure instead of actual NBT objects. This allows for much cleaner handling of adding/removing items from container types (TAG_Compound/TAG_List), as well as simplifying the UI code to reduce the need to handle edge cases.

Changes:

  • Input NBT objects are parsed to a representation format that keeps track of the parent containing it
  • Tree building logic is less complex and cleaner
  • NBT editing/adding dialogs are separate from each other
  • Removed the need for a callback (current NBT state can be accessed via the .nbt property)

Podshot avatar Aug 20 '21 04:08 Podshot

There are still some issues that need ironing out but it does look good. I re-added the old example nbt because you had it linked to a file on your PC but the old NBT cannot be displayed. For some reason it cannot display non-container data that is either the root or in the first level. This NBT viewer should be able to display any valid nbt or NBTFile

gentlegiantJGC avatar Aug 25 '21 13:08 gentlegiantJGC

The tree should really have one root node and all of the NBT should be a sub-entry under that node.

gentlegiantJGC avatar Aug 25 '21 14:08 gentlegiantJGC

Bugs: These things cannot be displayed

nbt.TAG_Compound({})  # This shows nothing
nbt.TAG_String("hello")  # This causes a crash
nbt.TAG_Compound({"str": nbt.TAG_String("hello")})  # This causes a crash

I cannot edit arrays. Not really a bug but I intuitively double click on items to edit them. I don't think that should be too difficult to add. wx assertion error when deleting the "root" compound tag (note this is not actually the root of the NBT) The add nbt tag window is not big enough by default to see the save/cancel buttons The icons in the new tag window could be closer to the radio button they are associated with. It currently looks like they are associated to the one to the right not the left. Creating a tag in a list asks me for a name. Tags in lists do not have names I am able to create tags of different types in a list. NBT can only have one type in a list I can create two tags in a compound with the same name

gentlegiantJGC avatar Aug 25 '21 14:08 gentlegiantJGC

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

:white_check_mark: gentlegiantJGC
:x: Podshot
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar May 11 '22 08:05 CLAassistant