Fix tiling opacity by drawing currently visible frame to a separate Viewport (#417)

- Now the current frame is drawn to a separate Viewport (with transparent background) taking into account only per layer opacity,
- Tiling is drawn by drawing current frame's ViewportTexture with tile mode opacity applied (using premultiply alpha blending).

Co-authored-by: kleonc <kleonc@users.noreply.github.com>
This commit is contained in:
kleonc 2021-01-04 18:30:15 +01:00 committed by GitHub
parent bc4d5fa51f
commit 92a22fe9bc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 8 deletions

View file

@ -9,6 +9,8 @@ var can_undo := true
var cursor_image_has_changed := false
var sprite_changed_this_frame := false # for optimization purposes
onready var currently_visible_frame : Viewport = $CurrentlyVisibleFrame
onready var current_frame_drawer = $CurrentlyVisibleFrame/CurrentFrameDrawer
onready var grid = $Grid
onready var tile_mode = $TileMode
onready var indicators = $Indicators
@ -42,6 +44,8 @@ func _draw() -> void:
if Global.onion_skinning:
onion_skinning()
currently_visible_frame.size = Global.current_project.size
current_frame_drawer.update()
tile_mode.update()
draw_set_transform(position, rotation, scale)