mrkite / minutor

Mapping for Minecraft
http://seancode.com/minutor
BSD 2-Clause "Simplified" License
278 stars 52 forks source link

[Suggestion] Structure Overlays Sorting option #350

Closed drakray closed 1 year ago

drakray commented 1 year ago

As the title says, having the option to sort the structure list would be VERY useful, especially in pack with (too) many structures Searching through the list can be a real pain, at least with alphabetical sorting, structures from a same mod would be easier to find Also, maybe grouping in folder by modID?, this pictures lists the structures in an Overworld, only(no Nether/other DIMs) 2022-12-26 22_23_54- I might generate its Nether, just to see if the menu will bug out lol

EtlamGit commented 1 year ago

I understand your problem. Even with vanilla only I sometimes struggle to find the right structure.

What is done now: on Dimension change, the list is cleared. Then for each (new) structure that is found an entry is added to to the bottom of that menu. So the list only contains structures that are currently present in the already loaded world.

At the moment I have no good idea, how to "change" a sorting scheme. So it might be a fixed one.

What could be done:

I like both ideas.

drakray commented 1 year ago

I can say that in 2.19.1, the list is not emptied when selecting a new dimension; only when changing world.

I was not thinking about a "sortable" thing either, just "sorted" Don't know if "adding at the correct position" is easier, or just a button "sort my stuff I'm lost" lol

Also, more suggestions in this section:


I'm just throwing everything at the wall seeing what sticks, I more than appreciate you work, I LOVE Minutor since wayyy back. I even thought about cleaning my definition files and make them public, to ease other people who uses mods.


Quick question completely out of the structure subject: can a Definition File have multiple type, like could I make 1 json with blocks, biomes, dimensions AND entities, or must they always have their own file?

EtlamGit commented 1 year ago

Empty the list on World/Dimension both has drawbacks and advantages.

I forgot what the current setting is at the moment. But as both have their reasoning I would not change that and focus on the other topics.

drakray commented 1 year ago

yeah, no problem with that, I'm just curious to see if I can overflow it XD

EtlamGit commented 1 year ago

Could you provide a test world containing some structures from mods?

(Alphabetically sorting is working now.)

EtlamGit commented 1 year ago

Nested menu for each mod should work also.

EtlamGit commented 1 year ago

Quick question completely out of the structure subject: can a Definition File have multiple type, like could I make 1 json with blocks, biomes, dimensions AND entities, or must they always have their own file?

No. As the type identifier is on the topmost level of the description. So you need multiple files.

The intended way to bundle multiple files (e.g. into one download) is to place them into a ZIP file. I have never done that, but the code to handle these "packs" is still there.

drakray commented 1 year ago

I'll see to make a new world for you, as my working world are HUGE(my current is almost 2Gb)


No problem for the multiDef, a zip with 4 file is not really a chore XD

EtlamGit commented 1 year ago

As the PullRequest is already merged, you can try it on your own -> Actions -> build artifacts

For a test world, ONE region file is sufficient.

drakray commented 1 year ago

Just tested it, seems to work nicely, although the mod folder themselves are not alphaSorted; having Minecraft Structure on top is weird at first, but understandable and useful If possible, clicking on the folder could toggle all structures inside, especially useful since clicking on a structure closes the menu

Just saw, toggling structure inside folder does not activate the overlay though EDIT: mna_villages:council_village is the big one south of the map in my link, easy to see that the overlay is not active. Other villages are minecraft:village_taiga, overlay working


Here is a link to a small world with lots of structures Also in the zip are my modded definition files

EtlamGit commented 1 year ago

mod menus are sorted now mod structures work again

EtlamGit commented 1 year ago

If possible, clicking on the folder could toggle all structures inside, especially useful since clicking on a structure closes the menu

Yes, that would be nice. But Qt QMenu class does not provide functionality to have a sub-menu that is checkable or clickable.

To archive that, we would have to subclass QMenu and implement some own GUI logic.

Maybe you can create a new Issue with only that topic, Then we have a reference for implementing it later.

EtlamGit commented 1 year ago

Is it possible to provide a test region file that is created (and last used) with a very old Minecraft version? (before "The Flattening" meaning version below 1.12) The older the better!

drakray commented 1 year ago

