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

Add a vertex color editor for Polygon2D #8195

Open
aXu-AP opened this issue Oct 19, 2023 · 3 comments
Open

Add a vertex color editor for Polygon2D #8195

aXu-AP opened this issue Oct 19, 2023 · 3 comments

Comments

@aXu-AP
Copy link

aXu-AP commented Oct 19, 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

Polygon2D supports vertex colors but there's no way to edit this data outside of setting it manually or by code. Vertex colors are useful for coloring polygons (duh), and for various vfx like adjusting amount of wind affecing leaves.

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

Inside UV editor, there would be a Color mode. User would be able to apply color to their vertices with brush and fill tools.

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

Color editor would support following functionality:
kuva

  • Adjust all channels at the same time (good for coloring the polygon) or one channel at the time (good for using shaders that interpret the colors as something else).
  • Brush tool. Paints vertices' color to selected value within radius of mouse cursor. Allow to adjust size and hardness.
  • Bucket tool. Paint all connected polygons at once.
  • Opacity. Set to less to make minor adjustments instead of overwriting current colors. Note: Setting color to transparent sets the vertices themselves to be transparent, so this needs to be a separate option.

Small note: on the above mockup I use sliders but in the actual editor I would use EditorSpinSlider for compactness.

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

Used more or less as often as uv and weight editor.

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

Adds editor support for existing core functionality.


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

@Calinou Calinou changed the title Vertex color editor for Polygon2D Add a vertex color editor for Polygon2D Oct 19, 2023
@Calinou
Copy link
Member

Calinou commented Oct 19, 2023

We already have a Polygon2D UV editor. I wonder if both should be merged in the same dialog (and rename the tool to "Polygon2D attribute editor" in the process, with UV and color modes). This would reduce the need for code duplication.

@aXu-AP
Copy link
Author

aXu-AP commented Oct 19, 2023

Yes, this is exactly my intention, see the part "Inside UV editor, there would be a Color mode."
Altough it's called UV editor, it's also bone weight and and general polygon editor, so renaming it would make sense.

EDIT: @Calinou also note this discussion here, where I have listed few other improvements I would like to implement into this Polygon Editor: #4118
Renaming the editor would be part of the idea to move the editor to bottom like animation/tileset/tilemap etc. editors. Practically it would just mean to get rid of "UV" button in the toolbar and add it as "Polygon" tab in the dock. Even the editor class is already called Polygon2DEditor, it's called uv editor only in the toolbar and dialog title. And most of class variables and enums are named like uv_this_or_that, but that can be left in I guess.

@aXu-AP
Copy link
Author

aXu-AP commented Oct 20, 2023

Made a separate proposal for bottom dock & refactoring to reflect editor's intention better: #8209
Refactor would help adding Color editor on the road, as currently magic numbers are used for distincting between modes, suggested change to use enum.

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

2 participants