24 lines
659 B
GDScript
24 lines
659 B
GDScript
class_name StateChartDebug
|
|
extends Tree
|
|
|
|
var target: StateChart = null
|
|
|
|
func _init() -> void:
|
|
set("custom_styles/bg", StyleBoxEmpty.new())
|
|
|
|
func _physics_process(delta: float) -> void:
|
|
if target is StateChart and visible:
|
|
clear()
|
|
var root_state = target.get_child(0)
|
|
if root_state is State:
|
|
var item = create_item(null)
|
|
item.set_text(0, root_state.name)
|
|
_find_active_states(root_state, item)
|
|
|
|
func _find_active_states(state: State, state_item: TreeItem):
|
|
for child in state.get_children():
|
|
if child is State:
|
|
if child.active:
|
|
var item := create_item(state_item)
|
|
item.set_text(0, child.name)
|
|
_find_active_states(child, item)
|