Astrabit-ST / Luminol

An RPG Maker XP-VX Ace rewrite, written in Rust with love 💕
https://luminol.dev/
GNU General Public License v3.0
95 stars 11 forks source link

Implement some of the database editors #99

Closed white-axe closed 4 months ago

white-axe commented 4 months ago

Description This pull request implements basic editors for skills, weapons, armor, states, actors, classes and enemies. They can be improved on later, I don't want to make this pull request too big.

I also increased the sizes of some of the margins and spacing in the editors, they were pretty small before.

Also, I said in #86 that egui doesn't allow truncating text, but that was because of a text-coloring bug that was fixed in egui 0.25, so I've added a method ui.truncate_text for making an egui::WidgetText that truncates with ellipses when the parent layout isn't wide enough to contain the text. I've used this to make the combo box lists in the database editors have truncating text rather than wrapping text. It makes all the rows in the combo box lists have the same height so that .show_rows can be used to show the contents of the combo boxes instead of .show.

Again, there's some missing functionality that I will implement after the event editor branch is done:

Changing the number of items is now implemented without using modals.

Testing I've tried these editors very basically on the KNight-Blade example project. Needs more thorough testing to see if there are any parts of the UI that edit the wrong settings, if any settings can be modified without triggering the unsaved changes dialog or if using the editors breaks projects when saving to them.

Checklist

Speak2Erase commented 4 months ago

Change maximum doesn't prevent you from setting the amount of anything to 0, however I could see that being useful. Do we want to keep that behavior?

white-axe commented 4 months ago

I think I set the lower bound for that drag value to 0 by accident. How would it be useful?

Speak2Erase commented 4 months ago

Maybe your project doesn't need actors or classes? I'm not sure though

@zimberzimber what do you think?

zimberzimber commented 4 months ago

It shouldn't hurt, because if the project isn't using them then it doesn't care if they're there or not. Trying to remove the overhead if max is set to 0 is way more trouble than its worth compared to the benefit I believe allowing 0 and simply passing an empty array to whatever logic needs them should work.

white-axe commented 4 months ago

I removed the limit of 999 items. There are some performance problems when going above about 200 000 items caused by the search functionality in the combo boxes which I'll try to fix. Still, I'm surprised it took that many items before UI performance problems!

Speak2Erase commented 4 months ago

Wow!

Speak2Erase commented 4 months ago

Maybe we could add a warning toast when bypassing limits? Something like Warning: going above 999 <data type> may introduce performance issues and instability

white-axe commented 4 months ago

Okay, there's now a warning for going above 999. z The search boxes also now cache search results instead of recalculating them every frame so you can now set the maximum to a million if you really want to.

white-axe commented 4 months ago

It should now clip the selected ID to the maximum valid ID when that happens instead of crashing