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

224 commits

Author SHA1 Message Date
Manolis Papadeas 3727caf9c4 Revert "Use L8 format for selection texture"
This reverts commit 8a3414f83a.
2022-03-23 03:56:47 +02:00
Manolis Papadeas 8a3414f83a Use L8 format for selection texture
Instead of LA8. This should result in slightly less memory usage and is more on par with Godot's BitMap "convert_to_image" method, which will be exposed in Godot 3.5.
2022-03-23 01:48:58 +02:00
Manolis Papadeas 71dcb9807d Theme code cleaning and tidying 2022-02-17 20:36:10 +02:00
mrtripie f0fbca8b5b
Bugfix: Duplicate Shader in ShaderImageEffect before modifiying its code (#630)
* Fixed issues with Shading tool Saturation and Value not always being right in Hue Shading mode

* Shading tool hue shifting fixes and tweaks

* Duplicate shader resource before modifying its code

* added line before comment

Co-authored-by: MrTriPie <MrTriPie>
2022-01-07 01:49:22 +02:00
Manolis Papadeas 8f701dfee0 Fix #626 2022-01-03 14:05:41 +02:00
Darshan Phaldesai 51288148ee
Shader Fix Hack (#625) 2021-12-30 18:05:28 +02:00
Manolis Papadeas 311f4dd70b Add missing line to Desaturate and InvertColors, and made some changes to ShaderImageEffect 2021-12-27 00:08:06 +02:00
Manolis Papadeas 48326900d9 Fix a memory leak coming from the Layer class
Removed the "frame_container" property from Layer.gd, which used to hold a reference to a node, leading to orphan nodes being created and never freed. Memory management seems to be working okay now. Previously, every time the user made a change, memory kept going up and never coming down. Now, data that can never be recovered, like undo data that have been rewritten in history, are also removed from memory.
2021-12-23 19:58:07 +02:00
Manolis Papadeas 750fae4713 Project data no longer remain in memory after the user has removed their tab 2021-12-11 21:29:32 +02:00
Manolis Papadeas 67ec887ad1 Just one method for undo/redo in Global.gd 2021-12-02 02:22:32 +02:00
Manolis Papadeas f70efe3076 Move new_empty_frame() to Project.gd from Canvas.gd
This commit also changes the behavior of the fill color. The new cels now only get filled with the Project.fill_color if they are on the bottom layer.
2021-12-01 20:50:50 +02:00
Manolis Papadeas 4c60ef144f Fixed project not having the correct size if the default image size has been changed in the Preferences
Ideally, the new_empty_frame() method should be removed from Canvas and should probably go to Frame or Project.
2021-12-01 20:02:39 +02:00
Manolis Papadeas f3d696ef81 Clear code from ShaderEffect.gd
Now inherits from ImageEffect and uses a ShaderImageEffect to generate the image. We get to clear duplicate code that was shared between ShaderEffect.gd and ShaderImageEffect.gd this way, and it also uses the undo/redo logic from ImageEffect instead of Canvas.gd.
2021-12-01 03:41:20 +02:00
Manolis Papadeas 2cab2af561 Preload image effect shaders 2021-12-01 03:04:40 +02:00
Manolis Papadeas 15d987ebae Changed behavior of flip image to make it work as expected with selections
The selection itself also gets flipped, if there is any
2021-11-30 02:42:35 +02:00
Manolis Papadeas e2a68c4ba4 Add an underscore to private method's names
As a way to differentiate between public and private methods, as per the official GDScript naming convention. Haven't changed all of the codebase yet, just some scripts that had a lot of public methods. This fixed 4 of the 7 errors of the linter.
2021-11-29 17:12:30 +02:00
Manolis Papadeas c6b9a1fb82
Format code and add static checks (#599)
* gdformat .

* Lint code - Part 1

* Format code - Part 2

* Lint code - Part 2

Trying to fix the max allowed line length errors

* Add normal_map_invert_y to the image .import files

Because of Godot 3.4

* Do not call private methods outside of the script's scope

Lint code - Part 3

* Format code - Part 3

* Fixed more line length exceeded errors - Lint code Part 3

* Export array of licenses - Lint code part 4

* Clean hint_tooltip code from Global

Removes a lot of lines of code

* Create static-checks.yml

* Fix FreeType's license
2021-11-25 14:48:30 +02:00
Manolis Papadeas 79ff0a8d45 Optimize _input() methods 2021-11-22 21:32:39 +02:00
Manolis Papadeas 19c062fa07 Move some PopupMenu code away from Global's _ready() 2021-11-22 16:15:36 +02:00
Variable 3e88efc118
Improvements to Animation Tags (#560)
* Animation tag fix (a)

fixed tag behavior in "Project.gd"

* Animation tag fix (b)

fixed tag behavior in "AnimationTimeline.gd"

* Animation tag fix (c)

fix top part of line not visible

* Animation tag fix (d)

a fix i forgot about earlier

* added a randomizer...

... to auto select colors of new tags

* Fix Tag scrolling without cels when scrolled on it

* removed randomize() cause it's not needed
2021-11-17 00:21:29 +02:00
mrtripie 969aed8070
Cache Save/Open Sprite Dialog's directory, and keep dialogs synced (#559)
* Open/Save Sprite Dialogs now have their directory cached so when reopening Pixelorama they will be set to that directory. Load last project and load recent project also syncs with the open/save dialogs and caches that directory

* Sets a projects default file path to the cached file directory (not sure about) and if the export directory is blank, use the cached file directory

* Changed 'file_dialog_dir' to 'current_dir'

Co-authored-by: MrTriPie <MrTriPie>
2021-11-17 00:17:02 +02:00
mrtripie a9039cccd5
Canvas Rotation (#558)
* Implemented canvas rotation

Co-authored-by: MrTriPie <MrTriPie>
2021-11-13 20:43:37 +02:00
Manolis Papadeas 87261e93c6 Disable "New Brush" in the Edit menu if there is no selection 2021-11-06 17:19:20 +02:00
Manolis Papadeas 37916b63ca Update the minimum value of the zoom level spinbox on project change 2021-09-04 16:59:23 +03:00
Manolis Papadeas 47b20ff5c3 Fix the canvas preview having incorrect zoom when switching between projects 2021-09-04 15:32:44 +03:00
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 1d20295f7d Keep images unlocked after editing them - Should close #331
Not sure if this actually solves the issue or just makes it more rare, but I haven't been able to reproduce any PoolVector locking issues so far. The problem was that images were remained locked essentially all the time, which seemed to cause issues. Maybe other PoolVectors could not get locked?
2021-07-25 21:49:37 +03:00
Manolis Papadeas ef133f4f71 Fix issue where Cel's image setter was not being called 2021-07-24 18:17:44 +03:00
Manolis Papadeas 65051f0910 Bring back the image_changed setter of the Cel class
Caused issues when importing files
2021-07-22 16:33:20 +03:00
Manolis Papadeas 57bb7929df Fixed issue with linked cels where, if you had linked cels in one layer and then linked more cels of the same frame in another layer, their previews did not update automatically
Cel's image_texture was being reset due to the creation of new Cel instances in CelButton.gd (line 113)
2021-07-22 02:25:00 +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 763a063de7 Made brushes work with the shading tool 2021-07-21 02:19:46 +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 2a9420700b Fix image effect preview background not keeping its aspect ratio 2021-05-30 19:20:56 +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 3852b419dd Image effects will not longer get applied to locked and/or hidden layers. 2021-04-21 00:48:36 +03:00
Manolis Papadeas ea606a072a Make layers uneditable when they're invisible 2021-04-21 00:12:05 +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 76772d3c64 Fixed bug with ImageEffect previews and different projects
When the user switched from one project to another, which had a larger size, the preview of the ImageEffect was trying to set pixels out of bounds, only when the affect option was different than "Current cel"
2020-11-16 00:56:03 +02: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 44ecf375fc Removed duplicate code from the image effects and put it into the parent ImageEffect class 2020-08-28 01:20:07 +03:00
OverloadedOrama b52a7c224a Put a transparent checker background to RotateImage dialog
Also made it extend the ImageEffect class.
2020-08-26 17:49:46 +03:00
Darshan Phaldesai 60c5ec9ad5
Affect area now affects the previews. (#320) 2020-08-26 14:29:49 +03:00
OverloadedOrama f121c39ddc Put checker backgrounds to almost all image effect dialog previews
Also made them inherit ImageEffect, resulting in much less and cleaner code. Only RotateImage remains. Partially addresses #206.
2020-08-25 19:49:18 +03:00
OverloadedOrama 2af677016e Created an ImageEffect class
This will be the parent of all (or most) image effect dialog nodes. Currently only parent on FlipImageDialog, will change to be parent of the rest of the effects.
2020-08-25 19:07:12 +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
OverloadedOrama 6c2b7f7067 Improved performance for drawing after the selected_pixels change
It should be as fast as before, if there's not a big selection.
2020-07-20 22:29:58 +03:00
OverloadedOrama 0f82be765e Replaced the _min and _max Project variables with Project.selected_pixels
This will allow us to create more selection tools in the future, that aren't necessarily rectangular (See #129) and even enhance the current rectangle selection tool (See #56)

Current issues spotted so far:
Drawing is slower for large images, and bucket filling is also considerably slower even on a 64x64 image. Optimizations are required.
2020-07-20 22:15:34 +03:00
OverloadedOrama a5a8bf1fe5 Turn Symmetry Guides visibility on and off if mirroring is enabled
Also fixed issue with "Show Guides" view menu option and having multiple projects with guides. Only think remaining is to make the Symmetry Guides look different than regular guides. Closes #133.
2020-07-16 05:05:40 +03:00
OverloadedOrama 9fa91ffd8e Added SymmetryGuides
Two special guides - one horizontal and one vertical - that let you change the axis of symmetry for mirroring. On the next commit(s) I will make them visible only if mirroring is toggled on. Almost solves #133
2020-07-16 04:25:59 +03:00
OverloadedOrama 7529e967e3 Selection no longer affects the mirroring point of symmetry
Instead, x_symmetry_point and y_symmetry_point are being used in Project.gd that determine the points of symmetry. This is necessary for #133
2020-07-15 21:23:15 +03:00
OverloadedOrama 671536cbd7 Fixed bucket crash when there were no patterns 2020-07-09 15:52:59 +03:00
Kinwailo 4a668f71f5
Refactoring tools (#281)
* Refactoring tools

* Remove unused code

* Fixed some inferring errors and added translations

* Attempt to fix some Script Errors found in the CI workflow

* Fix bucket crash.

* Fix static type convert.

Co-authored-by: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>
2020-07-09 15:22:17 +03:00
OverloadedOrama 2e587e3634 Made TopMenuContainer.gd and moved all the menu code there from Main.gd
Main.gd is now easier to read
2020-06-13 17:59:57 +03:00
OverloadedOrama 8064d7b459 Fixed shadowed variables crashes/warnings occurring in Godot 3.2.2-rc1 2020-06-13 15:25:12 +03:00
OverloadedOrama b0338ab09a Changed structure of .pxo files
The structure of the .pxo files is now consisted of a JSON-structured metadata part, where all the data that can be stored as text are, and a binary part, that contain all the actual image data for each cel and project brush.

This makes it easier for users to understand the .pxo structure, easier to add more changes without having to check versions for backwards compatibility, easier to be opened by third-party apps and it allows us to make an "Export JSON metadata" option, that will export just the metadata in JSON format, without the binary image data.

It's backwards compatible and .pxo files from as far as v0.5 are still supported.
2020-06-10 04:17:39 +03:00
OverloadedOrama 76af8a3214 Change paths in the open/save dialogs when switching project 2020-06-09 20:19:55 +03:00
OverloadedOrama 8118381b0b Fixed issue where new images had the size of the previous project 2020-06-09 18:44:08 +03:00
OverloadedOrama 01ce3a3932 When opening a project and the current tab is empty, open it in that tab
If the current project is empty (only 1 layer and frame, no tags and the image has no content - is invisible) and the user is opening a project, then the opened project will not open a new tab of its own, and will use the currently opened one instead.
2020-06-07 01:48:35 +03:00
OverloadedOrama 709a401373 Save backups for all opened projects
current_save_paths and backup_save_paths in OpenSave.gd are arrays now, have paths for every project
2020-06-06 02:16:53 +03:00
OverloadedOrama 2c409ab025 Camera zoom and offset are now project properites
The zoom/offset of the three cameras now get saved in each project, and change when you change project.
2020-06-05 21:03:34 +03:00
OverloadedOrama 9ffce37c0b An asterisk is added to the tab name if there are changes
The window title also changes when switching tabs. And yes, "has_changed_changed" is a stupid method name, I'll find another one sometime later.
2020-06-05 20:15:40 +03:00
OverloadedOrama 6d87901056 Imported image files now open in an new tab
Keep in mind that opening an image file as a new frame might not work properly yet, if the target image has a different size.
2020-06-05 19:51:06 +03:00
OverloadedOrama 1b1c7f844f .pxo files now get opened in a new tab 2020-06-05 18:54:11 +03:00
OverloadedOrama 7a61f1ea4a Fixed issue where the wrong amount of cels were being created
The new image's frames had as many cels as the previously selected project
2020-06-05 18:19:05 +03:00
OverloadedOrama b276999b12 Closing tabs is now possible 2020-06-05 17:50:52 +03:00
OverloadedOrama 4af130bc61 Project brushes change when switching projects
A new Global.file_brushes array is used for the file brushes, and the Project class has its own brushes array for the project brushes
2020-06-05 17:21:35 +03:00
OverloadedOrama 736521246d Change guides when switching project 2020-06-05 16:21:19 +03:00
OverloadedOrama fc03e83377 Change the selection rectangle when switching projects 2020-06-05 16:14:57 +03:00
OverloadedOrama 35969b2f67 Moved the _min and _max variables to Project.gd 2020-06-05 16:06:59 +03:00
OverloadedOrama ae381a8714 Change canvas and timeline when a tab is being pressed 2020-06-05 04:30:31 +03:00
OverloadedOrama 709a6d470e Added basic UI for tabs 2020-06-05 02:48:38 +03:00
OverloadedOrama f9bd590d20 Moved size variable from Canvas.gd to Project.gd 2020-06-04 23:20:20 +03:00
OverloadedOrama 4e111a7ac0 Created a Projects class
A Project class contains project-specific data like name, undo_redo, frames, layers, tags and brushes. These variables have been moved from Global. This is the first step towards multiple tab support, where each tab will be a different Project.
2020-06-04 21:05:36 +03:00
Manolis Papadeas 9d38cbd13e
Update Drawers.gd 2020-06-04 20:30:26 +03:00
Manolis Papadeas b6dec2d500
Merge branch 'master' into refactoring 2020-06-04 20:28:22 +03:00
OverloadedOrama 2e5ff236d7 Renamed the _limit variables
See https://github.com/Orama-Interactive/Pixelorama/issues/232#issuecomment-638718662
2020-06-04 18:20:56 +03:00
Kinwailo 30f8891f21
Move pixel perfect and mirror code to drawers class (#255) 2020-06-04 14:11:24 +03:00
OverloadedOrama 54b628f6cb Made a Frame class, no longer use multiple Canvases for multiple frames
The Canvas is now single node, instead of having multiple canvases for each frame. This should also be a performance optimization, since there are less canvas nodes, so there are less _input() calls. It should also fix a rare Undo/Redo issue with motion drawing and making lines. Could be unstable, needs more testing.

As a side effect, the guides are now the same for all frames, so this should also close #246.
2020-06-03 02:14:24 +03:00
Manolis Papadeas 881e53dadc
Bring refactoring changes to master (#253)
* Refactoring image_menu_id_pressed method in Main.gd (#243)

* Refactoring image_menu_id_pressed method in Main.gd

I've moved the code from each "match" case into a seperate method to make it more readable.

Co-authored-by: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>

* Refactoring Main.gd. Mostly cutting big methods into smaller ones. (#244)

* Refactoring Main.gd. Mostly cutting big methods into smaller one.

- Reduced size of _ready method in Main.gd
- Moved code from certain parts of old _ready method into seperate methods
- Fixed the translation bug related to CurrentFrame node in TopMenuContainer scene. The CurrentFrame node wasn't updating the language when I was changing language. I've also changed the translation file for this.
- Fixed Global.palette_option_button.selected related warning. Because of some unknown reasons, git didn't push completed line there.
- Moved code from file_menu_id_pressed and view_menu_id_pressed method in Main.gd to separate methods to make it more readable.

* Removed window_title changes from Main.tscn

Co-authored-by: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com>

* Fixed TextureRect images of the circle brushes in BrushesPopup

They all had the pixel brush image in their TextureRect

* Split code from PreferencesDialog.gd to HandleLanguages.gd

Also moved PreferencesDialog script & scene to src/Preferences. More Preferences code splitting will follow.

* Split theme related code from PreferencesDialog into HandleThemes.gd

* Moved shortcuts code from PreferencesDialog

* Created DrawingAlgos.gd and moved a lot of drawing code there

Moved code from Global.gd and Canvas.gd to DrawingAlgos.gd. Will also move the fill_gaps and draw_brush methods of Canvas.gd next. Maybe even refactor the inside of them a bit to make them easier to read.

* Connected "files_dropped" signal to a method

This lets the user drag and drop files into Pixelorama, while it runs, to open them. This doesn't work properly and will crash when it can't open the files. It will get merged into master soon.

* Renamed handle_running_pixelorama_with_arguments() to handle_loading_files()

handle_loading_files() is also used for _on_files_dropped()

* Moved draw_brush() and fill_gaps() from Canvas.gd to DrawingAlgos.gd

draw_brush() is currently very ugly and probably needs inside refactoring

* Removed coord clamping from fill_gaps()

This should make line making behave as expected when the mouse is outside of canvas boundaries

* Drawing is no longer limited by the canvas boundaries

his means that, if you have a brush largen than 1px, you can draw on the edges of the canvas. All pixels that are being drawn outside of the canvas will still have no effect.

* Use enums instead of strings for tools

This could be a slight increase in performance

* Fixed line making with Shift and don't let color picker pick colors outside of canvas

* Changed Global node variables to arrays for left/right

Instead of having 2 variables for left & right nodes, use an array instead. This will help with better looking code, automation and less repetitive code, as seen in ToolButtons.gd. Move related refactoring will follow.

* More Global left/right variables became Arrays

Global.update_left_custom_brush() and its right counterpart have also now become Global.update_custom_brush(mouse_button : int)

* Use Global.Mouse_Button instead of strings for comparison

This should be a slight increase in performance

* Refactoring perferences dialog (#251)

* Added ItemList to themes

* Language and theme checkboxes are now radio buttons

* Even more Global left/right variables became arrays

ColorAndToolOptions has now the same code for left and right tool options, with more similar refactoring coming soon to places like Canvas and DrawingAlgos

* Refactored Canvas.gd

* Refactored DrawingAlgos.draw_brush(), made draw_pixel() method

This also fixes alpha blending and lighting/darkening issues when drawing pixels with mirroring.

* Remove draw_pixel(), use draw_pixel_blended() instead

* Ignore warnings

I don't know what else to do about them, they seem trivial anyway

* Use enum instead of strings for Global.theme_type

Another potential small performance boost when changing themes.

* Use a new Layer class to handle layer information

This replaces the old Global.layers nested array mess, and makes the code easier to read and to understand.

* Fixed linked cel crash and layer naming

* Created a new Cel class, to handle cel information

Like the Layer class, it is used in place of Canvas.layers nested array mess. It hasn't been tested thoroughly yet, so there may be crashes.

* Fixed issue where if you moved a frame to the start (move left), it was invisible

* Added AnimationTag class

Replaces nested Global.animation_tags arrays. Also replaced array.duplicate(true) with looping through the array and creating a new class for each array element, because duplicate(true) does not create new classes, unfortunately, which was causing issues with undo/redo.

Co-authored-by: Igor Santarek <jegor377@gmail.com>
Co-authored-by: Kinwailo <lokinwai@gmail.com>
2020-06-02 20:00:18 +03:00
OverloadedOrama 34bc528e97 Added AnimationTag class
Replaces nested Global.animation_tags arrays. Also replaced array.duplicate(true) with looping through the array and creating a new class for each array element, because duplicate(true) does not create new classes, unfortunately, which was causing issues with undo/redo.
2020-06-02 05:14:05 +03:00