1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-20 12:33:14 +00:00
A free & open-source 2D sprite editor, made with the Godot Engine! Available on Windows, Linux, macOS and the Web! https://orama-interactive.itch.io/pixelorama
Find a file
Manolis Papadeas 27cb0d2d2f
New selection system (#474)
* Basic move tool

* Added marching ants effect on the selection borders

* Rename SelectionRectangle to SelectionShape, make it have non-rectangular shape and multiple SelectionShapes can exist

- Create multiple selection rectangles
- Merge them together if they intersect
- Move the selections (without contents as of right now)
- Gizmos are being drawn but they are not functional yet

Code is very ugly.

* Sort vectors counter-clockwise to be used as polygon borders

I did this, no idea if it works properly, probably won't be used but I thought I'd keep it saved somewhere

* More experiments I may or may not need

Trying to generate a polygon from the individual selected pixels

* Change default rectangle select behavior and ability to clip polygons using Control

* Fix rectangle selection clipping

* Split polygon into two with selection subtracting

* Move selection with contents with the move tool

Code is still a mess, don't bother looking.

* Move some methods from SelectionShape.gd to Selection.gd

The purpose of this is to generalize some selection code, so that it applies to all polygons, the entire selection. More will follow.

* UndoRedo for border moving

Nothing else in the selections system works properly in UndoRedo right now. Needs:

- UR support for creating selections
- UR support for modifying selections (merging and cutting selections together)
- UR support for removing selection
- UR support for moving content

& for all the rest of the remaining features

* Moving all of the selection shape logic to Selection.gd

Handle all of the polygons there instead of having them as individual nodes. Should be easier to handle undo/redo this way. This commit probably breaks move tool + selection tool and undo/redo. Code is still a mess. For your sanity, I hope you are not reading this. I promise I will clean up.

* Move tool works again

Buggy and messy, of course.

* Remove unneeded code and restore selection move undoredo logic

* Made Selection.gd have one big preview_image for when moving content, instead of each polygon having its own image

Could be further optimized for some specific cases. We could also remove selected_pixels from SelectionPolygon.

* UndoRedo support for creating, deleting, merging and clipping selections

UndoRedo support for moving content not added in this commit. Should work but needs more testing. This PR also removes selected_pixels from the SelectionPolygon class.

* Confirm & cancel selection movement, should support undoredo properly too

Press Enter or do any editing to confirm movement, Escape to cancel. I will most likely add UI buttons for confirm and cancel too.

* Mirror View affects selection

* Restore Cut, Copy, Paste and Clear Selection

Pasting now no longer requires a pre-existing selection and instead copies the selections themselves too.

* Created a new Select menu, which has Select All and Clear Selection as options

Clear Selection now also confirms content moving. TopMenuContainer code has changed to no longer rely on Global for the menu buttons.

* Draw gizmos as rectangles

No functionality yet. They may need to be turned to nodes, so that they can easily resize based on zoom level and check for mouse enter/exit events.

* Made gizmos get drawn in the sides and corners of the big bounding rectangle instead of individual selection parts

Still no functionality yet.

* Restore label text

* Minor optimization when clipping selections

This will execute the for loop less times

* Made a Gizmo class, cursor change on hover, has_focus = false on mouse click

Now I should actually make them resize when dragged, aye?

* Very basic gizmo resizing, still a WIP, does not work properly yet

* Start replacing the array of selected pixels with a BitMap

This should optimize the selection making a lot, and it also allows for easy border drawing without having to deal with polygons, thanks to the MarchingAntsOutline.shader

Still commit is still a WIP, image effects and brushes may not work properly yet.

Because the BitMap has a fixed size, the size of the project, moving the selection outside of canvas boundaries has proven to be a bit tricky. I did implement a hacky way of handling it, but it may be buggy and problematic. I'm still unsure whether this is the best way to handle the situation.

* Selection works with mirror view

* Draw a black rectangle when the user is making a rectangular selection

After they release the mouse, the black rectangle becomes the selection

* Make Selection.gd update when undoing/redoing

* Fix brushes not working properly with non-rectangular selections

* Added invert selection

* Cache has_selection as a variable for a speedup

* Fix conflict issues with the shape tools

* Made the bitmap image squared so the marching ants effect will be the same on both dimensions

There may be a better way to fix the issue, perhaps inside the shader itself.

* Some optimizations to call selection_bitmap_changed() less times

* Restored almost all of the image effects

Left to do:
- Change gradient's behavior. Unsure of how it will work with non-rectangular selections yet, but it should not generate pixels outside of the selection.
- Restore rotation
- Resize bitmap on image resize
- Remove the `pixels` array from the ImageEffect

* Fix Selection.gd not updating when changing project

* Resize the selection bitmap along with image resize

* Restored rotation's old behavior and finally got rid of the selected_pixels array

The rotation does not yet work properly with selections, but at least it now "works".

* Resize selection too when using gizmos

Left to do for gizmos:
- Proper cancel transformation
- Begin transformation
(currently named move_content_start but it should be renamed to something more general) when resizing gizmos
- Keep the original image and selection in memory and resize them. Meaning, gizmos should not resize the already resized data, but only resize the original. This is less destructive as there is no danger of data loss.
- Always resize on InputEventMouseMotion. This is going to be worse for performance, but it will look better for the user.

* Image and bitmap resizing now uses the original data and begin transformation on gizmo click

No matter how many times the user resizes on the current transformation, the original data will not be lost until they either confirm or cancel, so there is no data loss before confirmation/cancel.

* Cancel transformation now works properly when the selection has been resized

* Made gizmos resize on mouse motion, fix issues with negative bounding rectangle and when combined with the move tool

* Resizing can now get out of positive bounds, clearing and inverting now gets limited to the canvas bounds

Resizing currently does not work properly with negative (left & up) canvas boundaries

* Flip image when resizing and the bounding rectangle gets flipped

* Call move_content_confirm() when inverting selection

* Attempt to implement selection resizing that goes outside of the canvas boundaries (not working properly yet)

* Flip selection when resizing to negative bounding rectangle sizes

And fix preview_image vertical flipping

* Fix rotation so that it works (almost) properly with selections

Rotation algorithms now accept and only work with a given image, and the pivot has been added as a parameter

* Experimental gizmo rotation - does not work properly yet

Transforming the selection outside of the canvas is still broken.

* Fix some issues with moving selection out of canvas bounds

* Fix more issues with selection getting resized outside of canvas bounds

* Update marching ants effect properly when switching between projects

And make sure the frequency of the marching ants effect always looks roughly the same on all project sizes

* Made the rotation gizmo part of the gizmos array and resize them based on camera zoom

* Remove unneeded parameter from move_bitmap_values()

* Remove more unneeded parameters

* Move the selection only if the cursor is above it and neither shift nor control are currently pressed

* Gradient generation now works on non-rectangular selections

Although this behavior might not be the intended one

* Copy/paste marching ants effect offset

Useful for when the selection is in negative coords

* Fix issue with clear selection & UndoRedo

* Restore the ability to move selection when it's in negative coords

* Made the marching ants offset a Project variable

This fixes the issue of project switching and keeping the previous project's offset. Again, this is only relevant for when the selection is in negative coords.

* Made the "from current selection" palette preset work with the new selection system

* Fix out of bounds error when using the rectangular select tool on negative coords

* Some code cleanup

* Comment out the rotation gizmo for now, since it does not work properly

* Update marching ants shader params and gizmo sizes when the bitmap changes

* Move some methods around in Selection.gd
2021-04-17 11:30:12 -07:00
.github Fixed macOS butler deployment in release workflow 2021-01-18 17:22:00 -08:00
addons Update gdgifexporter addon - closes #387 2021-01-05 03:43:40 +02:00
assets Replace old palette system with a new one (#447) 2021-04-16 11:09:03 -07:00
installer New Crowdin updates (#400) 2021-02-03 17:20:30 -08:00
Misc v0.8.2-stable 2020-12-12 16:55:13 +02:00
pixelorama_data Replace old palette system with a new one (#447) 2021-04-16 11:09:03 -07:00
src New selection system (#474) 2021-04-17 11:30:12 -07:00
Translations Replace old palette system with a new one (#447) 2021-04-16 11:09:03 -07:00
.gitattributes Initial commit 2019-08-18 12:28:38 +03:00
.gitignore Update Mac export workflow (#319) 2020-08-26 14:51:53 +03:00
.gitmodules Add gif export plugin and extend export dialog with GIF animation support. 2020-04-06 18:51:47 +02:00
CHANGELOG.md Update CHANGELOG & AboutDialog 2021-04-16 22:07:38 +03:00
CONTRIBUTING.md Fix broken links in CONTRIBUTING.md 2021-01-17 10:56:00 -08:00
crowdin.yml Update Crowdin configuration file 2020-08-09 23:48:23 +03:00
export_presets.cfg Set up itch.io deployment on the release workflow 2020-12-01 00:24:28 +02:00
LICENSE Update copyright statements to present 2021-01-03 21:03:20 +02:00
project.godot New selection system (#474) 2021-04-17 11:30:12 -07:00
README.md Update README & CHANGELOG 2020-11-27 22:00:05 +02:00

Pixelorama - your free and open-source sprite editor!

Made by Orama Interactive with the Godot Engine, written in GDScript!

Build Passing Build Passing Code Size Repository size License

Downloads Discord Chat Crowdin Localized % Mentioned in Awesome Godot

Pixelorama's UI Art by Wishdream - winner of the first Pixelorama splash screen art contest!

Make sure to visit our website for more information! https://www.orama-interactive.com

Join our Discord community server where we can discuss about Pixelorama and all our other projects! https://discord.gg/GTMtr8s

If you like, consider helping us by sponsoring this project! It would enable us to focus more on Pixelorama, and make more projects in the future!

Toss A Coin For A New Feature: Become a Patron!

Download

Stable versions:

You can also find early access builds in the GitHub Actions page. There's also a Web version available. Keep in mind that these versions will have bugs and are unstable. Unless you're interested in testing the main branch of Pixelorama, it's recommended that you stick to a stable version.

Documentation

You can find Online Documentation for Pixelorama here: https://orama-interactive.github.io/Pixelorama-Docs

It's still work in progress so there are some pages missing. If you want to contribute, you can do so in Pixelorama-Docs' GitHub Repository.

Cloning Instructions

Pixelorama uses Godot 3.2, so you will need to have it in order to run the project. As of right now, most of the code is written using GDScript, so the mono version of Godot is not required, but Pixelorama should also work with it.

Current features as of version v0.8:

  • Choosing between 7 tools pencil, eraser, fill bucket, lighten/darken, color picker, rectangle select and zoom and mapping them to both of your left and right mouse buttons.
  • Are you an animator? Pixelorama has its own animation timeline just for you! You can work at an individual cel level, where each cel refers to a unique layer and frame. Supports onion skinning, cel linking, motion drawing and frame grouping with tags.
  • Different tool options for each of the mouse buttons.
  • Custom brushes! Load your brushes from files or select them in your project with the selection tool, and they will get stored in .pxo files!
  • Random custom brushes! Every time you draw, expect to see a different random result!
  • Create or import custom palettes!
  • Multiple project support, using tabs!
  • Pattern filling! Use the bucket tool to fill out an area with a pattern of your choosing.
  • Import images and edit them inside Pixelorama. If you import multiple files, they will be added as individual animation frames. Importing spritesheets is also supported.
  • Export your gorgeous art as PNG or GIF files. Exporting your projects as spritesheets is also possible.
  • Pixel perfect mode for perfect lines, for the pencil, eraser & lighten/darken tools.
  • Save and open your projects as Pixelorama's custom file format, .pxo
  • Undo/Redo support!
  • Autosave support, with data recovery in case of a software crash.
  • Multiple theme support! Choose a theme from Dark, Gray, Blue, Caramel and Light!
  • Horizontal & vertical mirrored drawing!
  • Tile Mode for pattern creation!
  • Split screen mode to see your masterpiece twice! And a mini canvas preview area to see it thrice!
  • Create straight lines for pencil, eraser and the lighten/darken tool by pressing Shift. If you also press Control, you can constrain angles with a step of 15.
  • Generate outlines for your images!
  • Υou can zoom in and out with the mouse scroll wheel or the + and - keys respectively, and pan by clicking the middle mouse button, by holding Space or with the arrow keys!
  • Keyboard shortcuts, and the ability to change their bindings.
  • Rulers and guides!
  • Rectangular & isometric grid types.
  • Scale, crop, rotate, flip, color invert, HSV-adjust, desaturate and generate gradients in your images!
  • Multi-language localization support! See our Crowdin page for more details.

Special thanks to