godotengine / godot-proposals

Godot Improvement Proposals (GIPs)
MIT License
1.12k stars 69 forks source link

Improve parity between Path, Line and Polygon editors #6401

Open ettiSurreal opened 1 year ago

ettiSurreal commented 1 year ago

Describe the project you are working on

Testing!

Describe the problem or limitation you are having in your project

The Path, Line and Polygon editors have many differences between them and their 2D and 3D implementations, which can make them somewhat difficult to work with when often switching between them.

Here are the main differences between them

Line2D:

Polygon2D:

Path2D:

Path3D:

CollisionPolygon3D and CSGPolygon3D:

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

Have a unified framework that each of the editors will follow.

Select points mode can do basically everything, and the other modes are mainly meant for devices with no keyboard that cannot use shortcuts.

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

Select Points: LMB - Drag points around RMB - Remove points CTRL+LMB - Add Point in empty space Can add points inbetween other points. Shift+LMB - Edit handles (Path2D/3D) CTRL+T - Edit tilt (Path3D)

Add Points: Adds point in empty space Can add points inbetween other points.

Remove Points: Removes points Using on Path2D/3D handles causes them to reset.

Select Control Points: Edits only handles on Path2D/3D, allowing you to drag them out when set to 0.

Clear Points: Immediately removes all points, a replacement for Create Points making a new polygon.

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

It can't

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

Improving the editor usability out of the box.

SlugFiller commented 1 year ago

The Polygon2D is all sorts of bad. To create custom triangulation, or apply bones, you have to pop up a separate editor window, which will refuse to open unless a texture is set, even though an untextured polygon might still need attachment to a skeleton.

If I'm perfectly honest, I think what's really needed is for point data to exist as nodes, and then the standard tree and transformation editing tools can be used. The cost is that nodes are not exactly lightweight, and would certainly take more resources than a simple PackedVector2Array. But the solution is that they should be, and that it's an issue with node allocation efficiency and not with the choice to use nodes.

aXu-AP commented 10 months ago

I'm gonna focus on 2D side of things in this reply because that's what I'm more familiar with.

I agree that parity between these editors would be nice, and I'm not sure why, but it seems to be a deliberate decision to differentiate Line2D and Polygon2D (+other polygon nodes) editors. They all inherit from the same AbstractPolygon2DEditor class, but for some reason polygons require you to start from scratch every time you need to add a point. Adding points inbetween other points would be a great addition. I've been planning a knife tool proposal which would solve this for polygons at least. Path2D is a odd one here, because it doesn't use point array but a curve. The interface could be made more similiar to other editors as you described.

point data to exist as nodes

Would this really be needed? If I'm understanding your idea right, wouldn't that just add translate/rotate/scale tools? I think adding these things to AbstractPolygon2DEditor would make more sense (and UV editor already has these). And add some way to summon the editor for custom nodes, currently all my scripts which need point data export a Line2D instead for editor support 😅 EDIT: Or did you mean that each point would be a separate node? I can see the benefits of that, but yeah, it could be a real resource hog.

The Polygon2D is all sorts of bad. To create custom triangulation, or apply bones, you have to pop up a separate editor window, which will refuse to open unless a texture is set, even though an untextured polygon might still need attachment to a skeleton.

A bit of a shameless plug, but my proposal #8209 addresses these exact problems. I suggest moving the editor to the bottom dock, much like Animation, Tilemap etc. editors. I've been testing it like that for some time now, and don't want to go back, the improvement in workflow is huge. The don't open without textures is especially offensive, I tried removing that limitation when evaluating if I could implement my proposal, and IIRC all it took was skipping texture draw if it's null to make it work.