another approach for making the debugger nicer

This commit is contained in:
Lilith Schier 2026-06-29 02:40:34 +02:00
parent b5d5a8f9f3
commit b37c78d75b
4 changed files with 65 additions and 55 deletions

View file

@ -13,14 +13,14 @@ public partial class BehaviorDebug : EditorPlugin
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,11 @@ 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);
session.Started += _behaviorDebugControl.Clear;
}
}
}