hkb_editor.gui.dialogs.state_graph_viewer_dialog
¶
CachedLayout
dataclass
¶
state_graph_viewer_dialog
¶
Bases: DpgItem
Draw a state machine's transitions as a graph.
Transitions are derived from event names of the form
<source>_to_<target>. The node layout is computed with networkx and
then handed to the graph widget through a :class:CachedLayout.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
behavior
|
HavokBehavior
|
Behavior to read state machines from. |
required |
statemachine_id
|
str or None
|
Object ID of the state machine to show first; falls back to any. |
required |
jump_callback
|
callable
|
Called as |
None
|
title
|
str
|
Window title bar label. |
'State Graph Viewer'
|
tag
|
int or str
|
Explicit tag; auto-generated if None. |
None
|
user_data
|
any
|
Passed through to |
None
|
build_state_graph
¶
build_state_graph(
behavior: HavokBehavior, statemachine: HkbRecord
) -> nx.DiGraph
Build the state transition graph of a state machine.
Nodes are state names carrying record and state_id; edges come
from events named <source>_to_<target> and carry event and the
event's idx.
get_statemachines
¶
get_statemachines(
behavior: HavokBehavior,
) -> dict[str, HkbRecord]
All hkbStateMachine records, keyed by object ID.