1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-02-21 21:13:14 +00:00

Fix onion skinning not working with mirror view

Addresses the 3rd issue in #717.
This commit is contained in:
Emmanouil Papadeas 2022-09-13 00:49:22 +03:00
parent 4b4b0773ff
commit 2e795e8db5

View file

@ -10,27 +10,29 @@ var rate := Global.onion_skinning_past_rate
func _draw() -> void: func _draw() -> void:
if !Global.onion_skinning: if !Global.onion_skinning:
return return
rate = Global.onion_skinning_past_rate if type == PAST else Global.onion_skinning_future_rate rate = Global.onion_skinning_past_rate if type == PAST else Global.onion_skinning_future_rate
if rate > 0: if rate <= 0:
var color: Color return
if Global.onion_skinning_blue_red:
color = blue_red_color var color := blue_red_color if Global.onion_skinning_blue_red else Color.white
else: var position_tmp := position
color = Color.white var scale_tmp := scale
for i in range(1, rate + 1): if Global.mirror_view:
var change: int = Global.current_project.current_frame position_tmp.x += Global.current_project.size.x
if type == PAST: scale_tmp.x = -1
change -= i draw_set_transform(position_tmp, rotation, scale_tmp)
else:
change += i for i in range(1, rate + 1):
if change == clamp(change, 0, Global.current_project.frames.size() - 1): var change: int = Global.current_project.current_frame
var layer_i := 0 change += i if type == FUTURE else -i
for cel in Global.current_project.frames[change].cels: if change == clamp(change, 0, Global.current_project.frames.size() - 1):
var layer: Layer = Global.current_project.layers[layer_i] var layer_i := 0
if layer.visible: for cel in Global.current_project.frames[change].cels:
# Ignore layer if it has the "_io" suffix in its name (case in-sensitive) var layer: Layer = Global.current_project.layers[layer_i]
if not (layer.name.to_lower().ends_with("_io")): if layer.visible:
color.a = 0.6 / i # Ignore layer if it has the "_io" suffix in its name (case in-sensitive)
draw_texture(cel.image_texture, Vector2.ZERO, color) if not (layer.name.to_lower().ends_with("_io")):
layer_i += 1 color.a = 0.6 / i
draw_texture(cel.image_texture, Vector2.ZERO, color)
layer_i += 1
draw_set_transform(position, rotation, scale)