2026-05-20 12:54:09 -04:00
|
|
|
extends PanelBase
|
|
|
|
|
class_name ModuleBase
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
signal module_ready
|
|
|
|
|
|
|
|
|
|
@export var module_title: String = "Module"
|
|
|
|
|
|
|
|
|
|
var _initialized: bool = false
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
2026-05-20 14:11:32 -04:00
|
|
|
# Don't intercept mouse events — DashboardGrid handles drag-and-drop
|
|
|
|
|
_set_mouse_ignore(self)
|
|
|
|
|
if not _initialized:
|
|
|
|
|
_initialize()
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func initialize() -> void:
|
2026-05-20 14:11:32 -04:00
|
|
|
pass
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func refresh(data: Dictionary) -> void:
|
2026-05-20 14:11:32 -04:00
|
|
|
pass
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func get_module_title() -> String:
|
2026-05-20 14:11:32 -04:00
|
|
|
return module_title
|
2026-05-20 12:54:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
func _initialize() -> void:
|
2026-05-20 14:11:32 -04:00
|
|
|
_initialized = true
|
|
|
|
|
initialize()
|
2026-05-20 21:37:07 -04:00
|
|
|
resized.connect(_update_noise_size)
|
|
|
|
|
_update_noise_size()
|
2026-05-20 14:11:32 -04:00
|
|
|
module_ready.emit()
|
|
|
|
|
|
|
|
|
|
|
2026-05-20 21:37:07 -04:00
|
|
|
func _update_noise_size() -> void:
|
|
|
|
|
var vial: ColorRect = find_child("VialFill", true, false) as ColorRect
|
|
|
|
|
if vial == null:
|
|
|
|
|
return
|
|
|
|
|
var mat := vial.material as ShaderMaterial
|
|
|
|
|
if mat and size.x > 0 and size.y > 0:
|
|
|
|
|
mat.set_shader_parameter("noise_module_size", size)
|
|
|
|
|
|
|
|
|
|
|
2026-05-20 14:11:32 -04:00
|
|
|
func _set_mouse_ignore(node: Node) -> void:
|
|
|
|
|
if node is Control:
|
|
|
|
|
node.mouse_filter = Control.MOUSE_FILTER_IGNORE
|
|
|
|
|
for child in node.get_children():
|
|
|
|
|
_set_mouse_ignore(child)
|