godot
godot copied to clipboard
Move UV editor to bottom dock, rename to Polygon editor
Implements https://github.com/godotengine/godot-proposals/issues/8209 (with the exception of refactoring input function).
- Move polygon editor to the bottom dock similiarly how tilemaps, animations etc. are handled.
- Reorder the modes to reflect usual workflow (move UV to third place)
- Refactor enums for modes, actions and menu items.
- Rename bunch of stuff (mainly remove "uv" prefixes) to more understandable, and reorder some members in header file.
- Some smaller cleanups
The pr is currently in multiple commits in case it's easier to review (for example, the functional change is just a few lines compared to refactoring). Or if some changes are deemed unwelcome, or better split to separate prs, we can cherry pick more easily. I will squash them eventually.
Marked as draft because of that one failing check. Any help to solve it would be appreciated...
I have no idea, so I ran the failed job again. Will investigate.
Managed to fix the problem. Since the editor is outside the tree when it's not in the dock, it won't free itself upon closing. Added cleanup in the NOTIFICATION_PREDELETE (I hope that's the correct place for it).
Now the pr is ready for review :)
Rebased and changed MODE_WEIGHTS to MODE_BONES to be more in line with existing terminology.
With this change, we have another node that pops a bottom panel every time you select it.
There is a glitch when the panel opens. It resets the view, but if it was shifted before selecting, the panel will appear if previous position and then reset after one frame. Very noticeable.
https://github.com/user-attachments/assets/a164e8ff-daca-4316-894b-8dedddac9ca6
I think it should not reset if you select the same node as before.
Reorder the modes to reflect usual workflow (move UV to third place)
With this you also changed default mode to Points. Is this the usual workflow? I only ever used UV editor to edit UV tbh.
The basic functionality still works and the code changes look fine overall. https://github.com/godotengine/godot/pull/99439#discussion_r1882871935 is the only major problem.
Thanks for the review, I think I can icorporate the feedback tomorrow.
With this you also changed default mode to Points. Is this the usual workflow? I only ever used UV editor to edit UV tbh.
The workflow of course depends on what we are doing. Some times UV editor is the one I need, some times other tabs, so I don't have strong preference on one over the other. I just felt that this order makes more sense and by default open the first tab. Here's 2 things I mostly use Polygon2D for:
- Cutout animation
- Here the first step is to create the polygon of the part we need from a spritesheet (ie. Points tab or automatic conversion from a sprite).
- Add inner points around joints and define polygons (Points, Polygons tabs). (a side note, this is a quite painful workflow, I have something better in mind and will make a few proposals for that).
- Do weight painting (Bones tab).
- Textured environments
- Here I create the polygon directly in the scene as it needs to be in relation to the level.
- Adjust uvs (UV tab)
I'd be interested in hearing what others are using the node and the editor for as I want to continue improving the editor. (See https://github.com/godotengine/godot-proposals/discussions/4118)
I made the requested changes. I managed to solve the one frame late view adjustment by recentering the view as many times as the canvas gets drawn in that frame. I'm not proud of that, feels hacky, but it seems to work reliably.
Needs rebase.
Rebased
Thanks!