godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.16k stars 97 forks source link

Add a Tool Settings panel to the GridMap bottom panel #11206

Open Nodragem opened 1 day ago

Nodragem commented 1 day ago

Describe the project you are working on

I work on this starter kit, which uses Gridmap a lot: https://github.com/Nodragem/top-down-action-adventure-starter-kit

Describe the problem or limitation you are having in your project

I would like to add parameters to the different tools we have in the Gridmap editor.

For instance:

But there might be a lot more, which we can discuss here, for each tool.

The issue is that the space in the top bar is very limited, and these tool parameters don't really belongs to the inspector. They are not parameters of the Gridmap.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

The solution I ssuggest is to add a tool settings panel on the right of the Gridmap Editor: Image (this is a old mockup made before I implemented the bottom panel, hence why it looks different)

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

See above.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No.

Is there a reason why this should be core and not an add-on in the asset library?

Gridmap is core.

badsectoracula commented 1 day ago

This mockup also makes me think that the line and rectangle tools (which i guess are things not implemented yet though they'd be very useful, especially rectangle) could be a single "shape" tool to save horizontal space for narrower monitors and more tools down the line. Then you'd select the shape you want (arbitrary line, line snapped to horizontal or vertical axis, filled rectangle, outlined rectangle) to paint from the properties (i think the panel should be a generic container for each tool to expose any sort of UI - e.g. the shape's modes would be different buttons). This would also allow more freedom for adding shapes.

In the same vain, the select tool could have also different modes and extra commands like a "flood fill select" (like the magic wand in editor) or "select all cells with the same item" (those would need non-rectangular selections to be implemented first of course - i think there was a proposal for this but can't find it with a quick search). And perhaps the shape code could be made generic enough (all shapes i mentioned work in a "make shape from x1,y1 to x2,y2" so some generic method could provide the cell coordinates / key indices from that, be it by filling some array or calling back a lambda) so that the same shapes and code would be usable for both painting and selecting.

Some tools might need similar properties (e.g. shape, paint and fill tools could have a "replace" or "mask" mode where instead of replacing everything they only replace cells that use a reference item set up as another parameter) but these could be done manually (even if the code underneath would most likely be the same).

Calinou commented 1 day ago

I like this idea as it reduces the need for mouse movement between the top and bottom of the 3D editor viewport.

However, the downside of moving these tools to the bottom panel is that they won't be visible when the GridMap editor is collapsed. Right now, even if the bottom panel is collapsed, you still have access to the tools at the top.

Edit: Nevermind, I thought this proposal was about moving the toolbar to the bottom panel, but it's already there.

badsectoracula commented 1 day ago

Also, i don't know if this is possible ATM (especially since from what i can tell Gridmap is essentially a plugin itself), but looking forward it should be a good idea if the individual tools could be done in a modular way so that more tools could be added by editor plugins, especially for game-specific stuff.

For example i was looking into https://github.com/godotengine/godot-proposals/issues/11161 and thought that the requested methods (not the example functionality mentioned, IMO that should be part of the gridmap editor itself) could be useful for game-specific tools like, e.g., setting up custom parameters per cell (the actual parameters would be saved somewhere else in a game-specific manner) by selecting one or more cells and having some custom UI to setup those parameters.

What i had in mind was a bit more hacky but if tools are done in a modular way, it could be done in a more seamless manner - essentially the game-specific script/plugin adding a new tool into the palette.