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

Basic Layer Groups and Timeline Refactor #698

Merged
merged 173 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
7d0c25f
Fixed issues with Shading tool Saturation and Value not always being …
Aug 18, 2021
9d653fc
Merge branch 'Orama-Interactive:master' into master
mrtripie Aug 20, 2021
3d476e6
Merge branch 'Orama-Interactive:master' into master
mrtripie Aug 21, 2021
f82a6fc
Shading tool hue shifting fixes and tweaks
Aug 23, 2021
774af73
Merge branch 'Orama-Interactive:master' into master
mrtripie Aug 26, 2021
06c12ee
Merge branch 'Orama-Interactive:master' into master
mrtripie Nov 11, 2021
5a9b7b4
Merge branch 'Orama-Interactive:master' into master
mrtripie Nov 13, 2021
6845aa4
Merge branch 'Orama-Interactive:master' into master
mrtripie Nov 14, 2021
bde2431
Merge branch 'Orama-Interactive:master' into master
mrtripie Dec 9, 2021
c8ff638
Merge branch 'Orama-Interactive:master' into master
mrtripie Dec 11, 2021
54e3daf
Merge branch 'Orama-Interactive:master' into master
mrtripie Dec 17, 2021
d8457ce
Merge branch 'Orama-Interactive:master' into master
mrtripie Jan 6, 2022
a07e33a
Merge branch 'Orama-Interactive:master' into master
mrtripie Jan 15, 2022
d30cd40
Merge branch 'Orama-Interactive:master' into master
mrtripie Jan 16, 2022
4d1a0e9
Merge branch 'Orama-Interactive:master' into master
mrtripie May 6, 2022
51e1b6b
Bringing over changes from layer groups brach, without any changes to…
May 6, 2022
031813b
Some quick fixes to make it work again
May 6, 2022
ed33874
Fixed some of the places where GroupLayers cause errors. Cel Buttons …
May 6, 2022
2bbc303
Layer drag highlighting (need to actually drop them correctly, also n…
May 8, 2022
0e96c9f
Added more layer hierarchy related functions, organized the function …
May 8, 2022
3b33d80
Switched the layer type changing from string to int
May 8, 2022
831818c
Moved layer type enum to Global
May 8, 2022
1e6a74f
Added get_layer_type_name(), currently used for the default layer name
May 8, 2022
3be9a74
Renamed the layer get_children/is_a_parent_of functions
May 9, 2022
17dcb68
changed get_layer_type_name() to get_default_name(number)
May 9, 2022
cc2b0eb
New layer drag and dropping behavior
May 11, 2022
dbf23fd
Added read/write_image_data_from/to_pxo functions to Cel classes to h…
May 11, 2022
a81e231
Fixed warning
May 11, 2022
37c6c0a
Added a line to child layers wich makes it easier to see where they a…
May 11, 2022
c2bf5e9
Fixed debugger warning
May 11, 2022
e1e3867
Fixed all cel types loading as PixelCels
May 11, 2022
e8d2bfe
Fixed spacing issue with cels when collapsing groups
May 12, 2022
683ac3c
Fixed bug when dropping a child layer to the bottom region of its par…
May 13, 2022
0cfd25c
updated temporary todo comments
May 13, 2022
132d5e2
Created a base scene for layer buttons and merged layer button script…
May 13, 2022
54d4c08
Prevent the case of parenting to itself in layer drag and drop, fixed…
May 13, 2022
c1eaa6f
Use a base scene for CelButtons
May 14, 2022
9a7b77a
First bit of the refactoring work
May 16, 2022
2751193
Several bits of refactoring
Jun 20, 2022
57b51f8
Fixed moving cels
Jun 22, 2022
bb9e697
Cleaned up Project.move_cel function
Jun 22, 2022
380e709
Fixed project_layer_removed
Jun 24, 2022
bb40950
Updated change_frame_order on FrameButton. Some (not all) work on get…
Jun 24, 2022
1b9c846
Bug fixes. Updating layer button's buttons
Jun 28, 2022
7303bb7
Fixed timeline selection issues when creating a new project. Some cod…
Jun 28, 2022
43be23d
tweaks
Jun 28, 2022
a45cd33
Removed a bunch of commented out code
Jun 28, 2022
3d29f85
Removing more commented out code
Jun 28, 2022
262fb85
Fixed bugs with timeline selectio. Fixed cels being placed in the rev…
Jun 29, 2022
252ca6a
Changed add/remove_frame to add/remove_frames (multiple support)
Jun 30, 2022
2bca533
Refactored copy_frames in animation timeline
Jul 1, 2022
cda37f2
added copy function to cel classes
Jul 1, 2022
44a2bd8
added layer copy function
Jul 1, 2022
3ed3dd2
simplifed copy_frames a tiny bit
Jul 1, 2022
a196185
Updated TODO comments to categorize them and remove any that were alr…
Jul 1, 2022
1e018ba
Turned Project.add/remove_layer into Project.add/remove_layers (multi…
Jul 1, 2022
53128f7
Seperated the layer cloning functionality in timeline's add_layer to …
Jul 1, 2022
4604c4c
some TODOs
Jul 2, 2022
2e6f71f
Added layer swapping
Jul 7, 2022
78f74dc
Added priorities to refactor TODOs
Jul 9, 2022
4ffec4c
Simplified layer swapping code a little
Jul 11, 2022
23abd60
Fixed performance regression on changing project, updated TODOs
Jul 11, 2022
c2193e0
Included _on_MergeDownLayer_pressed in timeline refactor
Jul 14, 2022
593c928
Cleaned up _on_MergeDownLayer_pressed refactor
Jul 14, 2022
5729f68
If all frames are selected, prevent being able to remove all of them
Jul 14, 2022
1d77155
Fixed cel linking when cloning layers/frames. Moved the copy function…
Jul 15, 2022
f282cda
Combined and rewrote the 2 project _toggle_layer_buttons_.. functions…
Jul 18, 2022
bf3a61d
Simplified _toggle_layer_buttons some more
Jul 18, 2022
22bf2c9
Added hierarchy support for move up/down layer buttons
Jul 19, 2022
1dfa0ed
Added toggle_frame_buttons method to project (extracted from _frame_…
Jul 19, 2022
4714b96
Fixed duplicate_layers parent references being to the original layers
Jul 19, 2022
e90878d
cleaned up project.move_layers method a bit
Jul 19, 2022
0f58b0f
TODOs
Jul 20, 2022
423da6f
moved the transform_content_confirm calls for the layer buttons in An…
Jul 20, 2022
7f3d5c1
animation first/last_frame tweaks and un-press play buttons when the …
Jul 20, 2022
2c9382d
Cleaned up project_changed in ANimationTimeline a bit
Jul 20, 2022
a1dfc7c
Cleaned up project_layer_added in AnimationTimeline
Jul 20, 2022
a65b4e6
Changed Layer classes get_default_name to set_name_to_default
Jul 20, 2022
df3cabd
Cleaned up LayerButton.drop_data slightly
Jul 20, 2022
4f75f30
Looked at some of my TODOs
Jul 20, 2022
586a820
cleaned up copying cels
Jul 20, 2022
a52f055
Fixed CelButton linked_indicator not showing up right away when becom…
Jul 20, 2022
5d4c044
Cleand up link/unlink cel menu option a little. Fixed situatoin where…
Jul 20, 2022
d7810e8
Fixed regression with copy_cel (linked) in when cloning a frame
Jul 20, 2022
33ae093
Minor cleanup, more detailed comments, updated TODOs
Jul 21, 2022
e33a553
more improved comments
Jul 21, 2022
77e6b66
Made focus_mode on Cel/Layer/FrameButton NONE to fix bug where it loo…
Jul 21, 2022
48788e0
Made AnimationTimeline.change_layer_order work a little more consista…
Jul 21, 2022
3316ee1
Updated comments and TODOs
Jul 21, 2022
8e33b74
cleanup
Jul 21, 2022
e3c548a
removed some code that should no longer be needed
Jul 21, 2022
b16f3d6
updated comment
Jul 21, 2022
f15549b
removed Project's frames and layers setters _frames_changed and _laye…
Jul 21, 2022
7e5514d
Made some 'for x in range(array.size())' just 'for x in array.size()'
Jul 22, 2022
e8da681
Merge pull request #4 from mrtripie/TimelineRefactor
mrtripie Jul 22, 2022
1fcd5bd
merging master into BasicLayerGroups
Jul 22, 2022
c233ae8
updated comments/TODOs
Jul 23, 2022
c600c2e
Cel content changes intial
Aug 13, 2022
d24938b
Added 'content' methods to Cel classes
Sep 8, 2022
3bdc03c
Removed image var from PixelCelButton
Sep 8, 2022
172a476
Reusing PixelCelButton.gd on GroupCelButton scene
Sep 8, 2022
c5b50b0
Renamed PixelCelButton.gd to CelButton.gd (as it will be used for all…
Sep 8, 2022
5c36673
Hide the TransparentChecker on GroupCelButton.tscn until a preview te…
Sep 8, 2022
baa6d2f
Merged Pixelorama Master
Sep 8, 2022
f377848
TODOs, prevent memory leak when closing projects
Sep 9, 2022
8dfe30a
Link/unlink cel cleanup
Sep 9, 2022
8d21125
Added _project param to _init methods of Layer classes
Sep 9, 2022
c568e4f
Added update_texture method to Cel classes (moving part from the upda…
Sep 12, 2022
caa202e
Removed a temporary check (which also fixed another bug)
Sep 12, 2022
016e14a
Clone child layers when cloning a layer
Sep 12, 2022
4359d9d
Added temp dummy get_image method to GroupCel, and use get_image when…
Sep 12, 2022
0a19ec5
TODOs
Sep 12, 2022
eb58033
Made open_image_as_spritesheet_layer work after the timeline refactor…
Sep 13, 2022
b92f653
Added create_new_cel methods to Layer classes
Sep 14, 2022
a8c7183
Updated TODOs and comments
Sep 14, 2022
8780246
Renamed Layer class's create_empty_cel to new_empty_cel to match Proj…
Sep 14, 2022
5c06190
Renamed create_layer/cel_button to instantiate_layer/cel_button
Sep 14, 2022
2fc9030
updated TODOs
Sep 14, 2022
8af1bb9
prioritized TODOs
Sep 14, 2022
34fe893
Fixed some warnings
Sep 14, 2022
1126958
removed commented out code from previous commit
Sep 14, 2022
30cb028
Merged Pixelorama master
Sep 14, 2022
5439a54
Fixed export
Sep 15, 2022
0420489
Made open_image_as_new_frame work after timeline refactor
Sep 15, 2022
68e5ad6
Fixed open_image_as_new_layer after timeline refactor
Sep 15, 2022
3ff4e70
Some linked cel fixes
Sep 15, 2022
83f6c82
More linked cels fixes
Sep 15, 2022
fb2b6fd
cleanup
Sep 15, 2022
4a9b7c8
Optimized importing spreadsheet as new layer
Sep 15, 2022
4877af3
Fixed Scale Image crash with Groups
Sep 15, 2022
13e265e
Fixed onion skin with groups
Sep 15, 2022
3a82653
Removed blend_mode from BaseLayer for now
Sep 16, 2022
3c8dc77
Mostly fixed image effects
Sep 16, 2022
c2ab5fa
Fixed resize canvas
Sep 16, 2022
eab0576
Fixed drag and drop not working with Cel Buttons on Group Layers
Sep 16, 2022
a1dda95
updated TODOs
Sep 16, 2022
875d2ab
Renamed Replace Frame (in open image) to Replace Cel
Sep 16, 2022
cc5215a
Continued renaming Replace Frame to Replace Cel
Sep 16, 2022
64cade7
Made open_image_at_cels work after timeline refactor
Sep 16, 2022
b6d7ef3
Added get_layer_path method to BaseLayer
Sep 16, 2022
17f31b7
Replaced AtLayerSpinbox with AtLayerOption for Open Image as New Fram…
Sep 16, 2022
d905416
Updated TODOs
Sep 16, 2022
699a93a
updated TODOs
Sep 16, 2022
988cc64
Comments for cel content methods
Sep 16, 2022
454cf3d
fixed right clicking group cel button deselecting the button (even th…
Sep 16, 2022
5e75ebb
frame/layer modification methods comments
Sep 16, 2022
746c610
Removed unneeded size flags
mrtripie Sep 16, 2022
a65441f
TODO updates
Sep 17, 2022
33399ae
merged online commit
Sep 17, 2022
159ef74
Removed a loop that would never run from open_image_as_spritesheet_tab
Sep 17, 2022
a03d9ff
TODO update
Sep 17, 2022
4ca7b73
Combined BaseLayer.get_children_direct and get_children_recursive int…
Sep 17, 2022
6348ee2
Removed unneeded frame paramaters from _on_DeleteFrame_pressed and _o…
Sep 17, 2022
470c212
TODO Updates
Sep 17, 2022
ea8bca0
Removed unneeded code from delete_frames
Sep 17, 2022
762eb5d
Made delete_frames variable names more consistent with my other changes
Sep 17, 2022
01a9346
Continuation
Sep 17, 2022
9a93751
made variable names in copy_frames more consistent with rest of changes
Sep 17, 2022
a55b02c
Update TODOs
Sep 17, 2022
4e3ea14
Removed TODOs for after this PR (moved to my notes)
Sep 17, 2022
ca68feb
Fixed crash when pasting image on Group
Sep 17, 2022
b2ee8e3
Fixed layer .visible check to be is_visible_in_hierarchy()
Sep 17, 2022
553a9ef
Removed some drag highlight polish code that didn't work
Sep 17, 2022
97c5e6a
Removed code from Canvas update_texture and update_selected_cels_text…
Sep 17, 2022
14db339
gdformat
Sep 17, 2022
1029dbf
gdformat
Sep 17, 2022
b8a98e2
gdlint fixes
Sep 17, 2022
2c9d1e0
Fixed Cel button not having its linked indicator show when enabling n…
Sep 17, 2022
69572b2
Fixed crop image and centralize image
Sep 17, 2022
99c45c0
merge master
Sep 17, 2022
39e7ecd
Added '# gdlint: ignore=max-public-methods' to the top of Project'
Sep 17, 2022
67aaa62
Fixed dragging cels to layer of different type crash
Sep 25, 2022
b6a6017
Formatted CelButton.gd
Sep 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion Translations/Translations.pot
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ msgstr ""
msgid "New frame"
msgstr ""

msgid "Replace frame"
msgid "Replace cel"
msgstr ""

msgid "New layer"
Expand Down Expand Up @@ -1540,12 +1540,18 @@ msgstr ""
msgid "Layer"
msgstr ""

msgid "Group"
msgstr ""

msgid "Layers"
msgstr ""

msgid "Create a new layer"
msgstr ""

msgid "Create a new group layer"
msgstr ""

msgid "Remove current layer"
msgstr ""

Expand Down Expand Up @@ -1580,6 +1586,9 @@ msgid "Enable/disable cel linking\n\n"
"Linked cels are being shared across multiple frames"
msgstr ""

msgid "Expand/collapse group"
msgstr ""

msgid "Palette"
msgstr ""

Expand Down
Binary file added assets/graphics/layers/group_collapsed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/layers/group_collapsed.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/group_collapsed.png-9d08fac1c2f635c754860111d024aa0f.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/layers/group_collapsed.png"
dest_files=[ "res://.import/group_collapsed.png-9d08fac1c2f635c754860111d024aa0f.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
Binary file added assets/graphics/layers/group_expanded.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/layers/group_expanded.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/group_expanded.png-f3cd620185a4989737d6d9a36f4b57f3.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/layers/group_expanded.png"
dest_files=[ "res://.import/group_expanded.png-f3cd620185a4989737d6d9a36f4b57f3.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
Binary file added assets/graphics/layers/group_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 35 additions & 0 deletions assets/graphics/layers/group_new.png.import
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[remap]

importer="texture"
type="StreamTexture"
path="res://.import/group_new.png-4ebdc7dd84d8c8a7b7979f50f4471543.stex"
metadata={
"vram_texture": false
}

[deps]

source_file="res://assets/graphics/layers/group_new.png"
dest_files=[ "res://.import/group_new.png-4ebdc7dd84d8c8a7b7979f50f4471543.stex" ]

[params]

compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0
48 changes: 36 additions & 12 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/Classes/AnimationTag.gd"
}, {
"base": "Reference",
"class": "BaseCel",
"language": "GDScript",
"path": "res://src/Classes/BaseCel.gd"
}, {
"base": "Reference",
"class": "BaseLayer",
"language": "GDScript",
"path": "res://src/Classes/BaseLayer.gd"
}, {
"base": "VBoxContainer",
"class": "BaseTool",
"language": "GDScript",
Expand All @@ -30,11 +40,6 @@ _global_script_classes=[ {
"path": "res://src/UI/Canvas/Canvas.gd"
}, {
"base": "Reference",
"class": "Cel",
"language": "GDScript",
"path": "res://src/Classes/Cel.gd"
}, {
"base": "Reference",
"class": "Drawer",
"language": "GDScript",
"path": "res://src/Classes/Drawers.gd"
Expand All @@ -49,6 +54,16 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/UI/Nodes/GradientEdit.gd"
}, {
"base": "BaseCel",
"class": "GroupCel",
"language": "GDScript",
"path": "res://src/Classes/GroupCel.gd"
}, {
"base": "BaseLayer",
"class": "GroupLayer",
"language": "GDScript",
"path": "res://src/Classes/GroupLayer.gd"
}, {
"base": "Line2D",
"class": "Guide",
"language": "GDScript",
Expand All @@ -59,11 +74,6 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/Classes/ImageEffect.gd"
}, {
"base": "Reference",
"class": "Layer",
"language": "GDScript",
"path": "res://src/Classes/Layer.gd"
}, {
"base": "Button",
"class": "LayerButton",
"language": "GDScript",
Expand Down Expand Up @@ -99,6 +109,16 @@ _global_script_classes=[ {
"language": "GDScript",
"path": "res://src/UI/PatternsPopup.gd"
}, {
"base": "BaseCel",
"class": "PixelCel",
"language": "GDScript",
"path": "res://src/Classes/PixelCel.gd"
}, {
"base": "BaseLayer",
"class": "PixelLayer",
"language": "GDScript",
"path": "res://src/Classes/PixelLayer.gd"
}, {
"base": "Reference",
"class": "Project",
"language": "GDScript",
Expand Down Expand Up @@ -136,23 +156,27 @@ _global_script_classes=[ {
} ]
_global_script_class_icons={
"AnimationTag": "",
"BaseCel": "",
"BaseLayer": "",
"BaseTool": "",
"Brushes": "",
"Canvas": "",
"Cel": "",
"Drawer": "",
"Frame": "",
"GradientEditNode": "",
"GroupCel": "",
"GroupLayer": "",
"Guide": "",
"ImageEffect": "",
"Layer": "",
"LayerButton": "",
"Palette": "",
"PaletteColor": "",
"PaletteGrid": "",
"PalettePanel": "",
"PaletteSwatch": "",
"Patterns": "",
"PixelCel": "",
"PixelLayer": "",
"Project": "",
"SelectionMap": "",
"SelectionTool": "",
Expand Down
20 changes: 16 additions & 4 deletions src/Autoload/DrawingAlgos.gd
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,8 @@ func scale_image(width: int, height: int, interpolation: int) -> void:

for f in Global.current_project.frames:
for i in range(f.cels.size() - 1, -1, -1):
if f.cels[i] is GroupCel:
continue
var sprite := Image.new()
sprite.copy_from(f.cels[i].image)
# Different method for scale_3x
Expand All @@ -449,6 +451,8 @@ func centralize() -> void:
# Find used rect of the current frame (across all of the layers)
var used_rect := Rect2()
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
if not cel is PixelCel:
continue
var cel_rect: Rect2 = cel.image.get_used_rect()
if not cel_rect.has_no_area():
used_rect = cel_rect if used_rect.has_no_area() else used_rect.merge(cel_rect)
Expand All @@ -457,14 +461,16 @@ func centralize() -> void:

var offset: Vector2 = (0.5 * (Global.current_project.size - used_rect.size)).floor()
general_do_centralize()
for c in Global.current_project.frames[Global.current_project.current_frame].cels:
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
if not cel is PixelCel:
continue
var sprite := Image.new()
sprite.create(
Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8
)
sprite.blend_rect(c.image, used_rect, offset)
Global.current_project.undo_redo.add_do_property(c.image, "data", sprite.data)
Global.current_project.undo_redo.add_undo_property(c.image, "data", c.image.data)
sprite.blend_rect(cel.image, used_rect, offset)
Global.current_project.undo_redo.add_do_property(cel.image, "data", sprite.data)
Global.current_project.undo_redo.add_undo_property(cel.image, "data", cel.image.data)
general_undo_centralize()


Expand All @@ -473,6 +479,8 @@ func crop_image() -> void:
var used_rect := Rect2()
for f in Global.current_project.frames:
for cel in f.cels:
if not cel is PixelCel:
continue
cel.image.unlock() # May be unneeded now, but keep it just in case
var cel_used_rect: Rect2 = cel.image.get_used_rect()
if cel_used_rect == Rect2(0, 0, 0, 0): # If the cel has no content
Expand All @@ -493,6 +501,8 @@ func crop_image() -> void:
# Loop through all the cels to crop them
for f in Global.current_project.frames:
for cel in f.cels:
if not cel is PixelCel:
continue
var sprite: Image = cel.image.get_rect(used_rect)
Global.current_project.undo_redo.add_do_property(cel.image, "data", sprite.data)
Global.current_project.undo_redo.add_undo_property(cel.image, "data", cel.image.data)
Expand All @@ -504,6 +514,8 @@ func resize_canvas(width: int, height: int, offset_x: int, offset_y: int) -> voi
general_do_scale(width, height)
for f in Global.current_project.frames:
for c in f.cels:
if not c is PixelCel:
continue
var sprite := Image.new()
sprite.create(width, height, false, Image.FORMAT_RGBA8)
sprite.blend_rect(
Expand Down
9 changes: 6 additions & 3 deletions src/Autoload/Export.gd
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ func blend_layers(image: Image, frame: Frame, origin: Vector2 = Vector2(0, 0)) -
image.lock()
var layer_i := 0
for cel in frame.cels:
if Global.current_project.layers[layer_i].visible:
if Global.current_project.layers[layer_i].is_visible_in_hierarchy() and cel is PixelCel:
var cel_image := Image.new()
cel_image.copy_from(cel.image)
cel_image.lock()
Expand All @@ -406,9 +406,12 @@ func blend_selected_cels(image: Image, frame: Frame, origin: Vector2 = Vector2(0
var test_array = [Global.current_project.current_frame, cel_ind]
if not test_array in Global.current_project.selected_cels:
continue
if not frame.cels[cel_ind] is PixelCel:
continue

var cel: PixelCel = frame.cels[cel_ind]

var cel: Cel = frame.cels[cel_ind]
if Global.current_project.layers[layer_i].visible:
if Global.current_project.layers[layer_i].is_visible_in_hierarchy():
var cel_image := Image.new()
cel_image.copy_from(cel.image)
cel_image.lock()
Expand Down
20 changes: 7 additions & 13 deletions src/Autoload/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ extends Node

signal project_changed

enum LayerTypes { PIXEL, GROUP }
enum GridTypes { CARTESIAN, ISOMETRIC, ALL }
enum PressureSensitivity { NONE, ALPHA, SIZE, ALPHA_AND_SIZE }
enum ColorFrom { THEME, CUSTOM }
Expand Down Expand Up @@ -59,7 +60,6 @@ var current_project_index := 0 setget _project_changed
var ui_tooltips := {}

# Canvas related stuff
var layers_changed_skip := false
var can_draw := false
var move_guides_on_canvas := false
var has_focus := false
Expand Down Expand Up @@ -144,6 +144,10 @@ var palettes := {}

# Nodes
var notification_label_node: PackedScene = preload("res://src/UI/NotificationLabel.tscn")
var pixel_layer_button_node: PackedScene = preload("res://src/UI/Timeline/PixelLayerButton.tscn")
var group_layer_button_node: PackedScene = preload("res://src/UI/Timeline/GroupLayerButton.tscn")
var pixel_cel_button_node: PackedScene = preload("res://src/UI/Timeline/PixelCelButton.tscn")
var group_cel_button_node: PackedScene = preload("res://src/UI/Timeline/GroupCelButton.tscn")

onready var control: Node = get_tree().current_scene

Expand Down Expand Up @@ -449,24 +453,14 @@ func undo_or_redo(
if action_name == "Scale":
for i in project.frames.size():
for j in project.layers.size():
var current_cel: Cel = project.frames[i].cels[j]
current_cel.image_texture.create_from_image(current_cel.image, 0)
var current_cel: BaseCel = project.frames[i].cels[j]
current_cel.image_texture.create_from_image(current_cel.get_image(), 0)
canvas.camera_zoom()
canvas.grid.update()
canvas.pixel_grid.update()
project.selection_map_changed()
cursor_position_label.text = "[%s×%s]" % [project.size.x, project.size.y]

elif "Frame" in action_name:
# This actually means that frames.size is one, but it hasn't been updated yet
if (undo and project.frames.size() == 2) or project.frames.size() == 1: # Stop animating
play_forward.pressed = false
play_backwards.pressed = false
animation_timer.stop()

elif "Move Cels" == action_name:
project.frames = project.frames # to call frames_changed

canvas.update()
if !project.has_changed:
project.has_changed = true
Expand Down
Loading