39 lines
1019 B
GDScript
39 lines
1019 B
GDScript
@tool
|
|
#@icon
|
|
class_name DebugLabel
|
|
extends HBoxContainer
|
|
## Easy-to-use(?) container for visualizing variables
|
|
|
|
## Signals
|
|
## Enums
|
|
## Constants
|
|
## @export variables
|
|
@export var target: Node ## The Node this label applies to (usually its parent)
|
|
@export var variable_name: String ## The variable this label displays; check spelling and casing
|
|
## Regular variables
|
|
## @onready variables
|
|
@onready var title_label: Label = $TitleLabel
|
|
@onready var value_label: Label = $ValueLabel
|
|
|
|
## Overridden built-in virtual methods
|
|
#func _init() -> void:
|
|
#func _enter_tree() -> void:
|
|
func _ready() -> void:
|
|
title_label.text = variable_name.capitalize() + ": "
|
|
add_child(title_label)
|
|
add_child(value_label)
|
|
|
|
|
|
func _process(_delta: float) -> void:
|
|
if not Engine.is_editor_hint():
|
|
if target:
|
|
if variable_name:
|
|
var value = target.get(variable_name)
|
|
value_label.text = str(value)
|
|
|
|
#func _physics_process(delta: float) -> void:
|
|
## Remaining virtual methods
|
|
## Overridden custom methods
|
|
## Remaining methods
|
|
## Subclasses
|