1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-19 17:49:47 +00:00
Commit graph

75 commits

Author SHA1 Message Date
Manolis Papadeas 3482314971 Fix project's selection bitmap having incorrect size when importing a pxo 2021-08-29 16:26:01 +03:00
Manolis Papadeas 9bec8f1b09 Preload more resources
Had to remove references to Brushes and Patterns classes from BrushesButton.gd and PatternButton.gd due to GDScript's cyclic reference bug
2021-07-21 18:29:52 +03:00
Manolis Papadeas d0433bed6f Preload layer and cel button nodes in Project.gd
Just a minor optimization to avoid unnecessary loading
2021-07-20 21:03:15 +03:00
Manolis Papadeas 2760049cfd Fix content transformation not getting confirmed when changes were done to frames and layers
Also fixes issue where frame/layer copying does not copy the transformed data
2021-07-08 20:46:56 +03:00
Manolis Papadeas cd811d7e78 Fixed issue where "Layer 0" would be renamed when it changed position 2021-07-04 15:29:44 +03:00
Manolis Papadeas 9234005d1a Minor drawing optimization 2021-07-01 18:14:49 +03:00
Manolis Papadeas 02278e5fee Fix crash when importing a new project on an empty project 2021-06-24 20:32:30 +03:00
Manolis Papadeas ac631e3e3d Transform selected content of multiple selected cels
Does not work with rotation. It might be a good idea to replace this whole system with one that uses a transformation matrix, to handle rotation and skewing more easily in the future. I'm not a huge fan of this current code.
2021-06-19 19:29:32 +03:00
Manolis Papadeas de850ce8a1 Ability to select multiple cels and edit them all at once
A rather significant change, so, while I have tested it, it might still be buggy. Implements a part of #306.
2021-06-12 01:06:13 +03:00
Manolis Papadeas e7a5b45536 Clicking on a layer button now selects the layer. Double clicking it allows renaming 2021-06-05 03:06:07 +03:00
Manolis Papadeas 39b0baca84 Frame numbers in the timeline above the cels are now clickable buttons 2021-06-05 02:11:22 +03:00
Manolis Papadeas 1827381439 Remove unnecessary image.lock() lines 2021-05-12 15:51:31 +03:00
Manolis Papadeas e8b36bbc61 Fix symmetry guide crash when opening pxo files
Related to the PoolVectorArray locking issue (#331). This still doesn't fix the issue itself, but at least Pixelorama does not crash anymore. It is still possible, though, to fail to load a guide when opening a project. Opening it again may solve the issue.
2021-05-12 15:35:20 +03:00
Manolis Papadeas afd7cc43c9 Rename move_content methods to transform_content 2021-04-23 23:37:07 +03:00
Manolis Papadeas dbda57396b Fix selection_offset not being reset to 0 when the bitmap's position is back to positive coordinates 2021-04-21 18:22:43 +03:00
Darshan Phaldesai dca76afe17
Shader based invert, desaturate and HSV dialogs (#475)
* Shader based invert, desaturate and HSV dialogs

* Bug fixes
2021-04-21 05:31:33 -07:00
Manolis Papadeas a712f822d7 Fixed bug when copying while moving content 2021-04-21 15:25:17 +03:00
Manolis Papadeas f1b98f662e Call move_content_confirm() when layers and frames change 2021-04-19 19:55:29 +03:00
Manolis Papadeas b735bc760f Optimize Project.get_selection_rectangle
It doesn't call bitmap_to_image() anymore.
2021-04-18 15:26:15 +03:00
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
ballerburg9005 de164ea9de
full support for auto tallscreen/widescreen panel layout (#458)
* full support for auto tallscreen/widescreen panel layout

* Update Main.tscn

* Update CanvasPreviewContainer.tscn

* Update UI.tscn

* tallscreen support - better display scale

* tallscreen support - better display scale

* Update UI.tscn

* Update Main.gd

* tallscreen support - better display scale

* tallscreen support - better display scale

* tallscreen support - alternate panel placement comment-784228607

* tallscreen support - code cleanup

* tallscreen support - color picker swap: comment-785032683

* prettier border

* tallscreen support - color picker

* tallscreen support - pullrequestreview-601156079

* tallscreen support - bugfix & review

Co-authored-by: ballerburg9005 <mathias.steiger@gmail.com>
2021-03-06 05:59:26 -08:00
Manolis Papadeas c54b74f829 Having no active selection no longer treats all the pixels of the canvas as selected
A performance boost for when opening large images. Also fixed an issue with pixels being selected outside of the canvas boundaries, when the selection rectangle was outside the canvas and its size got reduced.
2021-01-31 15:09:54 +02:00
Manolis Papadeas 7f1594e1bc You can now resize cels in the timeline by holding Control and scrolling with the mouse wheel.
Addresses part of #306
2021-01-30 23:57:33 +02:00
Manolis Papadeas 77185b5263 Update tile mode rects when importing a project 2021-01-30 20:43:10 +02:00
Manolis Papadeas 5b3b91b247 Fix #445 by NOT replacing empty backups 2021-01-30 20:33:00 +02:00
kleonc 4001a32f2b
Cache tile mode rects (#443)
* Cache tile mode rects

* Make TransparentChecker don't calculate tile mode rect on its own

* Minor fixes

- typo
- formatting
- moved unlock() call to the method where matching lock() was called
2021-01-28 11:21:48 -08:00
kleonc 63838964b3
Renamed enums to follow recommended naming convention (#437) 2021-01-20 06:59:42 -08:00
kleonc 9c520a65e9
Refactored isometric grid (#430)
* Move get_tile_mode_rect() method to the Project class

* Refactored isometric grid

Now it should be drawn properly in the target rect.
Settings (in pixels):
- cell's AABB size,
- offset from the canvas origin.
2021-01-18 12:59:26 -08:00
kleonc db9980a883
Draw Grid only over Canvas. Added PixelGrid. (#427)
* Draw grid only over the Canvas (when in tiling mode)

* Replace some magic numbers with enums.

It's too easy to break something when adding something new in here. Should be a little harder now.

* Added Pixel Grid.

- Pixel grid is shown only when it's enabled and camera is zoomed close enough.
- Settings: pixel_grid_show_at_zoom (as a percentage because that's what's shown in the settings panel), pixel_grid_color. Default values might need changing.
- To distinguish between grid and pixel grid default settings for grid width, grid height are changed.
- Now both grid and pixel grid are drawn above (after) tile mode. Grid is drawn above (after) pixel grid.
2021-01-16 10:24:46 -08:00
kleonc c18c705748
Update GUI for Cel.opacity on frame changed instead of on layer change (#420)
It's Cel's property and thus it changes when frame_changed is called (also layer_changed calls frame_changed on its own).

Co-authored-by: kleonc <kleonc@users.noreply.github.com>
2021-01-04 17:12:02 -08:00
Manolis Papadeas 031efc0cdb Make FPS project-specific and store it in the pxo files 2020-12-17 02:20:47 +02:00
Manolis Papadeas 05c9ef70d4 Put frame duration as a member of the Frame class
Instead of having a frame_duration[] array in the Project class. This makes the code much more readable and understandable, using less lines of code and, by avoiding an extra array, we also avoid potential out-of-bound array crashes.

The functionality for the user has not changed, and by testing so far I didn't find any issues.
2020-12-16 22:54:08 +02:00
Manolis Papadeas 46939bd74d Check the correct tile mode button in View > Tile Mode when changing between projects
Also changed the buttons to radiobuttons
2020-12-03 03:49:53 +02:00
Manolis Papadeas 54c6c86099 When opening a .pxo project which has guides, they will no longer be added to the project at the first tab too 2020-11-25 18:25:56 +02:00
AbhinavKDev 96454a2d57
Handiling tile modes in each project (#388)
* Handiling tile modes in each project

Co-authored-by: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com>
2020-11-24 08:53:18 -08:00
Manolis Papadeas 6feea6dd3f Fixed untranslated palette string 2020-11-14 15:24:24 +02:00
Manolis Papadeas 4be0740170 Fixed crash when loading a pxo older of 0.8.1 and selecting a frame other than the first
Had to do with Project.frame_duration not having as array members as it should.
2020-11-12 02:16:08 +02:00
Manolis Papadeas 7dd9b36cdc Move "Recent projects" up, just below "Open last project" in the File menu 2020-10-29 22:33:15 +02:00
Manolis Papadeas 4e33476a4d Fixed "Export" option in the File menu not working properly when switching between projects
Export.was_reported was keeping its value when switching projects, instead of being project-specific. Also fixed issue where imported images were not remembering the directory_path and file_name when switching projects.
2020-10-25 00:58:37 +03:00
Manolis Papadeas b3aa4a6343 Fixed crash when creating a new project
Caused by #357
2020-10-23 17:44:37 +03:00
OverloadedOrama e94bcf50e0 Made pxo saving a bit safer
It now first attempts to serialize the project data and turn them to JSON, and then opens the file. This is a lto safer because, if a crash happens in the serialization, the file is not already open, and therefore it does not get corrupt. Earlier, if a crash happened, the file would be empty. This meant that if that file existed previously, all of the data would be lost.
2020-10-20 03:27:38 +03:00
PinyaColada 852365c38f
Frame properties (#357)
* Sync for my local files to my repository

* This is frame properties update, it works but I can't be stored while
saving or loading and that makes crashes just the beggining :)

* I forgot this files :P

* Frame Properties update.

* Updating frame properties

* Update Translations.pot

* Changes to CanvasPreview and CelButton change
2020-10-19 17:57:40 +03:00
OverloadedOrama fbbdcdaa57 Made the frame move buttons get disabled when you can't move frames 2020-10-05 02:37:55 +03:00
OverloadedOrama edf7e43bb8 Update size label when changing project or scaling 2020-09-14 17:51:35 +03:00
OverloadedOrama 0a0bf62bcd Each Project has its own export path now
This could be buggy so it needs more testing.
2020-08-28 18:05:49 +03:00
OverloadedOrama 52effb12cd Fix issue with project loading and not being able to draw outside of 64x64
Project.selected_pixels() did not get updated.
2020-08-20 01:27:21 +03:00
OverloadedOrama 35b2c201ae Changed how isometric grid is drawn
Instead of drawing individual lines, execute draw_isometric_tile() multiple times. What this method does is basically draws a single isometric tile, which then gets repeated for the entire canvas size. Also moved all the grid logic to a new script, which gets updated less often that Canvas.gd, for optimization purposes.

Works better than the previous method, although it might be a bit slower, and currently does not work well if the canvas size is not divisible by the grid size. For now, it only gets affected by the grid width. Changing grid height has no effect.
2020-08-17 22:54:33 +03:00
OverloadedOrama 7269b45fc5 Added play button and zoom slider for the small canvas preview
May also be a solution for the age old issue #25.
2020-08-02 00:59:00 +03:00
OverloadedOrama 8529e93029 Don't save erased guides in .pxos
This fixes a crash when saving a pxo with guides that have been removed
2020-07-27 20:03:15 +03:00
OverloadedOrama c7f50107d6 Fixed symmetry guide being off by one pixel
See https://github.com/Orama-Interactive/Pixelorama/issues/133#issuecomment-662328285
2020-07-22 15:07:02 +03:00