buggy mess of a graph based behavior tree debugger (not good, pls ignore)

This commit is contained in:
Lilith Schier 2026-06-29 00:23:09 +02:00
parent b5d5a8f9f3
commit 738e33342e
6 changed files with 143 additions and 46 deletions

View file

@ -6,21 +6,21 @@ using Godot.Collections;
[Tool]
public partial class BehaviorDebug : EditorPlugin
{
private BtEditorDebugger _btEditorDebugger = new BtEditorDebugger();
private BtEditorDebugger _btEditorDebugger = new();
public override void _EnterTree() => AddDebuggerPlugin(_btEditorDebugger);
public override void _ExitTree() => RemoveDebuggerPlugin(_btEditorDebugger);
private partial class BtEditorDebugger : EditorDebuggerPlugin
{
private BehaviorDebugControl? _behaviorTreeView1;
private BehaviorDebugControl? _behaviorDebugControl;
private static readonly PackedScene DebuggerScene = GD.Load<PackedScene>("res://addons/BehaviorDebug/behavior_debug_dock.tscn");
public override bool _HasCapture(string capture) => capture == "behavior_debug";
public override bool _Capture(string message, Array data, int sessionId)
{
if (message == "behavior_debug:add_tree")
{
_behaviorTreeView1?.AddTreeData(data);
_behaviorDebugControl?.AddTreeData(data);
return true;
}
return false;
@ -28,10 +28,10 @@ public partial class BehaviorDebug : EditorPlugin
public override void _SetupSession(int sessionId)
{
_behaviorTreeView1 = DebuggerScene.Instantiate<BehaviorDebugControl>();
_behaviorTreeView1.Name = "Behavior Trees";
_behaviorDebugControl = DebuggerScene.Instantiate<BehaviorDebugControl>();
_behaviorDebugControl.Name = "Behavior Trees";
var session = GetSession(sessionId);
session.AddSessionTab(_behaviorTreeView1);
session.AddSessionTab(_behaviorDebugControl);
}
}
}