18 lines
372 B
GDScript

extends CheckButton
@export var layer_number: int
func _ready():
if !Global.camera:
return
set_pressed_no_signal(Global.camera.cull_mask & (1 << (layer_number - 1)))
func on_toggled(toggled_on: bool):
if !Global.camera:
return
if toggled_on:
Global.camera.cull_mask |= 1 << (layer_number - 1)
else:
Global.camera.cull_mask &= ~(1 << (layer_number - 1))