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

Better Onion Skinning #600

Merged
merged 69 commits into from
Nov 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0aa41f6
Merge pull request #1 from Orama-Interactive/master
Variable-ind Jan 26, 2021
2c502db
Merge pull request #2 from Orama-Interactive/master
Variable-ind Jan 26, 2021
63c5ea2
Merge pull request #5 from Orama-Interactive/master
Variable-ind Jan 29, 2021
dc4278d
Merge pull request #7 from Orama-Interactive/master
Variable-ind Feb 3, 2021
6b824f6
Merge pull request #8 from Orama-Interactive/master
Variable-ind Feb 4, 2021
5d74449
fixed some more bugs
Variable-ind Feb 5, 2021
925d3c9
Removed some more bugs
Variable-ind Feb 5, 2021
5d0dda6
Added "Replace Frame" option
Variable-ind Feb 5, 2021
81e0583
Update PreviewDialog.tscn
Variable-ind Feb 5, 2021
04d7316
Update PreviewDialog.gd
Variable-ind Feb 5, 2021
563bb43
Update OpenSave.gd
Variable-ind Feb 5, 2021
c03122c
Merge pull request #9 from Orama-Interactive/master
Variable-ind Feb 6, 2021
4cc7c88
Added some new pixel fonts
Variable-ind Feb 7, 2021
f8ac82e
Merge pull request #10 from Orama-Interactive/master
Variable-ind Feb 9, 2021
d1d0a1e
updating (#12)
Variable-ind May 4, 2021
77e559f
Merge pull request #13 from Orama-Interactive/master
Variable-ind May 4, 2021
90cbee1
Merge pull request #14 from Orama-Interactive/master
Variable-ind May 5, 2021
62331c8
Merge pull request #15 from Orama-Interactive/master
Variable-ind May 10, 2021
c178e9e
removed unneeded fonts
Variable-ind May 10, 2021
6fdaad9
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 11, 2021
ae6a284
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 13, 2021
a26cf59
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 13, 2021
0df974d
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 14, 2021
d1b67e0
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 16, 2021
fbbbccb
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 18, 2021
878b077
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 21, 2021
d4b4cf0
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 22, 2021
a349460
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 22, 2021
281a7ce
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 24, 2021
15e7685
Set project name. Also fixed a bug
Variable-ind May 24, 2021
6488d42
Update CreateNewImage.tscn
Variable-ind May 24, 2021
1b2a0c4
Update CreateNewImage.gd
Variable-ind May 24, 2021
c12d00b
Merge branch 'Orama-Interactive:master' into master
Variable-ind May 29, 2021
6dce0b2
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jun 14, 2021
58f4296
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jun 23, 2021
d263cc5
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jul 5, 2021
a122562
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jul 7, 2021
08f4027
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jul 10, 2021
d21c2da
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jul 12, 2021
9e9fd9d
Merge branch 'Orama-Interactive:master' into master
Variable-ind Jul 15, 2021
10b4661
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 1, 2021
c9a37fc
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 8, 2021
898535e
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 21, 2021
8251633
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 26, 2021
e112b8c
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 27, 2021
f558855
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 29, 2021
ac8b46b
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 30, 2021
5687da5
Merge branch 'Orama-Interactive:master' into master
Variable-ind Aug 30, 2021
43e79e5
Merge branch 'Orama-Interactive:master' into master
Variable-ind Sep 3, 2021
801252c
Merge branch 'Orama-Interactive:master' into master
Variable-ind Sep 6, 2021
c89a3fb
Merge branch 'Orama-Interactive:master' into master
Variable-ind Sep 23, 2021
8a07008
Merge branch 'Orama-Interactive:master' into master
Variable-ind Oct 5, 2021
397120b
Merge branch 'Orama-Interactive:master' into master
Variable-ind Oct 6, 2021
0468aa6
Merge branch 'Orama-Interactive:master' into master
Variable-ind Oct 9, 2021
78ce6dc
Merge branch 'Orama-Interactive:master' into master
Variable-ind Oct 15, 2021
61be980
Merge branch 'Orama-Interactive:master' into master
Variable-ind Oct 15, 2021
ab13d27
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 12, 2021
866e2e3
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 15, 2021
d9a0a41
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 17, 2021
f85dfda
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 18, 2021
e3a7b3a
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 24, 2021
5101b11
Merge branch 'Orama-Interactive:master' into master
Variable-ind Nov 25, 2021
0a3ad94
better onion part (1/3)
Variable-ind Nov 25, 2021
dbb856d
better onion part (2/3)
Variable-ind Nov 25, 2021
519db31
better onion part (3/3)
Variable-ind Nov 25, 2021
bb84ea8
Dummy change to test static checks workflow - ignore
OverloadedOrama Nov 25, 2021
1d5e283
removed whitespace that gave static error
Variable-ind Nov 25, 2021
9b80714
removed some more whitespace
Variable-ind Nov 25, 2021
8bd1f7d
attempt to remove whitespace
Variable-ind Nov 25, 2021
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
2 changes: 2 additions & 0 deletions src/Autoload/Global.gd
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ var onion_skinning := false
var onion_skinning_past_rate := 1.0
var onion_skinning_future_rate := 1.0
var onion_skinning_blue_red := false
var past_above_canvas := true
var future_above_canvas := true

# Palettes
var palettes := {}
Expand Down
41 changes: 4 additions & 37 deletions src/UI/Canvas/Canvas.gd
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func _draw() -> void:
draw_texture(current_cels[i].image_texture, Vector2.ZERO, modulate_color)

if Global.onion_skinning:
onion_skinning()
refresh_onion()
currently_visible_frame.size = Global.current_project.size
current_frame_drawer.update()
if Global.current_project.tile_mode != Global.TileMode.NONE:
Expand Down Expand Up @@ -239,39 +239,6 @@ func update_selected_cels_textures(project: Project = Global.current_project) ->
cel_texture_rect.texture = current_cel.image_texture


func onion_skinning() -> void:
if Global.onion_skinning_past_rate > 0: # Past
var color: Color
if Global.onion_skinning_blue_red:
color = Color.blue
else:
color = Color.white
for i in range(1, Global.onion_skinning_past_rate + 1):
if Global.current_project.current_frame >= i:
var layer_i := 0
for layer in Global.current_project.frames[(
Global.current_project.current_frame
- i
)].cels:
if Global.current_project.layers[layer_i].visible:
color.a = 0.6 / i
draw_texture(layer.image_texture, Vector2.ZERO, color)
layer_i += 1

if Global.onion_skinning_future_rate > 0: # Future
var color: Color
if Global.onion_skinning_blue_red:
color = Color.red
else:
color = Color.white
for i in range(1, Global.onion_skinning_future_rate + 1):
if Global.current_project.current_frame < Global.current_project.frames.size() - i:
var layer_i := 0
for layer in Global.current_project.frames[(
Global.current_project.current_frame
+ i
)].cels:
if Global.current_project.layers[layer_i].visible:
color.a = 0.6 / i
draw_texture(layer.image_texture, Vector2.ZERO, color)
layer_i += 1
func refresh_onion() -> void:
$OnionPast.update()
$OnionFuture.update()
10 changes: 9 additions & 1 deletion src/UI/Canvas/Canvas.tscn
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[gd_scene load_steps=14 format=2]
[gd_scene load_steps=16 format=2]

[ext_resource path="res://src/UI/Canvas/Canvas.gd" type="Script" id=1]
[ext_resource path="res://src/UI/Canvas/Grid.gd" type="Script" id=2]
Expand All @@ -10,6 +10,8 @@
[ext_resource path="res://src/UI/Canvas/Selection.gd" type="Script" id=8]
[ext_resource path="res://src/Shaders/MarchingAntsOutline.shader" type="Shader" id=9]
[ext_resource path="res://src/Shaders/AutoInvertColors.shader" type="Shader" id=10]
[ext_resource path="res://src/UI/Canvas/OnionFuture.gd" type="Script" id=11]
[ext_resource path="res://src/UI/Canvas/OnionPast.gd" type="Script" id=12]

[sub_resource type="CanvasItemMaterial" id=1]
blend_mode = 4
Expand Down Expand Up @@ -64,3 +66,9 @@ script = ExtResource( 3 )
[node name="Previews" type="Node2D" parent="."]
material = SubResource( 3 )
script = ExtResource( 7 )

[node name="OnionPast" type="Node2D" parent="."]
script = ExtResource( 12 )

[node name="OnionFuture" type="Node2D" parent="."]
script = ExtResource( 11 )
22 changes: 22 additions & 0 deletions src/UI/Canvas/OnionFuture.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends Node2D


func _draw() -> void:
if Global.onion_skinning:
if Global.onion_skinning_future_rate > 0:
var color : Color
if Global.onion_skinning_blue_red:
color = Color.red
else:
color = Color.white
for i in range(1, Global.onion_skinning_future_rate + 1):
if Global.current_project.current_frame < Global.current_project.frames.size() - i:
var layer_i := 0
for layer in Global.current_project.frames[Global.current_project.current_frame + i].cels:
if Global.current_project.layers[layer_i].visible:
#ignore layer if it has "onion_ignore" in its name (case in-sensitive).
if not "ignore_onion" in Global.current_project.layers[layer_i].name.to_lower():
color.a = 0.6 / i
draw_texture(layer.image_texture, Vector2.ZERO, color)
update()
layer_i += 1
22 changes: 22 additions & 0 deletions src/UI/Canvas/OnionPast.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
extends Node2D


func _draw() -> void:
if Global.onion_skinning:
if Global.onion_skinning_past_rate > 0:
var color: Color
if Global.onion_skinning_blue_red:
color = Color.blue
else:
color = Color.white
for i in range(1, Global.onion_skinning_past_rate + 1):
if Global.current_project.current_frame >= i:
var layer_i := 0
for layer in Global.current_project.frames[Global.current_project.current_frame - i].cels:
if Global.current_project.layers[layer_i].visible:
#ignore layer if it has "onion_ignore" in its name (case in-sensitive).
if not "ignore_onion" in Global.current_project.layers[layer_i].name.to_lower():
color.a = 0.6 / i
draw_texture(layer.image_texture, Vector2.ZERO, color)
update()
layer_i += 1
12 changes: 11 additions & 1 deletion src/UI/Timeline/AnimationTimeline.gd
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func _on_MoveRight_pressed() -> void:

func _on_OnionSkinning_pressed() -> void:
Global.onion_skinning = !Global.onion_skinning
Global.canvas.update()
Global.canvas.refresh_onion()
var texture_button: TextureRect = onion_skinning_button.get_child(0)
if Global.onion_skinning:
Global.change_button_texturerect(texture_button, "onion_skinning.png")
Expand Down Expand Up @@ -527,6 +527,16 @@ func _on_BlueRedMode_toggled(button_pressed: bool) -> void:
Global.canvas.update()


func _on_PastPlacement_item_selected(index):
Global.past_above_canvas = (index == 0)
Global.canvas.get_node("OnionPast").set("show_behind_parent", !Global.past_above_canvas)


func _on_FuturePlacement_item_selected(index):
Global.future_above_canvas = (index == 0)
Global.canvas.get_node("OnionFuture").set("show_behind_parent", !Global.future_above_canvas)


# Layer buttons


Expand Down
83 changes: 73 additions & 10 deletions src/UI/Timeline/AnimationTimeline.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -892,7 +892,7 @@ margin_bottom = 24.0
[node name="OnionSkinningSettings" type="WindowDialog" parent="."]
margin_right = 220.0
margin_bottom = 140.0
rect_min_size = Vector2( 220, 140 )
rect_min_size = Vector2( 300, 320 )
__meta__ = {
"_edit_use_anchors_": false
}
Expand All @@ -901,48 +901,109 @@ __meta__ = {
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
margin_left = 5.0
margin_top = -65.0
margin_right = -5.0
margin_bottom = 65.0
margin_left = 4.0
margin_top = -153.0
margin_right = -4.0
margin_bottom = 161.0
__meta__ = {
"_edit_use_anchors_": false
}

[node name="OnionSkinningPast" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_right = 210.0
margin_right = 292.0
margin_bottom = 14.0
text = "Past Frames"

[node name="PastOnionSkinning" type="SpinBox" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 18.0
margin_right = 210.0
margin_right = 292.0
margin_bottom = 42.0
mouse_default_cursor_shape = 2
value = 1.0
align = 1

[node name="OnionSkinningFuture" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 46.0
margin_right = 210.0
margin_right = 292.0
margin_bottom = 60.0
text = "Future Frames"

[node name="FutureOnionSkinning" type="SpinBox" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 64.0
margin_right = 210.0
margin_right = 292.0
margin_bottom = 88.0
mouse_default_cursor_shape = 2
value = 1.0
align = 1

[node name="BlueRedMode" type="CheckBox" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 92.0
margin_right = 210.0
margin_right = 292.0
margin_bottom = 116.0
mouse_default_cursor_shape = 2
text = "Blue-Red Mode"

[node name="PastPlace" type="HBoxContainer" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 120.0
margin_right = 292.0
margin_bottom = 140.0
alignment = 2

[node name="Label" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons/PastPlace"]
margin_left = 30.0
margin_top = 3.0
margin_right = 171.0
margin_bottom = 17.0
text = "Past Skin Placement : "
align = 2
valign = 1

[node name="PastPlacement" type="OptionButton" parent="OnionSkinningSettings/OnionSkinningButtons/PastPlace"]
margin_left = 175.0
margin_right = 292.0
margin_bottom = 20.0
text = "Above Canvas"
items = [ "Above Canvas", null, false, 0, null, "Below Canvas", null, false, 1, null ]
selected = 0
__meta__ = {
"_editor_description_": ""
}

[node name="FuturePlace" type="HBoxContainer" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 144.0
margin_right = 292.0
margin_bottom = 164.0
alignment = 2

[node name="Label" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons/FuturePlace"]
margin_left = 16.0
margin_top = 3.0
margin_right = 171.0
margin_bottom = 17.0
text = "Future Skin Placement : "
align = 2
valign = 1

[node name="FuturePlacement" type="OptionButton" parent="OnionSkinningSettings/OnionSkinningButtons/FuturePlace"]
margin_left = 175.0
margin_right = 292.0
margin_bottom = 20.0
text = "Above Canvas"
items = [ "Above Canvas", null, false, 0, null, "Below Canvas", null, false, 1, null ]
selected = 0

[node name="Label" type="Label" parent="OnionSkinningSettings/OnionSkinningButtons"]
margin_top = 168.0
margin_right = 292.0
margin_bottom = 233.0
custom_colors/font_color = Color( 0.333333, 0.901961, 0.462745, 1 )
text = "Note:
If you want a layer to ignore Onion-skinning simply add \"ignore_onion\" in its name
(it is case-insensitive)"
align = 1
valign = 1
autowrap = true

[node name="FrameTagDialog" parent="." instance=ExtResource( 42 )]

[node name="FakeVSplitContainerGrabber" type="TextureRect" parent="."]
Expand Down Expand Up @@ -986,3 +1047,5 @@ __meta__ = {
[connection signal="value_changed" from="OnionSkinningSettings/OnionSkinningButtons/PastOnionSkinning" to="." method="_on_PastOnionSkinning_value_changed"]
[connection signal="value_changed" from="OnionSkinningSettings/OnionSkinningButtons/FutureOnionSkinning" to="." method="_on_FutureOnionSkinning_value_changed"]
[connection signal="toggled" from="OnionSkinningSettings/OnionSkinningButtons/BlueRedMode" to="." method="_on_BlueRedMode_toggled"]
[connection signal="item_selected" from="OnionSkinningSettings/OnionSkinningButtons/PastPlace/PastPlacement" to="." method="_on_PastPlacement_item_selected"]
[connection signal="item_selected" from="OnionSkinningSettings/OnionSkinningButtons/FuturePlace/FuturePlacement" to="." method="_on_FuturePlacement_item_selected"]