Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move Polygon2D's UV Editor to bottom dock, rename to Polygon Editor #8209

Open
aXu-AP opened this issue Oct 20, 2023 · 9 comments
Open

Move Polygon2D's UV Editor to bottom dock, rename to Polygon Editor #8209

aXu-AP opened this issue Oct 20, 2023 · 9 comments

Comments

@aXu-AP
Copy link

aXu-AP commented Oct 20, 2023

Describe the project you are working on

Looking to resurrect an old 2D platformer game which uses textured polygons for characters and environments.

Describe the problem or limitation you are having in your project

The fact that Polygon2D's UV editor is a separate dialog has currently many limitations:

  • Breaks the flow of development. If using polygons as level geometry, you need to edit polygons relative to the rest of the scene, then adjust uvs - it's iterative work, jumping between 2 separate windows unnecessarily slows development.
  • Previewing made changes requires either closing the window or resizing/moving it around.
  • Undo/redo shortcuts aren't registered inside the dialog. Fixed by Fix undoredo handling in some dialogs godot#93898
  • Not consistent with how Animation/AnimationTree/SpriteFrames/Tileset/TileMap editors are handled.

Renaming makes sense because it's not just UV editor. It currently handles also polygon creation and bone weight painting. Also see proposal for color editor: #8195

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

When selecting a Polygon2D node, in the bottom dock appears editor named "Polygon". The functionality of the editor is unchanged. You can edit polygons in the dock or use tools that are available in canvas editor's toolbar. To iterate on previous points:

  • Working has better flow as both views are available at the same time.
  • You can see in main editor view what the results are when you are adjusting UVs or bone weights.
  • Undo/redo works out of the box as focus is in main window.
  • Polygon editor is no longer lonely but with good company.

Renaming the editor boosts feature discoverability. The little "UV" button in toolbar doesn't really tell you that this is also how you change bone weights.

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

kuva
I have already made a proof of concept on this, you can check it at aXu-AP/godot/uv-editor-enhanced (WIP)

  • Move the editor to bottom dock.
  • Remove UV button from toolbar, the editor opens upon selecting Polygon2D node.
    • Currently UVs get generated automatically when opening UV editor dialog the first time. Change this to generate when changed to UV tab inside the editor, same for bone weigths.
  • Allow editor to operate on Polygon2D without a texture. Fixed in Allow opening of polygon editor without texture godot#96731
  • Reorder the modes to match workflow: Points, Polygons, UV, Bones (you don't start with UV's, place some points first!)
  • Update the editor on Polygon2D's property changes.
  • Refactor code, as currently the code looks like everything was made under assumption that only UVs are going to be edited in this plugin, and thus many properties, enums and methods are named confusingly when other functionality was added on top:
    • Remove prefix uv_ from a lot of properties.
    • Rename UVMode enum to Action, uv_move_current to action_current. This is to make distinction clear between actions (create, transform points) and modes (UV, Bones etc.).
    • Add Mode enum to differentiate between editing modes/tabs. Add method _get_current_mode(). Ie. instead of uv_edit_mode[3]->is_pressed() => _get_current_mode() == MODE_BONES.
      • Allows for reordering and adding future modes without touching every area of the code, also makes code more readable.
    • Rename Mode enum to Menu, as it's used just for checking which menu option was selected, and doesn't really have anything to do with AbstractPolygon2DEditor's modes out of currently being in the same toolbar.
    • Note: these are all private members, so no breaking changes.
    • Change the flow/structure of input handling (_uv_input()).
      • Order the code tool/mode first, input second (see this comment).

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

Used often.

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

Improves core editor functionality and makes the code easier to maintain.


This is one part of multiple UV editor enhancements: #4118

@KoBeWi
Copy link
Member

KoBeWi commented Oct 20, 2023

This would possibly supersede #266

@aXu-AP
Copy link
Author

aXu-AP commented Oct 20, 2023

@KoBeWi as UV editor currently works only on Polygon2D, not necessarily. Down the line we could consider adding CollisionPolygon2D and LightOccluder2D support to it. But this proposal doesn't cover that.

@KoBeWi
Copy link
Member

KoBeWi commented Oct 20, 2023

Ah right. Well, at least it would make it possible to easily resolve that proposal, as the required functionality already exists.

@aXu-AP aXu-AP changed the title Move Polygon2D's UV Editor to bottom dock, rename to Polygon2D Editor Move Polygon2D's UV Editor to bottom dock, rename to Polygon Editor Oct 20, 2023
@aXu-AP
Copy link
Author

aXu-AP commented Oct 28, 2023

Interestingly, @reduz implied multiple times in #4565 that polygon editor is in the bottom dock. Citing:

This makes sense for the most part because most things in the bottom panels (console, debugger, animation editor, tile editor, polygon editor, etc) would simply not function on the side.

Contextual editors like Tile Editor, Polygon Editor, Animation Tree Editor and many others (which only one should open at the same time and only when the node or resource is being edited) should still remain hard-coded to the bottom panels

Was this at some point planned or does he talk about something else entirely?

@KoBeWi
Copy link
Member

KoBeWi commented Oct 28, 2023

He was probably referring to the texture region editor, which was since then moved to a dedicated dialog opened from the inspector.

@aXu-AP
Copy link
Author

aXu-AP commented Oct 28, 2023

I didn't know that texture region editor was in the dock at some point, but it makes sense that it's its own dialog now as it's for one off edits. Unlike polygon editor, which can be more of an iterative work, hence bottom dock ftw 😊

@miss-programgamer
Copy link

I'm interested in this rework of the polygon2d editor becoming a reality, and would even be willing to work on it. I've been working on a card game where I want character animations to use 2D skeleton animations, and the process of editing "meshes" (polygons) is really not great as it stands, heh.

@aXu-AP
Copy link
Author

aXu-AP commented Oct 2, 2024

I can finish my work on this and make a pr, I believe it more or less just needs a rebase and some small things. I have been waiting because there wasn't much support on this proposal. Altough there seems to be some at least, and notably I have seen no criticism towards the idea. I guess the best thing you can do to get this implemented is to try to get more community backing for the idea. It's not hard to implement, but the maintainers need to see that this is a valuable change.

I made a reddit post about this and other proposed modifications to polygon editor, which generated some buzz (votes stand at +52, with 96% upvote rate), but that's hard to convert into github likes.

@aXu-AP
Copy link
Author

aXu-AP commented Nov 21, 2024

At last I finished the pr: godotengine/godot#99439

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants