18 lines
372 B
GDScript3
Raw Normal View History

2024-02-14 12:52:59 +00:00
extends CheckButton
@export var layer_number: int
func _ready():
2024-02-25 18:47:13 +00:00
if !Global.camera:
return
2024-02-14 12:52:59 +00:00
set_pressed_no_signal(Global.camera.cull_mask & (1 << (layer_number - 1)))
func on_toggled(toggled_on: bool):
2024-02-25 18:47:13 +00:00
if !Global.camera:
return
2024-02-14 12:52:59 +00:00
if toggled_on:
Global.camera.cull_mask |= 1 << (layer_number - 1)
else:
Global.camera.cull_mask &= ~(1 << (layer_number - 1))