Var transparent mode (#444)

* allowed and enabled per_pixel_transparency

* Added a Transparency menu

* Added an Alternate screen for transparency

* Added transparency methods

Added the transparency methods plus modified fullscreen such that it resets transparency on toggling hence, Removing the issue of blackness

* Modified the shader to allow transparency

* Added a material to ViewportContainer

Fixed the bug that darkens image when decreasing opacity

* Update Global.gd

* Update Main.gd

* Update TopMenuContainer.gd
This commit is contained in:
Variable 2021-02-02 15:29:19 +00:00 committed by GitHub
parent 40f6a24fdc
commit dc469dd4b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 85 additions and 2 deletions

View file

@ -26,3 +26,18 @@ func _on_TransparentChecker_resized() -> void:
func fit_rect(rect : Rect2) -> void:
rect_position = rect.position
rect_size = rect.size
func transparency(value :float) -> void:
# first make viewport transparent then background and then viewport
if value == 1:
get_parent().transparent_bg = false
get_tree().get_root().set_transparent_background(false)
else:
OS.window_per_pixel_transparency_enabled = true
get_parent().transparent_bg = true
get_tree().get_root().set_transparent_background(true)
# this controls opacity 0 for transparent, 1 or a greater value than 1 is opaque
# i have set a minimum amount for the fade (We would'nt want the canvas to dissapear now would we?)
material.set("shader_param/alpha",clamp(value,0.1,1))