godot icon indicating copy to clipboard operation
godot copied to clipboard

Move UV editor to bottom dock, rename to Polygon editor

Open aXu-AP opened this issue 1 year ago • 8 comments

Implements https://github.com/godotengine/godot-proposals/issues/8209 (with the exception of refactoring input function). kuva

  • 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.

aXu-AP avatar Nov 19 '24 20:11 aXu-AP

Marked as draft because of that one failing check. Any help to solve it would be appreciated...

aXu-AP avatar Nov 19 '24 21:11 aXu-AP

I have no idea, so I ran the failed job again. Will investigate.

fire avatar Nov 20 '24 03:11 fire

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 :)

aXu-AP avatar Nov 21 '24 12:11 aXu-AP

Rebased and changed MODE_WEIGHTS to MODE_BONES to be more in line with existing terminology.

aXu-AP avatar Dec 12 '24 15:12 aXu-AP

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.

KoBeWi avatar Dec 12 '24 20:12 KoBeWi

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.

KoBeWi avatar Dec 12 '24 21:12 KoBeWi

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)

aXu-AP avatar Dec 13 '24 10:12 aXu-AP

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.

aXu-AP avatar Dec 15 '24 17:12 aXu-AP

Needs rebase.

KoBeWi avatar Jan 03 '25 18:01 KoBeWi

Rebased

aXu-AP avatar Jan 03 '25 21:01 aXu-AP

Thanks!

akien-mga avatar Jan 06 '25 21:01 akien-mga