2 saves, Release Version 1.0 and 1.3.1 saves.zip Not very explored though, just generated

EtlamGit commented 1 year ago

Do these contain modded features?

Sorry, didn't explain that I want to test modded structures for older versions . . . But nevertheless, I didn't played that old versions, so they contain plenty of valuable data to debug. (Especially, as version 1.0 does not render at all.)

Another remark: I have downloaded both files now. In case you want to take them down from the wild and public internet for privacy reasons, it is possible now.

drakray commented 1 year ago

There was a change in the saved files format in 1.2.1, probably the reason why it doesn't work No, those are vanilla saves, I don't know how far I can go to add modded feature, Forge was not always around XD

EtlamGit commented 1 year ago

I found a "simple" way to toggle some of the Overlays:

It will toggle visibility, not enable/disable. This feels a bit strange at the moment. Especially when you toggle all to ON and then move the map and find new structures, these are not enabled.

Kolcha commented 1 year ago

But Qt QMenu class does not provide functionality to have a sub-menu that is checkable or clickable.

this is expected behavior - sub-menu should be expanded on click because "auto-expand" on hover can be disabled (at least in Linux environments).

what about adding the first checkable item (as any other items in menu) called something like "enable all" (and checked by default) following by a separator in sub-menu which will switch all other items to the same state it has? it easy to achieve - just connect triggered() (not toggled() - we are interested in only user-triggered events) signal from it to setChecked() slot of other items. logic behind "structures" QActions should react on toggled() signal instead (programmatically changed state also should affect view/rendering results). I don't know how it is implemented now.

also it would be nice to have tri-state checkbox on this item, but unfortunately QAction supports only "classic" checkbox. this can be achieved by using QWidgetAction with embedded QCheckBox (which can be tri-state), but this is a bit complicated and definitely requires some logic to display this "third state" when not all items in menu are in the same state and to update it correctly when any of items changes own state.

I can look into this at weekend, this is interesting feature to implement for me.

EtlamGit commented 1 year ago

The LabeldSeparator is already a self-made combination of a separator line and a text label (based on QWidgetAction). It would be possible to add a tri-state checkbox there: grafik

I have (not checked in) code that uses that LabeldSeparator for the vanilla structures and entities. Do you want me to check in this experimental code?

Adding a toggle/enable/disable separator for EACH mod sub-menu might be too much. For the provided test world there are several mob sub-menus with only 1 or 2 structure entries in them. So the rate of toggle action versus real actions could be quite strange. We may have to test the approach and look how it feels. At least I have no other idea how to handle this easily (without another self-made class).

What I had in mind is a combination of a tri-state checkbox with the sub-menu we already have: grafik When clicking on the text, the sub-menu is opened, when clicking the checkbox, the state is altered. But I have also other ideas for that unused space in front of the sub-menu. Not sure which I like more at the moment...

EtlamGit commented 1 year ago

Here is an example how the approach with label for each sub-menu would look like: grafik

drakray commented 1 year ago

I like the "toggle all" header more, and it would make even more sense by putting all minecraft:* structure in their own submenu too, I think this way we could even skip the modName part of the structure in the subMenu, would make for more readability and reduce width

EtlamGit commented 1 year ago

I just moved vanilla structures out of a sub-menu to reduce clicking some month ago . . . so they should stay in first menu level.

Reducing names by redundant part is a good point.

drakray commented 1 year ago

yeah no problem I understand that XD I personally have no problem with more clicking, if it means cleaner UI 😉

Kolcha commented 1 year ago

I just moved vanilla structures out of a sub-menu to reduce clicking some month ago . . . so they should stay in first menu level.

just an idea: no mods - items are in the first level menu, have mods - vanilla structures also in sub-menu. but may be tricky to implement...

EtlamGit commented 1 year ago

Hi @Kolcha , I have checked in my intermediate state here: https://github.com/EtlamGit/minutor/tree/test-menu-structures

You can take a look there when you like.

Kolcha commented 1 year ago

Hi @EtlamGit , I looked into your sources. I can say it is a good start (it even has some placeholders in code for future logic), but personally I don't like "checkbox + separator" item design, it looks very strange... as for me, it is better to use just regular checkbox + standard separator item below it. the only thing I can say, it will be tricky to implement...