skybaks / tm-editor-helpers

Expand the map editor capabilities in Trackmania with Openplanet
https://openplanet.nl/files/69
The Unlicense
6 stars 0 forks source link

Feature Request: Better folder UX in editor #46

Open Devinish opened 1 year ago

Devinish commented 1 year ago

This is a combination of 2 related problem statements, which can potentially be solved in several different ways.

Problem 1 When I go to change my editing tool at the bottom bar (or any time I move my mouse around and accidentally hover over a folder), the folders I move past automatically open, cluttering up my vision in the editor.

Problem 2 When picking a block using the Picker tool, picking it automatically expands the folder tree to that object, cluttering my vision in the editor.

Some potential, non-mutually exclusive solutions to these problems, in no particular order:

  1. Make it so the folders don't open unless they are clicked on / their number is typed
  2. Make it so a slightly longer hover is required before the folder expands
  3. Change the folders to be some other UI, that isn't in the way all the time
  4. Make it so that after selecting a block, the folders auto-collapse
  5. Make it so that you can only see 3 rows of folders max (the level below, the level above, and the one you are currently selecting from
  6. Make a shortcut/hotkey to auto-collapse all the folders

I'm sure there are plenty of other solutions to these problems. Thanks for your consideration.

skybaks commented 1 year ago

Thanks for posting, these are really good ideas. I havent looked at this area of the api in a while so maybe there is something that can be done now on this

In the meantime, you can maybe use TAB to show/hide the inventory

skybaks commented 1 year ago

So after searching I was able to find a function that is equivalent to the down button which appears after you have focused on a folder level: Editor.EditorInterface.Childs["FrameMain"].Childs["FrameInventories"].Childs["ButtonInventoryDown"].OnAction(). How to focus the folder level is still eluding me, though.

Devinish commented 1 year ago

Ok, so this is the action to go one folder level down? could you loop through it until there's no more folder levels to go through?

skybaks commented 1 year ago

Sorry that was poorly phrased. I mean that method is what you get when you click this button image

Im still trying to find out if openplanet has hooks in the right places to be able to focus the inventory on a level

XertroV commented 1 year ago

Clicking (selecting) inventory items can be done like so: https://github.com/XertroV/tm-editor-plus-plus/blob/1a70468071775e0cae91d5adcef40a9d1dbf66ab/src/Components/Inventory/List.as#L63-L68

FYI I will probs expose this in E++ (via exports).

skybaks commented 1 year ago

Yeah, we do already have something like that implemented. Curious to see what you do with it tho!

XertroV commented 1 year ago

@skybaks here's how to set the number of hidden folders:

// 0 = show all. 1 = hide 1 level. 2 = hide 2 levels. If set to more than the available number of levels it will reset to 0;
void SetInventoryHiddenFolderDepth(CGameEditorGenericInventory@ inventory, uint8 v) {
    Dev::SetOffset(inventory, 0x1E8, v);
}
skybaks commented 1 year ago

I havent had a chance to play with this yet but it certainly is intriguing. I'm not sure I want to introduce the Dev api into this plugin, though, for the dual reasons that I dont really have the expertise to maintain it and I am uncomfortable with the instability it could introduce if not maintained.