1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Set grayscale vision node properties instead of in code

This commit is contained in:
Manolis Papadeas 2022-03-11 01:48:50 +02:00
parent 5995788ef7
commit f2a24aaffd
4 changed files with 7 additions and 12 deletions

View file

@ -122,7 +122,6 @@ onready var cameras := [camera, camera2, camera_preview]
onready var horizontal_ruler: BaseButton = control.find_node("HorizontalRuler")
onready var vertical_ruler: BaseButton = control.find_node("VerticalRuler")
onready var transparent_checker: ColorRect = control.find_node("TransparentChecker")
onready var greyscale_vision: ColorRect = control.find_node("GreyscaleVision")
onready var preview_zoom_slider: VSlider = control.find_node("PreviewZoomSlider")
onready var tool_panel: ScrollContainer = control.find_node("Tools")

View file

@ -57,6 +57,7 @@ onready var select_menu_button: MenuButton = find_node("SelectMenu")
onready var help_menu_button: MenuButton = find_node("HelpMenu")
onready var ui: Container = Global.control.find_node("DockableContainer")
onready var greyscale_vision: ColorRect = ui.find_node("GreyscaleVision")
onready var new_image_dialog: ConfirmationDialog = Global.control.find_node("CreateNewImage")
onready var window_opacity_dialog: AcceptDialog = Global.control.find_node("WindowOpacityDialog")
onready var tile_mode_submenu := PopupMenu.new()
@ -498,8 +499,7 @@ func set_layout(id: int) -> void:
var is_hidden: bool = ui.is_control_hidden(ui_elements[i])
panels_submenu.set_item_checked(i, !is_hidden)
# Turn zen mode off
if zen_mode:
if zen_mode: # Turn zen mode off
Global.control.find_node("TabsContainer").visible = true
zen_mode = false
window_menu.set_item_checked(WindowMenuId.ZEN_MODE, false)
@ -507,7 +507,7 @@ func set_layout(id: int) -> void:
func _toggle_greyscale_view() -> void:
Global.greyscale_view = !Global.greyscale_view
Global.greyscale_vision.visible = Global.greyscale_view
greyscale_vision.visible = Global.greyscale_view
view_menu.set_item_checked(ViewMenuId.GREYSCALE_VIEW, Global.greyscale_view)

View file

@ -7,13 +7,6 @@ onready var main_canvas_container = Global.main_canvas_container
func _ready() -> void:
update_transparent_shader()
# Set anchors for ShaderVision
Global.greyscale_vision.visible = false
Global.greyscale_vision.anchor_left = ANCHOR_BEGIN
Global.greyscale_vision.anchor_top = ANCHOR_BEGIN
Global.greyscale_vision.anchor_right = ANCHOR_END
Global.greyscale_vision.anchor_bottom = ANCHOR_END
func _on_main_canvas_item_rect_changed() -> void:
update_transparent_shader()
@ -27,4 +20,4 @@ func update_transparent_shader() -> void:
# Works independently of the transparency feature
material.set("shader_param/screen_resolution", get_viewport().size)
material.set("shader_param/position", main_canvas_container.rect_global_position)
material.set("shader_param/size", main_canvas_container.rect_size)
material.set("shader_param/size", main_canvas_container.rect_size - Vector2.ONE * 2)

View file

@ -302,7 +302,10 @@ script = ExtResource( 7 )
[node name="CanvasLayer" type="CanvasLayer" parent="DockableContainer/Main Canvas/ViewportandVerticalRuler/ViewportContainer/Viewport"]
[node name="GreyscaleVision" type="ColorRect" parent="DockableContainer/Main Canvas/ViewportandVerticalRuler/ViewportContainer/Viewport/CanvasLayer"]
visible = false
material = SubResource( 27 )
anchor_right = 1.0
anchor_bottom = 1.0
margin_right = 40.0
margin_bottom = 40.0
mouse_filter = 2